[![Visit SnapTrade](./header.png)](https://snaptrade.com) # [SnapTrade](https://snaptrade.com) Connect brokerage accounts to your app for live positions and trading [![npm](https://img.shields.io/badge/gem-v2.0.45-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.45) [![More Info](https://img.shields.io/badge/More%20Info-Click%20Here-orange)](https://snaptrade.com/)
## Table of Contents - [Installation](#installation) - [Getting Started](#getting-started) - [Raw HTTP Response](#raw-http-response) - [Reference](#reference) * [`snaptrade.account_information.get_all_user_holdings`](#snaptradeaccount_informationget_all_user_holdings) * [`snaptrade.account_information.get_user_account_balance`](#snaptradeaccount_informationget_user_account_balance) * [`snaptrade.account_information.get_user_account_details`](#snaptradeaccount_informationget_user_account_details) * [`snaptrade.account_information.get_user_account_orders`](#snaptradeaccount_informationget_user_account_orders) * [`snaptrade.account_information.get_user_account_positions`](#snaptradeaccount_informationget_user_account_positions) * [`snaptrade.account_information.get_user_holdings`](#snaptradeaccount_informationget_user_holdings) * [`snaptrade.account_information.list_user_accounts`](#snaptradeaccount_informationlist_user_accounts) * [`snaptrade.account_information.update_user_account`](#snaptradeaccount_informationupdate_user_account) * [`snaptrade.api_status.check`](#snaptradeapi_statuscheck) * [`snaptrade.authentication.delete_snap_trade_user`](#snaptradeauthenticationdelete_snap_trade_user) * [`snaptrade.authentication.list_snap_trade_users`](#snaptradeauthenticationlist_snap_trade_users) * [`snaptrade.authentication.login_snap_trade_user`](#snaptradeauthenticationlogin_snap_trade_user) * [`snaptrade.authentication.register_snap_trade_user`](#snaptradeauthenticationregister_snap_trade_user) * [`snaptrade.authentication.reset_snap_trade_user_secret`](#snaptradeauthenticationreset_snap_trade_user_secret) * [`snaptrade.connections.detail_brokerage_authorization`](#snaptradeconnectionsdetail_brokerage_authorization) * [`snaptrade.connections.disable_brokerage_authorization`](#snaptradeconnectionsdisable_brokerage_authorization) * [`snaptrade.connections.list_brokerage_authorizations`](#snaptradeconnectionslist_brokerage_authorizations) * [`snaptrade.connections.refresh_brokerage_authorization`](#snaptradeconnectionsrefresh_brokerage_authorization) * [`snaptrade.connections.remove_brokerage_authorization`](#snaptradeconnectionsremove_brokerage_authorization) * [`snaptrade.connections.session_events`](#snaptradeconnectionssession_events) * [`snaptrade.options.get_option_strategy`](#snaptradeoptionsget_option_strategy) * [`snaptrade.options.get_options_chain`](#snaptradeoptionsget_options_chain) * [`snaptrade.options.get_options_strategy_quote`](#snaptradeoptionsget_options_strategy_quote) * [`snaptrade.options.list_option_holdings`](#snaptradeoptionslist_option_holdings) * [`snaptrade.options.place_option_strategy`](#snaptradeoptionsplace_option_strategy) * [`snaptrade.reference_data.get_currency_exchange_rate_pair`](#snaptradereference_dataget_currency_exchange_rate_pair) * [`snaptrade.reference_data.get_partner_info`](#snaptradereference_dataget_partner_info) * [`snaptrade.reference_data.get_security_types`](#snaptradereference_dataget_security_types) * [`snaptrade.reference_data.get_stock_exchanges`](#snaptradereference_dataget_stock_exchanges) * [`snaptrade.reference_data.get_symbols`](#snaptradereference_dataget_symbols) * [`snaptrade.reference_data.get_symbols_by_ticker`](#snaptradereference_dataget_symbols_by_ticker) * [`snaptrade.reference_data.list_all_brokerage_authorization_type`](#snaptradereference_datalist_all_brokerage_authorization_type) * [`snaptrade.reference_data.list_all_brokerages`](#snaptradereference_datalist_all_brokerages) * [`snaptrade.reference_data.list_all_currencies`](#snaptradereference_datalist_all_currencies) * [`snaptrade.reference_data.list_all_currencies_rates`](#snaptradereference_datalist_all_currencies_rates) * [`snaptrade.reference_data.symbol_search_user_account`](#snaptradereference_datasymbol_search_user_account) * [`snaptrade.trading.cancel_user_account_order`](#snaptradetradingcancel_user_account_order) * [`snaptrade.trading.get_order_impact`](#snaptradetradingget_order_impact) * [`snaptrade.trading.get_user_account_quotes`](#snaptradetradingget_user_account_quotes) * [`snaptrade.trading.place_force_order`](#snaptradetradingplace_force_order) * [`snaptrade.trading.place_order`](#snaptradetradingplace_order) * [`snaptrade.transactions_and_reporting.get_activities`](#snaptradetransactions_and_reportingget_activities) * [`snaptrade.transactions_and_reporting.get_reporting_custom_range`](#snaptradetransactions_and_reportingget_reporting_custom_range) ## Installation Add to Gemfile: ```ruby gem 'snaptrade', '~> 2.0.45' ``` ## Getting Started ```ruby require 'snaptrade' configuration = SnapTrade::Configuration.new configuration.client_id = ENV["SNAPTRADE_CLIENT_ID"] configuration.consumer_key = ENV["SNAPTRADE_CONSUMER_KEY"] snaptrade = SnapTrade::Client.new(configuration) result = snaptrade.account_information.get_all_user_holdings( user_id: "snaptrade-user-123", user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61", brokerage_authorizations: "917c8734-8470-4a3e-a18f-57c3f2ee6631", ) p result ``` ## Raw HTTP Response To access the raw HTTP response, suffix any method with `_with_http_info`. ```ruby result = snaptrade.account_information.get_all_user_holdings_with_http_info( user_id: "snaptrade-user-123", user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61", brokerage_authorizations: "917c8734-8470-4a3e-a18f-57c3f2ee6631", ) p result[0] # [Array] Deserialized data p.result[1] # [Integer] HTTP status code p.result[2] # [Hash] HTTP headers p.result[3] # [Faraday::Response] Raw HTTP response ``` ## Reference ### `snaptrade.account_information.get_all_user_holdings` ![Deprecated](https://img.shields.io/badge/deprecated-yellow) **Deprecated, please use the account-specific holdings endpoint instead.** List all accounts for the user, plus balances, positions, and orders for each account. #### 🛠️ Usage ```ruby result = snaptrade.account_information.get_all_user_holdings( user_id: "snaptrade-user-123", user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61", brokerage_authorizations: "917c8734-8470-4a3e-a18f-57c3f2ee6631", ) p result ``` #### ⚙️ Parameters ##### user_id: `String` ##### user_secret: `String` ##### brokerage_authorizations: `String` Optional. Comma separated list of authorization IDs (only use if filtering is needed on one or more authorizations). #### 🔄 Return [AccountHoldings](./lib/snaptrade/models/account_holdings.rb) #### 🌐 Endpoint `/holdings` `GET` [🔙 **Back to Table of Contents**](#table-of-contents) --- ### `snaptrade.account_information.get_user_account_balance` Returns a list of balances for the account. Each element of the list has a distinct currency. Some brokerages like Questrade [allows holding multiple currencies in the same account](https://www.questrade.com/learning/questrade-basics/balances-and-reports/understanding-your-account-balances). The data returned here is cached. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for "Cache Expiry Time" to see the exact value for a specific brokerage. **If you need real-time data, please use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint**. #### 🛠️ Usage ```ruby result = snaptrade.account_information.get_user_account_balance( user_id: "snaptrade-user-123", user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61", account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631", ) p result ``` #### ⚙️ Parameters ##### user_id: `String` ##### user_secret: `String` ##### account_id: `String` #### 🔄 Return [Balance](./lib/snaptrade/models/balance.rb) #### 🌐 Endpoint `/accounts/{accountId}/balances` `GET` [🔙 **Back to Table of Contents**](#table-of-contents) --- ### `snaptrade.account_information.get_user_account_details` Returns account detail known to SnapTrade for the specified account. The data returned here is always cached and refreshed once a day. **If you need real-time data, please use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint**. #### 🛠️ Usage ```ruby result = snaptrade.account_information.get_user_account_details( user_id: "snaptrade-user-123", user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61", account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631", ) p result ``` #### ⚙️ Parameters ##### user_id: `String` ##### user_secret: `String` ##### account_id: `String` #### 🔄 Return [Account](./lib/snaptrade/models/account.rb) #### 🌐 Endpoint `/accounts/{accountId}` `GET` [🔙 **Back to Table of Contents**](#table-of-contents) --- ### `snaptrade.account_information.get_user_account_orders` Returns a list of recent orders in the specified account. The data returned here is cached. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for "Cache Expiry Time" to see the exact value for a specific brokerage. **If you need real-time data, please use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint**. #### 🛠️ Usage ```ruby result = snaptrade.account_information.get_user_account_orders( user_id: "snaptrade-user-123", user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61", account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631", state: "all", days: 30, ) p result ``` #### ⚙️ Parameters ##### user_id: `String` ##### user_secret: `String` ##### account_id: `String` ##### state: `String` defaults value is set to \"all\" ##### days: `Integer` Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in. #### 🔄 Return [AccountOrderRecord](./lib/snaptrade/models/account_order_record.rb) #### 🌐 Endpoint `/accounts/{accountId}/orders` `GET` [🔙 **Back to Table of Contents**](#table-of-contents) --- ### `snaptrade.account_information.get_user_account_positions` Returns a list of stock/ETF/crypto/mutual fund positions in the specified account. For option positions, please use the [options endpoint](/reference/Options/Options_listOptionHoldings). The data returned here is cached. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for "Cache Expiry Time" to see the exact value for a specific brokerage. **If you need real-time data, please use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint**. #### 🛠️ Usage ```ruby result = snaptrade.account_information.get_user_account_positions( user_id: "snaptrade-user-123", user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61", account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631", ) p result ``` #### ⚙️ Parameters ##### user_id: `String` ##### user_secret: `String` ##### account_id: `String` #### 🔄 Return [Position](./lib/snaptrade/models/position.rb) #### 🌐 Endpoint `/accounts/{accountId}/positions` `GET` [🔙 **Back to Table of Contents**](#table-of-contents) --- ### `snaptrade.account_information.get_user_holdings` Returns a list of balances, positions, and recent orders for the specified account. The data returned is similar to the data returned over the more fine-grained [balances](/reference/Account%20Information/AccountInformation_getUserAccountBalance), [positions](/reference/Account%20Information/AccountInformation_getUserAccountPositions) and [orders](/reference/Account%20Information/AccountInformation_getUserAccountOrders) endpoints. __The finer-grained APIs are preferred. They are easier to work with, faster, and have better error handling than this coarse-grained API.__ The data returned here is cached. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for "Cache Expiry Time" to see the exact value for a specific brokerage. **If you need real-time data, please use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint**. #### 🛠️ Usage ```ruby result = snaptrade.account_information.get_user_holdings( account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631", user_id: "snaptrade-user-123", user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61", ) p result ``` #### ⚙️ Parameters ##### account_id: `String` ##### user_id: `String` ##### user_secret: `String` #### 🔄 Return [AccountHoldingsAccount](./lib/snaptrade/models/account_holdings_account.rb) #### 🌐 Endpoint `/accounts/{accountId}/holdings` `GET` [🔙 **Back to Table of Contents**](#table-of-contents) --- ### `snaptrade.account_information.list_user_accounts` Returns all brokerage accounts across all connections known to SnapTrade for the authenticated user. The data returned here is always cached and refreshed once a day. **If you need real-time data, please use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint**. #### 🛠️ Usage ```ruby result = snaptrade.account_information.list_user_accounts( user_id: "snaptrade-user-123", user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61", ) p result ``` #### ⚙️ Parameters ##### user_id: `String` ##### user_secret: `String` #### 🔄 Return [Account](./lib/snaptrade/models/account.rb) #### 🌐 Endpoint `/accounts` `GET` [🔙 **Back to Table of Contents**](#table-of-contents) --- ### `snaptrade.account_information.update_user_account` Updates various properties of a specified account. #### 🛠️ Usage ```ruby result = snaptrade.account_information.update_user_account( user_id: "snaptrade-user-123", user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61", account_id: "accountId_example", ) p result ``` #### ⚙️ Parameters ##### user_id: `String` ##### user_secret: `String` ##### account_id: `String` The ID of the account to update. #### 🔄 Return [Account](./lib/snaptrade/models/account.rb) #### 🌐 Endpoint `/accounts/{accountId}` `PUT` [🔙 **Back to Table of Contents**](#table-of-contents) --- ### `snaptrade.api_status.check` Check whether the API is operational and verify timestamps. #### 🛠️ Usage ```ruby result = snaptrade.api_status.check p result ``` #### 🔄 Return [Status](./lib/snaptrade/models/status.rb) #### 🌐 Endpoint `/` `GET` [🔙 **Back to Table of Contents**](#table-of-contents) --- ### `snaptrade.authentication.delete_snap_trade_user` Deletes a registered user and all associated data. This action is irreversible. This API is asynchronous and will return a 200 status code if the request is accepted. The user and all associated data will be queued for deletion. Once deleted, a `USER_DELETED` webhook will be sent. #### 🛠️ Usage ```ruby result = snaptrade.authentication.delete_snap_trade_user( user_id: "snaptrade-user-123", ) p result ``` #### ⚙️ Parameters ##### user_id: `String` #### 🔄 Return [DeleteUserResponse](./lib/snaptrade/models/delete_user_response.rb) #### 🌐 Endpoint `/snapTrade/deleteUser` `DELETE` [🔙 **Back to Table of Contents**](#table-of-contents) --- ### `snaptrade.authentication.list_snap_trade_users` Returns a list of all registered user IDs. Please note that the response is not currently paginated. #### 🛠️ Usage ```ruby result = snaptrade.authentication.list_snap_trade_users p result ``` #### 🌐 Endpoint `/snapTrade/listUsers` `GET` [🔙 **Back to Table of Contents**](#table-of-contents) --- ### `snaptrade.authentication.login_snap_trade_user` Authenticates a SnapTrade user and returns the Connection Portal URL used for connecting brokerage accounts. Please check [this guide](/docs/implement-connection-portal) for how to integrate the Connection Portal into your app. Please note that the returned URL expires in 5 minutes. #### 🛠️ Usage ```ruby result = snaptrade.authentication.login_snap_trade_user( user_id: "snaptrade-user-123", user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61", broker: "ALPACA", immediate_redirect: true, custom_redirect: "https://snaptrade.com", reconnect: "8b5f262d-4bb9-365d-888a-202bd3b15fa1", connection_type: "read", connection_portal_version: "v3", ) p result ``` #### ⚙️ Parameters ##### user_id: `String` ##### user_secret: `String` ##### broker: `String` Slug of the brokerage to connect the user to. See [the integrations page](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=3cfea70ef4254afc89704e47275a7a9a&pvs=4) for a list of supported brokerages and their slugs. ##### immediateRedirect: `Boolean` When set to `true`, user will be redirected back to the partner's site instead of the connection portal. This parameter is ignored if the connection portal is loaded inside an iframe. See the [guide on ways to integrate the connection portal](/docs/implement-connection-portal) for more information. ##### customRedirect: `String` URL to redirect the user to after the user connects their brokerage account. This parameter is ignored if the connection portal is loaded inside an iframe. See the [guide on ways to integrate the connection portal](/docs/implement-connection-portal) for more information. ##### reconnect: `String` The UUID of the brokerage connection to be reconnected. This parameter should be left empty unless you are reconnecting a disabled connection. See the [guide on fixing broken connections](/docs/fix-broken-connections) for more information. ##### connectionType: [`ConnectionType`](./lib/snaptrade/models/connection_type.rb) Sets whether the connection should be read-only or trade-enabled. ##### connectionPortalVersion: [`ConnectionPortalVersion`](./lib/snaptrade/models/connection_portal_version.rb) Sets the version of the connection portal to render. #### 🔄 Return [AuthenticationLoginSnapTradeUser200Response](./lib/snaptrade/models/authentication_login_snap_trade_user200_response.rb) #### 🌐 Endpoint `/snapTrade/login` `POST` [🔙 **Back to Table of Contents**](#table-of-contents) --- ### `snaptrade.authentication.register_snap_trade_user` Registers a new SnapTrade user under your Client ID. A user secret will be automatically generated for you and must be properly stored in your system. Most SnapTrade operations require a user ID and user secret to be passed in as parameters. #### 🛠️ Usage ```ruby result = snaptrade.authentication.register_snap_trade_user( user_id: "snaptrade-user-123", ) p result ``` #### ⚙️ Parameters ##### userId: `String` SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable. #### 🔄 Return [UserIDandSecret](./lib/snaptrade/models/user_i_dand_secret.rb) #### 🌐 Endpoint `/snapTrade/registerUser` `POST` [🔙 **Back to Table of Contents**](#table-of-contents) --- ### `snaptrade.authentication.reset_snap_trade_user_secret` Rotates the secret for a SnapTrade user. You might use this if `userSecret` is compromised. Please note that if you call this endpoint and fail to save the new secret, you'll no longer be able to access any data for this user, and your only option will be to delete and recreate the user, then ask them to reconnect. #### 🛠️ Usage ```ruby result = snaptrade.authentication.reset_snap_trade_user_secret( user_id: "snaptrade-user-123", user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61", ) p result ``` #### ⚙️ Parameters ##### userId: `String` SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable. ##### userSecret: `String` SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret). #### 🔄 Return [UserIDandSecret](./lib/snaptrade/models/user_i_dand_secret.rb) #### 🌐 Endpoint `/snapTrade/resetUserSecret` `POST` [🔙 **Back to Table of Contents**](#table-of-contents) --- ### `snaptrade.connections.detail_brokerage_authorization` Returns a single connection for the specified ID. #### 🛠️ Usage ```ruby result = snaptrade.connections.detail_brokerage_authorization( authorization_id: "87b24961-b51e-4db8-9226-f198f6518a89", user_id: "snaptrade-user-123", user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61", ) p result ``` #### ⚙️ Parameters ##### authorization_id: `String` ##### user_id: `String` ##### user_secret: `String` #### 🔄 Return [BrokerageAuthorization](./lib/snaptrade/models/brokerage_authorization.rb) #### 🌐 Endpoint `/authorizations/{authorizationId}` `GET` [🔙 **Back to Table of Contents**](#table-of-contents) --- ### `snaptrade.connections.disable_brokerage_authorization` Manually force the specified connection to become disabled. This should only be used for testing a reconnect flow, and never used on production connections. Will trigger a disconnect as if it happened naturally, and send a [`CONNECTION_BROKEN` webhook](/docs/webhooks#webhooks-connection_broken) for the connection. *Please contact us in order to use this endpoint as it is disabled by default.* #### 🛠️ Usage ```ruby result = snaptrade.connections.disable_brokerage_authorization( authorization_id: "87b24961-b51e-4db8-9226-f198f6518a89", user_id: "snaptrade-user-123", user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61", ) p result ``` #### ⚙️ Parameters ##### authorization_id: `String` ##### user_id: `String` ##### user_secret: `String` #### 🔄 Return [BrokerageAuthorizationDisabledConfirmation](./lib/snaptrade/models/brokerage_authorization_disabled_confirmation.rb) #### 🌐 Endpoint `/authorizations/{authorizationId}/disable` `POST` [🔙 **Back to Table of Contents**](#table-of-contents) --- ### `snaptrade.connections.list_brokerage_authorizations` Returns a list of all connections for the specified user. Note that `Connection` and `Brokerage Authorization` are interchangeable, but the term `Connection` is preferred and used in the doc for consistency. A connection is usually tied to a single login at a brokerage. A single connection can contain multiple brokerage accounts. SnapTrade performs de-duping on connections for a given user. If the user has an existing connection with the brokerage, when connecting the brokerage with the same credentials, SnapTrade will return the existing connection instead of creating a new one. #### 🛠️ Usage ```ruby result = snaptrade.connections.list_brokerage_authorizations( user_id: "snaptrade-user-123", user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61", ) p result ``` #### ⚙️ Parameters ##### user_id: `String` ##### user_secret: `String` #### 🔄 Return [BrokerageAuthorization](./lib/snaptrade/models/brokerage_authorization.rb) #### 🌐 Endpoint `/authorizations` `GET` [🔙 **Back to Table of Contents**](#table-of-contents) --- ### `snaptrade.connections.refresh_brokerage_authorization` Trigger a holdings update for all accounts under this connection. Updates will be queued asynchronously. [`ACCOUNT_HOLDINGS_UPDATED` webhook](/docs/webhooks#webhooks-account_holdings_updated) will be sent once the sync completes for each account under the connection. *Please contact support for access as this endpoint is not enabled by default.* #### 🛠️ Usage ```ruby result = snaptrade.connections.refresh_brokerage_authorization( authorization_id: "87b24961-b51e-4db8-9226-f198f6518a89", user_id: "snaptrade-user-123", user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61", ) p result ``` #### ⚙️ Parameters ##### authorization_id: `String` ##### user_id: `String` ##### user_secret: `String` #### 🔄 Return [BrokerageAuthorizationRefreshConfirmation](./lib/snaptrade/models/brokerage_authorization_refresh_confirmation.rb) #### 🌐 Endpoint `/authorizations/{authorizationId}/refresh` `POST` [🔙 **Back to Table of Contents**](#table-of-contents) --- ### `snaptrade.connections.remove_brokerage_authorization` Deletes the connection specified by the ID. This will also delete all accounts and holdings associated with the connection. This action is irreversible. This endpoint is synchronous, a 204 response indicates that the connection has been successfully deleted. #### 🛠️ Usage ```ruby snaptrade.connections.remove_brokerage_authorization( authorization_id: "87b24961-b51e-4db8-9226-f198f6518a89", user_id: "snaptrade-user-123", user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61", ) ``` #### ⚙️ Parameters ##### authorization_id: `String` ##### user_id: `String` ##### user_secret: `String` #### 🌐 Endpoint `/authorizations/{authorizationId}` `DELETE` [🔙 **Back to Table of Contents**](#table-of-contents) --- ### `snaptrade.connections.session_events` Returns a list of session events associated with a user. #### 🛠️ Usage ```ruby result = snaptrade.connections.session_events( partner_client_id: "SNAPTRADETEST", user_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631,65e839a3-9103-4cfb-9b72-2071ef80c5f2", session_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631,65e839a3-9103-4cfb-9b72-2071ef80c5f2", ) p result ``` #### ⚙️ Parameters ##### partner_client_id: `String` ##### user_id: `String` Optional comma separated list of user IDs used to filter the request on specific users ##### session_id: `String` Optional comma separated list of session IDs used to filter the request on specific users #### 🔄 Return [ConnectionsSessionEvents200ResponseInner](./lib/snaptrade/models/connections_session_events200_response_inner.rb) #### 🌐 Endpoint `/sessionEvents` `GET` [🔙 **Back to Table of Contents**](#table-of-contents) --- ### `snaptrade.options.get_option_strategy` Creates an option strategy object that will be used to place an option strategy order. #### 🛠️ Usage ```ruby result = snaptrade.options.get_option_strategy( underlying_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3", legs: [ { "action" => "BUY_TO_OPEN", "option_symbol_id" => "SPY220819P00200000", "quantity" => 1, } ], strategy_type: "CUSTOM", user_id: "snaptrade-user-123", user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61", account_id: "accountId_example", ) p result ``` #### ⚙️ Parameters ##### underlying_symbol_id: `String` ##### legs: Array<[`OptionLeg`](./lib/snaptrade/models/option_leg.rb)> ##### strategy_type: [`StrategyType`](./lib/snaptrade/models/strategy_type.rb) ##### user_id: `String` ##### user_secret: `String` ##### account_id: `String` The ID of the account to create the option strategy object in. #### 🔄 Return [StrategyQuotes](./lib/snaptrade/models/strategy_quotes.rb) #### 🌐 Endpoint `/accounts/{accountId}/optionStrategy` `POST` [🔙 **Back to Table of Contents**](#table-of-contents) --- ### `snaptrade.options.get_options_chain` Returns the option chain for the specified symbol in the specified account. #### 🛠️ Usage ```ruby result = snaptrade.options.get_options_chain( user_id: "snaptrade-user-123", user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61", account_id: "accountId_example", symbol: "symbol_example", ) p result ``` #### ⚙️ Parameters ##### user_id: `String` ##### user_secret: `String` ##### account_id: `String` The ID of the account to get the options chain from. ##### symbol: `String` Universal symbol ID if symbol #### 🔄 Return [OptionChainInner](./lib/snaptrade/models/option_chain_inner.rb) #### 🌐 Endpoint `/accounts/{accountId}/optionsChain` `GET` [🔙 **Back to Table of Contents**](#table-of-contents) --- ### `snaptrade.options.get_options_strategy_quote` Returns a Strategy Quotes object which has latest market data of the specified option strategy. #### 🛠️ Usage ```ruby result = snaptrade.options.get_options_strategy_quote( user_id: "snaptrade-user-123", user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61", account_id: "accountId_example", option_strategy_id: "2bcd7cc3-e922-4976-bce1-9858296801c3", ) p result ``` #### ⚙️ Parameters ##### user_id: `String` ##### user_secret: `String` ##### account_id: `String` The ID of the account the strategy will be placed in. ##### option_strategy_id: `String` Option strategy id obtained from response when creating option strategy object #### 🔄 Return [StrategyQuotes](./lib/snaptrade/models/strategy_quotes.rb) #### 🌐 Endpoint `/accounts/{accountId}/optionStrategy/{optionStrategyId}` `GET` [🔙 **Back to Table of Contents**](#table-of-contents) --- ### `snaptrade.options.list_option_holdings` Returns a list of option positions in the specified account. For stock/ETF/crypto/mutual fund positions, please use the [positions endpoint](/reference/Account%20Information/AccountInformation_getUserAccountPositions). The data returned here is cached. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for "Cache Expiry Time" to see the exact value for a specific brokerage. **If you need real-time data, please use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint**. #### 🛠️ Usage ```ruby result = snaptrade.options.list_option_holdings( user_id: "snaptrade-user-123", user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61", account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631", ) p result ``` #### ⚙️ Parameters ##### user_id: `String` ##### user_secret: `String` ##### account_id: `String` #### 🔄 Return [OptionsPosition](./lib/snaptrade/models/options_position.rb) #### 🌐 Endpoint `/accounts/{accountId}/options` `GET` [🔙 **Back to Table of Contents**](#table-of-contents) --- ### `snaptrade.options.place_option_strategy` Places the option strategy order and returns the order record received from the brokerage. #### 🛠️ Usage ```ruby result = snaptrade.options.place_option_strategy( order_type: "Market", time_in_force: "FOK", user_id: "snaptrade-user-123", user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61", account_id: "2bcd7cc3-e922-4976-bce1-9858296801c3", option_strategy_id: "2bcd7cc3-e922-4976-bce1-9858296801c3", price: 31.33, ) p result ``` #### ⚙️ Parameters ##### order_type: [`OrderTypeStrict`](./lib/snaptrade/models/order_type_strict.rb) The type of order to place. - For `Limit` and `StopLimit` orders, the `price` field is required. - For `Stop` and `StopLimit` orders, the `stop` field is required. ##### time_in_force: [`TimeInForceStrict`](./lib/snaptrade/models/time_in_force_strict.rb) The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. ##### user_id: `String` ##### user_secret: `String` ##### account_id: `String` The ID of the account to execute the strategy in. ##### option_strategy_id: `String` Option strategy id obtained from response when creating option strategy object ##### price: `Float` Trade Price if limit or stop limit order #### 🔄 Return [StrategyOrderRecord](./lib/snaptrade/models/strategy_order_record.rb) #### 🌐 Endpoint `/accounts/{accountId}/optionStrategy/{optionStrategyId}/execute` `POST` [🔙 **Back to Table of Contents**](#table-of-contents) --- ### `snaptrade.reference_data.get_currency_exchange_rate_pair` Returns an Exchange Rate Pair object for the specified Currency Pair. #### 🛠️ Usage ```ruby result = snaptrade.reference_data.get_currency_exchange_rate_pair( currency_pair: "currencyPair_example", ) p result ``` #### ⚙️ Parameters ##### currency_pair: `String` A currency pair based on currency code for example, {CAD-USD} #### 🔄 Return [ExchangeRatePairs](./lib/snaptrade/models/exchange_rate_pairs.rb) #### 🌐 Endpoint `/currencies/rates/{currencyPair}` `GET` [🔙 **Back to Table of Contents**](#table-of-contents) --- ### `snaptrade.reference_data.get_partner_info` Returns configurations for your SnapTrade Client ID, including allowed brokerages and data access. #### 🛠️ Usage ```ruby result = snaptrade.reference_data.get_partner_info p result ``` #### 🔄 Return [PartnerData](./lib/snaptrade/models/partner_data.rb) #### 🌐 Endpoint `/snapTrade/partners` `GET` [🔙 **Back to Table of Contents**](#table-of-contents) --- ### `snaptrade.reference_data.get_security_types` Return all available security types supported by SnapTrade. #### 🛠️ Usage ```ruby result = snaptrade.reference_data.get_security_types p result ``` #### 🔄 Return [SecurityType](./lib/snaptrade/models/security_type.rb) #### 🌐 Endpoint `/securityTypes` `GET` [🔙 **Back to Table of Contents**](#table-of-contents) --- ### `snaptrade.reference_data.get_stock_exchanges` Returns a list of all supported Exchanges. #### 🛠️ Usage ```ruby result = snaptrade.reference_data.get_stock_exchanges p result ``` #### 🔄 Return [Exchange](./lib/snaptrade/models/exchange.rb) #### 🌐 Endpoint `/exchanges` `GET` [🔙 **Back to Table of Contents**](#table-of-contents) --- ### `snaptrade.reference_data.get_symbols` Returns a list of Universal Symbol objects that match the given query. The matching takes into consideration both the ticker and the name of the symbol. Only the first 20 results are returned. #### 🛠️ Usage ```ruby result = snaptrade.reference_data.get_symbols( substring: "AAPL", ) p result ``` #### ⚙️ Parameters ##### substring: `String` The search query for symbols. #### 🔄 Return [UniversalSymbol](./lib/snaptrade/models/universal_symbol.rb) #### 🌐 Endpoint `/symbols` `POST` [🔙 **Back to Table of Contents**](#table-of-contents) --- ### `snaptrade.reference_data.get_symbols_by_ticker` Returns the Universal Symbol object specified by the ticker or the Universal Symbol ID. When a ticker is specified, the first matching result is returned. We largely follow the [Yahoo Finance ticker format](https://help.yahoo.com/kb/SLN2310.html)(click on "Yahoo Finance Market Coverage and Data Delays"). For example, for securities traded on the Toronto Stock Exchange, the symbol has a '.TO' suffix. For securities traded on NASDAQ or NYSE, the symbol does not have a suffix. Please use the ticker with the proper suffix for the best results. #### 🛠️ Usage ```ruby result = snaptrade.reference_data.get_symbols_by_ticker( query: "query_example", ) p result ``` #### ⚙️ Parameters ##### query: `String` The ticker or Universal Symbol ID to look up the symbol with. #### 🔄 Return [UniversalSymbol](./lib/snaptrade/models/universal_symbol.rb) #### 🌐 Endpoint `/symbols/{query}` `GET` [🔙 **Back to Table of Contents**](#table-of-contents) --- ### `snaptrade.reference_data.list_all_brokerage_authorization_type` Returns a list of all defined Brokerage authorization Type objects. #### 🛠️ Usage ```ruby result = snaptrade.reference_data.list_all_brokerage_authorization_type( brokerage: "QUESTRADE,ALPACA", ) p result ``` #### ⚙️ Parameters ##### brokerage: `String` Comma separated value of brokerage slugs #### 🔄 Return [BrokerageAuthorizationTypeReadOnly](./lib/snaptrade/models/brokerage_authorization_type_read_only.rb) #### 🌐 Endpoint `/brokerageAuthorizationTypes` `GET` [🔙 **Back to Table of Contents**](#table-of-contents) --- ### `snaptrade.reference_data.list_all_brokerages` Returns a list of all defined Brokerage objects. #### 🛠️ Usage ```ruby result = snaptrade.reference_data.list_all_brokerages p result ``` #### 🔄 Return [Brokerage](./lib/snaptrade/models/brokerage.rb) #### 🌐 Endpoint `/brokerages` `GET` [🔙 **Back to Table of Contents**](#table-of-contents) --- ### `snaptrade.reference_data.list_all_currencies` Returns a list of all defined Currency objects. #### 🛠️ Usage ```ruby result = snaptrade.reference_data.list_all_currencies p result ``` #### 🔄 Return [Currency](./lib/snaptrade/models/currency.rb) #### 🌐 Endpoint `/currencies` `GET` [🔙 **Back to Table of Contents**](#table-of-contents) --- ### `snaptrade.reference_data.list_all_currencies_rates` Returns a list of all Exchange Rate Pairs for all supported Currencies. #### 🛠️ Usage ```ruby result = snaptrade.reference_data.list_all_currencies_rates p result ``` #### 🔄 Return [ExchangeRatePairs](./lib/snaptrade/models/exchange_rate_pairs.rb) #### 🌐 Endpoint `/currencies/rates` `GET` [🔙 **Back to Table of Contents**](#table-of-contents) --- ### `snaptrade.reference_data.symbol_search_user_account` Returns a list of Universal Symbol objects that match the given query. The matching takes into consideration both the ticker and the name of the symbol. Only the first 20 results are returned. The search results are further limited to the symbols supported by the brokerage for which the account is under. #### 🛠️ Usage ```ruby result = snaptrade.reference_data.symbol_search_user_account( user_id: "snaptrade-user-123", user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61", account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631", substring: "AAPL", ) p result ``` #### ⚙️ Parameters ##### user_id: `String` ##### user_secret: `String` ##### account_id: `String` ##### substring: `String` The search query for symbols. #### 🔄 Return [UniversalSymbol](./lib/snaptrade/models/universal_symbol.rb) #### 🌐 Endpoint `/accounts/{accountId}/symbols` `POST` [🔙 **Back to Table of Contents**](#table-of-contents) --- ### `snaptrade.trading.cancel_user_account_order` Attempts to cancel an open order with the brokerage. If the order is no longer cancellable, the request will be rejected. #### 🛠️ Usage ```ruby result = snaptrade.trading.cancel_user_account_order( user_id: "snaptrade-user-123", user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61", account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631", brokerage_order_id: "66a033fa-da74-4fcf-b527-feefdec9257e", ) p result ``` #### ⚙️ Parameters ##### user_id: `String` ##### user_secret: `String` ##### account_id: `String` ##### brokerage_order_id: `String` Order ID returned by brokerage. This is the unique identifier for the order in the brokerage system. #### 🔄 Return [AccountOrderRecord](./lib/snaptrade/models/account_order_record.rb) #### 🌐 Endpoint `/accounts/{accountId}/orders/cancel` `POST` [🔙 **Back to Table of Contents**](#table-of-contents) --- ### `snaptrade.trading.get_order_impact` Simulates an order and its impact on the account. This endpoint does not place the order with the brokerage. If successful, it returns a `Trade` object and the ID of the object can be used to place the order with the brokerage using the [place checked order endpoint](/reference/Trading/Trading_placeOrder). Please note that the `Trade` object returned expires after 5 minutes. Any order placed using an expired `Trade` will be rejected. #### 🛠️ Usage ```ruby result = snaptrade.trading.get_order_impact( account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631", action: "BUY", universal_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3", order_type: "Market", time_in_force: "FOK", user_id: "snaptrade-user-123", user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61", price: 31.33, stop: 31.33, units: 10.5, notional_value: None, ) p result ``` #### ⚙️ Parameters ##### account_id: `String` Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade. ##### action: [`ActionStrict`](./lib/snaptrade/models/action_strict.rb) The action describes the intent or side of a trade. This is either `BUY` or `SELL` ##### universal_symbol_id: `String` Unique identifier for the symbol within SnapTrade. This is the ID used to reference the symbol in SnapTrade API calls. ##### order_type: [`OrderTypeStrict`](./lib/snaptrade/models/order_type_strict.rb) The type of order to place. - For `Limit` and `StopLimit` orders, the `price` field is required. - For `Stop` and `StopLimit` orders, the `stop` field is required. ##### time_in_force: [`TimeInForceStrict`](./lib/snaptrade/models/time_in_force_strict.rb) The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. ##### user_id: `String` ##### user_secret: `String` ##### price: `Float` The limit price for `Limit` and `StopLimit` orders. ##### stop: `Float` The price at which a stop order is triggered for `Stop` and `StopLimit` orders. ##### units: [`Float`](./lib/snaptrade/models/float.rb) ##### notional_value: [`ManualTradeFormNotionalValue`](./lib/snaptrade/models/manual_trade_form_notional_value.rb) #### 🔄 Return [ManualTradeAndImpact](./lib/snaptrade/models/manual_trade_and_impact.rb) #### 🌐 Endpoint `/trade/impact` `POST` [🔙 **Back to Table of Contents**](#table-of-contents) --- ### `snaptrade.trading.get_user_account_quotes` Returns quotes from the brokerage for the specified symbols and account. The quotes returned can be delayed depending on the brokerage the account belongs to. It is highly recommended that you use your own market data provider for real-time quotes instead of relying on this endpoint. This endpoint does not work for options quotes. #### 🛠️ Usage ```ruby result = snaptrade.trading.get_user_account_quotes( user_id: "snaptrade-user-123", user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61", symbols: "symbols_example", account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631", use_ticker: true, ) p result ``` #### ⚙️ Parameters ##### user_id: `String` ##### user_secret: `String` ##### symbols: `String` List of Universal Symbol IDs or tickers to get quotes for. ##### account_id: `String` ##### use_ticker: `Boolean` Should be set to `True` if `symbols` are comprised of tickers. Defaults to `False` if not provided. #### 🔄 Return [SymbolsQuotesInner](./lib/snaptrade/models/symbols_quotes_inner.rb) #### 🌐 Endpoint `/accounts/{accountId}/quotes` `GET` [🔙 **Back to Table of Contents**](#table-of-contents) --- ### `snaptrade.trading.place_force_order` Places a brokerage order in the specified account. The order could be rejected by the brokerage if it is invalid or if the account does not have sufficient funds. This endpoint does not compute the impact to the account balance from the order and any potential commissions before submitting the order to the brokerage. If that is desired, you can use the [check order impact endpoint](/reference/Trading/Trading_getOrderImpact). It's recommended to trigger a manual refresh of the account after placing an order to ensure the account is up to date. You can use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint for this. #### 🛠️ Usage ```ruby result = snaptrade.trading.place_force_order( account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631", action: "BUY", universal_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3", order_type: "Market", time_in_force: "FOK", user_id: "snaptrade-user-123", user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61", price: 31.33, stop: 31.33, units: 10.5, notional_value: None, ) p result ``` #### ⚙️ Parameters ##### account_id: `String` Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade. ##### action: [`ActionStrict`](./lib/snaptrade/models/action_strict.rb) The action describes the intent or side of a trade. This is either `BUY` or `SELL` ##### universal_symbol_id: `String` Unique identifier for the symbol within SnapTrade. This is the ID used to reference the symbol in SnapTrade API calls. ##### order_type: [`OrderTypeStrict`](./lib/snaptrade/models/order_type_strict.rb) The type of order to place. - For `Limit` and `StopLimit` orders, the `price` field is required. - For `Stop` and `StopLimit` orders, the `stop` field is required. ##### time_in_force: [`TimeInForceStrict`](./lib/snaptrade/models/time_in_force_strict.rb) The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. ##### user_id: `String` ##### user_secret: `String` ##### price: `Float` The limit price for `Limit` and `StopLimit` orders. ##### stop: `Float` The price at which a stop order is triggered for `Stop` and `StopLimit` orders. ##### units: [`Float`](./lib/snaptrade/models/float.rb) ##### notional_value: [`ManualTradeFormNotionalValue`](./lib/snaptrade/models/manual_trade_form_notional_value.rb) #### 🔄 Return [AccountOrderRecord](./lib/snaptrade/models/account_order_record.rb) #### 🌐 Endpoint `/trade/place` `POST` [🔙 **Back to Table of Contents**](#table-of-contents) --- ### `snaptrade.trading.place_order` Places the previously checked order with the brokerage. The `tradeId` is obtained from the [check order impact endpoint](/reference/Trading/Trading_getOrderImpact). If you prefer to place the order without checking for impact first, you can use the [place order endpoint](/reference/Trading/Trading_placeForceOrder). It's recommended to trigger a manual refresh of the account after placing an order to ensure the account is up to date. You can use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint for this. #### 🛠️ Usage ```ruby result = snaptrade.trading.place_order( trade_id: "139e307a-82f7-4402-b39e-4da7baa87758", user_id: "snaptrade-user-123", user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61", wait_to_confirm: true, ) p result ``` #### ⚙️ Parameters ##### trade_id: `String` Obtained from calling the [check order impact endpoint](/reference/Trading/Trading_getOrderImpact) ##### user_id: `String` ##### user_secret: `String` ##### wait_to_confirm: `Boolean` Optional, defaults to true. Determines if a wait is performed to check on order status. If false, latency will be reduced but orders returned will be more likely to be of status `PENDING` as we will not wait to check on the status before responding to the request. #### 🔄 Return [AccountOrderRecord](./lib/snaptrade/models/account_order_record.rb) #### 🌐 Endpoint `/trade/{tradeId}` `POST` [🔙 **Back to Table of Contents**](#table-of-contents) --- ### `snaptrade.transactions_and_reporting.get_activities` 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. **If you need real-time data, please use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint**. #### 🛠️ Usage ```ruby result = snaptrade.transactions_and_reporting.get_activities( user_id: "snaptrade-user-123", user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61", start_date: "2022-01-24", end_date: "2022-01-24", accounts: "917c8734-8470-4a3e-a18f-57c3f2ee6631,65e839a3-9103-4cfb-9b72-2071ef80c5f2", brokerage_authorizations: "917c8734-8470-4a3e-a18f-57c3f2ee6631,65e839a3-9103-4cfb-9b72-2071ef80c5f2", type: "BUY,SELL,DIVIDEND", ) p result ``` #### ⚙️ Parameters ##### user_id: `String` ##### user_secret: `String` ##### start_date: `Date` 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` 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` 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` 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` 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. #### 🔄 Return [UniversalActivity](./lib/snaptrade/models/universal_activity.rb) #### 🌐 Endpoint `/activities` `GET` [🔙 **Back to Table of Contents**](#table-of-contents) --- ### `snaptrade.transactions_and_reporting.get_reporting_custom_range` ![Deprecated](https://img.shields.io/badge/deprecated-yellow) 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. #### 🛠️ Usage ```ruby result = snaptrade.transactions_and_reporting.get_reporting_custom_range( start_date: "2022-01-24", end_date: "2022-01-24", user_id: "snaptrade-user-123", user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61", accounts: "917c8734-8470-4a3e-a18f-57c3f2ee6631,65e839a3-9103-4cfb-9b72-2071ef80c5f2", detailed: true, frequency: "monthly", ) p result ``` #### ⚙️ Parameters ##### start_date: `Date` ##### end_date: `Date` ##### user_id: `String` ##### user_secret: `String` ##### accounts: `String` Optional comma separated list of account IDs used to filter the request on specific accounts ##### detailed: `Boolean` Optional, increases frequency of data points for the total value and contribution charts if set to true ##### frequency: `String` Optional frequency for the rate of return chart (defaults to monthly). Possible values are daily, weekly, monthly, quarterly, yearly. #### 🔄 Return [PerformanceCustom](./lib/snaptrade/models/performance_custom.rb) #### 🌐 Endpoint `/performance/custom` `GET` [🔙 **Back to Table of Contents**](#table-of-contents) --- ## Author This TypeScript package is automatically generated by [Konfig](https://konfigthis.com)