Class: SnapTrade::TransactionsAndReportingApi

Inherits:
Object
  • Object
show all
Defined in:
lib/snaptrade/api/transactions_and_reporting_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ TransactionsAndReportingApi

Returns a new instance of TransactionsAndReportingApi.



16
17
18
# File 'lib/snaptrade/api/transactions_and_reporting_api.rb', line 16

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



14
15
16
# File 'lib/snaptrade/api/transactions_and_reporting_api.rb', line 14

def api_client
  @api_client
end

Instance Method Details

#get_activities(user_id:, user_secret:, start_date: SENTINEL, end_date: SENTINEL, accounts: SENTINEL, brokerage_authorizations: SENTINEL, type: SENTINEL, extra: {}) ⇒ Object

Get transaction history for a user

This endpoint is being deprecated but will continue to be available for use via SDKs, please use [the account level endpoint](/reference/Account%20Information/AccountInformation_getAccountActivities) if possible

Returns all historical transactions for the specified user and filtering criteria. It’s recommended to use ‘startDate` and `endDate` to paginate through the data, as the response may be very large for accounts with a long history and/or a lot of activity. There’s a max number of 10000 transactions returned per request.

There is no guarantee to the ordering of the transactions returned. Please sort the transactions based on the ‘trade_date` field if you need them in a specific order.

The data returned here is always cached and refreshed once a day.

Parameters:

  • user_id (String)
  • user_secret (String)
  • start_date (Date) (defaults to: SENTINEL)

    The start date (inclusive) of the transaction history to retrieve. If not provided, the default is the first transaction known to SnapTrade based on ‘trade_date`.

  • end_date (Date) (defaults to: SENTINEL)

    The end date (inclusive) of the transaction history to retrieve. If not provided, the default is the last transaction known to SnapTrade based on ‘trade_date`.

  • accounts (String) (defaults to: SENTINEL)

    Optional comma separated list of SnapTrade Account IDs used to filter the request to specific accounts. If not provided, the default is all known brokerage accounts for the user. The ‘brokerageAuthorizations` parameter takes precedence over this parameter.

  • brokerage_authorizations (String) (defaults to: SENTINEL)

    Optional comma separated list of SnapTrade Connection (Brokerage Authorization) IDs used to filter the request to only accounts that belong to those connections. If not provided, the default is all connections for the user. This parameter takes precedence over the ‘accounts` parameter.

  • type (String) (defaults to: SENTINEL)

    Optional comma separated list of transaction types to filter by. SnapTrade does a best effort to categorize brokerage transaction types into a common set of values. Here are some of the most popular values: - ‘BUY` - Asset bought. - `SELL` - Asset sold. - `DIVIDEND` - Dividend payout. - `CONTRIBUTION` - Cash contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment. - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `OPTIONEXPIRATION` - Option expiration event. - `OPTIONASSIGNMENT` - Option assignment event. - `OPTIONEXERCISE` - Option exercise event. - `TRANSFER` - Transfer of assets from one account to another

  • extra (Hash) (defaults to: {})

    additional parameters to pass along through :header_params, :query_params, or parameter name



38
39
40
41
42
43
44
45
46
# File 'lib/snaptrade/api/transactions_and_reporting_api.rb', line 38

def get_activities(user_id:, user_secret:, start_date: SENTINEL, end_date: SENTINEL, accounts: SENTINEL, brokerage_authorizations: SENTINEL, type: SENTINEL, extra: {})
  extra[:start_date] = start_date if start_date != SENTINEL
  extra[:end_date] = end_date if end_date != SENTINEL
  extra[:accounts] = accounts if accounts != SENTINEL
  extra[:brokerage_authorizations] = brokerage_authorizations if brokerage_authorizations != SENTINEL
  extra[:type] = type if type != SENTINEL
  data, _status_code, _headers = get_activities_with_http_info_impl(user_id, user_secret, extra)
  data
end

#get_activities_with_http_info(user_id:, user_secret:, start_date: SENTINEL, end_date: SENTINEL, accounts: SENTINEL, brokerage_authorizations: SENTINEL, type: SENTINEL, extra: {}) ⇒ Object

Get transaction history for a user

This endpoint is being deprecated but will continue to be available for use via SDKs, please use [the account level endpoint](/reference/Account%20Information/AccountInformation_getAccountActivities) if possible

Returns all historical transactions for the specified user and filtering criteria. It’s recommended to use ‘startDate` and `endDate` to paginate through the data, as the response may be very large for accounts with a long history and/or a lot of activity. There’s a max number of 10000 transactions returned per request.

