Class: Tastytrade::Operations::AccountTransactions::ListTransactions

Inherits:
BaseOperation
  • Object
show all
Defined in:
lib/tastytrade/operations/account_transactions/list_transactions.rb

Constant Summary collapse

VALID_SORT_VALUES =
%w[Asc Desc].freeze
VALID_TYPES =
[
  'Administrative Transfer',
  'Money Movement',
  'Receive Deliver',
  'Trade'
].freeze
VALID_SUB_TYPES =
[
  'ACAT', 'Assignment', 'Balance Adjustment', 'Cash Merger',
  'Cash Settled Assignment', 'Cash Settled Exercise', 'Credit Interest',
  'Debit Interest', 'Deposit', 'Dividend', 'Exercise', 'Expiration',
  'Fee', 'Forward Split', 'Fully Paid Stock Lending Income',
  'Futures Settlement', 'Mark to Market', 'Maturity', 'Reverse Split',
  'Reverse Split Removal', 'Special Dividend', 'Stock Merger',
  'Stock Merger Removal', 'Symbol Change', 'Transfer', 'Withdrawal'
].freeze
VALID_INSTRUMENT_TYPES =
%w[
  Bond Cryptocurrency Equity EquityOffering EquityOption
  Future FutureOption Index Unknown Warrant
].freeze
VALID_ACTIONS =
[
  'Buy', 'Buy to Close', 'Buy to Open',
  'Sell', 'Sell to Close', 'Sell to Open'
].freeze

Instance Attribute Summary

Attributes inherited from BaseOperation

#client

Instance Method Summary collapse

Methods inherited from BaseOperation

#initialize

Methods included from Util

response_success?

Methods included from Error

raise_error

Constructor Details

This class inherits a constructor from Tastytrade::Operations::BaseOperation

Instance Method Details

#call(account_number:, **options) ⇒ Object

Calls GET /accounts/account_number/transactions

Options:

sort:               String  - "Asc" or "Desc" (default: "Desc")
type:               String  - single transaction type (mutually exclusive with types:)
types:              Array   - multiple transaction types (mutually exclusive with type:)
sub_type:           Array   - transaction sub-types (passed as 'sub-type[]')
start_date:         String  - "YYYY-MM-DD"
end_date:           String  - "YYYY-MM-DD"
instrument_type:    String
symbol:             String
underlying_symbol:  String
action:             String
partition_key:      String
futures_symbol:     String
start_at:           String  - "YYYY-MM-DDTHH:MM:SS"
end_at:             String  - "YYYY-MM-DDTHH:MM:SS"
page_offset:        Integer - for pagination


55
56
57
58
59
60
61
62
63
64
# File 'lib/tastytrade/operations/account_transactions/list_transactions.rb', line 55

def call(account_number:, **options)
  validate_options!(options)

  query = build_query(options)

  perform_api_get_request(
    url: "#{Tastytrade::BASE_URL}/accounts/#{}/transactions",
    query: query.empty? ? nil : query
  )
end