[![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.14-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.14) [![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.get_user_jwt`](#snaptradeauthenticationget_user_jwt) * [`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.list_brokerage_authorizations`](#snaptradeconnectionslist_brokerage_authorizations) * [`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_oco_order`](#snaptradetradingplace_oco_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.14' ``` ## 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: "John.doe@snaptrade.com", user_secret: "USERSECRET123", 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: "John.doe@snaptrade.com", user_secret: "USERSECRET123", 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` 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: "John.doe@snaptrade.com", user_secret: "USERSECRET123", brokerage_authorizations: "917c8734-8470-4a3e-a18f-57c3f2ee6631", ) p result ``` #### βš™οΈ Parameters ##### user_id: `String` ##### user_secret: `String` ##### brokerage_authorizations: `String` Optional. Comma seperated 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` A list of account balances for the specified account (one per currency that the account holds). #### πŸ› οΈ Usage ```ruby result = snaptrade.account_information.get_user_account_balance( user_id: "John.doe@snaptrade.com", user_secret: "USERSECRET123", account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631", ) p result ``` #### βš™οΈ Parameters ##### user_id: `String` ##### user_secret: `String` ##### account_id: `String` The ID of the account to get balances. #### πŸ”„ 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` Return details of a specific investment account #### πŸ› οΈ Usage ```ruby result = snaptrade.account_information.get_user_account_details( user_id: "John.doe@snaptrade.com", user_secret: "USERSECRET123", account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631", ) p result ``` #### βš™οΈ Parameters ##### user_id: `String` ##### user_secret: `String` ##### account_id: `String` The ID of the account to get detail of. #### πŸ”„ 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` Fetch all recent orders from a user's account. #### πŸ› οΈ Usage ```ruby result = snaptrade.account_information.get_user_account_orders( user_id: "John.doe@snaptrade.com", user_secret: "USERSECRET123", account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631", state: "all", days: 30, ) p result ``` #### βš™οΈ Parameters ##### user_id: `String` ##### user_secret: `String` ##### account_id: `String` The ID of the account to get orders. ##### 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` List account positions #### πŸ› οΈ Usage ```ruby result = snaptrade.account_information.get_user_account_positions( user_id: "John.doe@snaptrade.com", user_secret: "USERSECRET123", account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631", ) p result ``` #### βš™οΈ Parameters ##### user_id: `String` ##### user_secret: `String` ##### account_id: `String` The ID of the account to get positions. #### πŸ”„ 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` List balances, positions and orders for the specified account #### πŸ› οΈ Usage ```ruby result = snaptrade.account_information.get_user_holdings( account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631", user_id: "John.doe@snaptrade.com", user_secret: "USERSECRET123", ) p result ``` #### βš™οΈ Parameters ##### account_id: `String` The ID of the account to fetch holdings for. ##### 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` List accounts #### πŸ› οΈ Usage ```ruby result = snaptrade.account_information.list_user_accounts( user_id: "John.doe@snaptrade.com", user_secret: "USERSECRET123", ) 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` Update details of an investment account #### πŸ› οΈ Usage ```ruby result = snaptrade.account_information.update_user_account( user_id: "John.doe@snaptrade.com", user_secret: "USERSECRET123", 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 user you've registered over the SnapTrade API, and any data associated with them or their investment accounts. #### πŸ› οΈ Usage ```ruby result = snaptrade.authentication.delete_snap_trade_user( user_id: "John.doe@snaptrade.com", ) 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.get_user_jwt` Generate encrypted JWT token #### πŸ› οΈ Usage ```ruby result = snaptrade.authentication.get_user_jwt( user_id: "John.doe@snaptrade.com", user_secret: "USERSECRET123", ) p result ``` #### βš™οΈ Parameters ##### user_id: `String` ##### user_secret: `String` #### πŸ”„ Return [EncryptedResponse](./lib/snaptrade/models/encrypted_response.rb) #### 🌐 Endpoint `/snapTrade/encryptedJWT` `GET` [πŸ”™ **Back to Table of Contents**](#table-of-contents) --- ### `snaptrade.authentication.list_snap_trade_users` Returns a list of users you've registered over the SnapTrade API. #### πŸ› οΈ 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` Logs in a SnapTrade user and returns an authenticated connection portal URL for them to use to connect a brokerage account. #### πŸ› οΈ Usage ```ruby result = snaptrade.authentication.login_snap_trade_user( user_id: "John.doe@snaptrade.com", user_secret: "USERSECRET123", broker: "ALPACA", immediate_redirect: true, custom_redirect: "https://snaptrade.com", reconnect: "8b5f262d-4bb9-365d-888a-202bd3b15fa1", connection_type: "read", connection_portal_version: "v2", ) p result ``` #### βš™οΈ Parameters ##### user_id: `String` ##### user_secret: `String` ##### broker: `String` Slug of the brokerage to connect the user to ##### immediateRedirect: `Boolean` When set to True, user will be redirected back to the partner's site instead of the connection portal ##### customRedirect: `String` URL to redirect the user to after the user connects their brokerage account ##### 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 β€˜Reconnecting Accounts’ for more information. ##### connectionType: [`ConnectionType`](./lib/snaptrade/models/connection_type.rb) Sets whether the connection should be read or trade ##### connectionPortalVersion: [`ConnectionPortalVersion`](./lib/snaptrade/models/connection_portal_version.rb) Sets the version of the connection portal to render, with a default to 'v2' #### πŸ”„ 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` Create SnapTrade user #### πŸ› οΈ Usage ```ruby result = snaptrade.authentication.register_snap_trade_user( user_id: "snaptrade-user-123", ) p result ``` #### βš™οΈ Parameters ##### userId: `String` SnapTrade User ID. Provided by SnapTrade Partner. Can be any string, as long as it's unique to a user #### πŸ”„ 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` Obtain a new user secret for a user #### πŸ› οΈ Usage ```ruby result = snaptrade.authentication.reset_snap_trade_user_secret( user_id: "snaptrade-user-123", user_secret: "h81@cx1lkalablakwjaltkejraj11=", ) p result ``` #### βš™οΈ Parameters ##### userId: `String` SnapTrade User ID. Provided by SnapTrade Partner. Can be any string, as long as it's unique to a user ##### userSecret: `String` SnapTrade User Secret randomly generated by SnapTrade. This should be considered priviledged information and if compromised, you should delete and re-create this SnapTrade user. #### πŸ”„ 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` Get brokerage authorization details #### πŸ› οΈ Usage ```ruby result = snaptrade.connections.detail_brokerage_authorization( authorization_id: "2bcd7cc3-e922-4976-bce1-9858296801c3", user_id: "John.doe@snaptrade.com", user_secret: "USERSECRET123", ) p result ``` #### βš™οΈ Parameters ##### authorization_id: `String` The ID of a brokerage authorization object. ##### 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.list_brokerage_authorizations` List all brokerage authorizations for the user #### πŸ› οΈ Usage ```ruby result = snaptrade.connections.list_brokerage_authorizations( user_id: "John.doe@snaptrade.com", user_secret: "USERSECRET123", ) 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.remove_brokerage_authorization` Delete brokerage authorization #### πŸ› οΈ Usage ```ruby snaptrade.connections.remove_brokerage_authorization( authorization_id: "2bcd7cc3-e922-4976-bce1-9858296801c3", user_id: "John.doe@snaptrade.com", user_secret: "USERSECRET123", ) ``` #### βš™οΈ Parameters ##### authorization_id: `String` The ID of the Authorization to delete. ##### user_id: `String` ##### user_secret: `String` #### 🌐 Endpoint `/authorizations/{authorizationId}` `DELETE` [πŸ”™ **Back to Table of Contents**](#table-of-contents) --- ### `snaptrade.connections.session_events` List all session events for the partner #### πŸ› οΈ 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 seperated list of user IDs used to filter the request on specific users ##### session_id: `String` Optional comma seperated 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: "John.doe@snaptrade.com", user_secret: "USERSECRET123", 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` Get the options chain #### πŸ› οΈ Usage ```ruby result = snaptrade.options.get_options_chain( user_id: "John.doe@snaptrade.com", user_secret: "USERSECRET123", 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` Get latest market data of option strategy #### πŸ› οΈ Usage ```ruby result = snaptrade.options.get_options_strategy_quote( user_id: "John.doe@snaptrade.com", user_secret: "USERSECRET123", 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` Get the options holdings in the account #### πŸ› οΈ Usage ```ruby result = snaptrade.options.list_option_holdings( user_id: "John.doe@snaptrade.com", user_secret: "USERSECRET123", account_id: "accountId_example", ) p result ``` #### βš™οΈ Parameters ##### user_id: `String` ##### user_secret: `String` ##### account_id: `String` The ID of the account to fetch options holdings for. #### πŸ”„ 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` Place an option strategy order on the brokerage #### πŸ› οΈ Usage ```ruby result = snaptrade.options.place_option_strategy( order_type: "Limit", time_in_force: "FOK", user_id: "John.doe@snaptrade.com", user_secret: "USERSECRET123", account_id: "2bcd7cc3-e922-4976-bce1-9858296801c3", option_strategy_id: "2bcd7cc3-e922-4976-bce1-9858296801c3", price: 31.33, ) p result ``` #### βš™οΈ Parameters ##### order_type: [`OrderType`](./lib/snaptrade/models/order_type.rb) Order Type ##### time_in_force: [`TimeInForceStrict`](./lib/snaptrade/models/time_in_force_strict.rb) Trade time in force examples: * FOK - Fill Or Kill * Day - Day * GTC - Good Til Canceled ##### 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` Return the exchange rate of a 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` Get metadata related to Snaptrade partner #### πŸ› οΈ 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` List security types available on 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` List 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` Search for symbols #### πŸ› οΈ Usage ```ruby result = snaptrade.reference_data.get_symbols( substring: "apple", ) p result ``` #### βš™οΈ Parameters ##### substring: `String` #### πŸ”„ 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` Get details of a symbol by the ticker or the universal_symbol_id #### πŸ› οΈ Usage ```ruby result = snaptrade.reference_data.get_symbols_by_ticker( query: "query_example", ) p result ``` #### βš™οΈ Parameters ##### query: `String` The ticker or universal_symbol_id of the UniversalSymbol to get. #### πŸ”„ 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` List of all brokerage authorization types #### πŸ› οΈ 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` List brokerages #### πŸ› οΈ 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` List currencies #### πŸ› οΈ 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` List currency exchange rates #### πŸ› οΈ 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` Search for symbols available in an account #### πŸ› οΈ Usage ```ruby result = snaptrade.reference_data.symbol_search_user_account( user_id: "John.doe@snaptrade.com", user_secret: "USERSECRET123", account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631", substring: "apple", ) p result ``` #### βš™οΈ Parameters ##### user_id: `String` ##### user_secret: `String` ##### account_id: `String` The ID of the account to search for symbols within. ##### substring: `String` #### πŸ”„ 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` Cancel open order in account #### πŸ› οΈ Usage ```ruby result = snaptrade.trading.cancel_user_account_order( user_id: "John.doe@snaptrade.com", user_secret: "USERSECRET123", account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631", brokerage_order_id: "2bcd7cc3-e922-4976-bce1-9858296801c3", ) p result ``` #### βš™οΈ Parameters ##### user_id: `String` ##### user_secret: `String` ##### account_id: `String` The ID of the account to cancel the order in. ##### brokerage_order_id: `String` #### πŸ”„ 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` Check impact of trades on account. #### πŸ› οΈ Usage ```ruby result = snaptrade.trading.get_order_impact( user_id: "John.doe@snaptrade.com", user_secret: "USERSECRET123", account_id: "2bcd7cc3-e922-4976-bce1-9858296801c3", action: "BUY", order_type: "Limit", price: 31.33, stop: 31.33, time_in_force: "FOK", units: 3.14, universal_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3", notional_value: 100, ) p result ``` #### βš™οΈ Parameters ##### user_id: `String` ##### user_secret: `String` ##### account_id: `String` ##### action: [`Action`](./lib/snaptrade/models/action.rb) Trade Action ##### order_type: [`OrderType`](./lib/snaptrade/models/order_type.rb) Order Type ##### price: `Float` Trade Price if limit or stop limit order ##### stop: `Float` Stop Price. If stop loss or stop limit order, the price to trigger the stop ##### time_in_force: [`TimeInForceStrict`](./lib/snaptrade/models/time_in_force_strict.rb) Trade time in force examples: * FOK - Fill Or Kill * Day - Day * GTC - Good Til Canceled ##### units: [`Float`](./lib/snaptrade/models/float.rb) ##### universal_symbol_id: `String` ##### notional_value: [`Float`](./lib/snaptrade/models/float.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` Get symbol quotes #### πŸ› οΈ Usage ```ruby result = snaptrade.trading.get_user_account_quotes( user_id: "John.doe@snaptrade.com", user_secret: "USERSECRET123", 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_id or tickers to get quotes for. ##### account_id: `String` The ID of the account to get quotes. ##### use_ticker: `Boolean` Should be set to True if providing tickers. #### πŸ”„ 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` Place a trade with NO validation. #### πŸ› οΈ Usage ```ruby result = snaptrade.trading.place_force_order( user_id: "John.doe@snaptrade.com", user_secret: "USERSECRET123", account_id: "2bcd7cc3-e922-4976-bce1-9858296801c3", action: "BUY", order_type: "Limit", price: 31.33, stop: 31.33, time_in_force: "FOK", units: 3.14, universal_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3", notional_value: 100, ) p result ``` #### βš™οΈ Parameters ##### user_id: `String` ##### user_secret: `String` ##### account_id: `String` ##### action: [`Action`](./lib/snaptrade/models/action.rb) Trade Action ##### order_type: [`OrderType`](./lib/snaptrade/models/order_type.rb) Order Type ##### price: `Float` Trade Price if limit or stop limit order ##### stop: `Float` Stop Price. If stop loss or stop limit order, the price to trigger the stop ##### time_in_force: [`TimeInForceStrict`](./lib/snaptrade/models/time_in_force_strict.rb) Trade time in force examples: * FOK - Fill Or Kill * Day - Day * GTC - Good Til Canceled ##### units: [`Float`](./lib/snaptrade/models/float.rb) ##### universal_symbol_id: `String` ##### notional_value: [`Float`](./lib/snaptrade/models/float.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_oco_order` Place a OCO (One Cancels Other) order #### πŸ› οΈ Usage ```ruby result = snaptrade.trading.place_oco_order( user_id: "John.doe@snaptrade.com", user_secret: "USERSECRET123", first_trade_id: None, second_trade_id: None, ) p result ``` #### βš™οΈ Parameters ##### user_id: `String` ##### user_secret: `String` ##### first_trade_id: `Object` The ID of first trade object obtained from trade/impact endpoint ##### second_trade_id: `Object` The ID of second trade object obtained from trade/impact endpoint #### πŸ”„ Return [AccountOrderRecord](./lib/snaptrade/models/account_order_record.rb) #### 🌐 Endpoint `/trade/oco` `POST` [πŸ”™ **Back to Table of Contents**](#table-of-contents) --- ### `snaptrade.trading.place_order` Place order #### πŸ› οΈ Usage ```ruby result = snaptrade.trading.place_order( trade_id: "tradeId_example", user_id: "John.doe@snaptrade.com", user_secret: "USERSECRET123", wait_to_confirm: true, ) p result ``` #### βš™οΈ Parameters ##### trade_id: `String` The ID of trade object obtained from trade/impact endpoint ##### 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 activities (transactions) for a user. Specifying start and end date is highly recommended for better performance #### πŸ› οΈ Usage ```ruby result = snaptrade.transactions_and_reporting.get_activities( user_id: "John.doe@snaptrade.com", user_secret: "USERSECRET123", 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: "DIVIDEND", ) p result ``` #### βš™οΈ Parameters ##### user_id: `String` ##### user_secret: `String` ##### start_date: `Date` ##### end_date: `Date` ##### accounts: `String` Optional comma seperated list of account IDs used to filter the request on specific accounts ##### brokerage_authorizations: `String` Optional comma seperated list of brokerage authorization IDs used to filter the request on only accounts that belong to those authorizations ##### type: `String` Optional comma seperated list of types to filter activities by. This is not an exhaustive list, if we fail to match to these types, we will return the raw description from the brokerage. Potential values include - DIVIDEND - BUY - SELL - CONTRIBUTION - WITHDRAWAL - EXTERNAL_ASSET_TRANSFER_IN - EXTERNAL_ASSET_TRANSFER_OUT - INTERNAL_CASH_TRANSFER_IN - INTERNAL_CASH_TRANSFER_OUT - INTERNAL_ASSET_TRANSFER_IN - INTERNAL_ASSET_TRANSFER_OUT - INTEREST - REBATE - GOV_GRANT - TAX - FEE - REI - FXT #### πŸ”„ 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` 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: "John.doe@snaptrade.com", user_secret: "USERSECRET123", 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 seperated 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)