snaptrade 2.0.189 → 2.0.191
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 +1 -1
- data/README.md +50 -46
- data/lib/snaptrade/api/account_information_api.rb +129 -6
- data/lib/snaptrade/api/connections_api.rb +4 -4
- data/lib/snaptrade/api/experimental_endpoints_api.rb +8 -119
- data/lib/snaptrade/api/options_api.rb +6 -2
- data/lib/snaptrade/version.rb +1 -1
- data/spec/api/account_information_api_spec.rb +16 -2
- data/spec/api/connections_api_spec.rb +1 -1
- data/spec/api/experimental_endpoints_api_spec.rb +1 -15
- data/spec/api/options_api_spec.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 93ecd88f7f7bb7f1f5585242e2221a0f831813438652cca5bb792a62eef34a08
|
|
4
|
+
data.tar.gz: 2e9abe12eead3eeaa1e8a0b0cff22db5537d4daf531dcca15c974d755755a2b7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 891ae577616deb3841a32a2788bc6d5832615b745249f9cb826fb4e7d2ce35429db41c1945fcea59496b9f1c96bdd1f8a8f8a07b471d500ba750fe77fb061ea6
|
|
7
|
+
data.tar.gz: c2f91e665080bbe6b374d64be1af1b6f97cd195c4fdda81bd3006fb9cc1bd210798dba19ec2cf2eb0ed02b955f7162387feb7db2c8afc2fa0273ceb6a5c72a04
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
Connect brokerage accounts to your app for live positions and trading
|
|
8
8
|
|
|
9
|
-
[](https://rubygems.org/gems/snaptrade/versions/2.0.191)
|
|
10
10
|
[](https://snaptrade.com/)
|
|
11
11
|
|
|
12
12
|
</div>
|
|
@@ -21,6 +21,7 @@ Connect brokerage accounts to your app for live positions and trading
|
|
|
21
21
|
- [Reference](#reference)
|
|
22
22
|
* [`snaptrade.account_information.get_account_activities`](#snaptradeaccount_informationget_account_activities)
|
|
23
23
|
* [`snaptrade.account_information.get_account_balance_history`](#snaptradeaccount_informationget_account_balance_history)
|
|
24
|
+
* [`snaptrade.account_information.get_all_account_positions`](#snaptradeaccount_informationget_all_account_positions)
|
|
24
25
|
* [`snaptrade.account_information.get_all_user_holdings`](#snaptradeaccount_informationget_all_user_holdings)
|
|
25
26
|
* [`snaptrade.account_information.get_user_account_balance`](#snaptradeaccount_informationget_user_account_balance)
|
|
26
27
|
* [`snaptrade.account_information.get_user_account_details`](#snaptradeaccount_informationget_user_account_details)
|
|
@@ -47,7 +48,6 @@ Connect brokerage accounts to your app for live positions and trading
|
|
|
47
48
|
* [`snaptrade.connections.remove_brokerage_authorization`](#snaptradeconnectionsremove_brokerage_authorization)
|
|
48
49
|
* [`snaptrade.connections.return_rates`](#snaptradeconnectionsreturn_rates)
|
|
49
50
|
* [`snaptrade.connections.session_events`](#snaptradeconnectionssession_events)
|
|
50
|
-
* [`snaptrade.experimental_endpoints.get_all_account_positions`](#snaptradeexperimental_endpointsget_all_account_positions)
|
|
51
51
|
* [`snaptrade.experimental_endpoints.get_user_account_order_detail_v2`](#snaptradeexperimental_endpointsget_user_account_order_detail_v2)
|
|
52
52
|
* [`snaptrade.experimental_endpoints.get_user_account_orders_v2`](#snaptradeexperimental_endpointsget_user_account_orders_v2)
|
|
53
53
|
* [`snaptrade.experimental_endpoints.get_user_account_recent_orders_v2`](#snaptradeexperimental_endpointsget_user_account_recent_orders_v2)
|
|
@@ -91,7 +91,7 @@ Connect brokerage accounts to your app for live positions and trading
|
|
|
91
91
|
Add to Gemfile:
|
|
92
92
|
|
|
93
93
|
```ruby
|
|
94
|
-
gem 'snaptrade', '~> 2.0.
|
|
94
|
+
gem 'snaptrade', '~> 2.0.191'
|
|
95
95
|
```
|
|
96
96
|
|
|
97
97
|
## Getting Started<a id="getting-started"></a>
|
|
@@ -252,6 +252,46 @@ p result
|
|
|
252
252
|
---
|
|
253
253
|
|
|
254
254
|
|
|
255
|
+
### `snaptrade.account_information.get_all_account_positions`<a id="snaptradeaccount_informationget_all_account_positions"></a>
|
|
256
|
+
|
|
257
|
+
Returns a list of all positions in the specified account.
|
|
258
|
+
|
|
259
|
+
The `results` list can contain multiple instrument types in the same response, including stocks, ADRs, ETFs, mutual funds, closed-end funds, crypto, futures, and option positions. Use the `instrument.kind` discriminator to determine the schema for each position's `instrument`.
|
|
260
|
+
|
|
261
|
+
Stock positions may also include `cash_equivalent`, and may include `tax_lots` when tax lot data is enabled for the account.
|
|
262
|
+
|
|
263
|
+
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.
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
|
267
|
+
|
|
268
|
+
```ruby
|
|
269
|
+
result = snaptrade.account_information.get_all_account_positions(
|
|
270
|
+
user_id: "snaptrade-user-123",
|
|
271
|
+
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
272
|
+
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
273
|
+
)
|
|
274
|
+
p result
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
278
|
+
|
|
279
|
+
##### user_id: `String`<a id="user_id-string"></a>
|
|
280
|
+
##### user_secret: `String`<a id="user_secret-string"></a>
|
|
281
|
+
##### account_id: `String`<a id="account_id-string"></a>
|
|
282
|
+
#### 🔄 Return<a id="🔄-return"></a>
|
|
283
|
+
|
|
284
|
+
[AllAccountPositionsResponse](./lib/snaptrade/models/all_account_positions_response.rb)
|
|
285
|
+
|
|
286
|
+
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
|
287
|
+
|
|
288
|
+
`/accounts/{accountId}/positions/all` `GET`
|
|
289
|
+
|
|
290
|
+
[🔙 **Back to Table of Contents**](#table-of-contents)
|
|
291
|
+
|
|
292
|
+
---
|
|
293
|
+
|
|
294
|
+
|
|
255
295
|
### `snaptrade.account_information.get_all_user_holdings`<a id="snaptradeaccount_informationget_all_user_holdings"></a>
|
|
256
296
|

|
|
257
297
|
|
|
@@ -454,7 +494,7 @@ defaults value is set to \"all\"
|
|
|
454
494
|
|
|
455
495
|
##### days: `Integer`<a id="days-integer"></a>
|
|
456
496
|
Number of days in the past to fetch the most recent orders. Defaults to the last
|
|
457
|
-
30 days if no value is passed in.
|
|
497
|
+
30 days if no value is passed in. Values greater than 90 will be capped at 90.
|
|
458
498
|
|
|
459
499
|
#### 🔄 Return<a id="🔄-return"></a>
|
|
460
500
|
|
|
@@ -473,6 +513,8 @@ Number of days in the past to fetch the most recent orders. Defaults to the last
|
|
|
473
513
|
|
|
474
514
|
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).
|
|
475
515
|
|
|
516
|
+
Consider using the newer [unified positions endpoint](/reference/Account%20Information/AccountInformation_getAllAccountPositions). This will allow you to get both equity and option positions in a single call, as well as additional asset classes such as futures.
|
|
517
|
+
|
|
476
518
|
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:
|
|
477
519
|
- If you do, this endpoint returns real-time data.
|
|
478
520
|
- If you don't, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://support.snaptrade.com/brokerages-table?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for "Cache Expiry Time" to see the exact value for a specific brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint.
|
|
@@ -1042,7 +1084,7 @@ p result
|
|
|
1042
1084
|
|
|
1043
1085
|
Returns all brokerage accounts that belong to the specified connection for the authenticated user.
|
|
1044
1086
|
|
|
1045
|
-
On real-time plans, this endpoint refreshes each account's opening date, funding date, and total value live from the brokerage on each call.
|
|
1087
|
+
On real-time plans, this endpoint refreshes each account's opening date, funding date, and total value live from the brokerage on each call.
|
|
1046
1088
|
|
|
1047
1089
|
On delayed plans, this endpoint returns cached data that is refreshed once a day. To force a refresh, use the [manual refresh endpoint](/reference/Connections/Connections_refreshBrokerageAuthorization).
|
|
1048
1090
|
|
|
@@ -1259,46 +1301,6 @@ specific users
|
|
|
1259
1301
|
---
|
|
1260
1302
|
|
|
1261
1303
|
|
|
1262
|
-
### `snaptrade.experimental_endpoints.get_all_account_positions`<a id="snaptradeexperimental_endpointsget_all_account_positions"></a>
|
|
1263
|
-
|
|
1264
|
-
Returns a list of all positions in the specified account.
|
|
1265
|
-
|
|
1266
|
-
The `results` list can contain multiple instrument types in the same response, including stocks, ADRs, ETFs, mutual funds, closed-end funds, crypto, futures, and option positions. Use the `instrument.kind` discriminator to determine the schema for each position's `instrument`.
|
|
1267
|
-
|
|
1268
|
-
Stock positions may also include `cash_equivalent`, and may include `tax_lots` when tax lot data is enabled for the account.
|
|
1269
|
-
|
|
1270
|
-
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.
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
|
1274
|
-
|
|
1275
|
-
```ruby
|
|
1276
|
-
result = snaptrade.experimental_endpoints.get_all_account_positions(
|
|
1277
|
-
user_id: "snaptrade-user-123",
|
|
1278
|
-
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
1279
|
-
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
1280
|
-
)
|
|
1281
|
-
p result
|
|
1282
|
-
```
|
|
1283
|
-
|
|
1284
|
-
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
1285
|
-
|
|
1286
|
-
##### user_id: `String`<a id="user_id-string"></a>
|
|
1287
|
-
##### user_secret: `String`<a id="user_secret-string"></a>
|
|
1288
|
-
##### account_id: `String`<a id="account_id-string"></a>
|
|
1289
|
-
#### 🔄 Return<a id="🔄-return"></a>
|
|
1290
|
-
|
|
1291
|
-
[AllAccountPositionsResponse](./lib/snaptrade/models/all_account_positions_response.rb)
|
|
1292
|
-
|
|
1293
|
-
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
|
1294
|
-
|
|
1295
|
-
`/accounts/{accountId}/positions/all` `GET`
|
|
1296
|
-
|
|
1297
|
-
[🔙 **Back to Table of Contents**](#table-of-contents)
|
|
1298
|
-
|
|
1299
|
-
---
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
1304
|
### `snaptrade.experimental_endpoints.get_user_account_order_detail_v2`<a id="snaptradeexperimental_endpointsget_user_account_order_detail_v2"></a>
|
|
1303
1305
|
|
|
1304
1306
|
Returns the detail of a single order using the brokerage order ID provided as a path parameter.
|
|
@@ -1374,7 +1376,7 @@ defaults value is set to \"all\"
|
|
|
1374
1376
|
|
|
1375
1377
|
##### days: `Integer`<a id="days-integer"></a>
|
|
1376
1378
|
Number of days in the past to fetch the most recent orders. Defaults to the last
|
|
1377
|
-
30 days if no value is passed in.
|
|
1379
|
+
30 days if no value is passed in. Values greater than 90 will be capped at 90.
|
|
1378
1380
|
|
|
1379
1381
|
#### 🔄 Return<a id="🔄-return"></a>
|
|
1380
1382
|
|
|
@@ -1470,6 +1472,8 @@ p result
|
|
|
1470
1472
|
|
|
1471
1473
|
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).
|
|
1472
1474
|
|
|
1475
|
+
Consider using the newer [unified positions endpoint](/reference/Account%20Information/AccountInformation_getAllAccountPositions). This will allow you to get both equity and option positions in a single call, as well as additional asset classes such as futures.
|
|
1476
|
+
|
|
1473
1477
|
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:
|
|
1474
1478
|
- If you do, this endpoint returns real-time data.
|
|
1475
1479
|
- If you don't, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://support.snaptrade.com/brokerages-table?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for "Cache Expiry Time" to see the exact value for a specific brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint.
|
|
@@ -282,6 +282,121 @@ module SnapTrade
|
|
|
282
282
|
end
|
|
283
283
|
|
|
284
284
|
|
|
285
|
+
# List all account positions
|
|
286
|
+
#
|
|
287
|
+
# Returns a list of all positions in the specified account.
|
|
288
|
+
#
|
|
289
|
+
# The `results` list can contain multiple instrument types in the same response, including stocks, ADRs, ETFs, mutual funds, closed-end funds, crypto, futures, and option positions. Use the `instrument.kind` discriminator to determine the schema for each position's `instrument`.
|
|
290
|
+
#
|
|
291
|
+
# Stock positions may also include `cash_equivalent`, and may include `tax_lots` when tax lot data is enabled for the account.
|
|
292
|
+
#
|
|
293
|
+
# 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.
|
|
294
|
+
#
|
|
295
|
+
# @param user_id [String]
|
|
296
|
+
# @param user_secret [String]
|
|
297
|
+
# @param account_id [String]
|
|
298
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
299
|
+
def get_all_account_positions(user_id:, user_secret:, account_id:, extra: {})
|
|
300
|
+
data, _status_code, _headers = get_all_account_positions_with_http_info_impl(user_id, user_secret, account_id, extra)
|
|
301
|
+
data
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
# List all account positions
|
|
305
|
+
#
|
|
306
|
+
# Returns a list of all positions in the specified account.
|
|
307
|
+
#
|
|
308
|
+
# The `results` list can contain multiple instrument types in the same response, including stocks, ADRs, ETFs, mutual funds, closed-end funds, crypto, futures, and option positions. Use the `instrument.kind` discriminator to determine the schema for each position's `instrument`.
|
|
309
|
+
#
|
|
310
|
+
# Stock positions may also include `cash_equivalent`, and may include `tax_lots` when tax lot data is enabled for the account.
|
|
311
|
+
#
|
|
312
|
+
# 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.
|
|
313
|
+
#
|
|
314
|
+
# @param user_id [String]
|
|
315
|
+
# @param user_secret [String]
|
|
316
|
+
# @param account_id [String]
|
|
317
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
318
|
+
def get_all_account_positions_with_http_info(user_id:, user_secret:, account_id:, extra: {})
|
|
319
|
+
get_all_account_positions_with_http_info_impl(user_id, user_secret, account_id, extra)
|
|
320
|
+
end
|
|
321
|
+
|
|
322
|
+
# List all account positions
|
|
323
|
+
# 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, and option positions. Use the `instrument.kind` discriminator to determine the schema for each position's `instrument`. Stock positions may also include `cash_equivalent`, and 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.
|
|
324
|
+
# @param user_id [String]
|
|
325
|
+
# @param user_secret [String]
|
|
326
|
+
# @param account_id [String]
|
|
327
|
+
# @param [Hash] opts the optional parameters
|
|
328
|
+
# @return [AllAccountPositionsResponse]
|
|
329
|
+
private def get_all_account_positions_impl(user_id, user_secret, account_id, opts = {})
|
|
330
|
+
data, _status_code, _headers = get_all_account_positions_with_http_info(user_id, user_secret, account_id, opts)
|
|
331
|
+
data
|
|
332
|
+
end
|
|
333
|
+
|
|
334
|
+
# List all account positions
|
|
335
|
+
# 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, and option positions. Use the `instrument.kind` discriminator to determine the schema for each position's `instrument`. Stock positions may also include `cash_equivalent`, and 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.
|
|
336
|
+
# @param user_id [String]
|
|
337
|
+
# @param user_secret [String]
|
|
338
|
+
# @param account_id [String]
|
|
339
|
+
# @param [Hash] opts the optional parameters
|
|
340
|
+
# @return [Array<(AllAccountPositionsResponse, Integer, Hash)>] AllAccountPositionsResponse data, response status code and response headers
|
|
341
|
+
private def get_all_account_positions_with_http_info_impl(user_id, user_secret, account_id, opts = {})
|
|
342
|
+
if @api_client.config.debugging
|
|
343
|
+
@api_client.config.logger.debug 'Calling API: AccountInformationApi.get_all_account_positions ...'
|
|
344
|
+
end
|
|
345
|
+
# verify the required parameter 'user_id' is set
|
|
346
|
+
if @api_client.config.client_side_validation && user_id.nil?
|
|
347
|
+
fail ArgumentError, "Missing the required parameter 'user_id' when calling AccountInformationApi.get_all_account_positions"
|
|
348
|
+
end
|
|
349
|
+
# verify the required parameter 'user_secret' is set
|
|
350
|
+
if @api_client.config.client_side_validation && user_secret.nil?
|
|
351
|
+
fail ArgumentError, "Missing the required parameter 'user_secret' when calling AccountInformationApi.get_all_account_positions"
|
|
352
|
+
end
|
|
353
|
+
# verify the required parameter 'account_id' is set
|
|
354
|
+
if @api_client.config.client_side_validation && account_id.nil?
|
|
355
|
+
fail ArgumentError, "Missing the required parameter 'account_id' when calling AccountInformationApi.get_all_account_positions"
|
|
356
|
+
end
|
|
357
|
+
# resource path
|
|
358
|
+
local_var_path = '/accounts/{accountId}/positions/all'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
|
|
359
|
+
|
|
360
|
+
# query parameters
|
|
361
|
+
query_params = opts[:query_params] || {}
|
|
362
|
+
query_params[:'userId'] = user_id
|
|
363
|
+
query_params[:'userSecret'] = user_secret
|
|
364
|
+
|
|
365
|
+
# header parameters
|
|
366
|
+
header_params = opts[:header_params] || {}
|
|
367
|
+
# HTTP header 'Accept' (if needed)
|
|
368
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
369
|
+
|
|
370
|
+
# form parameters
|
|
371
|
+
form_params = opts[:form_params] || {}
|
|
372
|
+
|
|
373
|
+
# http body (model)
|
|
374
|
+
post_body = opts[:debug_body]
|
|
375
|
+
|
|
376
|
+
# return_type
|
|
377
|
+
return_type = opts[:debug_return_type] || 'AllAccountPositionsResponse'
|
|
378
|
+
|
|
379
|
+
# auth_names
|
|
380
|
+
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
|
381
|
+
|
|
382
|
+
new_options = opts.merge(
|
|
383
|
+
:operation => :"AccountInformationApi.get_all_account_positions",
|
|
384
|
+
:header_params => header_params,
|
|
385
|
+
:query_params => query_params,
|
|
386
|
+
:form_params => form_params,
|
|
387
|
+
:body => post_body,
|
|
388
|
+
:auth_names => auth_names,
|
|
389
|
+
:return_type => return_type
|
|
390
|
+
)
|
|
391
|
+
|
|
392
|
+
data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
|
|
393
|
+
if @api_client.config.debugging
|
|
394
|
+
@api_client.config.logger.debug "API called: AccountInformationApi#get_all_account_positions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
395
|
+
end
|
|
396
|
+
return data, status_code, headers, response
|
|
397
|
+
end
|
|
398
|
+
|
|
399
|
+
|
|
285
400
|
# List all accounts for the user, plus balances, positions, and orders for each account.
|
|
286
401
|
#
|
|
287
402
|
# **Deprecated, please use the account-specific holdings endpoint instead.**
|
|
@@ -774,7 +889,7 @@ module SnapTrade
|
|
|
774
889
|
# @param user_secret [String]
|
|
775
890
|
# @param account_id [String]
|
|
776
891
|
# @param state [String] defaults value is set to \"all\"
|
|
777
|
-
# @param 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.
|
|
892
|
+
# @param 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. Values greater than 90 will be capped at 90.
|
|
778
893
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
779
894
|
def get_user_account_orders(user_id:, user_secret:, account_id:, state: SENTINEL, days: SENTINEL, extra: {})
|
|
780
895
|
extra[:state] = state if state != SENTINEL
|
|
@@ -797,7 +912,7 @@ module SnapTrade
|
|
|
797
912
|
# @param user_secret [String]
|
|
798
913
|
# @param account_id [String]
|
|
799
914
|
# @param state [String] defaults value is set to \"all\"
|
|
800
|
-
# @param 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.
|
|
915
|
+
# @param 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. Values greater than 90 will be capped at 90.
|
|
801
916
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
802
917
|
def get_user_account_orders_with_http_info(user_id:, user_secret:, account_id:, state: SENTINEL, days: SENTINEL, extra: {})
|
|
803
918
|
extra[:state] = state if state != SENTINEL
|
|
@@ -812,7 +927,7 @@ module SnapTrade
|
|
|
812
927
|
# @param account_id [String]
|
|
813
928
|
# @param [Hash] opts the optional parameters
|
|
814
929
|
# @option opts [String] :state defaults value is set to \"all\"
|
|
815
|
-
# @option opts [Integer] :days Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in.
|
|
930
|
+
# @option opts [Integer] :days Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in. Values greater than 90 will be capped at 90.
|
|
816
931
|
# @return [Array<AccountOrderRecord>]
|
|
817
932
|
private def get_user_account_orders_impl(user_id, user_secret, account_id, opts = {})
|
|
818
933
|
data, _status_code, _headers = get_user_account_orders_with_http_info(user_id, user_secret, account_id, opts)
|
|
@@ -826,7 +941,7 @@ module SnapTrade
|
|
|
826
941
|
# @param account_id [String]
|
|
827
942
|
# @param [Hash] opts the optional parameters
|
|
828
943
|
# @option opts [String] :state defaults value is set to \"all\"
|
|
829
|
-
# @option opts [Integer] :days Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in.
|
|
944
|
+
# @option opts [Integer] :days Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in. Values greater than 90 will be capped at 90.
|
|
830
945
|
# @return [Array<(Array<AccountOrderRecord>, Integer, Hash)>] Array<AccountOrderRecord> data, response status code and response headers
|
|
831
946
|
private def get_user_account_orders_with_http_info_impl(user_id, user_secret, account_id, opts = {})
|
|
832
947
|
if @api_client.config.debugging
|
|
@@ -848,6 +963,10 @@ module SnapTrade
|
|
|
848
963
|
if @api_client.config.client_side_validation && opts[:'state'] && !allowable_values.include?(opts[:'state'])
|
|
849
964
|
fail ArgumentError, "invalid value for \"state\", must be one of #{allowable_values}"
|
|
850
965
|
end
|
|
966
|
+
if @api_client.config.client_side_validation && !opts[:'days'].nil? && opts[:'days'] > 90
|
|
967
|
+
fail ArgumentError, 'invalid value for "opts[:"days"]" when calling AccountInformationApi.get_user_account_orders, must be smaller than or equal to 90.'
|
|
968
|
+
end
|
|
969
|
+
|
|
851
970
|
if @api_client.config.client_side_validation && !opts[:'days'].nil? && opts[:'days'] < 1
|
|
852
971
|
fail ArgumentError, 'invalid value for "opts[:"days"]" when calling AccountInformationApi.get_user_account_orders, must be greater than or equal to 1.'
|
|
853
972
|
end
|
|
@@ -901,6 +1020,8 @@ module SnapTrade
|
|
|
901
1020
|
#
|
|
902
1021
|
# 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).
|
|
903
1022
|
#
|
|
1023
|
+
# Consider using the newer [unified positions endpoint](/reference/Account%20Information/AccountInformation_getAllAccountPositions). This will allow you to get both equity and option positions in a single call, as well as additional asset classes such as futures.
|
|
1024
|
+
#
|
|
904
1025
|
# 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:
|
|
905
1026
|
# - If you do, this endpoint returns real-time data.
|
|
906
1027
|
# - If you don't, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://support.snaptrade.com/brokerages-table?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for "Cache Expiry Time" to see the exact value for a specific brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint.
|
|
@@ -920,6 +1041,8 @@ module SnapTrade
|
|
|
920
1041
|
#
|
|
921
1042
|
# 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).
|
|
922
1043
|
#
|
|
1044
|
+
# Consider using the newer [unified positions endpoint](/reference/Account%20Information/AccountInformation_getAllAccountPositions). This will allow you to get both equity and option positions in a single call, as well as additional asset classes such as futures.
|
|
1045
|
+
#
|
|
923
1046
|
# 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:
|
|
924
1047
|
# - If you do, this endpoint returns real-time data.
|
|
925
1048
|
# - If you don't, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://support.snaptrade.com/brokerages-table?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for "Cache Expiry Time" to see the exact value for a specific brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint.
|
|
@@ -935,7 +1058,7 @@ module SnapTrade
|
|
|
935
1058
|
end
|
|
936
1059
|
|
|
937
1060
|
# List account positions
|
|
938
|
-
# 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, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://support.snaptrade.com/brokerages-table?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for \"Cache Expiry Time\" to see the exact value for a specific 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.
|
|
1061
|
+
# 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). Consider using the newer [unified positions endpoint](/reference/Account%20Information/AccountInformation_getAllAccountPositions). This will allow you to get both equity and option positions in a single call, as well as additional asset classes such as futures. 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, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://support.snaptrade.com/brokerages-table?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for \"Cache Expiry Time\" to see the exact value for a specific 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.
|
|
939
1062
|
# @param user_id [String]
|
|
940
1063
|
# @param user_secret [String]
|
|
941
1064
|
# @param account_id [String]
|
|
@@ -947,7 +1070,7 @@ module SnapTrade
|
|
|
947
1070
|
end
|
|
948
1071
|
|
|
949
1072
|
# List account positions
|
|
950
|
-
# 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, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://support.snaptrade.com/brokerages-table?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for \"Cache Expiry Time\" to see the exact value for a specific 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.
|
|
1073
|
+
# 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). Consider using the newer [unified positions endpoint](/reference/Account%20Information/AccountInformation_getAllAccountPositions). This will allow you to get both equity and option positions in a single call, as well as additional asset classes such as futures. 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, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://support.snaptrade.com/brokerages-table?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for \"Cache Expiry Time\" to see the exact value for a specific 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.
|
|
951
1074
|
# @param user_id [String]
|
|
952
1075
|
# @param user_secret [String]
|
|
953
1076
|
# @param account_id [String]
|
|
@@ -336,7 +336,7 @@ module SnapTrade
|
|
|
336
336
|
#
|
|
337
337
|
# Returns all brokerage accounts that belong to the specified connection for the authenticated user.
|
|
338
338
|
#
|
|
339
|
-
# On real-time plans, this endpoint refreshes each account's opening date, funding date, and total value live from the brokerage on each call.
|
|
339
|
+
# On real-time plans, this endpoint refreshes each account's opening date, funding date, and total value live from the brokerage on each call.
|
|
340
340
|
#
|
|
341
341
|
# On delayed plans, this endpoint returns cached data that is refreshed once a day. To force a refresh, use the [manual refresh endpoint](/reference/Connections/Connections_refreshBrokerageAuthorization).
|
|
342
342
|
#
|
|
@@ -355,7 +355,7 @@ module SnapTrade
|
|
|
355
355
|
#
|
|
356
356
|
# Returns all brokerage accounts that belong to the specified connection for the authenticated user.
|
|
357
357
|
#
|
|
358
|
-
# On real-time plans, this endpoint refreshes each account's opening date, funding date, and total value live from the brokerage on each call.
|
|
358
|
+
# On real-time plans, this endpoint refreshes each account's opening date, funding date, and total value live from the brokerage on each call.
|
|
359
359
|
#
|
|
360
360
|
# On delayed plans, this endpoint returns cached data that is refreshed once a day. To force a refresh, use the [manual refresh endpoint](/reference/Connections/Connections_refreshBrokerageAuthorization).
|
|
361
361
|
#
|
|
@@ -370,7 +370,7 @@ module SnapTrade
|
|
|
370
370
|
end
|
|
371
371
|
|
|
372
372
|
# List accounts for a connection
|
|
373
|
-
# Returns all brokerage accounts that belong to the specified connection for the authenticated user. On real-time plans, this endpoint refreshes each account's opening date, funding date, and total value live from the brokerage on each call.
|
|
373
|
+
# Returns all brokerage accounts that belong to the specified connection for the authenticated user. On real-time plans, this endpoint refreshes each account's opening date, funding date, and total value live from the brokerage on each call. On delayed plans, this endpoint returns cached data that is refreshed once a day. 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.
|
|
374
374
|
# @param authorization_id [String]
|
|
375
375
|
# @param user_id [String]
|
|
376
376
|
# @param user_secret [String]
|
|
@@ -382,7 +382,7 @@ module SnapTrade
|
|
|
382
382
|
end
|
|
383
383
|
|
|
384
384
|
# List accounts for a connection
|
|
385
|
-
# Returns all brokerage accounts that belong to the specified connection for the authenticated user. On real-time plans, this endpoint refreshes each account's opening date, funding date, and total value live from the brokerage on each call.
|
|
385
|
+
# Returns all brokerage accounts that belong to the specified connection for the authenticated user. On real-time plans, this endpoint refreshes each account's opening date, funding date, and total value live from the brokerage on each call. On delayed plans, this endpoint returns cached data that is refreshed once a day. 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.
|
|
386
386
|
# @param authorization_id [String]
|
|
387
387
|
# @param user_id [String]
|
|
388
388
|
# @param user_secret [String]
|
|
@@ -17,121 +17,6 @@ module SnapTrade
|
|
|
17
17
|
@api_client = api_client
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
# List all account positions
|
|
21
|
-
#
|
|
22
|
-
# Returns a list of all positions in the specified account.
|
|
23
|
-
#
|
|
24
|
-
# The `results` list can contain multiple instrument types in the same response, including stocks, ADRs, ETFs, mutual funds, closed-end funds, crypto, futures, and option positions. Use the `instrument.kind` discriminator to determine the schema for each position's `instrument`.
|
|
25
|
-
#
|
|
26
|
-
# Stock positions may also include `cash_equivalent`, and may include `tax_lots` when tax lot data is enabled for the account.
|
|
27
|
-
#
|
|
28
|
-
# 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.
|
|
29
|
-
#
|
|
30
|
-
# @param user_id [String]
|
|
31
|
-
# @param user_secret [String]
|
|
32
|
-
# @param account_id [String]
|
|
33
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
34
|
-
def get_all_account_positions(user_id:, user_secret:, account_id:, extra: {})
|
|
35
|
-
data, _status_code, _headers = get_all_account_positions_with_http_info_impl(user_id, user_secret, account_id, extra)
|
|
36
|
-
data
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
# List all account positions
|
|
40
|
-
#
|
|
41
|
-
# Returns a list of all positions in the specified account.
|
|
42
|
-
#
|
|
43
|
-
# The `results` list can contain multiple instrument types in the same response, including stocks, ADRs, ETFs, mutual funds, closed-end funds, crypto, futures, and option positions. Use the `instrument.kind` discriminator to determine the schema for each position's `instrument`.
|
|
44
|
-
#
|
|
45
|
-
# Stock positions may also include `cash_equivalent`, and may include `tax_lots` when tax lot data is enabled for the account.
|
|
46
|
-
#
|
|
47
|
-
# 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.
|
|
48
|
-
#
|
|
49
|
-
# @param user_id [String]
|
|
50
|
-
# @param user_secret [String]
|
|
51
|
-
# @param account_id [String]
|
|
52
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
53
|
-
def get_all_account_positions_with_http_info(user_id:, user_secret:, account_id:, extra: {})
|
|
54
|
-
get_all_account_positions_with_http_info_impl(user_id, user_secret, account_id, extra)
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
# List all account positions
|
|
58
|
-
# 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, and option positions. Use the `instrument.kind` discriminator to determine the schema for each position's `instrument`. Stock positions may also include `cash_equivalent`, and 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.
|
|
59
|
-
# @param user_id [String]
|
|
60
|
-
# @param user_secret [String]
|
|
61
|
-
# @param account_id [String]
|
|
62
|
-
# @param [Hash] opts the optional parameters
|
|
63
|
-
# @return [AllAccountPositionsResponse]
|
|
64
|
-
private def get_all_account_positions_impl(user_id, user_secret, account_id, opts = {})
|
|
65
|
-
data, _status_code, _headers = get_all_account_positions_with_http_info(user_id, user_secret, account_id, opts)
|
|
66
|
-
data
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
# List all account positions
|
|
70
|
-
# 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, and option positions. Use the `instrument.kind` discriminator to determine the schema for each position's `instrument`. Stock positions may also include `cash_equivalent`, and 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.
|
|
71
|
-
# @param user_id [String]
|
|
72
|
-
# @param user_secret [String]
|
|
73
|
-
# @param account_id [String]
|
|
74
|
-
# @param [Hash] opts the optional parameters
|
|
75
|
-
# @return [Array<(AllAccountPositionsResponse, Integer, Hash)>] AllAccountPositionsResponse data, response status code and response headers
|
|
76
|
-
private def get_all_account_positions_with_http_info_impl(user_id, user_secret, account_id, opts = {})
|
|
77
|
-
if @api_client.config.debugging
|
|
78
|
-
@api_client.config.logger.debug 'Calling API: ExperimentalEndpointsApi.get_all_account_positions ...'
|
|
79
|
-
end
|
|
80
|
-
# verify the required parameter 'user_id' is set
|
|
81
|
-
if @api_client.config.client_side_validation && user_id.nil?
|
|
82
|
-
fail ArgumentError, "Missing the required parameter 'user_id' when calling ExperimentalEndpointsApi.get_all_account_positions"
|
|
83
|
-
end
|
|
84
|
-
# verify the required parameter 'user_secret' is set
|
|
85
|
-
if @api_client.config.client_side_validation && user_secret.nil?
|
|
86
|
-
fail ArgumentError, "Missing the required parameter 'user_secret' when calling ExperimentalEndpointsApi.get_all_account_positions"
|
|
87
|
-
end
|
|
88
|
-
# verify the required parameter 'account_id' is set
|
|
89
|
-
if @api_client.config.client_side_validation && account_id.nil?
|
|
90
|
-
fail ArgumentError, "Missing the required parameter 'account_id' when calling ExperimentalEndpointsApi.get_all_account_positions"
|
|
91
|
-
end
|
|
92
|
-
# resource path
|
|
93
|
-
local_var_path = '/accounts/{accountId}/positions/all'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
|
|
94
|
-
|
|
95
|
-
# query parameters
|
|
96
|
-
query_params = opts[:query_params] || {}
|
|
97
|
-
query_params[:'userId'] = user_id
|
|
98
|
-
query_params[:'userSecret'] = user_secret
|
|
99
|
-
|
|
100
|
-
# header parameters
|
|
101
|
-
header_params = opts[:header_params] || {}
|
|
102
|
-
# HTTP header 'Accept' (if needed)
|
|
103
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
104
|
-
|
|
105
|
-
# form parameters
|
|
106
|
-
form_params = opts[:form_params] || {}
|
|
107
|
-
|
|
108
|
-
# http body (model)
|
|
109
|
-
post_body = opts[:debug_body]
|
|
110
|
-
|
|
111
|
-
# return_type
|
|
112
|
-
return_type = opts[:debug_return_type] || 'AllAccountPositionsResponse'
|
|
113
|
-
|
|
114
|
-
# auth_names
|
|
115
|
-
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
|
116
|
-
|
|
117
|
-
new_options = opts.merge(
|
|
118
|
-
:operation => :"ExperimentalEndpointsApi.get_all_account_positions",
|
|
119
|
-
:header_params => header_params,
|
|
120
|
-
:query_params => query_params,
|
|
121
|
-
:form_params => form_params,
|
|
122
|
-
:body => post_body,
|
|
123
|
-
:auth_names => auth_names,
|
|
124
|
-
:return_type => return_type
|
|
125
|
-
)
|
|
126
|
-
|
|
127
|
-
data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
|
|
128
|
-
if @api_client.config.debugging
|
|
129
|
-
@api_client.config.logger.debug "API called: ExperimentalEndpointsApi#get_all_account_positions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
130
|
-
end
|
|
131
|
-
return data, status_code, headers, response
|
|
132
|
-
end
|
|
133
|
-
|
|
134
|
-
|
|
135
20
|
# Get account order detail (V2)
|
|
136
21
|
#
|
|
137
22
|
# Returns the detail of a single order using the brokerage order ID provided as a path parameter.
|
|
@@ -269,7 +154,7 @@ module SnapTrade
|
|
|
269
154
|
# @param user_secret [String]
|
|
270
155
|
# @param account_id [String]
|
|
271
156
|
# @param state [String] defaults value is set to \"all\"
|
|
272
|
-
# @param 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.
|
|
157
|
+
# @param 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. Values greater than 90 will be capped at 90.
|
|
273
158
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
274
159
|
def get_user_account_orders_v2(user_id:, user_secret:, account_id:, state: SENTINEL, days: SENTINEL, extra: {})
|
|
275
160
|
extra[:state] = state if state != SENTINEL
|
|
@@ -290,7 +175,7 @@ module SnapTrade
|
|
|
290
175
|
# @param user_secret [String]
|
|
291
176
|
# @param account_id [String]
|
|
292
177
|
# @param state [String] defaults value is set to \"all\"
|
|
293
|
-
# @param 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.
|
|
178
|
+
# @param 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. Values greater than 90 will be capped at 90.
|
|
294
179
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
295
180
|
def get_user_account_orders_v2_with_http_info(user_id:, user_secret:, account_id:, state: SENTINEL, days: SENTINEL, extra: {})
|
|
296
181
|
extra[:state] = state if state != SENTINEL
|
|
@@ -305,7 +190,7 @@ module SnapTrade
|
|
|
305
190
|
# @param account_id [String]
|
|
306
191
|
# @param [Hash] opts the optional parameters
|
|
307
192
|
# @option opts [String] :state defaults value is set to \"all\"
|
|
308
|
-
# @option opts [Integer] :days Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in.
|
|
193
|
+
# @option opts [Integer] :days Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in. Values greater than 90 will be capped at 90.
|
|
309
194
|
# @return [AccountOrdersV2Response]
|
|
310
195
|
private def get_user_account_orders_v2_impl(user_id, user_secret, account_id, opts = {})
|
|
311
196
|
data, _status_code, _headers = get_user_account_orders_v2_with_http_info(user_id, user_secret, account_id, opts)
|
|
@@ -319,7 +204,7 @@ module SnapTrade
|
|
|
319
204
|
# @param account_id [String]
|
|
320
205
|
# @param [Hash] opts the optional parameters
|
|
321
206
|
# @option opts [String] :state defaults value is set to \"all\"
|
|
322
|
-
# @option opts [Integer] :days Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in.
|
|
207
|
+
# @option opts [Integer] :days Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in. Values greater than 90 will be capped at 90.
|
|
323
208
|
# @return [Array<(AccountOrdersV2Response, Integer, Hash)>] AccountOrdersV2Response data, response status code and response headers
|
|
324
209
|
private def get_user_account_orders_v2_with_http_info_impl(user_id, user_secret, account_id, opts = {})
|
|
325
210
|
if @api_client.config.debugging
|
|
@@ -341,6 +226,10 @@ module SnapTrade
|
|
|
341
226
|
if @api_client.config.client_side_validation && opts[:'state'] && !allowable_values.include?(opts[:'state'])
|
|
342
227
|
fail ArgumentError, "invalid value for \"state\", must be one of #{allowable_values}"
|
|
343
228
|
end
|
|
229
|
+
if @api_client.config.client_side_validation && !opts[:'days'].nil? && opts[:'days'] > 90
|
|
230
|
+
fail ArgumentError, 'invalid value for "opts[:"days"]" when calling ExperimentalEndpointsApi.get_user_account_orders_v2, must be smaller than or equal to 90.'
|
|
231
|
+
end
|
|
232
|
+
|
|
344
233
|
if @api_client.config.client_side_validation && !opts[:'days'].nil? && opts[:'days'] < 1
|
|
345
234
|
fail ArgumentError, 'invalid value for "opts[:"days"]" when calling ExperimentalEndpointsApi.get_user_account_orders_v2, must be greater than or equal to 1.'
|
|
346
235
|
end
|
|
@@ -21,6 +21,8 @@ module SnapTrade
|
|
|
21
21
|
#
|
|
22
22
|
# 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).
|
|
23
23
|
#
|
|
24
|
+
# Consider using the newer [unified positions endpoint](/reference/Account%20Information/AccountInformation_getAllAccountPositions). This will allow you to get both equity and option positions in a single call, as well as additional asset classes such as futures.
|
|
25
|
+
#
|
|
24
26
|
# 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:
|
|
25
27
|
# - If you do, this endpoint returns real-time data.
|
|
26
28
|
# - If you don't, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://support.snaptrade.com/brokerages-table?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for "Cache Expiry Time" to see the exact value for a specific brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint.
|
|
@@ -38,6 +40,8 @@ module SnapTrade
|
|
|
38
40
|
#
|
|
39
41
|
# 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).
|
|
40
42
|
#
|
|
43
|
+
# Consider using the newer [unified positions endpoint](/reference/Account%20Information/AccountInformation_getAllAccountPositions). This will allow you to get both equity and option positions in a single call, as well as additional asset classes such as futures.
|
|
44
|
+
#
|
|
41
45
|
# 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:
|
|
42
46
|
# - If you do, this endpoint returns real-time data.
|
|
43
47
|
# - If you don't, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://support.snaptrade.com/brokerages-table?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for "Cache Expiry Time" to see the exact value for a specific brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint.
|
|
@@ -51,7 +55,7 @@ module SnapTrade
|
|
|
51
55
|
end
|
|
52
56
|
|
|
53
57
|
# List account option positions
|
|
54
|
-
# 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). 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, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://support.snaptrade.com/brokerages-table?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for \"Cache Expiry Time\" to see the exact value for a specific brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint.
|
|
58
|
+
# 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). Consider using the newer [unified positions endpoint](/reference/Account%20Information/AccountInformation_getAllAccountPositions). This will allow you to get both equity and option positions in a single call, as well as additional asset classes such as futures. 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, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://support.snaptrade.com/brokerages-table?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for \"Cache Expiry Time\" to see the exact value for a specific brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint.
|
|
55
59
|
# @param user_id [String]
|
|
56
60
|
# @param user_secret [String]
|
|
57
61
|
# @param account_id [String]
|
|
@@ -63,7 +67,7 @@ module SnapTrade
|
|
|
63
67
|
end
|
|
64
68
|
|
|
65
69
|
# List account option positions
|
|
66
|
-
# 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). 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, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://support.snaptrade.com/brokerages-table?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for \"Cache Expiry Time\" to see the exact value for a specific brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint.
|
|
70
|
+
# 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). Consider using the newer [unified positions endpoint](/reference/Account%20Information/AccountInformation_getAllAccountPositions). This will allow you to get both equity and option positions in a single call, as well as additional asset classes such as futures. 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, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://support.snaptrade.com/brokerages-table?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for \"Cache Expiry Time\" to see the exact value for a specific brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint.
|
|
67
71
|
# @param user_id [String]
|
|
68
72
|
# @param user_secret [String]
|
|
69
73
|
# @param account_id [String]
|
data/lib/snaptrade/version.rb
CHANGED
|
@@ -60,6 +60,20 @@ describe 'AccountInformationApi' do
|
|
|
60
60
|
end
|
|
61
61
|
end
|
|
62
62
|
|
|
63
|
+
# unit tests for get_all_account_positions
|
|
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, and option positions. Use the `instrument.kind` discriminator to determine the schema for each position's `instrument`. Stock positions may also include `cash_equivalent`, and 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.
|
|
66
|
+
# @param user_id
|
|
67
|
+
# @param user_secret
|
|
68
|
+
# @param account_id
|
|
69
|
+
# @param [Hash] opts the optional parameters
|
|
70
|
+
# @return [AllAccountPositionsResponse]
|
|
71
|
+
describe 'get_all_account_positions test' do
|
|
72
|
+
it 'should work' do
|
|
73
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
63
77
|
# unit tests for get_all_user_holdings
|
|
64
78
|
# List all accounts for the user, plus balances, positions, and orders for each account.
|
|
65
79
|
# **Deprecated, please use the account-specific holdings endpoint instead.** List all accounts for the user, plus balances, positions, and orders for each account. **Note:** This endpoint will return HTTP 410 Gone for all customers that sign up after April 25, 2026.
|
|
@@ -125,7 +139,7 @@ describe 'AccountInformationApi' do
|
|
|
125
139
|
# @param account_id
|
|
126
140
|
# @param [Hash] opts the optional parameters
|
|
127
141
|
# @option opts [String] :state defaults value is set to \"all\"
|
|
128
|
-
# @option opts [Integer] :days Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in.
|
|
142
|
+
# @option opts [Integer] :days Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in. Values greater than 90 will be capped at 90.
|
|
129
143
|
# @return [Array<AccountOrderRecord>]
|
|
130
144
|
describe 'get_user_account_orders test' do
|
|
131
145
|
it 'should work' do
|
|
@@ -135,7 +149,7 @@ describe 'AccountInformationApi' do
|
|
|
135
149
|
|
|
136
150
|
# unit tests for get_user_account_positions
|
|
137
151
|
# List account positions
|
|
138
|
-
# 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, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://support.snaptrade.com/brokerages-table?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for \"Cache Expiry Time\" to see the exact value for a specific 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.
|
|
152
|
+
# 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). Consider using the newer [unified positions endpoint](/reference/Account%20Information/AccountInformation_getAllAccountPositions). This will allow you to get both equity and option positions in a single call, as well as additional asset classes such as futures. 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, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://support.snaptrade.com/brokerages-table?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for \"Cache Expiry Time\" to see the exact value for a specific 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.
|
|
139
153
|
# @param user_id
|
|
140
154
|
# @param user_secret
|
|
141
155
|
# @param account_id
|
|
@@ -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 real-time plans, this endpoint refreshes each account's opening date, funding date, and total value live from the brokerage on each call.
|
|
74
|
+
# Returns all brokerage accounts that belong to the specified connection for the authenticated user. On real-time plans, this endpoint refreshes each account's opening date, funding date, and total value live from the brokerage on each call. On delayed plans, this endpoint returns cached data that is refreshed once a day. 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
|
|
@@ -27,20 +27,6 @@ describe 'ExperimentalEndpointsApi' do
|
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
-
# unit tests for get_all_account_positions
|
|
31
|
-
# List all account positions
|
|
32
|
-
# 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, and option positions. Use the `instrument.kind` discriminator to determine the schema for each position's `instrument`. Stock positions may also include `cash_equivalent`, and 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.
|
|
33
|
-
# @param user_id
|
|
34
|
-
# @param user_secret
|
|
35
|
-
# @param account_id
|
|
36
|
-
# @param [Hash] opts the optional parameters
|
|
37
|
-
# @return [AllAccountPositionsResponse]
|
|
38
|
-
describe 'get_all_account_positions test' do
|
|
39
|
-
it 'should work' do
|
|
40
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
|
|
44
30
|
# unit tests for get_user_account_order_detail_v2
|
|
45
31
|
# Get account order detail (V2)
|
|
46
32
|
# Returns the detail of a single order using the brokerage order ID provided as a path parameter. The V2 order response format includes all legs of the order in the `legs` list field. If the order is single legged, `legs` will be a list of one leg. This endpoint is always realtime and does not rely on cached data. This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint.
|
|
@@ -64,7 +50,7 @@ describe 'ExperimentalEndpointsApi' do
|
|
|
64
50
|
# @param account_id
|
|
65
51
|
# @param [Hash] opts the optional parameters
|
|
66
52
|
# @option opts [String] :state defaults value is set to \"all\"
|
|
67
|
-
# @option opts [Integer] :days Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in.
|
|
53
|
+
# @option opts [Integer] :days Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in. Values greater than 90 will be capped at 90.
|
|
68
54
|
# @return [AccountOrdersV2Response]
|
|
69
55
|
describe 'get_user_account_orders_v2 test' do
|
|
70
56
|
it 'should work' do
|
|
@@ -29,7 +29,7 @@ describe 'OptionsApi' do
|
|
|
29
29
|
|
|
30
30
|
# unit tests for list_option_holdings
|
|
31
31
|
# List account option positions
|
|
32
|
-
# 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). 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, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://support.snaptrade.com/brokerages-table?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for \"Cache Expiry Time\" to see the exact value for a specific brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint.
|
|
32
|
+
# 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). Consider using the newer [unified positions endpoint](/reference/Account%20Information/AccountInformation_getAllAccountPositions). This will allow you to get both equity and option positions in a single call, as well as additional asset classes such as futures. 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, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://support.snaptrade.com/brokerages-table?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for \"Cache Expiry Time\" to see the exact value for a specific brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint.
|
|
33
33
|
# @param user_id
|
|
34
34
|
# @param user_secret
|
|
35
35
|
# @param account_id
|