There is no guarantee to the ordering of the transactions returned. Please sort the transactions based on the ‘trade_date` field if you need them in a specific order.

The data returned here is always cached and refreshed once a day.

Parameters:

  • user_id (String)
  • user_secret (String)
  • start_date (Date) (defaults to: SENTINEL)

    The start date (inclusive) of the transaction history to retrieve. If not provided, the default is the first transaction known to SnapTrade based on ‘trade_date`.

  • end_date (Date) (defaults to: SENTINEL)

    The end date (inclusive) of the transaction history to retrieve. If not provided, the default is the last transaction known to SnapTrade based on ‘trade_date`.

  • accounts (String) (defaults to: SENTINEL)

    Optional comma separated list of SnapTrade Account IDs used to filter the request to specific accounts. If not provided, the default is all known brokerage accounts for the user. The ‘brokerageAuthorizations` parameter takes precedence over this parameter.

  • brokerage_authorizations (String) (defaults to: SENTINEL)

    Optional comma separated list of SnapTrade Connection (Brokerage Authorization) IDs used to filter the request to only accounts that belong to those connections. If not provided, the default is all connections for the user. This parameter takes precedence over the ‘accounts` parameter.

  • type (String) (defaults to: SENTINEL)

    Optional comma separated list of transaction types to filter by. SnapTrade does a best effort to categorize brokerage transaction types into a common set of values. Here are some of the most popular values: - ‘BUY` - Asset bought. - `SELL` - Asset sold. - `DIVIDEND` - Dividend payout. - `CONTRIBUTION` - Cash contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment. - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `OPTIONEXPIRATION` - Option expiration event. - `OPTIONASSIGNMENT` - Option assignment event. - `OPTIONEXERCISE` - Option exercise event. - `TRANSFER` - Transfer of assets from one account to another

  • extra (Hash) (defaults to: {})

    additional parameters to pass along through :header_params, :query_params, or parameter name



66
67
68
69
70
71
72
73
# File 'lib/snaptrade/api/transactions_and_reporting_api.rb', line 66

def get_activities_with_http_info(user_id:, user_secret:, start_date: SENTINEL, end_date: SENTINEL, accounts: SENTINEL, brokerage_authorizations: SENTINEL, type: SENTINEL, extra: {})
  extra[:start_date] = start_date if start_date != SENTINEL
  extra[:end_date] = end_date if end_date != SENTINEL
  extra[:accounts] = accounts if accounts != SENTINEL
  extra[:brokerage_authorizations] = brokerage_authorizations if brokerage_authorizations != SENTINEL
  extra[:type] = type if type != SENTINEL
  get_activities_with_http_info_impl(user_id, user_secret, extra)
end

#get_reporting_custom_range(start_date:, end_date:, user_id:, user_secret:, accounts: SENTINEL, detailed: SENTINEL, frequency: SENTINEL, extra: {}) ⇒ Object

Get performance information for a specific timeframe

Returns performance information (contributions, dividends, rate of return, etc) for a specific timeframe. Please note that Total Equity Timeframe and Rate of Returns are experimental features. Please contact support@snaptrade.com if you notice any inconsistencies.

Parameters:

  • start_date (Date)
  • end_date (Date)
  • user_id (String)
  • user_secret (String)
  • accounts (String) (defaults to: SENTINEL)

    Optional comma separated list of account IDs used to filter the request on specific accounts

  • detailed (Boolean) (defaults to: SENTINEL)

    Optional, increases frequency of data points for the total value and contribution charts if set to true

  • frequency (String) (defaults to: SENTINEL)

    Optional frequency for the rate of return chart (defaults to monthly). Possible values are daily, weekly, monthly, quarterly, yearly.

  • extra (Hash) (defaults to: {})

    additional parameters to pass along through :header_params, :query_params, or parameter name



174
175
176
177
178
179
180
# File 'lib/snaptrade/api/transactions_and_reporting_api.rb', line 174

def get_reporting_custom_range(start_date:, end_date:, user_id:, user_secret:, accounts: SENTINEL, detailed: SENTINEL, frequency: SENTINEL, extra: {})
  extra[:accounts] = accounts if accounts != SENTINEL
  extra[:detailed] = detailed if detailed != SENTINEL
  extra[:frequency] = frequency if frequency != SENTINEL
  data, _status_code, _headers = get_reporting_custom_range_with_http_info_impl(start_date, end_date, user_id, user_secret, extra)
  data
end

#get_reporting_custom_range_with_http_info(start_date:, end_date:, user_id:, user_secret:, accounts: SENTINEL, detailed: SENTINEL, frequency: SENTINEL, extra: {}) ⇒ Object

Get performance information for a specific timeframe

Returns performance information (contributions, dividends, rate of return, etc) for a specific timeframe. Please note that Total Equity Timeframe and Rate of Returns are experimental features. Please contact support@snaptrade.com if you notice any inconsistencies.

Parameters:

  • start_date (Date)
  • end_date (Date)
  • user_id (String)
  • user_secret (String)
  • accounts (String) (defaults to: SENTINEL)

    Optional comma separated list of account IDs used to filter the request on specific accounts

  • detailed (Boolean) (defaults to: SENTINEL)

    Optional, increases frequency of data points for the total value and contribution charts if set to true

  • frequency (String) (defaults to: SENTINEL)

    Optional frequency for the rate of return chart (defaults to monthly). Possible values are daily, weekly, monthly, quarterly, yearly.

  • extra (Hash) (defaults to: {})

    additional parameters to pass along through :header_params, :query_params, or parameter name



194
195
196
197
198
199
# File 'lib/snaptrade/api/transactions_and_reporting_api.rb', line 194

def get_reporting_custom_range_with_http_info(start_date:, end_date:, user_id:, user_secret:, accounts: SENTINEL, detailed: SENTINEL, frequency: SENTINEL, extra: {})
  extra[:accounts] = accounts if accounts != SENTINEL
  extra[:detailed] = detailed if detailed != SENTINEL
  extra[:frequency] = frequency if frequency != SENTINEL
  get_reporting_custom_range_with_http_info_impl(start_date, end_date, user_id, user_secret, extra)
end