snaptrade 2.1.0 → 3.0.1
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/Gemfile.lock +2 -2
- data/README.md +8 -580
- data/lib/snaptrade/api/account_information_api.rb +4 -235
- data/lib/snaptrade/api/connections_api.rb +0 -201
- data/lib/snaptrade/api/reference_data_api.rb +0 -316
- data/lib/snaptrade/api/trading_api.rb +4 -294
- data/lib/snaptrade/models/manual_trade_replace_form.rb +3 -3
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +0 -7
- data/spec/api/account_information_api_spec.rb +1 -29
- data/spec/api/connections_api_spec.rb +0 -28
- data/spec/api/reference_data_api_spec.rb +0 -45
- data/spec/api/trading_api_spec.rb +0 -30
- metadata +200 -209
- data/lib/snaptrade/api/options_api.rb +0 -137
- data/lib/snaptrade/api/transactions_and_reporting_api.rb +0 -302
- data/lib/snaptrade/models/connections_session_events200_response_inner.rb +0 -292
- data/spec/api/options_api_spec.rb +0 -44
- data/spec/api/transactions_and_reporting_api_spec.rb +0 -66
- data/spec/models/connections_session_events200_response_inner_spec.rb +0 -65
|
@@ -16,7 +16,7 @@ module SnapTrade
|
|
|
16
16
|
# Order ID returned by brokerage. This is the unique identifier for the order in the brokerage system.
|
|
17
17
|
attr_accessor :brokerage_order_id
|
|
18
18
|
|
|
19
|
-
# The action describes the intent or side of a trade. This is either `BUY` or `SELL
|
|
19
|
+
# The action describes the intent or side of a trade. This is either `BUY` or `SELL` for Equity symbols or `BUY_TO_OPEN`, `BUY_TO_CLOSE`, `SELL_TO_OPEN` or `SELL_TO_CLOSE` for Options.
|
|
20
20
|
attr_accessor :action
|
|
21
21
|
|
|
22
22
|
# 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.
|
|
@@ -28,7 +28,7 @@ module SnapTrade
|
|
|
28
28
|
# The limit price for `Limit` and `StopLimit` orders.
|
|
29
29
|
attr_accessor :price
|
|
30
30
|
|
|
31
|
-
# The security's trading ticker symbol
|
|
31
|
+
# The security's trading ticker symbol. Use the OCC symbol to replace an option order.
|
|
32
32
|
attr_accessor :symbol
|
|
33
33
|
|
|
34
34
|
# The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
|
|
@@ -59,7 +59,7 @@ module SnapTrade
|
|
|
59
59
|
def self.openapi_types
|
|
60
60
|
{
|
|
61
61
|
:'brokerage_order_id' => :'String',
|
|
62
|
-
:'action' => :'
|
|
62
|
+
:'action' => :'ActionStrictWithOptions',
|
|
63
63
|
:'order_type' => :'OrderTypeStrict',
|
|
64
64
|
:'time_in_force' => :'TimeInForceStrict',
|
|
65
65
|
:'price' => :'Float',
|
data/lib/snaptrade/version.rb
CHANGED
data/lib/snaptrade.rb
CHANGED
|
@@ -83,7 +83,6 @@ require 'snaptrade/models/connection_account'
|
|
|
83
83
|
require 'snaptrade/models/connection_account_sync_status'
|
|
84
84
|
require 'snaptrade/models/connection_portal_version'
|
|
85
85
|
require 'snaptrade/models/connection_type'
|
|
86
|
-
require 'snaptrade/models/connections_session_events200_response_inner'
|
|
87
86
|
require 'snaptrade/models/crypto_instrument'
|
|
88
87
|
require 'snaptrade/models/crypto_instrument_kind'
|
|
89
88
|
require 'snaptrade/models/crypto_order_form'
|
|
@@ -246,10 +245,8 @@ require 'snaptrade/api/api_status_api'
|
|
|
246
245
|
require 'snaptrade/api/authentication_api'
|
|
247
246
|
require 'snaptrade/api/connections_api'
|
|
248
247
|
require 'snaptrade/api/experimental_endpoints_api'
|
|
249
|
-
require 'snaptrade/api/options_api'
|
|
250
248
|
require 'snaptrade/api/reference_data_api'
|
|
251
249
|
require 'snaptrade/api/trading_api'
|
|
252
|
-
require 'snaptrade/api/transactions_and_reporting_api'
|
|
253
250
|
|
|
254
251
|
module SnapTrade
|
|
255
252
|
@config = Configuration.default
|
|
@@ -320,10 +317,8 @@ module SnapTrade
|
|
|
320
317
|
attr_reader :authentication
|
|
321
318
|
attr_reader :connections
|
|
322
319
|
attr_reader :experimental_endpoints
|
|
323
|
-
attr_reader :options
|
|
324
320
|
attr_reader :reference_data
|
|
325
321
|
attr_reader :trading
|
|
326
|
-
attr_reader :transactions_and_reporting
|
|
327
322
|
|
|
328
323
|
def initialize(config = Configuration.default)
|
|
329
324
|
@api_client = ApiClient::new(config)
|
|
@@ -332,10 +327,8 @@ module SnapTrade
|
|
|
332
327
|
@authentication = SnapTrade::AuthenticationApi.new(@api_client)
|
|
333
328
|
@connections = SnapTrade::ConnectionsApi.new(@api_client)
|
|
334
329
|
@experimental_endpoints = SnapTrade::ExperimentalEndpointsApi.new(@api_client)
|
|
335
|
-
@options = SnapTrade::OptionsApi.new(@api_client)
|
|
336
330
|
@reference_data = SnapTrade::ReferenceDataApi.new(@api_client)
|
|
337
331
|
@trading = SnapTrade::TradingApi.new(@api_client)
|
|
338
|
-
@transactions_and_reporting = SnapTrade::TransactionsAndReportingApi.new(@api_client)
|
|
339
332
|
end
|
|
340
333
|
end
|
|
341
334
|
end
|
|
@@ -62,7 +62,7 @@ describe 'AccountInformationApi' do
|
|
|
62
62
|
|
|
63
63
|
# unit tests for get_all_account_positions
|
|
64
64
|
# List all account positions
|
|
65
|
-
# Returns a list of all positions in the specified account. The `results` list can contain multiple instrument types in the same response, including stocks, ADRs, ETFs, mutual funds, closed-end funds, crypto, futures, option positions, and CFD positions. Use the `instrument.kind` discriminator to determine the schema for each position's `instrument`. `mutualfund` positions may also include `cash_equivalent`. `stock`, `etf`, and `mutualfund` positions may include `tax_lots` when tax lot data is enabled for the account. 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.
|
|
65
|
+
# Returns a list of all positions in the specified account. The `results` list can contain multiple instrument types in the same response, including stocks, ADRs, ETFs, mutual funds, closed-end funds, crypto, futures, option positions, and CFD positions. Use the `instrument.kind` discriminator to determine the schema for each position's `instrument`. `mutualfund` positions may also include `cash_equivalent`. `stock`, `etf`, and `mutualfund` positions may include `tax_lots` when tax lot data is enabled for the account. To see which institutions support tax lot data, please see our [supported institutions doc](https://support.snaptrade.com/brokerages). 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.
|
|
66
66
|
# @param user_id
|
|
67
67
|
# @param user_secret
|
|
68
68
|
# @param account_id
|
|
@@ -74,20 +74,6 @@ describe 'AccountInformationApi' do
|
|
|
74
74
|
end
|
|
75
75
|
end
|
|
76
76
|
|
|
77
|
-
# unit tests for get_all_user_holdings
|
|
78
|
-
# List all accounts for the user, plus balances, positions, and orders for each account.
|
|
79
|
-
# **Deprecated.** Use the account-specific holdings endpoint instead. This endpoint will return HTTP 410 Gone for all customers that sign up after April 25, 2026. List all accounts for the user, plus balances, positions, and orders for each account.
|
|
80
|
-
# @param user_id
|
|
81
|
-
# @param user_secret
|
|
82
|
-
# @param [Hash] opts the optional parameters
|
|
83
|
-
# @option opts [String] :brokerage_authorizations Optional. Comma separated list of authorization IDs (only use if filtering is needed on one or more authorizations).
|
|
84
|
-
# @return [Array<AccountHoldings>]
|
|
85
|
-
describe 'get_all_user_holdings test' do
|
|
86
|
-
it 'should work' do
|
|
87
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
88
|
-
end
|
|
89
|
-
end
|
|
90
|
-
|
|
91
77
|
# unit tests for get_user_account_balance
|
|
92
78
|
# List account balances
|
|
93
79
|
# 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). 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.
|
|
@@ -147,20 +133,6 @@ describe 'AccountInformationApi' do
|
|
|
147
133
|
end
|
|
148
134
|
end
|
|
149
135
|
|
|
150
|
-
# unit tests for get_user_account_positions
|
|
151
|
-
# List account positions
|
|
152
|
-
# **Deprecated.** Use the newer [unified positions endpoint](/reference/Account%20Information/AccountInformation_getAllAccountPositions) instead. This will allow you to get both equity and option positions in a single call, as well as additional asset classes such as futures. 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). 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.
|
|
153
|
-
# @param user_id
|
|
154
|
-
# @param user_secret
|
|
155
|
-
# @param account_id
|
|
156
|
-
# @param [Hash] opts the optional parameters
|
|
157
|
-
# @return [Array<Position>]
|
|
158
|
-
describe 'get_user_account_positions test' do
|
|
159
|
-
it 'should work' do
|
|
160
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
161
|
-
end
|
|
162
|
-
end
|
|
163
|
-
|
|
164
136
|
# unit tests for get_user_account_recent_orders
|
|
165
137
|
# List account recent orders (last 24 hours only)
|
|
166
138
|
# A lightweight endpoint that returns the latest page of orders placed in the last 24 hours in the specified account. For most brokerages, the default page size is 100 meaning the endpoint will return a max of 100 orders. This endpoint is realtime and can be used to quickly check if account state has recently changed due to an execution, or check status of recently placed orders Differs from /orders in that it is always realtime, and only checks the last 24 hours By default only returns executed orders, but that can be changed by setting *only_executed* to false
|
|
@@ -110,20 +110,6 @@ describe 'ConnectionsApi' do
|
|
|
110
110
|
end
|
|
111
111
|
end
|
|
112
112
|
|
|
113
|
-
# unit tests for remove_brokerage_authorization
|
|
114
|
-
# Delete connection
|
|
115
|
-
# Deletes the SnapTrade connection specified by the ID. This will also remove the accounts and holdings data associated with the connection from SnapTrade. This action is irreversible. This endpoint is synchronous, a 204 response indicates that the data has been successfully deleted.
|
|
116
|
-
# @param authorization_id
|
|
117
|
-
# @param user_id
|
|
118
|
-
# @param user_secret
|
|
119
|
-
# @param [Hash] opts the optional parameters
|
|
120
|
-
# @return [nil]
|
|
121
|
-
describe 'remove_brokerage_authorization test' do
|
|
122
|
-
it 'should work' do
|
|
123
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
124
|
-
end
|
|
125
|
-
end
|
|
126
|
-
|
|
127
113
|
# unit tests for return_rates
|
|
128
114
|
# List connection rate of returns
|
|
129
115
|
# Returns a list of rate of return percents for a given connection.
|
|
@@ -139,20 +125,6 @@ describe 'ConnectionsApi' do
|
|
|
139
125
|
end
|
|
140
126
|
end
|
|
141
127
|
|
|
142
|
-
# unit tests for session_events
|
|
143
|
-
# Get all session events for a user
|
|
144
|
-
# Returns a list of session events associated with a user.
|
|
145
|
-
# @param partner_client_id
|
|
146
|
-
# @param [Hash] opts the optional parameters
|
|
147
|
-
# @option opts [String] :user_id Optional comma separated list of user IDs used to filter the request on specific users
|
|
148
|
-
# @option opts [String] :session_id Optional comma separated list of session IDs used to filter the request on specific users
|
|
149
|
-
# @return [Array<ConnectionsSessionEvents200ResponseInner>]
|
|
150
|
-
describe 'session_events test' do
|
|
151
|
-
it 'should work' do
|
|
152
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
153
|
-
end
|
|
154
|
-
end
|
|
155
|
-
|
|
156
128
|
# unit tests for sync_brokerage_authorization_transactions
|
|
157
129
|
# Sync transactions for a connection
|
|
158
130
|
# Trigger a transactions sync for all accounts under this connection. Updates will be queued asynchronously. Transactions are not updated intra-day, but calling this endpoint can ensure that the previous day's transactions have been synced. For more information on sync behaviour, see: https://docs.snaptrade.com/docs/syncing
|
|
@@ -27,18 +27,6 @@ describe 'ReferenceDataApi' do
|
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
-
# unit tests for get_currency_exchange_rate_pair
|
|
31
|
-
# Get exchange rate of a currency pair
|
|
32
|
-
# Returns an Exchange Rate Pair object for the specified Currency Pair.
|
|
33
|
-
# @param currency_pair A currency pair based on currency code for example, {CAD-USD}
|
|
34
|
-
# @param [Hash] opts the optional parameters
|
|
35
|
-
# @return [ExchangeRatePairs]
|
|
36
|
-
describe 'get_currency_exchange_rate_pair test' do
|
|
37
|
-
it 'should work' do
|
|
38
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
|
|
42
30
|
# unit tests for get_partner_info
|
|
43
31
|
# Get Client Info
|
|
44
32
|
# Returns configurations for your SnapTrade Client ID, including allowed brokerages and data access.
|
|
@@ -50,17 +38,6 @@ describe 'ReferenceDataApi' do
|
|
|
50
38
|
end
|
|
51
39
|
end
|
|
52
40
|
|
|
53
|
-
# unit tests for get_security_types
|
|
54
|
-
# List security types
|
|
55
|
-
# Return all available security types supported by SnapTrade.
|
|
56
|
-
# @param [Hash] opts the optional parameters
|
|
57
|
-
# @return [Array<SecurityType>]
|
|
58
|
-
describe 'get_security_types test' do
|
|
59
|
-
it 'should work' do
|
|
60
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
|
|
64
41
|
# unit tests for get_stock_exchanges
|
|
65
42
|
# Get exchanges
|
|
66
43
|
# Returns a list of all supported Exchanges.
|
|
@@ -131,28 +108,6 @@ describe 'ReferenceDataApi' do
|
|
|
131
108
|
end
|
|
132
109
|
end
|
|
133
110
|
|
|
134
|
-
# unit tests for list_all_currencies
|
|
135
|
-
# Get currencies
|
|
136
|
-
# Returns a list of all defined Currency objects.
|
|
137
|
-
# @param [Hash] opts the optional parameters
|
|
138
|
-
# @return [Array<Currency>]
|
|
139
|
-
describe 'list_all_currencies test' do
|
|
140
|
-
it 'should work' do
|
|
141
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
142
|
-
end
|
|
143
|
-
end
|
|
144
|
-
|
|
145
|
-
# unit tests for list_all_currencies_rates
|
|
146
|
-
# Get currency exchange rates
|
|
147
|
-
# Returns a list of all Exchange Rate Pairs for all supported Currencies.
|
|
148
|
-
# @param [Hash] opts the optional parameters
|
|
149
|
-
# @return [Array<ExchangeRatePairs>]
|
|
150
|
-
describe 'list_all_currencies_rates test' do
|
|
151
|
-
it 'should work' do
|
|
152
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
153
|
-
end
|
|
154
|
-
end
|
|
155
|
-
|
|
156
111
|
# unit tests for symbol_search_user_account
|
|
157
112
|
# Search account symbols
|
|
158
113
|
# 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.
|
|
@@ -42,21 +42,6 @@ describe 'TradingApi' do
|
|
|
42
42
|
end
|
|
43
43
|
end
|
|
44
44
|
|
|
45
|
-
# unit tests for cancel_user_account_order
|
|
46
|
-
# Cancel equity order
|
|
47
|
-
# **Deprecated.** Use [the new cancel order endpoint](/reference/Trading/Trading_cancelOrder) instead. Attempts to cancel an open order with the brokerage. If the order is no longer cancellable, the request will be rejected.
|
|
48
|
-
# @param user_id
|
|
49
|
-
# @param user_secret
|
|
50
|
-
# @param account_id
|
|
51
|
-
# @param account_information_get_user_account_order_detail_request
|
|
52
|
-
# @param [Hash] opts the optional parameters
|
|
53
|
-
# @return [AccountOrderRecord]
|
|
54
|
-
describe 'cancel_user_account_order test' do
|
|
55
|
-
it 'should work' do
|
|
56
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
|
|
60
45
|
# unit tests for get_cryptocurrency_pair_quote
|
|
61
46
|
# Get crypto pair quote
|
|
62
47
|
# Gets a quote for the specified account.
|
|
@@ -132,21 +117,6 @@ describe 'TradingApi' do
|
|
|
132
117
|
end
|
|
133
118
|
end
|
|
134
119
|
|
|
135
|
-
# unit tests for place_bracket_order
|
|
136
|
-
# Place bracket order
|
|
137
|
-
# **Deprecated.** Use [the new complex order endpoint](/reference/Trading/Trading_placeComplexOrder) instead. Places a bracket order (entry order + OCO of stop loss and take profit). Disabled by default please contact support for use. Only supported on certain brokerages
|
|
138
|
-
# @param account_id The ID of the account to execute the trade on.
|
|
139
|
-
# @param user_id
|
|
140
|
-
# @param user_secret
|
|
141
|
-
# @param manual_trade_form_bracket
|
|
142
|
-
# @param [Hash] opts the optional parameters
|
|
143
|
-
# @return [AccountOrderRecord]
|
|
144
|
-
describe 'place_bracket_order test' do
|
|
145
|
-
it 'should work' do
|
|
146
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
147
|
-
end
|
|
148
|
-
end
|
|
149
|
-
|
|
150
120
|
# unit tests for place_complex_order
|
|
151
121
|
# Place complex order
|
|
152
122
|
# Places a complex conditional order (OCO, OTO, or OTOCO). Only supported on certain brokerages. Please refer to the [brokerage trading support page](https://support.snaptrade.com/brokerages) for details on which brokerages support complex orders and which types they support. - **OCO** (One Cancels the Other): Two peer orders; when one fills the other is cancelled. - **OTO** (One Triggers the Other): A trigger order that, when filled, activates a conditional order. - **OTOCO** (One Triggers a One Cancels the Other): A trigger order that, when filled, activates an OCO pair of two peer orders.
|