snaptrade 3.0.65 → 3.0.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +165 -154
- data/lib/snaptrade/api/account_information_api.rb +22 -14
- data/lib/snaptrade/api/connections_api.rb +10 -2
- data/lib/snaptrade/api/experimental_endpoints_api.rb +0 -184
- data/lib/snaptrade/api/trading_api.rb +184 -0
- data/lib/snaptrade/models/account_universal_activity.rb +12 -2
- data/lib/snaptrade/models/activity.rb +1 -1
- data/lib/snaptrade/models/future_option_instrument.rb +1 -1
- data/lib/snaptrade/models/universal_activity.rb +1 -1
- data/lib/snaptrade/version.rb +1 -1
- data/spec/api/account_information_api_spec.rb +4 -4
- data/spec/api/connections_api_spec.rb +1 -1
- data/spec/api/experimental_endpoints_api_spec.rb +0 -15
- data/spec/api/trading_api_spec.rb +15 -0
- data/spec/models/account_universal_activity_spec.rb +6 -0
- metadata +293 -293
|
@@ -38,7 +38,7 @@ describe 'AccountInformationApi' do
|
|
|
38
38
|
# @option opts [Date] :end_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`.
|
|
39
39
|
# @option opts [Integer] :offset An integer that specifies the starting point of the paginated results. Default is 0.
|
|
40
40
|
# @option opts [Integer] :limit An integer that specifies the maximum number of transactions to return. Default of 1000.
|
|
41
|
-
# @option opts [String] :type 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. - `SUBSTITUTE_DIVIDEND` - Payment in lieu of a dividend. - `CONTRIBUTION` - Cash contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment. - `STOCK_DIVIDEND` - A type of dividend where a company distributes shares instead of cash - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `TAX` - A tax related fee. - `OPTIONEXPIRATION` - Option expiration event. - `OPTIONASSIGNMENT` - Option assignment event. - `OPTIONEXERCISE` - Option exercise event. - `TRANSFER` - Transfer of assets from one account to another. - `SPLIT` - A stock share split.
|
|
41
|
+
# @option opts [String] :type 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. - `SUBSTITUTE_DIVIDEND` - Payment in lieu of a dividend. - `CAPITAL_GAINS_LONG` - Long-term capital-gain distribution. - `CAPITAL_GAINS_SHORT` - Short-term capital-gain distribution. - `CONTRIBUTION` - Cash contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment. - `STOCK_DIVIDEND` - A type of dividend where a company distributes shares instead of cash - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `TAX` - A tax related fee. - `OPTIONEXPIRATION` - Option expiration event. - `OPTIONASSIGNMENT` - Option assignment event. - `OPTIONEXERCISE` - Option exercise event. - `TRANSFER` - Transfer of assets from one account to another. - `SPLIT` - A stock share split.
|
|
42
42
|
# @return [PaginatedUniversalActivity]
|
|
43
43
|
describe 'get_account_activities test' do
|
|
44
44
|
it 'should work' do
|
|
@@ -112,7 +112,7 @@ describe 'AccountInformationApi' do
|
|
|
112
112
|
# @param [Hash] opts the optional parameters
|
|
113
113
|
# @option opts [Date] :start_date First date to include (UTC). Defaults to the earliest available transaction.
|
|
114
114
|
# @option opts [Date] :end_date Last date to include (UTC). Defaults to the latest available transaction.
|
|
115
|
-
# @option opts [String] :type 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. - `BUY_TO_OPEN` - Option bought to open a long position. - `BUY_TO_CLOSE` - Option bought to close a short position. - `SELL_TO_OPEN` - Option sold to open a short position. - `SELL_TO_CLOSE` - Option sold to close a long position. - `DIVIDEND` - Dividend payout. - `SUBSTITUTE_DIVIDEND` - Payment in lieu of a dividend. - `CONTRIBUTION` - Cash contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment. - `STOCK_DIVIDEND` - A type of dividend where a company distributes shares instead of cash - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `TAX` - A tax related fee. - `OPTIONEXPIRATION` - Option expiration event. - `OPTIONASSIGNMENT` - Option assignment event. - `OPTIONEXERCISE` - Option exercise event. - `TRANSFER` - Transfer of assets from one account to another. - `SPLIT` - A stock share split.
|
|
115
|
+
# @option opts [String] :type 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. - `BUY_TO_OPEN` - Option bought to open a long position. - `BUY_TO_CLOSE` - Option bought to close a short position. - `SELL_TO_OPEN` - Option sold to open a short position. - `SELL_TO_CLOSE` - Option sold to close a long position. - `DIVIDEND` - Dividend payout. - `SUBSTITUTE_DIVIDEND` - Payment in lieu of a dividend. - `CAPITAL_GAINS_LONG` - Long-term capital-gain distribution. - `CAPITAL_GAINS_SHORT` - Short-term capital-gain distribution. - `CONTRIBUTION` - Cash contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment. - `STOCK_DIVIDEND` - A type of dividend where a company distributes shares instead of cash - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `TAX` - A tax related fee. - `OPTIONEXPIRATION` - Option expiration event. - `OPTIONASSIGNMENT` - Option assignment event. - `OPTIONEXERCISE` - Option exercise event. - `TRANSFER` - Transfer of assets from one account to another. - `SPLIT` - A stock share split.
|
|
116
116
|
# @option opts [Integer] :offset An integer that specifies the starting point of the paginated results. Default is 0.
|
|
117
117
|
# @option opts [Integer] :limit An integer that specifies the maximum number of transactions to return. Default of 1000.
|
|
118
118
|
# @return [AccountTransactionsResponse]
|
|
@@ -183,7 +183,7 @@ describe 'AccountInformationApi' do
|
|
|
183
183
|
|
|
184
184
|
# unit tests for get_user_account_details
|
|
185
185
|
# Get account detail
|
|
186
|
-
# **Deprecated.** Use the [get account details](/reference/Account%20Information/AccountInformation_getAccountDetails) endpoint instead, which supports all account types, including investment, deposit, line of credit, annuity, and mortgage accounts. Returns account detail known to SnapTrade for the specified account. Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access: - If you do, this endpoint returns real-time data. - If you don't, Daily data is cached and refreshed once a day. Exact refresh timing may vary by brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
|
|
186
|
+
# **Deprecated.** Use the [get account details](/reference/Account%20Information/AccountInformation_getAccountDetails) endpoint instead, which supports all account types, including investment, deposit, line of credit, annuity, and mortgage accounts. This endpoint will return HTTP 410 Gone for all customers that sign up after December 1, 2026. Returns account detail known to SnapTrade for the specified account. Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access: - If you do, this endpoint returns real-time data. - If you don't, Daily data is cached and refreshed once a day. Exact refresh timing may vary by brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
|
|
187
187
|
# @param user_id
|
|
188
188
|
# @param user_secret
|
|
189
189
|
# @param account_id
|
|
@@ -285,7 +285,7 @@ describe 'AccountInformationApi' do
|
|
|
285
285
|
|
|
286
286
|
# unit tests for list_user_accounts
|
|
287
287
|
# List user accounts
|
|
288
|
-
# **Deprecated.** Use the [list all user accounts](/reference/Account%20Information/AccountInformation_listAllUserAccounts) endpoint instead, which returns all account types in a single response, including investment, deposit, line of credit, annuity, and mortgage accounts. Returns all brokerage accounts across all connections known to SnapTrade for the authenticated user. This endpoint returns Daily data regardless of the customer's plan. Daily data is cached and refreshed once a day, which makes this endpoint fast and well-suited to listing accounts across all of a user's connections in a single call. Exact refresh timing may vary by brokerage. To get real-time data on Pay as you Go / Real-time, use the [list accounts for a connection endpoint](/reference/Connections/
|
|
288
|
+
# **Deprecated.** Use the [list all user accounts](/reference/Account%20Information/AccountInformation_listAllUserAccounts) endpoint instead, which returns all account types in a single response, including investment, deposit, line of credit, annuity, and mortgage accounts. This endpoint will return HTTP 410 Gone for all customers that sign up after December 1, 2026. Returns all brokerage accounts across all connections known to SnapTrade for the authenticated user. This endpoint returns Daily data regardless of the customer's plan. Daily data is cached and refreshed once a day, which makes this endpoint fast and well-suited to listing accounts across all of a user's connections in a single call. Exact refresh timing may vary by brokerage. To get real-time data on Pay as you Go / Real-time, use the [list accounts for a connection endpoint](/reference/Connections/Connections_listConnectionAccounts). Customers on Pay as you Go / Daily can force a refresh with the [manual refresh endpoint](/reference/Connections/Connections_refreshBrokerageAuthorization).
|
|
289
289
|
# @param user_id
|
|
290
290
|
# @param user_secret
|
|
291
291
|
# @param [Hash] opts the optional parameters
|
|
@@ -71,7 +71,7 @@ describe 'ConnectionsApi' do
|
|
|
71
71
|
|
|
72
72
|
# unit tests for list_brokerage_authorization_accounts
|
|
73
73
|
# List accounts for a connection
|
|
74
|
-
# Returns all brokerage accounts that belong to the specified connection for the authenticated user. On Pay as you Go / Real-time, this endpoint refreshes each account's opening date, funding date, and total value live from the brokerage on each call. On Pay as you Go / Daily, this endpoint returns Daily data. Daily data is cached and refreshed once a day. Exact refresh timing may vary by brokerage. To force a refresh, use the [manual refresh endpoint](/reference/Connections/Connections_refreshBrokerageAuthorization). Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see whether your plan includes real-time data.
|
|
74
|
+
# **Deprecated.** Use the [list accounts](/reference/Connections/Connections_listConnectionAccounts) endpoint instead, which returns all account types in a single response, including investment, deposit, line of credit, annuity, and mortgage accounts. This endpoint will return HTTP 410 Gone for all customers that sign up after December 1, 2026. Returns all brokerage accounts that belong to the specified connection for the authenticated user. On Pay as you Go / Real-time, this endpoint refreshes each account's opening date, funding date, and total value live from the brokerage on each call. On Pay as you Go / Daily, this endpoint returns Daily data. Daily data is cached and refreshed once a day. Exact refresh timing may vary by brokerage. To force a refresh, use the [manual refresh endpoint](/reference/Connections/Connections_refreshBrokerageAuthorization). Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see whether your plan includes real-time data.
|
|
75
75
|
# @param authorization_id
|
|
76
76
|
# @param user_id
|
|
77
77
|
# @param user_secret
|
|
@@ -110,19 +110,4 @@ describe 'ExperimentalEndpointsApi' do
|
|
|
110
110
|
end
|
|
111
111
|
end
|
|
112
112
|
|
|
113
|
-
# unit tests for place_simple_order
|
|
114
|
-
# Place a simple order (beta)
|
|
115
|
-
# **Beta.** Places a single-leg or multi-leg order using a common request format for equities, equity options, futures, and future options. This endpoint is experimental; breaking changes are possible during the experimental phase. Equity and equity-option orders use the existing brokerage trading capabilities. Futures are supported on tastytrade, Webull US, and TradeStation (live and SIM); future options are supported on tastytrade and TradeStation (live and SIM). Order types, time in force, optional fields, and strategy combinations remain subject to brokerage support. See the [brokerage trading support page](https://support.snaptrade.com/brokerages). An order may contain equity/option legs or future/future_option legs, but cannot mix those two families. Equity/option strategies must share the same underlying symbol. Each strategy is submitted as one brokerage order; unsupported strategies are never split into independent orders. Tastytrade supports single-leg outright futures and up to four future-option legs, and does not support multi-leg market orders. Webull US supports single-leg futures orders with buy or sell actions and positive whole-contract quantities. Supported order types are market, limit, stop, and stop_limit, with day or gtc duration. Futures options, multi-leg futures, trailing stops, and Webull Canada futures trading are not supported. Webull determines contract availability, margin requirements, and valid price increments. TradeStation and TradeStation SIM support single-leg futures and futures-option orders in Futures accounts, with positive whole-contract quantities. Supported order types are market, limit, stop, and stop_limit, with day, gtc, ioc, or fok duration, subject to the contract and route's supported combinations. Futures use buy/sell; futures options use the open/close option actions. Multi-leg futures-family strategies are not supported. Prices are forwarded without rounding; TradeStation determines contract availability, permissions, margin requirements, and valid price increments. All string choices use lower snake_case and are case-sensitive. Symbols retain their native format: equity tickers, OCC equity-option symbols, or brokerage-native futures symbols. For tastytrade, use the exact BrokerageInstrument ticker, including any spaces. For Webull US, use a specific unprefixed futures contract symbol such as ESZ6; slash-prefixed aliases, continuous/root-only symbols, and whitespace are not accepted. For TradeStation, use a specific two-digit-year contract such as ESZ26 or @ESZ26, or a futures-option symbol such as `ESZ26 C6000`, preserving the space and any session alias. The optional @ prefix is supported for dated futures contracts and is forwarded unchanged. Slash-prefixed aliases and root-only continuous symbols such as @ES are not accepted. A futures symbol does not need to be present in SnapTrade's local instrument catalog to submit an order. A successful response contains only the brokerage order ID. Use the existing order endpoints to retrieve order details.
|
|
116
|
-
# @param account_id The ID of the account to execute the trade on.
|
|
117
|
-
# @param user_id
|
|
118
|
-
# @param user_secret
|
|
119
|
-
# @param simple_trade_form
|
|
120
|
-
# @param [Hash] opts the optional parameters
|
|
121
|
-
# @return [SimpleTradeResponse]
|
|
122
|
-
describe 'place_simple_order test' do
|
|
123
|
-
it 'should work' do
|
|
124
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
125
|
-
end
|
|
126
|
-
end
|
|
127
|
-
|
|
128
113
|
end
|
|
@@ -191,6 +191,21 @@ describe 'TradingApi' do
|
|
|
191
191
|
end
|
|
192
192
|
end
|
|
193
193
|
|
|
194
|
+
# unit tests for place_simple_order
|
|
195
|
+
# Place a simple order (beta)
|
|
196
|
+
# **Beta.** Places a single-leg or multi-leg order using a common request format for equities, equity options, futures, and future options. Breaking changes are possible while this endpoint is in beta. Equity and equity-option orders use the existing brokerage trading capabilities. Futures are supported on tastytrade, Webull US, and TradeStation (live and SIM); future options are supported on tastytrade and TradeStation (live and SIM). Order types, time in force, optional fields, and strategy combinations remain subject to brokerage support. See the [brokerage trading support page](https://support.snaptrade.com/brokerages). An order may contain equity/option legs or future/future_option legs, but cannot mix those two families. Equity/option strategies must share the same underlying symbol. Each strategy is submitted as one brokerage order; unsupported strategies are never split into independent orders. Tastytrade supports single-leg outright futures and up to four future-option legs, and does not support multi-leg market orders. Webull US supports single-leg futures orders with buy or sell actions and positive whole-contract quantities. Supported order types are market, limit, stop, and stop_limit, with day or gtc duration. Futures options, multi-leg futures, trailing stops, and Webull Canada futures trading are not supported. Webull determines contract availability, margin requirements, and valid price increments. TradeStation and TradeStation SIM support single-leg futures and futures-option orders in Futures accounts, with positive whole-contract quantities. Supported order types are market, limit, stop, and stop_limit, with day, gtc, ioc, or fok duration, subject to the contract and route's supported combinations. Futures use buy/sell; futures options use the open/close option actions. Multi-leg futures-family strategies are not supported. Prices are forwarded without rounding; TradeStation determines contract availability, permissions, margin requirements, and valid price increments. All string choices use lower snake_case and are case-sensitive. Symbols retain their native format: equity tickers, OCC equity-option symbols, or brokerage-native futures symbols. For tastytrade, use the exact BrokerageInstrument ticker, including any spaces. For Webull US, use a specific unprefixed futures contract symbol such as ESZ6; slash-prefixed aliases, continuous/root-only symbols, and whitespace are not accepted. For TradeStation, use a specific two-digit-year contract such as ESZ26 or @ESZ26, or a futures-option symbol such as `ESZ26 C6000`, preserving the space and any session alias. The optional @ prefix is supported for dated futures contracts and is forwarded unchanged. Slash-prefixed aliases and root-only continuous symbols such as @ES are not accepted. A futures symbol does not need to be present in SnapTrade's local instrument catalog to submit an order. A successful response contains only the brokerage order ID. Use the existing order endpoints to retrieve order details.
|
|
197
|
+
# @param account_id The ID of the account to execute the trade on.
|
|
198
|
+
# @param user_id
|
|
199
|
+
# @param user_secret
|
|
200
|
+
# @param simple_trade_form
|
|
201
|
+
# @param [Hash] opts the optional parameters
|
|
202
|
+
# @return [SimpleTradeResponse]
|
|
203
|
+
describe 'place_simple_order test' do
|
|
204
|
+
it 'should work' do
|
|
205
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
206
|
+
end
|
|
207
|
+
end
|
|
208
|
+
|
|
194
209
|
# unit tests for preview_crypto_order
|
|
195
210
|
# Preview crypto order
|
|
196
211
|
# Previews an order using the specified account.
|
|
@@ -20,6 +20,12 @@ describe SnapTrade::AccountUniversalActivity do
|
|
|
20
20
|
expect(instance).to be_instance_of(SnapTrade::AccountUniversalActivity)
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
|
+
describe 'test attribute "instrument"' do
|
|
24
|
+
it 'should work' do
|
|
25
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
23
29
|
describe 'test attribute "id"' do
|
|
24
30
|
it 'should work' do
|
|
25
31
|
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|