snaptrade 3.0.56 → 3.0.58
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 +153 -153
- data/lib/snaptrade/api/account_information_api.rb +416 -16
- data/lib/snaptrade/api/connections_api.rb +4 -4
- data/lib/snaptrade/api/experimental_endpoints_api.rb +0 -400
- data/lib/snaptrade/models/account.rb +1 -1
- data/lib/snaptrade/models/account_category.rb +2 -1
- data/lib/snaptrade/models/annuity_account.rb +1 -1
- data/lib/snaptrade/models/annuity_account_sync_status.rb +1 -1
- data/lib/snaptrade/models/connection_account.rb +5 -3
- data/lib/snaptrade/models/mortgage_account.rb +356 -0
- data/lib/snaptrade/models/mortgage_account_kind.rb +36 -0
- data/lib/snaptrade/models/mortgage_account_net_value.rb +228 -0
- data/lib/snaptrade/models/mortgage_account_sync_status.rb +228 -0
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +4 -0
- data/spec/api/account_information_api_spec.rb +50 -4
- data/spec/api/connections_api_spec.rb +1 -1
- data/spec/api/experimental_endpoints_api_spec.rb +0 -46
- data/spec/models/mortgage_account_kind_spec.rb +23 -0
- data/spec/models/mortgage_account_net_value_spec.rb +35 -0
- data/spec/models/mortgage_account_spec.rb +95 -0
- data/spec/models/mortgage_account_sync_status_spec.rb +35 -0
- metadata +292 -280
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: da21811c8f6aa42d8a71ebc0d0df36e34b216440dc986468a7b65e274a83c466
|
|
4
|
+
data.tar.gz: 77833dff700d39c027e72f28722ba6abc8fb2d06148c2fa2d6d399615bf38405
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3d815cdcee09d0d6161c2ad6dc8151fd571793605f1d9751fd167918a695e2300e1d8a93c013656e7d4b5d25c1252f1f78c27e417fb6a2c59ef99bd7f914a10a
|
|
7
|
+
data.tar.gz: c4e6edb12011abe81f9337d06eac0c851beaef8df1adcf0549d3fd6decaebef62777dcdda316bbaeab75cb7a1a5ff4128782c17a70faf89d4866e6cf85553536
|
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.58)
|
|
67
67
|
[](https://snaptrade.com/)
|
|
68
68
|
|
|
69
69
|
</div>
|
|
@@ -80,7 +80,10 @@ See https://docs.snaptrade.com/docs/ratelimiting.
|
|
|
80
80
|
* [`snaptrade.account_information.get_account_balance_history`](#snaptradeaccount_informationget_account_balance_history)
|
|
81
81
|
* [`snaptrade.account_information.get_account_balances_v2`](#snaptradeaccount_informationget_account_balances_v2)
|
|
82
82
|
* [`snaptrade.account_information.get_account_details`](#snaptradeaccount_informationget_account_details)
|
|
83
|
+
* [`snaptrade.account_information.get_account_order`](#snaptradeaccount_informationget_account_order)
|
|
84
|
+
* [`snaptrade.account_information.get_all_account_orders`](#snaptradeaccount_informationget_all_account_orders)
|
|
83
85
|
* [`snaptrade.account_information.get_all_account_positions`](#snaptradeaccount_informationget_all_account_positions)
|
|
86
|
+
* [`snaptrade.account_information.get_all_account_recent_orders`](#snaptradeaccount_informationget_all_account_recent_orders)
|
|
84
87
|
* [`snaptrade.account_information.get_user_account_balance`](#snaptradeaccount_informationget_user_account_balance)
|
|
85
88
|
* [`snaptrade.account_information.get_user_account_details`](#snaptradeaccount_informationget_user_account_details)
|
|
86
89
|
* [`snaptrade.account_information.get_user_account_order_detail`](#snaptradeaccount_informationget_user_account_order_detail)
|
|
@@ -108,9 +111,6 @@ See https://docs.snaptrade.com/docs/ratelimiting.
|
|
|
108
111
|
* [`snaptrade.connections.sync_brokerage_authorization_transactions`](#snaptradeconnectionssync_brokerage_authorization_transactions)
|
|
109
112
|
* [`snaptrade.experimental_endpoints.add_subscription`](#snaptradeexperimental_endpointsadd_subscription)
|
|
110
113
|
* [`snaptrade.experimental_endpoints.cancel_subscription`](#snaptradeexperimental_endpointscancel_subscription)
|
|
111
|
-
* [`snaptrade.experimental_endpoints.get_account_order`](#snaptradeexperimental_endpointsget_account_order)
|
|
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)
|
|
114
114
|
* [`snaptrade.experimental_endpoints.get_user_account_order_detail_v2`](#snaptradeexperimental_endpointsget_user_account_order_detail_v2)
|
|
115
115
|
* [`snaptrade.experimental_endpoints.get_user_account_orders_v2`](#snaptradeexperimental_endpointsget_user_account_orders_v2)
|
|
116
116
|
* [`snaptrade.experimental_endpoints.get_user_account_recent_orders_v2`](#snaptradeexperimental_endpointsget_user_account_recent_orders_v2)
|
|
@@ -149,7 +149,7 @@ See https://docs.snaptrade.com/docs/ratelimiting.
|
|
|
149
149
|
Add to Gemfile:
|
|
150
150
|
|
|
151
151
|
```ruby
|
|
152
|
-
gem 'snaptrade', '~> 3.0.
|
|
152
|
+
gem 'snaptrade', '~> 3.0.58'
|
|
153
153
|
```
|
|
154
154
|
|
|
155
155
|
## Getting Started<a id="getting-started"></a>
|
|
@@ -361,7 +361,7 @@ p result
|
|
|
361
361
|
|
|
362
362
|
### `snaptrade.account_information.get_account_details`<a id="snaptradeaccount_informationget_account_details"></a>
|
|
363
363
|
|
|
364
|
-
Returns the specified account for the authenticated user. The account can be an investment, deposit, line of credit, or
|
|
364
|
+
Returns the specified account for the authenticated user. The account can be an investment, deposit, line of credit, annuity, or mortgage account. Use the `kind` discriminator to determine the schema for the account.
|
|
365
365
|
|
|
366
366
|
On Pay as you Go / Real-time, this endpoint refreshes the account's opening date and total net value (`net_value`) live from the institution on each call, along with funding date for `investment` accounts.
|
|
367
367
|
|
|
@@ -401,6 +401,101 @@ p result
|
|
|
401
401
|
---
|
|
402
402
|
|
|
403
403
|
|
|
404
|
+
### `snaptrade.account_information.get_account_order`<a id="snaptradeaccount_informationget_account_order"></a>
|
|
405
|
+
|
|
406
|
+
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`.
|
|
407
|
+
|
|
408
|
+
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.
|
|
409
|
+
|
|
410
|
+
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.
|
|
411
|
+
|
|
412
|
+
This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint.
|
|
413
|
+
|
|
414
|
+
**Beta:** this endpoint and its response schema may change.
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
|
418
|
+
|
|
419
|
+
```ruby
|
|
420
|
+
result = snaptrade.account_information.get_account_order(
|
|
421
|
+
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
422
|
+
brokerage_order_id: "66a033fa-da74-4fcf-b527-feefdec9257e",
|
|
423
|
+
user_id: "snaptrade-user-123",
|
|
424
|
+
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
425
|
+
)
|
|
426
|
+
p result
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
430
|
+
|
|
431
|
+
##### account_id: `String`<a id="account_id-string"></a>
|
|
432
|
+
##### brokerage_order_id: `String`<a id="brokerage_order_id-string"></a>
|
|
433
|
+
##### user_id: `String`<a id="user_id-string"></a>
|
|
434
|
+
##### user_secret: `String`<a id="user_secret-string"></a>
|
|
435
|
+
#### 🔄 Return<a id="🔄-return"></a>
|
|
436
|
+
|
|
437
|
+
[AccountOrder](./lib/snaptrade/models/account_order.rb)
|
|
438
|
+
|
|
439
|
+
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
|
440
|
+
|
|
441
|
+
`/accounts/{accountId}/orders/{brokerageOrderId}` `GET`
|
|
442
|
+
|
|
443
|
+
[🔙 **Back to Table of Contents**](#table-of-contents)
|
|
444
|
+
|
|
445
|
+
---
|
|
446
|
+
|
|
447
|
+
|
|
448
|
+
### `snaptrade.account_information.get_all_account_orders`<a id="snaptradeaccount_informationget_all_account_orders"></a>
|
|
449
|
+
|
|
450
|
+
Returns a list of recent orders in the specified account, in the same `kind`-discriminated format as `/accounts/{accountId}/positions/all`.
|
|
451
|
+
|
|
452
|
+
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`.
|
|
453
|
+
|
|
454
|
+
`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`.
|
|
455
|
+
|
|
456
|
+
**Beta:** this endpoint and its response schema may change.
|
|
457
|
+
|
|
458
|
+
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.
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
|
462
|
+
|
|
463
|
+
```ruby
|
|
464
|
+
result = snaptrade.account_information.get_all_account_orders(
|
|
465
|
+
user_id: "snaptrade-user-123",
|
|
466
|
+
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
467
|
+
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
468
|
+
state: "all",
|
|
469
|
+
days: 30,
|
|
470
|
+
)
|
|
471
|
+
p result
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
475
|
+
|
|
476
|
+
##### user_id: `String`<a id="user_id-string"></a>
|
|
477
|
+
##### user_secret: `String`<a id="user_secret-string"></a>
|
|
478
|
+
##### account_id: `String`<a id="account_id-string"></a>
|
|
479
|
+
##### state: `String`<a id="state-string"></a>
|
|
480
|
+
defaults to \"all\"
|
|
481
|
+
|
|
482
|
+
##### days: `Integer`<a id="days-integer"></a>
|
|
483
|
+
Number of days in the past to fetch the most recent orders. Defaults to the last
|
|
484
|
+
30 days if no value is passed in. Values greater than 90 will be capped at 90.
|
|
485
|
+
|
|
486
|
+
#### 🔄 Return<a id="🔄-return"></a>
|
|
487
|
+
|
|
488
|
+
[AllAccountOrdersResponse](./lib/snaptrade/models/all_account_orders_response.rb)
|
|
489
|
+
|
|
490
|
+
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
|
491
|
+
|
|
492
|
+
`/accounts/{accountId}/orders/all` `GET`
|
|
493
|
+
|
|
494
|
+
[🔙 **Back to Table of Contents**](#table-of-contents)
|
|
495
|
+
|
|
496
|
+
---
|
|
497
|
+
|
|
498
|
+
|
|
404
499
|
### `snaptrade.account_information.get_all_account_positions`<a id="snaptradeaccount_informationget_all_account_positions"></a>
|
|
405
500
|
|
|
406
501
|
Returns a list of all positions in the specified account.
|
|
@@ -443,6 +538,54 @@ p result
|
|
|
443
538
|
---
|
|
444
539
|
|
|
445
540
|
|
|
541
|
+
### `snaptrade.account_information.get_all_account_recent_orders`<a id="snaptradeaccount_informationget_all_account_recent_orders"></a>
|
|
542
|
+
|
|
543
|
+
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.
|
|
544
|
+
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.
|
|
545
|
+
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.
|
|
546
|
+
By default only returns executed orders, but that can be changed by setting *only_executed* to false.
|
|
547
|
+
|
|
548
|
+
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.
|
|
549
|
+
|
|
550
|
+
**Beta:** this endpoint and its response schema may change.
|
|
551
|
+
|
|
552
|
+
**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)**
|
|
553
|
+
|
|
554
|
+
|
|
555
|
+
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
|
556
|
+
|
|
557
|
+
```ruby
|
|
558
|
+
result = snaptrade.account_information.get_all_account_recent_orders(
|
|
559
|
+
user_id: "snaptrade-user-123",
|
|
560
|
+
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
561
|
+
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
562
|
+
only_executed: true,
|
|
563
|
+
)
|
|
564
|
+
p result
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
568
|
+
|
|
569
|
+
##### user_id: `String`<a id="user_id-string"></a>
|
|
570
|
+
##### user_secret: `String`<a id="user_secret-string"></a>
|
|
571
|
+
##### account_id: `String`<a id="account_id-string"></a>
|
|
572
|
+
##### only_executed: `Boolean`<a id="only_executed-boolean"></a>
|
|
573
|
+
Defaults to true. Indicates if request should fetch only executed orders. Set to
|
|
574
|
+
false to retrieve non executed orders as well
|
|
575
|
+
|
|
576
|
+
#### 🔄 Return<a id="🔄-return"></a>
|
|
577
|
+
|
|
578
|
+
[AllAccountOrdersResponse](./lib/snaptrade/models/all_account_orders_response.rb)
|
|
579
|
+
|
|
580
|
+
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
|
581
|
+
|
|
582
|
+
`/accounts/{accountId}/orders/recent` `GET`
|
|
583
|
+
|
|
584
|
+
[🔙 **Back to Table of Contents**](#table-of-contents)
|
|
585
|
+
|
|
586
|
+
---
|
|
587
|
+
|
|
588
|
+
|
|
446
589
|
### `snaptrade.account_information.get_user_account_balance`<a id="snaptradeaccount_informationget_user_account_balance"></a>
|
|
447
590
|
|
|
448
591
|
Returns a list of balances for the account. Each element of the list has a distinct currency. Some brokerages like Questrade [allows holding multiple currencies in the same account](https://www.questrade.com/learning/questrade-basics/balances-and-reports/understanding-your-account-balances).
|
|
@@ -486,7 +629,7 @@ p result
|
|
|
486
629
|
### `snaptrade.account_information.get_user_account_details`<a id="snaptradeaccount_informationget_user_account_details"></a>
|
|
487
630
|

|
|
488
631
|
|
|
489
|
-
**Deprecated.** Use the [get account details](/reference/Account%20Information/AccountInformation_getAccountDetails) endpoint instead, which supports all account types, including investment, deposit, line of credit, and
|
|
632
|
+
**Deprecated.** Use the [get account details](/reference/Account%20Information/AccountInformation_getAccountDetails) endpoint instead, which supports all account types, including investment, deposit, line of credit, annuity, and mortgage accounts.
|
|
490
633
|
|
|
491
634
|
Returns account detail known to SnapTrade for the specified account.
|
|
492
635
|
|
|
@@ -753,7 +896,7 @@ p result
|
|
|
753
896
|
|
|
754
897
|
Returns all accounts across all connections known to SnapTrade for the authenticated user.
|
|
755
898
|
|
|
756
|
-
The `results` list can contain multiple account types in the same response, including investment, deposit, line of credit, and
|
|
899
|
+
The `results` list can contain multiple account types in the same response, including investment, deposit, line of credit, annuity, and mortgage accounts. Use the `kind` discriminator to determine the schema for each account.
|
|
757
900
|
|
|
758
901
|
This endpoint returns Daily data regardless of the customer's plan. Daily data is cached and refreshed once a day, which makes this endpoint fast and well-suited to listing accounts across all of a user's connections in a single call. Exact refresh timing may vary by institution. To get real-time data on Pay as you Go / Real-time, use the [list accounts for a connection endpoint](/reference/Connections/Connections_listConnectionAccounts). Customers on Pay as you Go / Daily can force a refresh with the [manual refresh endpoint](/reference/Connections/Connections_refreshBrokerageAuthorization).
|
|
759
902
|
|
|
@@ -788,7 +931,7 @@ p result
|
|
|
788
931
|
### `snaptrade.account_information.list_user_accounts`<a id="snaptradeaccount_informationlist_user_accounts"></a>
|
|
789
932
|

|
|
790
933
|
|
|
791
|
-
**Deprecated.** Use the [list all user accounts](/reference/Account%20Information/AccountInformation_listAllUserAccounts) endpoint instead, which returns all account types in a single response, including investment, deposit, line of credit, and
|
|
934
|
+
**Deprecated.** Use the [list all user accounts](/reference/Account%20Information/AccountInformation_listAllUserAccounts) endpoint instead, which returns all account types in a single response, including investment, deposit, line of credit, annuity, and mortgage accounts.
|
|
792
935
|
|
|
793
936
|
Returns all brokerage accounts across all connections known to SnapTrade for the authenticated user.
|
|
794
937
|
|
|
@@ -1283,7 +1426,7 @@ p result
|
|
|
1283
1426
|
|
|
1284
1427
|
Returns all accounts that belong to the specified connection for the authenticated user.
|
|
1285
1428
|
|
|
1286
|
-
The `results` list can contain multiple account types in the same response, including investment, deposit, line of credit, and
|
|
1429
|
+
The `results` list can contain multiple account types in the same response, including investment, deposit, line of credit, annuity, and mortgage accounts. Use the `kind` discriminator to determine the schema for each account.
|
|
1287
1430
|
|
|
1288
1431
|
On Pay as you Go / Real-time, this endpoint refreshes each account's opening date and total net value (`net_value`) live from the institution on each call, along with funding date for `investment` accounts.
|
|
1289
1432
|
|
|
@@ -1510,149 +1653,6 @@ reference the account in SnapTrade.
|
|
|
1510
1653
|
---
|
|
1511
1654
|
|
|
1512
1655
|
|
|
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
|
-
|
|
1557
|
-
### `snaptrade.experimental_endpoints.get_all_account_orders`<a id="snaptradeexperimental_endpointsget_all_account_orders"></a>
|
|
1558
|
-
|
|
1559
|
-
Returns a list of recent orders in the specified account, in the same `kind`-discriminated format as `/accounts/{accountId}/positions/all`.
|
|
1560
|
-
|
|
1561
|
-
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`.
|
|
1562
|
-
|
|
1563
|
-
`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`.
|
|
1564
|
-
|
|
1565
|
-
**Experimental:** this endpoint may change without notice.
|
|
1566
|
-
|
|
1567
|
-
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.
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
|
1571
|
-
|
|
1572
|
-
```ruby
|
|
1573
|
-
result = snaptrade.experimental_endpoints.get_all_account_orders(
|
|
1574
|
-
user_id: "snaptrade-user-123",
|
|
1575
|
-
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
1576
|
-
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
1577
|
-
state: "all",
|
|
1578
|
-
days: 30,
|
|
1579
|
-
)
|
|
1580
|
-
p result
|
|
1581
|
-
```
|
|
1582
|
-
|
|
1583
|
-
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
1584
|
-
|
|
1585
|
-
##### user_id: `String`<a id="user_id-string"></a>
|
|
1586
|
-
##### user_secret: `String`<a id="user_secret-string"></a>
|
|
1587
|
-
##### account_id: `String`<a id="account_id-string"></a>
|
|
1588
|
-
##### state: `String`<a id="state-string"></a>
|
|
1589
|
-
defaults to \"all\"
|
|
1590
|
-
|
|
1591
|
-
##### days: `Integer`<a id="days-integer"></a>
|
|
1592
|
-
Number of days in the past to fetch the most recent orders. Defaults to the last
|
|
1593
|
-
30 days if no value is passed in. Values greater than 90 will be capped at 90.
|
|
1594
|
-
|
|
1595
|
-
#### 🔄 Return<a id="🔄-return"></a>
|
|
1596
|
-
|
|
1597
|
-
[AllAccountOrdersResponse](./lib/snaptrade/models/all_account_orders_response.rb)
|
|
1598
|
-
|
|
1599
|
-
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
|
1600
|
-
|
|
1601
|
-
`/accounts/{accountId}/orders/all` `GET`
|
|
1602
|
-
|
|
1603
|
-
[🔙 **Back to Table of Contents**](#table-of-contents)
|
|
1604
|
-
|
|
1605
|
-
---
|
|
1606
|
-
|
|
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
|
-
|
|
1656
1656
|
### `snaptrade.experimental_endpoints.get_user_account_order_detail_v2`<a id="snaptradeexperimental_endpointsget_user_account_order_detail_v2"></a>
|
|
1657
1657
|
|
|
1658
1658
|
Returns the detail of a single order using the brokerage order ID provided as a path parameter.
|