snaptrade 3.0.54 → 3.0.56
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 +96 -2
- data/lib/snaptrade/api/experimental_endpoints_api.rb +255 -0
- data/lib/snaptrade/models/account_order.rb +3 -7
- data/lib/snaptrade/models/account_order_price_effect.rb +39 -0
- data/lib/snaptrade/models/account_order_record_v2.rb +1 -35
- data/lib/snaptrade/models/all_account_orders_response.rb +1 -1
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +1 -0
- data/spec/api/experimental_endpoints_api_spec.rb +30 -0
- data/spec/models/account_order_price_effect_spec.rb +23 -0
- data/spec/models/account_order_record_v2_spec.rb +0 -4
- metadata +291 -288
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1fe8acb27186487220407e4d73d4e119236c7cf502e97c3fa42dd590cf09ee5f
|
|
4
|
+
data.tar.gz: 02c0f22dc76901552d548f0532cee29496e3dba215e45cf576c9e7de6bd35940
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bcd7068be92cd738f56900db43d9859d64854edeba715c777b6eac87223a9da3e43d3352e77c02f412185d8ad2ec66e10189c647701e1b557b6bb527121bd543
|
|
7
|
+
data.tar.gz: 2e6766f782edb063c01c776b3f7489623485f2b226854ae58957a9b66a0dcaba4a136e8b9ca2ac752a21a4a66eb5102154b948252d50b1d1e47653cee5250884
|
data/README.md
CHANGED
|
@@ -63,7 +63,7 @@ backoff with jitter rather than from the headers.
|
|
|
63
63
|
See https://docs.snaptrade.com/docs/ratelimiting.
|
|
64
64
|
|
|
65
65
|
|
|
66
|
-
[](https://rubygems.org/gems/snaptrade/versions/3.0.56)
|
|
67
67
|
[](https://snaptrade.com/)
|
|
68
68
|
|
|
69
69
|
</div>
|
|
@@ -108,7 +108,9 @@ See https://docs.snaptrade.com/docs/ratelimiting.
|
|
|
108
108
|
* [`snaptrade.connections.sync_brokerage_authorization_transactions`](#snaptradeconnectionssync_brokerage_authorization_transactions)
|
|
109
109
|
* [`snaptrade.experimental_endpoints.add_subscription`](#snaptradeexperimental_endpointsadd_subscription)
|
|
110
110
|
* [`snaptrade.experimental_endpoints.cancel_subscription`](#snaptradeexperimental_endpointscancel_subscription)
|
|
111
|
+
* [`snaptrade.experimental_endpoints.get_account_order`](#snaptradeexperimental_endpointsget_account_order)
|
|
111
112
|
* [`snaptrade.experimental_endpoints.get_all_account_orders`](#snaptradeexperimental_endpointsget_all_account_orders)
|
|
113
|
+
* [`snaptrade.experimental_endpoints.get_all_account_recent_orders`](#snaptradeexperimental_endpointsget_all_account_recent_orders)
|
|
112
114
|
* [`snaptrade.experimental_endpoints.get_user_account_order_detail_v2`](#snaptradeexperimental_endpointsget_user_account_order_detail_v2)
|
|
113
115
|
* [`snaptrade.experimental_endpoints.get_user_account_orders_v2`](#snaptradeexperimental_endpointsget_user_account_orders_v2)
|
|
114
116
|
* [`snaptrade.experimental_endpoints.get_user_account_recent_orders_v2`](#snaptradeexperimental_endpointsget_user_account_recent_orders_v2)
|
|
@@ -147,7 +149,7 @@ See https://docs.snaptrade.com/docs/ratelimiting.
|
|
|
147
149
|
Add to Gemfile:
|
|
148
150
|
|
|
149
151
|
```ruby
|
|
150
|
-
gem 'snaptrade', '~> 3.0.
|
|
152
|
+
gem 'snaptrade', '~> 3.0.56'
|
|
151
153
|
```
|
|
152
154
|
|
|
153
155
|
## Getting Started<a id="getting-started"></a>
|
|
@@ -1508,6 +1510,50 @@ reference the account in SnapTrade.
|
|
|
1508
1510
|
---
|
|
1509
1511
|
|
|
1510
1512
|
|
|
1513
|
+
### `snaptrade.experimental_endpoints.get_account_order`<a id="snaptradeexperimental_endpointsget_account_order"></a>
|
|
1514
|
+
|
|
1515
|
+
Returns the detail of a single order, identified by the brokerage order ID in the path, in the same `kind`-discriminated format as `/accounts/{accountId}/orders/all`.
|
|
1516
|
+
|
|
1517
|
+
The order carries a `legs` list with at least one leg; switch on `legs[].instrument.kind` and `order_type.kind` to know which fields are present. Multi-leg orders are a single order with multiple legs.
|
|
1518
|
+
|
|
1519
|
+
This endpoint is always realtime and does not rely on cached data, except that an order in a terminal state (executed, canceled, rejected, failed, expired, replaced) may be served from a short-lived cache since it can no longer change.
|
|
1520
|
+
|
|
1521
|
+
This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint.
|
|
1522
|
+
|
|
1523
|
+
**Experimental:** this endpoint may change without notice.
|
|
1524
|
+
|
|
1525
|
+
|
|
1526
|
+
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
|
1527
|
+
|
|
1528
|
+
```ruby
|
|
1529
|
+
result = snaptrade.experimental_endpoints.get_account_order(
|
|
1530
|
+
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
1531
|
+
brokerage_order_id: "66a033fa-da74-4fcf-b527-feefdec9257e",
|
|
1532
|
+
user_id: "snaptrade-user-123",
|
|
1533
|
+
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
1534
|
+
)
|
|
1535
|
+
p result
|
|
1536
|
+
```
|
|
1537
|
+
|
|
1538
|
+
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
1539
|
+
|
|
1540
|
+
##### account_id: `String`<a id="account_id-string"></a>
|
|
1541
|
+
##### brokerage_order_id: `String`<a id="brokerage_order_id-string"></a>
|
|
1542
|
+
##### user_id: `String`<a id="user_id-string"></a>
|
|
1543
|
+
##### user_secret: `String`<a id="user_secret-string"></a>
|
|
1544
|
+
#### 🔄 Return<a id="🔄-return"></a>
|
|
1545
|
+
|
|
1546
|
+
[AccountOrder](./lib/snaptrade/models/account_order.rb)
|
|
1547
|
+
|
|
1548
|
+
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
|
1549
|
+
|
|
1550
|
+
`/accounts/{accountId}/orders/{brokerageOrderId}` `GET`
|
|
1551
|
+
|
|
1552
|
+
[🔙 **Back to Table of Contents**](#table-of-contents)
|
|
1553
|
+
|
|
1554
|
+
---
|
|
1555
|
+
|
|
1556
|
+
|
|
1511
1557
|
### `snaptrade.experimental_endpoints.get_all_account_orders`<a id="snaptradeexperimental_endpointsget_all_account_orders"></a>
|
|
1512
1558
|
|
|
1513
1559
|
Returns a list of recent orders in the specified account, in the same `kind`-discriminated format as `/accounts/{accountId}/positions/all`.
|
|
@@ -1559,6 +1605,54 @@ Number of days in the past to fetch the most recent orders. Defaults to the last
|
|
|
1559
1605
|
---
|
|
1560
1606
|
|
|
1561
1607
|
|
|
1608
|
+
### `snaptrade.experimental_endpoints.get_all_account_recent_orders`<a id="snaptradeexperimental_endpointsget_all_account_recent_orders"></a>
|
|
1609
|
+
|
|
1610
|
+
A lightweight endpoint that returns the latest page of orders placed in the last 24 hours in the specified account, in the same `kind`-discriminated format as `/accounts/{accountId}/orders/all`. For most brokerages, the default page size is 100 meaning the endpoint will return a max of 100 orders.
|
|
1611
|
+
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.
|
|
1612
|
+
Differs from `/accounts/{accountId}/orders/all` in that it is always realtime, and only checks the last 24 hours as opposed to the last 30 days.
|
|
1613
|
+
By default only returns executed orders, but that can be changed by setting *only_executed* to false.
|
|
1614
|
+
|
|
1615
|
+
Every order carries a `legs` list with at least one leg; switch on `legs[].instrument.kind` and `order_type.kind` to know which fields are present. `data_freshness.as_of` is the time of this live request.
|
|
1616
|
+
|
|
1617
|
+
**Experimental:** this endpoint may change without notice.
|
|
1618
|
+
|
|
1619
|
+
**Because of the cost of realtime requests, each call to this endpoint incurs an additional charge. You can find the exact cost for your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing)**
|
|
1620
|
+
|
|
1621
|
+
|
|
1622
|
+
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
|
1623
|
+
|
|
1624
|
+
```ruby
|
|
1625
|
+
result = snaptrade.experimental_endpoints.get_all_account_recent_orders(
|
|
1626
|
+
user_id: "snaptrade-user-123",
|
|
1627
|
+
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
1628
|
+
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
1629
|
+
only_executed: true,
|
|
1630
|
+
)
|
|
1631
|
+
p result
|
|
1632
|
+
```
|
|
1633
|
+
|
|
1634
|
+
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
1635
|
+
|
|
1636
|
+
##### user_id: `String`<a id="user_id-string"></a>
|
|
1637
|
+
##### user_secret: `String`<a id="user_secret-string"></a>
|
|
1638
|
+
##### account_id: `String`<a id="account_id-string"></a>
|
|
1639
|
+
##### only_executed: `Boolean`<a id="only_executed-boolean"></a>
|
|
1640
|
+
Defaults to true. Indicates if request should fetch only executed orders. Set to
|
|
1641
|
+
false to retrieve non executed orders as well
|
|
1642
|
+
|
|
1643
|
+
#### 🔄 Return<a id="🔄-return"></a>
|
|
1644
|
+
|
|
1645
|
+
[AllAccountOrdersResponse](./lib/snaptrade/models/all_account_orders_response.rb)
|
|
1646
|
+
|
|
1647
|
+
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
|
1648
|
+
|
|
1649
|
+
`/accounts/{accountId}/orders/recent` `GET`
|
|
1650
|
+
|
|
1651
|
+
[🔙 **Back to Table of Contents**](#table-of-contents)
|
|
1652
|
+
|
|
1653
|
+
---
|
|
1654
|
+
|
|
1655
|
+
|
|
1562
1656
|
### `snaptrade.experimental_endpoints.get_user_account_order_detail_v2`<a id="snaptradeexperimental_endpointsget_user_account_order_detail_v2"></a>
|
|
1563
1657
|
|
|
1564
1658
|
Returns the detail of a single order using the brokerage order ID provided as a path parameter.
|
|
@@ -239,6 +239,133 @@ module SnapTrade
|
|
|
239
239
|
end
|
|
240
240
|
|
|
241
241
|
|
|
242
|
+
# Get account order detail
|
|
243
|
+
#
|
|
244
|
+
# Returns the detail of a single order, identified by the brokerage order ID in the path, in the same `kind`-discriminated format as `/accounts/{accountId}/orders/all`.
|
|
245
|
+
#
|
|
246
|
+
# The order carries a `legs` list with at least one leg; switch on `legs[].instrument.kind` and `order_type.kind` to know which fields are present. Multi-leg orders are a single order with multiple legs.
|
|
247
|
+
#
|
|
248
|
+
# This endpoint is always realtime and does not rely on cached data, except that an order in a terminal state (executed, canceled, rejected, failed, expired, replaced) may be served from a short-lived cache since it can no longer change.
|
|
249
|
+
#
|
|
250
|
+
# This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint.
|
|
251
|
+
#
|
|
252
|
+
# **Experimental:** this endpoint may change without notice.
|
|
253
|
+
#
|
|
254
|
+
# @param account_id [String]
|
|
255
|
+
# @param brokerage_order_id [String]
|
|
256
|
+
# @param user_id [String]
|
|
257
|
+
# @param user_secret [String]
|
|
258
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
259
|
+
def get_account_order(account_id:, brokerage_order_id:, user_id:, user_secret:, extra: {})
|
|
260
|
+
data, _status_code, _headers = get_account_order_with_http_info_impl(account_id, brokerage_order_id, user_id, user_secret, extra)
|
|
261
|
+
data
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
# Get account order detail
|
|
265
|
+
#
|
|
266
|
+
# Returns the detail of a single order, identified by the brokerage order ID in the path, in the same `kind`-discriminated format as `/accounts/{accountId}/orders/all`.
|
|
267
|
+
#
|
|
268
|
+
# The order carries a `legs` list with at least one leg; switch on `legs[].instrument.kind` and `order_type.kind` to know which fields are present. Multi-leg orders are a single order with multiple legs.
|
|
269
|
+
#
|
|
270
|
+
# This endpoint is always realtime and does not rely on cached data, except that an order in a terminal state (executed, canceled, rejected, failed, expired, replaced) may be served from a short-lived cache since it can no longer change.
|
|
271
|
+
#
|
|
272
|
+
# This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint.
|
|
273
|
+
#
|
|
274
|
+
# **Experimental:** this endpoint may change without notice.
|
|
275
|
+
#
|
|
276
|
+
# @param account_id [String]
|
|
277
|
+
# @param brokerage_order_id [String]
|
|
278
|
+
# @param user_id [String]
|
|
279
|
+
# @param user_secret [String]
|
|
280
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
281
|
+
def get_account_order_with_http_info(account_id:, brokerage_order_id:, user_id:, user_secret:, extra: {})
|
|
282
|
+
get_account_order_with_http_info_impl(account_id, brokerage_order_id, user_id, user_secret, extra)
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
# Get account order detail
|
|
286
|
+
# Returns the detail of a single order, identified by the brokerage order ID in the path, in the same `kind`-discriminated format as `/accounts/{accountId}/orders/all`. The order carries a `legs` list with at least one leg; switch on `legs[].instrument.kind` and `order_type.kind` to know which fields are present. Multi-leg orders are a single order with multiple legs. This endpoint is always realtime and does not rely on cached data, except that an order in a terminal state (executed, canceled, rejected, failed, expired, replaced) may be served from a short-lived cache since it can no longer change. This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint. **Experimental:** this endpoint may change without notice.
|
|
287
|
+
# @param account_id [String]
|
|
288
|
+
# @param brokerage_order_id [String]
|
|
289
|
+
# @param user_id [String]
|
|
290
|
+
# @param user_secret [String]
|
|
291
|
+
# @param [Hash] opts the optional parameters
|
|
292
|
+
# @return [AccountOrder]
|
|
293
|
+
private def get_account_order_impl(account_id, brokerage_order_id, user_id, user_secret, opts = {})
|
|
294
|
+
data, _status_code, _headers = get_account_order_with_http_info(account_id, brokerage_order_id, user_id, user_secret, opts)
|
|
295
|
+
data
|
|
296
|
+
end
|
|
297
|
+
|
|
298
|
+
# Get account order detail
|
|
299
|
+
# Returns the detail of a single order, identified by the brokerage order ID in the path, in the same `kind`-discriminated format as `/accounts/{accountId}/orders/all`. The order carries a `legs` list with at least one leg; switch on `legs[].instrument.kind` and `order_type.kind` to know which fields are present. Multi-leg orders are a single order with multiple legs. This endpoint is always realtime and does not rely on cached data, except that an order in a terminal state (executed, canceled, rejected, failed, expired, replaced) may be served from a short-lived cache since it can no longer change. This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint. **Experimental:** this endpoint may change without notice.
|
|
300
|
+
# @param account_id [String]
|
|
301
|
+
# @param brokerage_order_id [String]
|
|
302
|
+
# @param user_id [String]
|
|
303
|
+
# @param user_secret [String]
|
|
304
|
+
# @param [Hash] opts the optional parameters
|
|
305
|
+
# @return [Array<(AccountOrder, Integer, Hash)>] AccountOrder data, response status code and response headers
|
|
306
|
+
private def get_account_order_with_http_info_impl(account_id, brokerage_order_id, user_id, user_secret, opts = {})
|
|
307
|
+
if @api_client.config.debugging
|
|
308
|
+
@api_client.config.logger.debug 'Calling API: ExperimentalEndpointsApi.get_account_order ...'
|
|
309
|
+
end
|
|
310
|
+
# verify the required parameter 'account_id' is set
|
|
311
|
+
if @api_client.config.client_side_validation && account_id.nil?
|
|
312
|
+
fail ArgumentError, "Missing the required parameter 'account_id' when calling ExperimentalEndpointsApi.get_account_order"
|
|
313
|
+
end
|
|
314
|
+
# verify the required parameter 'brokerage_order_id' is set
|
|
315
|
+
if @api_client.config.client_side_validation && brokerage_order_id.nil?
|
|
316
|
+
fail ArgumentError, "Missing the required parameter 'brokerage_order_id' when calling ExperimentalEndpointsApi.get_account_order"
|
|
317
|
+
end
|
|
318
|
+
# verify the required parameter 'user_id' is set
|
|
319
|
+
if @api_client.config.client_side_validation && user_id.nil?
|
|
320
|
+
fail ArgumentError, "Missing the required parameter 'user_id' when calling ExperimentalEndpointsApi.get_account_order"
|
|
321
|
+
end
|
|
322
|
+
# verify the required parameter 'user_secret' is set
|
|
323
|
+
if @api_client.config.client_side_validation && user_secret.nil?
|
|
324
|
+
fail ArgumentError, "Missing the required parameter 'user_secret' when calling ExperimentalEndpointsApi.get_account_order"
|
|
325
|
+
end
|
|
326
|
+
# resource path
|
|
327
|
+
local_var_path = '/accounts/{accountId}/orders/{brokerageOrderId}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'brokerageOrderId' + '}', CGI.escape(brokerage_order_id.to_s))
|
|
328
|
+
|
|
329
|
+
# query parameters
|
|
330
|
+
query_params = opts[:query_params] || {}
|
|
331
|
+
query_params[:'userId'] = user_id
|
|
332
|
+
query_params[:'userSecret'] = user_secret
|
|
333
|
+
|
|
334
|
+
# header parameters
|
|
335
|
+
header_params = opts[:header_params] || {}
|
|
336
|
+
# HTTP header 'Accept' (if needed)
|
|
337
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
338
|
+
|
|
339
|
+
# form parameters
|
|
340
|
+
form_params = opts[:form_params] || {}
|
|
341
|
+
|
|
342
|
+
# http body (model)
|
|
343
|
+
post_body = opts[:debug_body]
|
|
344
|
+
|
|
345
|
+
# return_type
|
|
346
|
+
return_type = opts[:debug_return_type] || 'AccountOrder'
|
|
347
|
+
|
|
348
|
+
# auth_names
|
|
349
|
+
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
|
350
|
+
|
|
351
|
+
new_options = opts.merge(
|
|
352
|
+
:operation => :"ExperimentalEndpointsApi.get_account_order",
|
|
353
|
+
:header_params => header_params,
|
|
354
|
+
:query_params => query_params,
|
|
355
|
+
:form_params => form_params,
|
|
356
|
+
:body => post_body,
|
|
357
|
+
:auth_names => auth_names,
|
|
358
|
+
:return_type => return_type
|
|
359
|
+
)
|
|
360
|
+
|
|
361
|
+
data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
|
|
362
|
+
if @api_client.config.debugging
|
|
363
|
+
@api_client.config.logger.debug "API called: ExperimentalEndpointsApi#get_account_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
364
|
+
end
|
|
365
|
+
return data, status_code, headers, response
|
|
366
|
+
end
|
|
367
|
+
|
|
368
|
+
|
|
242
369
|
# List all account orders
|
|
243
370
|
#
|
|
244
371
|
# Returns a list of recent orders in the specified account, in the same `kind`-discriminated format as `/accounts/{accountId}/positions/all`.
|
|
@@ -384,6 +511,134 @@ module SnapTrade
|
|
|
384
511
|
end
|
|
385
512
|
|
|
386
513
|
|
|
514
|
+
# List all account recent orders (last 24 hours only)
|
|
515
|
+
#
|
|
516
|
+
# A lightweight endpoint that returns the latest page of orders placed in the last 24 hours in the specified account, in the same `kind`-discriminated format as `/accounts/{accountId}/orders/all`. For most brokerages, the default page size is 100 meaning the endpoint will return a max of 100 orders.
|
|
517
|
+
# 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.
|
|
518
|
+
# Differs from `/accounts/{accountId}/orders/all` in that it is always realtime, and only checks the last 24 hours as opposed to the last 30 days.
|
|
519
|
+
# By default only returns executed orders, but that can be changed by setting *only_executed* to false.
|
|
520
|
+
#
|
|
521
|
+
# Every order carries a `legs` list with at least one leg; switch on `legs[].instrument.kind` and `order_type.kind` to know which fields are present. `data_freshness.as_of` is the time of this live request.
|
|
522
|
+
#
|
|
523
|
+
# **Experimental:** this endpoint may change without notice.
|
|
524
|
+
#
|
|
525
|
+
# **Because of the cost of realtime requests, each call to this endpoint incurs an additional charge. You can find the exact cost for your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing)**
|
|
526
|
+
#
|
|
527
|
+
# @param user_id [String]
|
|
528
|
+
# @param user_secret [String]
|
|
529
|
+
# @param account_id [String]
|
|
530
|
+
# @param only_executed [Boolean] Defaults to true. Indicates if request should fetch only executed orders. Set to false to retrieve non executed orders as well
|
|
531
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
532
|
+
def get_all_account_recent_orders(user_id:, user_secret:, account_id:, only_executed: SENTINEL, extra: {})
|
|
533
|
+
extra[:only_executed] = only_executed if only_executed != SENTINEL
|
|
534
|
+
data, _status_code, _headers = get_all_account_recent_orders_with_http_info_impl(user_id, user_secret, account_id, extra)
|
|
535
|
+
data
|
|
536
|
+
end
|
|
537
|
+
|
|
538
|
+
# List all account recent orders (last 24 hours only)
|
|
539
|
+
#
|
|
540
|
+
# A lightweight endpoint that returns the latest page of orders placed in the last 24 hours in the specified account, in the same `kind`-discriminated format as `/accounts/{accountId}/orders/all`. For most brokerages, the default page size is 100 meaning the endpoint will return a max of 100 orders.
|
|
541
|
+
# 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.
|
|
542
|
+
# Differs from `/accounts/{accountId}/orders/all` in that it is always realtime, and only checks the last 24 hours as opposed to the last 30 days.
|
|
543
|
+
# By default only returns executed orders, but that can be changed by setting *only_executed* to false.
|
|
544
|
+
#
|
|
545
|
+
# Every order carries a `legs` list with at least one leg; switch on `legs[].instrument.kind` and `order_type.kind` to know which fields are present. `data_freshness.as_of` is the time of this live request.
|
|
546
|
+
#
|
|
547
|
+
# **Experimental:** this endpoint may change without notice.
|
|
548
|
+
#
|
|
549
|
+
# **Because of the cost of realtime requests, each call to this endpoint incurs an additional charge. You can find the exact cost for your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing)**
|
|
550
|
+
#
|
|
551
|
+
# @param user_id [String]
|
|
552
|
+
# @param user_secret [String]
|
|
553
|
+
# @param account_id [String]
|
|
554
|
+
# @param only_executed [Boolean] Defaults to true. Indicates if request should fetch only executed orders. Set to false to retrieve non executed orders as well
|
|
555
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
556
|
+
def get_all_account_recent_orders_with_http_info(user_id:, user_secret:, account_id:, only_executed: SENTINEL, extra: {})
|
|
557
|
+
extra[:only_executed] = only_executed if only_executed != SENTINEL
|
|
558
|
+
get_all_account_recent_orders_with_http_info_impl(user_id, user_secret, account_id, extra)
|
|
559
|
+
end
|
|
560
|
+
|
|
561
|
+
# List all account recent orders (last 24 hours only)
|
|
562
|
+
# A lightweight endpoint that returns the latest page of orders placed in the last 24 hours in the specified account, in the same `kind`-discriminated format as `/accounts/{accountId}/orders/all`. 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 `/accounts/{accountId}/orders/all` in that it is always realtime, and only checks the last 24 hours as opposed to the last 30 days. By default only returns executed orders, but that can be changed by setting *only_executed* to false. Every order carries a `legs` list with at least one leg; switch on `legs[].instrument.kind` and `order_type.kind` to know which fields are present. `data_freshness.as_of` is the time of this live request. **Experimental:** this endpoint may change without notice. **Because of the cost of realtime requests, each call to this endpoint incurs an additional charge. You can find the exact cost for your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing)**
|
|
563
|
+
# @param user_id [String]
|
|
564
|
+
# @param user_secret [String]
|
|
565
|
+
# @param account_id [String]
|
|
566
|
+
# @param [Hash] opts the optional parameters
|
|
567
|
+
# @option opts [Boolean] :only_executed Defaults to true. Indicates if request should fetch only executed orders. Set to false to retrieve non executed orders as well
|
|
568
|
+
# @return [AllAccountOrdersResponse]
|
|
569
|
+
private def get_all_account_recent_orders_impl(user_id, user_secret, account_id, opts = {})
|
|
570
|
+
data, _status_code, _headers = get_all_account_recent_orders_with_http_info(user_id, user_secret, account_id, opts)
|
|
571
|
+
data
|
|
572
|
+
end
|
|
573
|
+
|
|
574
|
+
# List all account recent orders (last 24 hours only)
|
|
575
|
+
# A lightweight endpoint that returns the latest page of orders placed in the last 24 hours in the specified account, in the same `kind`-discriminated format as `/accounts/{accountId}/orders/all`. 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 `/accounts/{accountId}/orders/all` in that it is always realtime, and only checks the last 24 hours as opposed to the last 30 days. By default only returns executed orders, but that can be changed by setting *only_executed* to false. Every order carries a `legs` list with at least one leg; switch on `legs[].instrument.kind` and `order_type.kind` to know which fields are present. `data_freshness.as_of` is the time of this live request. **Experimental:** this endpoint may change without notice. **Because of the cost of realtime requests, each call to this endpoint incurs an additional charge. You can find the exact cost for your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing)**
|
|
576
|
+
# @param user_id [String]
|
|
577
|
+
# @param user_secret [String]
|
|
578
|
+
# @param account_id [String]
|
|
579
|
+
# @param [Hash] opts the optional parameters
|
|
580
|
+
# @option opts [Boolean] :only_executed Defaults to true. Indicates if request should fetch only executed orders. Set to false to retrieve non executed orders as well
|
|
581
|
+
# @return [Array<(AllAccountOrdersResponse, Integer, Hash)>] AllAccountOrdersResponse data, response status code and response headers
|
|
582
|
+
private def get_all_account_recent_orders_with_http_info_impl(user_id, user_secret, account_id, opts = {})
|
|
583
|
+
if @api_client.config.debugging
|
|
584
|
+
@api_client.config.logger.debug 'Calling API: ExperimentalEndpointsApi.get_all_account_recent_orders ...'
|
|
585
|
+
end
|
|
586
|
+
# verify the required parameter 'user_id' is set
|
|
587
|
+
if @api_client.config.client_side_validation && user_id.nil?
|
|
588
|
+
fail ArgumentError, "Missing the required parameter 'user_id' when calling ExperimentalEndpointsApi.get_all_account_recent_orders"
|
|
589
|
+
end
|
|
590
|
+
# verify the required parameter 'user_secret' is set
|
|
591
|
+
if @api_client.config.client_side_validation && user_secret.nil?
|
|
592
|
+
fail ArgumentError, "Missing the required parameter 'user_secret' when calling ExperimentalEndpointsApi.get_all_account_recent_orders"
|
|
593
|
+
end
|
|
594
|
+
# verify the required parameter 'account_id' is set
|
|
595
|
+
if @api_client.config.client_side_validation && account_id.nil?
|
|
596
|
+
fail ArgumentError, "Missing the required parameter 'account_id' when calling ExperimentalEndpointsApi.get_all_account_recent_orders"
|
|
597
|
+
end
|
|
598
|
+
# resource path
|
|
599
|
+
local_var_path = '/accounts/{accountId}/orders/recent'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
|
|
600
|
+
|
|
601
|
+
# query parameters
|
|
602
|
+
query_params = opts[:query_params] || {}
|
|
603
|
+
query_params[:'userId'] = user_id
|
|
604
|
+
query_params[:'userSecret'] = user_secret
|
|
605
|
+
query_params[:'only_executed'] = opts[:'only_executed'] if !opts[:'only_executed'].nil?
|
|
606
|
+
|
|
607
|
+
# header parameters
|
|
608
|
+
header_params = opts[:header_params] || {}
|
|
609
|
+
# HTTP header 'Accept' (if needed)
|
|
610
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
611
|
+
|
|
612
|
+
# form parameters
|
|
613
|
+
form_params = opts[:form_params] || {}
|
|
614
|
+
|
|
615
|
+
# http body (model)
|
|
616
|
+
post_body = opts[:debug_body]
|
|
617
|
+
|
|
618
|
+
# return_type
|
|
619
|
+
return_type = opts[:debug_return_type] || 'AllAccountOrdersResponse'
|
|
620
|
+
|
|
621
|
+
# auth_names
|
|
622
|
+
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
|
623
|
+
|
|
624
|
+
new_options = opts.merge(
|
|
625
|
+
:operation => :"ExperimentalEndpointsApi.get_all_account_recent_orders",
|
|
626
|
+
:header_params => header_params,
|
|
627
|
+
:query_params => query_params,
|
|
628
|
+
:form_params => form_params,
|
|
629
|
+
:body => post_body,
|
|
630
|
+
:auth_names => auth_names,
|
|
631
|
+
:return_type => return_type
|
|
632
|
+
)
|
|
633
|
+
|
|
634
|
+
data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
|
|
635
|
+
if @api_client.config.debugging
|
|
636
|
+
@api_client.config.logger.debug "API called: ExperimentalEndpointsApi#get_all_account_recent_orders\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
637
|
+
end
|
|
638
|
+
return data, status_code, headers, response
|
|
639
|
+
end
|
|
640
|
+
|
|
641
|
+
|
|
387
642
|
# Get account order detail (V2)
|
|
388
643
|
#
|
|
389
644
|
# Returns the detail of a single order using the brokerage order ID provided as a path parameter.
|
|
@@ -29,7 +29,7 @@ module SnapTrade
|
|
|
29
29
|
|
|
30
30
|
attr_accessor :priced_in
|
|
31
31
|
|
|
32
|
-
# Direction of the net order price. CREDIT means cash is received, DEBIT means cash is paid, EVEN means the net price is zero, and UNKNOWN means the direction could not be determined.
|
|
32
|
+
# Direction of the net order price. CREDIT means cash is received, DEBIT means cash is paid, EVEN means the net price is zero, and UNKNOWN means the direction could not be determined. Null when not applicable, for example for orders containing an outright futures leg (`instrument.kind` of `future`). A futures price is a contract quote, not an upfront cash flow. Futures options retain their price effect.
|
|
33
33
|
attr_accessor :price_effect
|
|
34
34
|
|
|
35
35
|
# Total quantity requested. For multi-leg orders this is the number of spreads, not the sum of leg quantities.
|
|
@@ -98,7 +98,7 @@ module SnapTrade
|
|
|
98
98
|
:'time_in_force' => :'AccountOrderTimeInForce',
|
|
99
99
|
:'expiry_date' => :'Time',
|
|
100
100
|
:'priced_in' => :'PricedInInstrument',
|
|
101
|
-
:'price_effect' => :'
|
|
101
|
+
:'price_effect' => :'AccountOrderPriceEffect',
|
|
102
102
|
:'total_quantity' => :'Float',
|
|
103
103
|
:'filled_quantity' => :'Float',
|
|
104
104
|
:'canceled_quantity' => :'Float',
|
|
@@ -117,6 +117,7 @@ module SnapTrade
|
|
|
117
117
|
Set.new([
|
|
118
118
|
:'expiry_date',
|
|
119
119
|
:'priced_in',
|
|
120
|
+
:'price_effect',
|
|
120
121
|
:'total_quantity',
|
|
121
122
|
:'filled_quantity',
|
|
122
123
|
:'canceled_quantity',
|
|
@@ -235,10 +236,6 @@ module SnapTrade
|
|
|
235
236
|
invalid_properties.push('invalid value for "time_in_force", time_in_force cannot be nil.')
|
|
236
237
|
end
|
|
237
238
|
|
|
238
|
-
if @price_effect.nil?
|
|
239
|
-
invalid_properties.push('invalid value for "price_effect", price_effect cannot be nil.')
|
|
240
|
-
end
|
|
241
|
-
|
|
242
239
|
if @legs.nil?
|
|
243
240
|
invalid_properties.push('invalid value for "legs", legs cannot be nil.')
|
|
244
241
|
end
|
|
@@ -257,7 +254,6 @@ module SnapTrade
|
|
|
257
254
|
return false if @status.nil?
|
|
258
255
|
return false if @order_type.nil?
|
|
259
256
|
return false if @time_in_force.nil?
|
|
260
|
-
return false if @price_effect.nil?
|
|
261
257
|
return false if @legs.nil?
|
|
262
258
|
return false if @legs.length < 1
|
|
263
259
|
true
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#SnapTrade
|
|
3
|
+
|
|
4
|
+
#Connect brokerage accounts to your app for live positions and trading. ## Rate limiting Two limits apply to requests signed with your `clientId`. The stricter one wins, and exceeding either returns `429 Too Many Requests`. - **Customer-level** — 250 requests/minute by default, scoped to your `clientId` and applied across all endpoints. Reported in `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. - **Account-level** — 10 requests/minute per account, scoped to (`clientId`, `accountId`). All covered operations for one account draw on the same bucket — reading balances and reading positions share it — and enforcement does not depend on the HTTP method, so updating an account consumes the same bucket as reading it. Only enforced for Personal users, and only for integrations it has been rolled out to — it is not yet in force for every Personal integration. It also does not apply on every operation that documents a 429 below. Where it applies it is reported in `X-RateLimit-Account-Limit`, `X-RateLimit-Account-Remaining` and `X-RateLimit-Account-Reset`. Do not read the absence of those headers as proof the limit is off — some configurations omit the rate limit headers while still enforcing the limit, so header absence tells you nothing about your allowance. On a 429, `X-RateLimit-Remaining: 0` means you hit the customer-level limit and `X-RateLimit-Account-Remaining: 0` means the account-level one. Wait for the corresponding `*-Reset` value (seconds) before retrying, or fall back to exponential backoff with jitter. Not every 429 is explained by those headers. A separate per-authenticated-user limit, reported in no `X-RateLimit-*` header, covers OAuth-authenticated requests and signed requests in configurations where the customer-level limit is not in effect — on the operations that use the default throttles. A few operations override those and are governed by the customer-level limit alone. The two do not stack: a signed request governed by the customer-level limit above is not additionally subject to the per-user one. If a 429 arrives with no header at zero — or with no `X-RateLimit-*` headers at all — honour `Retry-After` and back off. Treat the remaining counts as a hint, not a guarantee that the next request will succeed. Because the customer-level limit applies everywhere, any signed request can return 429. **OAuth-authenticated requests are an exception.** They are not subject to the customer-level limit and do not receive `X-RateLimit-Limit`, `X-RateLimit-Remaining` or `X-RateLimit-Reset` — do not wait on those headers or design around a customer-level allowance on this path. The account-level limit still applies to them on the account-data endpoints above, reported in the `X-RateLimit-Account-*` headers. On operations using the default throttles the per-user limit above applies to them as well, so an OAuth request can be rejected while the account headers still show capacity; on the few operations that override those throttles, OAuth callers have no per-user ceiling at all. Drive retries from `Retry-After` and exponential backoff with jitter rather than from the headers. See https://docs.snaptrade.com/docs/ratelimiting.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
Contact: api@snaptrade.com
|
|
8
|
+
=end
|
|
9
|
+
|
|
10
|
+
require 'date'
|
|
11
|
+
require 'time'
|
|
12
|
+
|
|
13
|
+
module SnapTrade
|
|
14
|
+
class AccountOrderPriceEffect
|
|
15
|
+
CREDIT = "CREDIT".freeze
|
|
16
|
+
DEBIT = "DEBIT".freeze
|
|
17
|
+
EVEN = "EVEN".freeze
|
|
18
|
+
UNKNOWN = "UNKNOWN".freeze
|
|
19
|
+
|
|
20
|
+
def self.all_vars
|
|
21
|
+
@all_vars ||= [CREDIT, DEBIT, EVEN, UNKNOWN].freeze
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Builds the enum from string
|
|
25
|
+
# @param [String] The enum value in the form of the string
|
|
26
|
+
# @return [String] The enum value
|
|
27
|
+
def self.build_from_hash(value)
|
|
28
|
+
new.build_from_hash(value)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Builds the enum from string
|
|
32
|
+
# @param [String] The enum value in the form of the string
|
|
33
|
+
# @return [String] The enum value
|
|
34
|
+
def build_from_hash(value)
|
|
35
|
+
return value if AccountOrderPriceEffect.all_vars.include?(value)
|
|
36
|
+
raise "Invalid ENUM value #{value} for class #AccountOrderPriceEffect"
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -57,28 +57,6 @@ module SnapTrade
|
|
|
57
57
|
# List of legs that make up the order.
|
|
58
58
|
attr_accessor :legs
|
|
59
59
|
|
|
60
|
-
class EnumAttributeValidator
|
|
61
|
-
attr_reader :datatype
|
|
62
|
-
attr_reader :allowable_values
|
|
63
|
-
|
|
64
|
-
def initialize(datatype, allowable_values)
|
|
65
|
-
@allowable_values = allowable_values.map do |value|
|
|
66
|
-
case datatype.to_s
|
|
67
|
-
when /Integer/i
|
|
68
|
-
value.to_i
|
|
69
|
-
when /Float/i
|
|
70
|
-
value.to_f
|
|
71
|
-
else
|
|
72
|
-
value
|
|
73
|
-
end
|
|
74
|
-
end
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
def valid?(value)
|
|
78
|
-
!value || allowable_values.include?(value)
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
|
|
82
60
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
83
61
|
def self.attribute_map
|
|
84
62
|
{
|
|
@@ -117,7 +95,7 @@ module SnapTrade
|
|
|
117
95
|
:'time_placed' => :'Time',
|
|
118
96
|
:'time_executed' => :'Time',
|
|
119
97
|
:'price_currency' => :'String',
|
|
120
|
-
:'price_effect' => :'
|
|
98
|
+
:'price_effect' => :'PriceEffect',
|
|
121
99
|
:'execution_price' => :'Float',
|
|
122
100
|
:'limit_price' => :'Float',
|
|
123
101
|
:'stop_price' => :'Float',
|
|
@@ -233,21 +211,9 @@ module SnapTrade
|
|
|
233
211
|
# @return true if the model is valid
|
|
234
212
|
def valid?
|
|
235
213
|
return false if @price_effect.nil?
|
|
236
|
-
price_effect_validator = EnumAttributeValidator.new('String', ["CREDIT", "DEBIT", "EVEN", "UNKNOWN"])
|
|
237
|
-
return false unless price_effect_validator.valid?(@price_effect)
|
|
238
214
|
true
|
|
239
215
|
end
|
|
240
216
|
|
|
241
|
-
# Custom attribute writer method checking allowed values (enum).
|
|
242
|
-
# @param [Object] price_effect Object to be assigned
|
|
243
|
-
def price_effect=(price_effect)
|
|
244
|
-
validator = EnumAttributeValidator.new('String', ["CREDIT", "DEBIT", "EVEN", "UNKNOWN"])
|
|
245
|
-
unless validator.valid?(price_effect)
|
|
246
|
-
fail ArgumentError, "invalid value for \"price_effect\", must be one of #{validator.allowable_values}."
|
|
247
|
-
end
|
|
248
|
-
@price_effect = price_effect
|
|
249
|
-
end
|
|
250
|
-
|
|
251
217
|
# Checks equality by comparing each attribute.
|
|
252
218
|
# @param [Object] Object to be compared
|
|
253
219
|
def ==(o)
|
|
@@ -11,7 +11,7 @@ require 'date'
|
|
|
11
11
|
require 'time'
|
|
12
12
|
|
|
13
13
|
module SnapTrade
|
|
14
|
-
#
|
|
14
|
+
# A list of account orders together with the freshness of the returned data.
|
|
15
15
|
class AllAccountOrdersResponse
|
|
16
16
|
# Orders returned for the request.
|
|
17
17
|
attr_accessor :results
|
data/lib/snaptrade/version.rb
CHANGED
data/lib/snaptrade.rb
CHANGED
|
@@ -33,6 +33,7 @@ require 'snaptrade/models/account_information_get_user_holdings409_response'
|
|
|
33
33
|
require 'snaptrade/models/account_order'
|
|
34
34
|
require 'snaptrade/models/account_order_group'
|
|
35
35
|
require 'snaptrade/models/account_order_leg'
|
|
36
|
+
require 'snaptrade/models/account_order_price_effect'
|
|
36
37
|
require 'snaptrade/models/account_order_record'
|
|
37
38
|
require 'snaptrade/models/account_order_record_child_brokerage_order_ids'
|
|
38
39
|
require 'snaptrade/models/account_order_record_leg'
|
|
@@ -53,6 +53,21 @@ describe 'ExperimentalEndpointsApi' do
|
|
|
53
53
|
end
|
|
54
54
|
end
|
|
55
55
|
|
|
56
|
+
# unit tests for get_account_order
|
|
57
|
+
# Get account order detail
|
|
58
|
+
# Returns the detail of a single order, identified by the brokerage order ID in the path, in the same `kind`-discriminated format as `/accounts/{accountId}/orders/all`. The order carries a `legs` list with at least one leg; switch on `legs[].instrument.kind` and `order_type.kind` to know which fields are present. Multi-leg orders are a single order with multiple legs. This endpoint is always realtime and does not rely on cached data, except that an order in a terminal state (executed, canceled, rejected, failed, expired, replaced) may be served from a short-lived cache since it can no longer change. This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint. **Experimental:** this endpoint may change without notice.
|
|
59
|
+
# @param account_id
|
|
60
|
+
# @param brokerage_order_id
|
|
61
|
+
# @param user_id
|
|
62
|
+
# @param user_secret
|
|
63
|
+
# @param [Hash] opts the optional parameters
|
|
64
|
+
# @return [AccountOrder]
|
|
65
|
+
describe 'get_account_order test' do
|
|
66
|
+
it 'should work' do
|
|
67
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
56
71
|
# unit tests for get_all_account_orders
|
|
57
72
|
# List all account orders
|
|
58
73
|
# Returns a list of recent orders in the specified account, in the same `kind`-discriminated format as `/accounts/{accountId}/positions/all`. Every order carries a `legs` list with at least one leg. Each leg's `instrument` uses the same `Instrument` union as positions; switch on `instrument.kind` to know which fields are present. Multi-leg orders (spreads, strangles, covered calls) are a single order with multiple legs. Orders that belong to a complex order group (OCO, OTO, OTOCO) share a `group.id`. `order_type` is an object discriminated by `kind`. Each kind declares the price fields it requires (`limit_price` on `limit`, `stop_price` on `stop`, both on `stop_limit`, `trail` on `trailing_stop`), so a consumer never has to null-check a price that cannot exist for that kind. When the brokerage reports an order type we cannot normalize, `kind` is `other` and the brokerage's own label is in `raw_type`. **Experimental:** this endpoint may change without notice. 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.
|
|
@@ -69,6 +84,21 @@ describe 'ExperimentalEndpointsApi' do
|
|
|
69
84
|
end
|
|
70
85
|
end
|
|
71
86
|
|
|
87
|
+
# unit tests for get_all_account_recent_orders
|
|
88
|
+
# List all account recent orders (last 24 hours only)
|
|
89
|
+
# A lightweight endpoint that returns the latest page of orders placed in the last 24 hours in the specified account, in the same `kind`-discriminated format as `/accounts/{accountId}/orders/all`. 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 `/accounts/{accountId}/orders/all` in that it is always realtime, and only checks the last 24 hours as opposed to the last 30 days. By default only returns executed orders, but that can be changed by setting *only_executed* to false. Every order carries a `legs` list with at least one leg; switch on `legs[].instrument.kind` and `order_type.kind` to know which fields are present. `data_freshness.as_of` is the time of this live request. **Experimental:** this endpoint may change without notice. **Because of the cost of realtime requests, each call to this endpoint incurs an additional charge. You can find the exact cost for your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing)**
|
|
90
|
+
# @param user_id
|
|
91
|
+
# @param user_secret
|
|
92
|
+
# @param account_id
|
|
93
|
+
# @param [Hash] opts the optional parameters
|
|
94
|
+
# @option opts [Boolean] :only_executed Defaults to true. Indicates if request should fetch only executed orders. Set to false to retrieve non executed orders as well
|
|
95
|
+
# @return [AllAccountOrdersResponse]
|
|
96
|
+
describe 'get_all_account_recent_orders test' do
|
|
97
|
+
it 'should work' do
|
|
98
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
|
|
72
102
|
# unit tests for get_user_account_order_detail_v2
|
|
73
103
|
# Get account order detail (V2)
|
|
74
104
|
# 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.
|