snaptrade 3.0.30 → 3.0.32
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 +120 -2
- data/lib/snaptrade/api/account_information_api.rb +12 -4
- data/lib/snaptrade/api/experimental_endpoints_api.rb +176 -0
- data/lib/snaptrade/models/account_information_get_user_holdings409_response.rb +234 -0
- data/lib/snaptrade/models/account_position.rb +1 -1
- data/lib/snaptrade/models/account_value_history_response.rb +1 -1
- data/lib/snaptrade/models/{account_type.rb → cash_or_margin.rb} +3 -3
- data/lib/snaptrade/models/institution.rb +1 -1
- data/lib/snaptrade/models/investment_account.rb +7 -7
- data/lib/snaptrade/models/position.rb +1 -1
- data/lib/snaptrade/models/release_stage.rb +2 -1
- data/lib/snaptrade/models/simple_trade_form.rb +346 -0
- data/lib/snaptrade/models/simple_trade_form_order_type.rb +39 -0
- data/lib/snaptrade/models/simple_trade_form_price_effect.rb +38 -0
- data/lib/snaptrade/models/simple_trade_form_time_in_force.rb +40 -0
- data/lib/snaptrade/models/simple_trade_form_trading_session.rb +37 -0
- data/lib/snaptrade/models/simple_trade_instrument.rb +255 -0
- data/lib/snaptrade/models/simple_trade_instrument_kind.rb +39 -0
- data/lib/snaptrade/models/simple_trade_leg.rb +246 -0
- data/lib/snaptrade/models/simple_trade_leg_action.rb +41 -0
- data/lib/snaptrade/models/simple_trade_response.rb +222 -0
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +12 -1
- data/spec/api/account_information_api_spec.rb +2 -2
- data/spec/api/experimental_endpoints_api_spec.rb +15 -0
- data/spec/models/account_information_get_user_holdings409_response_spec.rb +41 -0
- data/spec/models/{account_type_spec.rb → cash_or_margin_spec.rb} +6 -6
- data/spec/models/investment_account_spec.rb +1 -1
- data/spec/models/simple_trade_form_order_type_spec.rb +23 -0
- data/spec/models/simple_trade_form_price_effect_spec.rb +23 -0
- data/spec/models/simple_trade_form_spec.rb +83 -0
- data/spec/models/simple_trade_form_time_in_force_spec.rb +23 -0
- data/spec/models/simple_trade_form_trading_session_spec.rb +23 -0
- data/spec/models/simple_trade_instrument_kind_spec.rb +23 -0
- data/spec/models/simple_trade_instrument_spec.rb +35 -0
- data/spec/models/simple_trade_leg_action_spec.rb +23 -0
- data/spec/models/simple_trade_leg_spec.rb +41 -0
- data/spec/models/simple_trade_response_spec.rb +29 -0
- metadata +266 -233
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e9d0698080dbeff004ed03dc9aacdf589ed4f9847685c765c6bde9ac03b8263a
|
|
4
|
+
data.tar.gz: ee7279bec959662a67b12b8baad39b07010bfac1adeff33a54cd2d6056360829
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e5c7d1858f2aab23bfeff374907312572292552966b22147bcbf983381567d7b2dbb694521e5c1e62e0117ac37a2027c186b2877d697e36dc7dca73fb52227d5
|
|
7
|
+
data.tar.gz: 1d44a37d011a648708a366f106596ea34c0d1cf554150c8394cb1cd67130d9dcccba5c4f37be679684d43f2bce927e2a528b872072b49eb9da9ea917e9304a65
|
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.32)
|
|
67
67
|
[](https://snaptrade.com/)
|
|
68
68
|
|
|
69
69
|
</div>
|
|
@@ -111,6 +111,7 @@ See https://docs.snaptrade.com/docs/ratelimiting.
|
|
|
111
111
|
* [`snaptrade.experimental_endpoints.get_user_account_recent_orders_v2`](#snaptradeexperimental_endpointsget_user_account_recent_orders_v2)
|
|
112
112
|
* [`snaptrade.experimental_endpoints.list_all_user_accounts`](#snaptradeexperimental_endpointslist_all_user_accounts)
|
|
113
113
|
* [`snaptrade.experimental_endpoints.list_subscriptions`](#snaptradeexperimental_endpointslist_subscriptions)
|
|
114
|
+
* [`snaptrade.experimental_endpoints.place_simple_order`](#snaptradeexperimental_endpointsplace_simple_order)
|
|
114
115
|
* [`snaptrade.reference_data.get_partner_info`](#snaptradereference_dataget_partner_info)
|
|
115
116
|
* [`snaptrade.reference_data.get_stock_exchanges`](#snaptradereference_dataget_stock_exchanges)
|
|
116
117
|
* [`snaptrade.reference_data.get_symbols`](#snaptradereference_dataget_symbols)
|
|
@@ -142,7 +143,7 @@ See https://docs.snaptrade.com/docs/ratelimiting.
|
|
|
142
143
|
Add to Gemfile:
|
|
143
144
|
|
|
144
145
|
```ruby
|
|
145
|
-
gem 'snaptrade', '~> 3.0.
|
|
146
|
+
gem 'snaptrade', '~> 3.0.32'
|
|
146
147
|
```
|
|
147
148
|
|
|
148
149
|
## Getting Started<a id="getting-started"></a>
|
|
@@ -276,6 +277,8 @@ one account to another. - `SPLIT` - A stock share split.
|
|
|
276
277
|
|
|
277
278
|
An experimental endpoint that returns estimated historical total account value for the specified account. Total account value is the sum of the market value of all positions and cash in the account at a given time. This endpoint is experimental, disabled by default, and has a maximum lookback of 1 year. Because the data is dynamically generated, we recommend replacing your dataset with each request as opposed to combining data from multiple requests. Enable this feature for free in the [Add-on page of the Customer Dashboard](https://dashboard.snaptrade.com/add-ons)
|
|
278
279
|
|
|
280
|
+
The data may contain gaps and is best used for charting account value trends. It should not be relied on as a complete or exact record of historical account values.
|
|
281
|
+
|
|
279
282
|
|
|
280
283
|
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
|
281
284
|
|
|
@@ -619,6 +622,8 @@ Check your API key on the [Customer Dashboard billing page](https://dashboard.sn
|
|
|
619
622
|
|
|
620
623
|
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.
|
|
621
624
|
|
|
625
|
+
Concurrent live holdings requests for the same account fail immediately with HTTP 409 and error code `1166`. Wait for the in-flight request to complete before retrying.
|
|
626
|
+
|
|
622
627
|
|
|
623
628
|
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
|
624
629
|
|
|
@@ -1610,6 +1615,119 @@ p result
|
|
|
1610
1615
|
---
|
|
1611
1616
|
|
|
1612
1617
|
|
|
1618
|
+
### `snaptrade.experimental_endpoints.place_simple_order`<a id="snaptradeexperimental_endpointsplace_simple_order"></a>
|
|
1619
|
+
|
|
1620
|
+
**Beta.** Places a single-leg or multi-leg order using a common request format for equities, equity options, futures, and future options. This endpoint is experimental; breaking changes are possible during the experimental phase.
|
|
1621
|
+
|
|
1622
|
+
Equity and equity-option orders use the existing brokerage trading capabilities. Futures and future options are currently supported only on tastytrade. Order types, time in force, optional fields, and strategy combinations remain subject to brokerage support. See the [brokerage trading support page](https://support.snaptrade.com/brokerages).
|
|
1623
|
+
|
|
1624
|
+
An order may contain equity/option legs or future/future_option legs, but cannot mix those two families. Equity/option strategies must share the same underlying symbol. Each strategy is submitted as one brokerage order; unsupported strategies are never split into independent orders. Tastytrade supports single-leg outright futures and up to four future-option legs, and does not support multi-leg market orders.
|
|
1625
|
+
|
|
1626
|
+
All string choices use lower snake_case and are case-sensitive. Symbols retain their native format: equity tickers, OCC equity-option symbols, or the exact tastytrade BrokerageInstrument ticker for futures and future options, including any spaces.
|
|
1627
|
+
|
|
1628
|
+
A successful response contains only the brokerage order ID. Use the existing order endpoints to retrieve order details.
|
|
1629
|
+
|
|
1630
|
+
|
|
1631
|
+
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
|
1632
|
+
|
|
1633
|
+
```ruby
|
|
1634
|
+
result = snaptrade.experimental_endpoints.place_simple_order(
|
|
1635
|
+
order_type: "stop_limit",
|
|
1636
|
+
time_in_force: "day",
|
|
1637
|
+
legs: [
|
|
1638
|
+
{
|
|
1639
|
+
"instrument" => {
|
|
1640
|
+
"kind" => "future",
|
|
1641
|
+
"symbol" => "/ESZ6",
|
|
1642
|
+
},
|
|
1643
|
+
"action" => "buy",
|
|
1644
|
+
"units" => "1.25",
|
|
1645
|
+
}
|
|
1646
|
+
],
|
|
1647
|
+
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
1648
|
+
user_id: "snaptrade-user-123",
|
|
1649
|
+
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
1650
|
+
limit_price: "1.25",
|
|
1651
|
+
stop_price: "1.25",
|
|
1652
|
+
price_effect: "debit",
|
|
1653
|
+
client_order_id: "550e8400-e29b-41d4-a716-446655440000",
|
|
1654
|
+
expiry_date: "2026-12-18T20:00:00Z",
|
|
1655
|
+
notional_value: "1.25",
|
|
1656
|
+
trading_session: "regular",
|
|
1657
|
+
)
|
|
1658
|
+
p result
|
|
1659
|
+
```
|
|
1660
|
+
|
|
1661
|
+
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
1662
|
+
|
|
1663
|
+
##### order_type: [`SimpleTradeFormOrderType`](./lib/snaptrade/models/simple_trade_form_order_type.rb)<a id="order_type-simpletradeformordertypelibsnaptrademodelssimple_trade_form_order_typerb"></a>
|
|
1664
|
+
##### time_in_force: [`SimpleTradeFormTimeInForce`](./lib/snaptrade/models/simple_trade_form_time_in_force.rb)<a id="time_in_force-simpletradeformtimeinforcelibsnaptrademodelssimple_trade_form_time_in_forcerb"></a>
|
|
1665
|
+
Order duration, subject to brokerage and execution-path support. gtd requires
|
|
1666
|
+
expiry_date and a non-market single-leg equity/option order. Existing single-leg
|
|
1667
|
+
option routing does not support ioc. Futures and multi-leg orders do not support
|
|
1668
|
+
gtd through this endpoint.
|
|
1669
|
+
|
|
1670
|
+
##### legs: Array<[`SimpleTradeLeg`](./lib/snaptrade/models/simple_trade_leg.rb)><a id="legs-array"></a>
|
|
1671
|
+
Legs of one brokerage order. Use equity/option legs or future/future_option
|
|
1672
|
+
legs, without mixing the two families. Brokerage strategy and leg-count limits
|
|
1673
|
+
apply.
|
|
1674
|
+
|
|
1675
|
+
##### account_id: `String`<a id="account_id-string"></a>
|
|
1676
|
+
The ID of the account to execute the trade on.
|
|
1677
|
+
|
|
1678
|
+
##### user_id: `String`<a id="user_id-string"></a>
|
|
1679
|
+
##### user_secret: `String`<a id="user_secret-string"></a>
|
|
1680
|
+
##### limit_price: [`Float`](./lib/snaptrade/models/float.rb)<a id="limit_price-floatlibsnaptrademodelsfloatrb"></a>
|
|
1681
|
+
Required for limit and stop_limit orders, except that multi-leg price_effect
|
|
1682
|
+
even implies zero. Must be omitted or null for market and stop orders. For
|
|
1683
|
+
multi-leg orders this is the net strategy price. Negative prices are accepted
|
|
1684
|
+
only for futures-family orders, subject to brokerage support.
|
|
1685
|
+
|
|
1686
|
+
##### stop_price: [`Float`](./lib/snaptrade/models/float.rb)<a id="stop_price-floatlibsnaptrademodelsfloatrb"></a>
|
|
1687
|
+
Required for stop and stop_limit orders. Must be omitted or null for market and
|
|
1688
|
+
limit orders. Must be positive for equity/option orders; futures-family trigger
|
|
1689
|
+
prices are subject to brokerage support.
|
|
1690
|
+
|
|
1691
|
+
##### price_effect: [`SimpleTradeFormPriceEffect`](./lib/snaptrade/models/simple_trade_form_price_effect.rb)<a id="price_effect-simpletradeformpriceeffectlibsnaptrademodelssimple_trade_form_price_effectrb"></a>
|
|
1692
|
+
Only applicable to multi-leg limit and stop_limit orders. Requirements and
|
|
1693
|
+
supported values depend on the brokerage; tastytrade requires credit or debit.
|
|
1694
|
+
even implies a zero limit_price, which may be omitted and must be zero if
|
|
1695
|
+
supplied. Single-leg price effects are derived from the action.
|
|
1696
|
+
|
|
1697
|
+
##### client_order_id: [`String`](./lib/snaptrade/models/string.rb)<a id="client_order_id-stringlibsnaptrademodelsstringrb"></a>
|
|
1698
|
+
Optional canonical UUID, forwarded where the existing execution path supports it
|
|
1699
|
+
and for tastytrade futures orders. Requires the existing client-order-ID
|
|
1700
|
+
enablement; when disabled the value is ignored. Brokerage behavior on duplicates
|
|
1701
|
+
varies; SnapTrade does not enforce uniqueness. Tastytrade uses this as
|
|
1702
|
+
external-identifier for correlation and does not deduplicate submissions.
|
|
1703
|
+
|
|
1704
|
+
##### expiry_date: `Time`<a id="expiry_date-time"></a>
|
|
1705
|
+
ISO 8601 expiry timestamp, required for gtd and invalid with other durations. A
|
|
1706
|
+
missing timezone is treated as UTC. Supported only through existing single-leg
|
|
1707
|
+
Public and Sandbox execution paths.
|
|
1708
|
+
|
|
1709
|
+
##### notional_value: [`Float`](./lib/snaptrade/models/float.rb)<a id="notional_value-floatlibsnaptrademodelsfloatrb"></a>
|
|
1710
|
+
Positive order value, supported only for a single-equity market order on
|
|
1711
|
+
eligible brokerages and partners. Mutually exclusive with leg units. Omit or set
|
|
1712
|
+
units to null when supplied.
|
|
1713
|
+
|
|
1714
|
+
##### trading_session: [`SimpleTradeFormTradingSession`](./lib/snaptrade/models/simple_trade_form_trading_session.rb)<a id="trading_session-simpletradeformtradingsessionlibsnaptrademodelssimple_trade_form_trading_sessionrb"></a>
|
|
1715
|
+
extended uses existing single-leg equity/option brokerage support and requires
|
|
1716
|
+
extended-hours enablement. Futures and multi-leg orders only accept regular.
|
|
1717
|
+
|
|
1718
|
+
#### 🔄 Return<a id="🔄-return"></a>
|
|
1719
|
+
|
|
1720
|
+
[SimpleTradeResponse](./lib/snaptrade/models/simple_trade_response.rb)
|
|
1721
|
+
|
|
1722
|
+
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
|
1723
|
+
|
|
1724
|
+
`/accounts/{accountId}/trading/simple` `POST`
|
|
1725
|
+
|
|
1726
|
+
[🔙 **Back to Table of Contents**](#table-of-contents)
|
|
1727
|
+
|
|
1728
|
+
---
|
|
1729
|
+
|
|
1730
|
+
|
|
1613
1731
|
### `snaptrade.reference_data.get_partner_info`<a id="snaptradereference_dataget_partner_info"></a>
|
|
1614
1732
|
|
|
1615
1733
|
Returns configurations for your SnapTrade Client ID, including allowed brokerages and data access.
|
|
@@ -186,6 +186,8 @@ module SnapTrade
|
|
|
186
186
|
# List historical account total value
|
|
187
187
|
#
|
|
188
188
|
# An experimental endpoint that returns estimated historical total account value for the specified account. Total account value is the sum of the market value of all positions and cash in the account at a given time. This endpoint is experimental, disabled by default, and has a maximum lookback of 1 year. Because the data is dynamically generated, we recommend replacing your dataset with each request as opposed to combining data from multiple requests. Enable this feature for free in the [Add-on page of the Customer Dashboard](https://dashboard.snaptrade.com/add-ons)
|
|
189
|
+
#
|
|
190
|
+
# The data may contain gaps and is best used for charting account value trends. It should not be relied on as a complete or exact record of historical account values.
|
|
189
191
|
#
|
|
190
192
|
# @param user_id [String]
|
|
191
193
|
# @param user_secret [String]
|
|
@@ -199,6 +201,8 @@ module SnapTrade
|
|
|
199
201
|
# List historical account total value
|
|
200
202
|
#
|
|
201
203
|
# An experimental endpoint that returns estimated historical total account value for the specified account. Total account value is the sum of the market value of all positions and cash in the account at a given time. This endpoint is experimental, disabled by default, and has a maximum lookback of 1 year. Because the data is dynamically generated, we recommend replacing your dataset with each request as opposed to combining data from multiple requests. Enable this feature for free in the [Add-on page of the Customer Dashboard](https://dashboard.snaptrade.com/add-ons)
|
|
204
|
+
#
|
|
205
|
+
# The data may contain gaps and is best used for charting account value trends. It should not be relied on as a complete or exact record of historical account values.
|
|
202
206
|
#
|
|
203
207
|
# @param user_id [String]
|
|
204
208
|
# @param user_secret [String]
|
|
@@ -209,7 +213,7 @@ module SnapTrade
|
|
|
209
213
|
end
|
|
210
214
|
|
|
211
215
|
# List historical account total value
|
|
212
|
-
# An experimental endpoint that returns estimated historical total account value for the specified account. Total account value is the sum of the market value of all positions and cash in the account at a given time. This endpoint is experimental, disabled by default, and has a maximum lookback of 1 year. Because the data is dynamically generated, we recommend replacing your dataset with each request as opposed to combining data from multiple requests. Enable this feature for free in the [Add-on page of the Customer Dashboard](https://dashboard.snaptrade.com/add-ons)
|
|
216
|
+
# An experimental endpoint that returns estimated historical total account value for the specified account. Total account value is the sum of the market value of all positions and cash in the account at a given time. This endpoint is experimental, disabled by default, and has a maximum lookback of 1 year. Because the data is dynamically generated, we recommend replacing your dataset with each request as opposed to combining data from multiple requests. Enable this feature for free in the [Add-on page of the Customer Dashboard](https://dashboard.snaptrade.com/add-ons) The data may contain gaps and is best used for charting account value trends. It should not be relied on as a complete or exact record of historical account values.
|
|
213
217
|
# @param user_id [String]
|
|
214
218
|
# @param user_secret [String]
|
|
215
219
|
# @param account_id [String]
|
|
@@ -221,7 +225,7 @@ module SnapTrade
|
|
|
221
225
|
end
|
|
222
226
|
|
|
223
227
|
# List historical account total value
|
|
224
|
-
# An experimental endpoint that returns estimated historical total account value for the specified account. Total account value is the sum of the market value of all positions and cash in the account at a given time. This endpoint is experimental, disabled by default, and has a maximum lookback of 1 year. Because the data is dynamically generated, we recommend replacing your dataset with each request as opposed to combining data from multiple requests. Enable this feature for free in the [Add-on page of the Customer Dashboard](https://dashboard.snaptrade.com/add-ons)
|
|
228
|
+
# An experimental endpoint that returns estimated historical total account value for the specified account. Total account value is the sum of the market value of all positions and cash in the account at a given time. This endpoint is experimental, disabled by default, and has a maximum lookback of 1 year. Because the data is dynamically generated, we recommend replacing your dataset with each request as opposed to combining data from multiple requests. Enable this feature for free in the [Add-on page of the Customer Dashboard](https://dashboard.snaptrade.com/add-ons) The data may contain gaps and is best used for charting account value trends. It should not be relied on as a complete or exact record of historical account values.
|
|
225
229
|
# @param user_id [String]
|
|
226
230
|
# @param user_secret [String]
|
|
227
231
|
# @param account_id [String]
|
|
@@ -1151,6 +1155,8 @@ module SnapTrade
|
|
|
1151
1155
|
# - If you don't, Daily data is cached and refreshed once a day. Exact refresh timing may vary by brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint.
|
|
1152
1156
|
#
|
|
1153
1157
|
# 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.
|
|
1158
|
+
#
|
|
1159
|
+
# Concurrent live holdings requests for the same account fail immediately with HTTP 409 and error code `1166`. Wait for the in-flight request to complete before retrying.
|
|
1154
1160
|
#
|
|
1155
1161
|
# @param account_id [String]
|
|
1156
1162
|
# @param user_id [String]
|
|
@@ -1174,6 +1180,8 @@ module SnapTrade
|
|
|
1174
1180
|
# - If you don't, Daily data is cached and refreshed once a day. Exact refresh timing may vary by brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint.
|
|
1175
1181
|
#
|
|
1176
1182
|
# 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.
|
|
1183
|
+
#
|
|
1184
|
+
# Concurrent live holdings requests for the same account fail immediately with HTTP 409 and error code `1166`. Wait for the in-flight request to complete before retrying.
|
|
1177
1185
|
#
|
|
1178
1186
|
# @param account_id [String]
|
|
1179
1187
|
# @param user_id [String]
|
|
@@ -1184,7 +1192,7 @@ module SnapTrade
|
|
|
1184
1192
|
end
|
|
1185
1193
|
|
|
1186
1194
|
# List account holdings
|
|
1187
|
-
# **Deprecated.** Use the finer-grained account data endpoints instead: [balances](/reference/Account%20Information/AccountInformation_getUserAccountBalance), [positions](/reference/Account%20Information/AccountInformation_getAllAccountPositions), and [orders](/reference/Account%20Information/AccountInformation_getUserAccountOrders). This endpoint will return HTTP 410 Gone for all customers that sign up after May 11, 2026. Returns a list of balances, positions, and recent orders for the specified account. Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access: - If you do, this endpoint returns real-time data. - If you don't, Daily data is cached and refreshed once a day. Exact refresh timing may vary by brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
|
|
1195
|
+
# **Deprecated.** Use the finer-grained account data endpoints instead: [balances](/reference/Account%20Information/AccountInformation_getUserAccountBalance), [positions](/reference/Account%20Information/AccountInformation_getAllAccountPositions), and [orders](/reference/Account%20Information/AccountInformation_getUserAccountOrders). This endpoint will return HTTP 410 Gone for all customers that sign up after May 11, 2026. Returns a list of balances, positions, and recent orders for the specified account. Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access: - If you do, this endpoint returns real-time data. - If you don't, Daily data is cached and refreshed once a day. Exact refresh timing may vary by brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection. Concurrent live holdings requests for the same account fail immediately with HTTP 409 and error code `1166`. Wait for the in-flight request to complete before retrying.
|
|
1188
1196
|
# @param account_id [String]
|
|
1189
1197
|
# @param user_id [String]
|
|
1190
1198
|
# @param user_secret [String]
|
|
@@ -1196,7 +1204,7 @@ module SnapTrade
|
|
|
1196
1204
|
end
|
|
1197
1205
|
|
|
1198
1206
|
# List account holdings
|
|
1199
|
-
# **Deprecated.** Use the finer-grained account data endpoints instead: [balances](/reference/Account%20Information/AccountInformation_getUserAccountBalance), [positions](/reference/Account%20Information/AccountInformation_getAllAccountPositions), and [orders](/reference/Account%20Information/AccountInformation_getUserAccountOrders). This endpoint will return HTTP 410 Gone for all customers that sign up after May 11, 2026. Returns a list of balances, positions, and recent orders for the specified account. Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access: - If you do, this endpoint returns real-time data. - If you don't, Daily data is cached and refreshed once a day. Exact refresh timing may vary by brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
|
|
1207
|
+
# **Deprecated.** Use the finer-grained account data endpoints instead: [balances](/reference/Account%20Information/AccountInformation_getUserAccountBalance), [positions](/reference/Account%20Information/AccountInformation_getAllAccountPositions), and [orders](/reference/Account%20Information/AccountInformation_getUserAccountOrders). This endpoint will return HTTP 410 Gone for all customers that sign up after May 11, 2026. Returns a list of balances, positions, and recent orders for the specified account. Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access: - If you do, this endpoint returns real-time data. - If you don't, Daily data is cached and refreshed once a day. Exact refresh timing may vary by brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection. Concurrent live holdings requests for the same account fail immediately with HTTP 409 and error code `1166`. Wait for the in-flight request to complete before retrying.
|
|
1200
1208
|
# @param account_id [String]
|
|
1201
1209
|
# @param user_id [String]
|
|
1202
1210
|
# @param user_secret [String]
|
|
@@ -924,6 +924,182 @@ module SnapTrade
|
|
|
924
924
|
end
|
|
925
925
|
return data, status_code, headers, response
|
|
926
926
|
end
|
|
927
|
+
|
|
928
|
+
|
|
929
|
+
# Place a simple order (beta)
|
|
930
|
+
#
|
|
931
|
+
# **Beta.** Places a single-leg or multi-leg order using a common request format for equities, equity options, futures, and future options. This endpoint is experimental; breaking changes are possible during the experimental phase.
|
|
932
|
+
#
|
|
933
|
+
# Equity and equity-option orders use the existing brokerage trading capabilities. Futures and future options are currently supported only on tastytrade. Order types, time in force, optional fields, and strategy combinations remain subject to brokerage support. See the [brokerage trading support page](https://support.snaptrade.com/brokerages).
|
|
934
|
+
#
|
|
935
|
+
# An order may contain equity/option legs or future/future_option legs, but cannot mix those two families. Equity/option strategies must share the same underlying symbol. Each strategy is submitted as one brokerage order; unsupported strategies are never split into independent orders. Tastytrade supports single-leg outright futures and up to four future-option legs, and does not support multi-leg market orders.
|
|
936
|
+
#
|
|
937
|
+
# All string choices use lower snake_case and are case-sensitive. Symbols retain their native format: equity tickers, OCC equity-option symbols, or the exact tastytrade BrokerageInstrument ticker for futures and future options, including any spaces.
|
|
938
|
+
#
|
|
939
|
+
# A successful response contains only the brokerage order ID. Use the existing order endpoints to retrieve order details.
|
|
940
|
+
#
|
|
941
|
+
# @param order_type [SimpleTradeFormOrderType]
|
|
942
|
+
# @param time_in_force [SimpleTradeFormTimeInForce] Order duration, subject to brokerage and execution-path support. gtd requires expiry_date and a non-market single-leg equity/option order. Existing single-leg option routing does not support ioc. Futures and multi-leg orders do not support gtd through this endpoint.
|
|
943
|
+
# @param legs [Array<SimpleTradeLeg>] Legs of one brokerage order. Use equity/option legs or future/future_option legs, without mixing the two families. Brokerage strategy and leg-count limits apply.
|
|
944
|
+
# @param account_id [String] The ID of the account to execute the trade on.
|
|
945
|
+
# @param user_id [String]
|
|
946
|
+
# @param user_secret [String]
|
|
947
|
+
# @param limit_price [Float] Required for limit and stop_limit orders, except that multi-leg price_effect even implies zero. Must be omitted or null for market and stop orders. For multi-leg orders this is the net strategy price. Negative prices are accepted only for futures-family orders, subject to brokerage support.
|
|
948
|
+
# @param stop_price [Float] Required for stop and stop_limit orders. Must be omitted or null for market and limit orders. Must be positive for equity/option orders; futures-family trigger prices are subject to brokerage support.
|
|
949
|
+
# @param price_effect [SimpleTradeFormPriceEffect] Only applicable to multi-leg limit and stop_limit orders. Requirements and supported values depend on the brokerage; tastytrade requires credit or debit. even implies a zero limit_price, which may be omitted and must be zero if supplied. Single-leg price effects are derived from the action.
|
|
950
|
+
# @param client_order_id [String] Optional canonical UUID, forwarded where the existing execution path supports it and for tastytrade futures orders. Requires the existing client-order-ID enablement; when disabled the value is ignored. Brokerage behavior on duplicates varies; SnapTrade does not enforce uniqueness. Tastytrade uses this as external-identifier for correlation and does not deduplicate submissions.
|
|
951
|
+
# @param expiry_date [Time] ISO 8601 expiry timestamp, required for gtd and invalid with other durations. A missing timezone is treated as UTC. Supported only through existing single-leg Public and Sandbox execution paths.
|
|
952
|
+
# @param notional_value [Float] Positive order value, supported only for a single-equity market order on eligible brokerages and partners. Mutually exclusive with leg units. Omit or set units to null when supplied.
|
|
953
|
+
# @param trading_session [SimpleTradeFormTradingSession] extended uses existing single-leg equity/option brokerage support and requires extended-hours enablement. Futures and multi-leg orders only accept regular.
|
|
954
|
+
# @param body [SimpleTradeForm]
|
|
955
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
956
|
+
def place_simple_order(order_type:, time_in_force:, legs:, account_id:, user_id:, user_secret:, limit_price: SENTINEL, stop_price: SENTINEL, price_effect: SENTINEL, client_order_id: SENTINEL, expiry_date: SENTINEL, notional_value: SENTINEL, trading_session: 'regular', extra: {})
|
|
957
|
+
_body = {}
|
|
958
|
+
_body[:order_type] = order_type if order_type != SENTINEL
|
|
959
|
+
_body[:time_in_force] = time_in_force if time_in_force != SENTINEL
|
|
960
|
+
_body[:legs] = legs if legs != SENTINEL
|
|
961
|
+
_body[:limit_price] = limit_price if limit_price != SENTINEL
|
|
962
|
+
_body[:stop_price] = stop_price if stop_price != SENTINEL
|
|
963
|
+
_body[:price_effect] = price_effect if price_effect != SENTINEL
|
|
964
|
+
_body[:client_order_id] = client_order_id if client_order_id != SENTINEL
|
|
965
|
+
_body[:expiry_date] = expiry_date if expiry_date != SENTINEL
|
|
966
|
+
_body[:notional_value] = notional_value if notional_value != SENTINEL
|
|
967
|
+
_body[:trading_session] = trading_session if trading_session != SENTINEL
|
|
968
|
+
simple_trade_form = _body
|
|
969
|
+
data, _status_code, _headers = place_simple_order_with_http_info_impl(account_id, user_id, user_secret, simple_trade_form, extra)
|
|
970
|
+
data
|
|
971
|
+
end
|
|
972
|
+
|
|
973
|
+
# Place a simple order (beta)
|
|
974
|
+
#
|
|
975
|
+
# **Beta.** Places a single-leg or multi-leg order using a common request format for equities, equity options, futures, and future options. This endpoint is experimental; breaking changes are possible during the experimental phase.
|
|
976
|
+
#
|
|
977
|
+
# Equity and equity-option orders use the existing brokerage trading capabilities. Futures and future options are currently supported only on tastytrade. Order types, time in force, optional fields, and strategy combinations remain subject to brokerage support. See the [brokerage trading support page](https://support.snaptrade.com/brokerages).
|
|
978
|
+
#
|
|
979
|
+
# An order may contain equity/option legs or future/future_option legs, but cannot mix those two families. Equity/option strategies must share the same underlying symbol. Each strategy is submitted as one brokerage order; unsupported strategies are never split into independent orders. Tastytrade supports single-leg outright futures and up to four future-option legs, and does not support multi-leg market orders.
|
|
980
|
+
#
|
|
981
|
+
# All string choices use lower snake_case and are case-sensitive. Symbols retain their native format: equity tickers, OCC equity-option symbols, or the exact tastytrade BrokerageInstrument ticker for futures and future options, including any spaces.
|
|
982
|
+
#
|
|
983
|
+
# A successful response contains only the brokerage order ID. Use the existing order endpoints to retrieve order details.
|
|
984
|
+
#
|
|
985
|
+
# @param order_type [SimpleTradeFormOrderType]
|
|
986
|
+
# @param time_in_force [SimpleTradeFormTimeInForce] Order duration, subject to brokerage and execution-path support. gtd requires expiry_date and a non-market single-leg equity/option order. Existing single-leg option routing does not support ioc. Futures and multi-leg orders do not support gtd through this endpoint.
|
|
987
|
+
# @param legs [Array<SimpleTradeLeg>] Legs of one brokerage order. Use equity/option legs or future/future_option legs, without mixing the two families. Brokerage strategy and leg-count limits apply.
|
|
988
|
+
# @param account_id [String] The ID of the account to execute the trade on.
|
|
989
|
+
# @param user_id [String]
|
|
990
|
+
# @param user_secret [String]
|
|
991
|
+
# @param limit_price [Float] Required for limit and stop_limit orders, except that multi-leg price_effect even implies zero. Must be omitted or null for market and stop orders. For multi-leg orders this is the net strategy price. Negative prices are accepted only for futures-family orders, subject to brokerage support.
|
|
992
|
+
# @param stop_price [Float] Required for stop and stop_limit orders. Must be omitted or null for market and limit orders. Must be positive for equity/option orders; futures-family trigger prices are subject to brokerage support.
|
|
993
|
+
# @param price_effect [SimpleTradeFormPriceEffect] Only applicable to multi-leg limit and stop_limit orders. Requirements and supported values depend on the brokerage; tastytrade requires credit or debit. even implies a zero limit_price, which may be omitted and must be zero if supplied. Single-leg price effects are derived from the action.
|
|
994
|
+
# @param client_order_id [String] Optional canonical UUID, forwarded where the existing execution path supports it and for tastytrade futures orders. Requires the existing client-order-ID enablement; when disabled the value is ignored. Brokerage behavior on duplicates varies; SnapTrade does not enforce uniqueness. Tastytrade uses this as external-identifier for correlation and does not deduplicate submissions.
|
|
995
|
+
# @param expiry_date [Time] ISO 8601 expiry timestamp, required for gtd and invalid with other durations. A missing timezone is treated as UTC. Supported only through existing single-leg Public and Sandbox execution paths.
|
|
996
|
+
# @param notional_value [Float] Positive order value, supported only for a single-equity market order on eligible brokerages and partners. Mutually exclusive with leg units. Omit or set units to null when supplied.
|
|
997
|
+
# @param trading_session [SimpleTradeFormTradingSession] extended uses existing single-leg equity/option brokerage support and requires extended-hours enablement. Futures and multi-leg orders only accept regular.
|
|
998
|
+
# @param body [SimpleTradeForm]
|
|
999
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
1000
|
+
def place_simple_order_with_http_info(order_type:, time_in_force:, legs:, account_id:, user_id:, user_secret:, limit_price: SENTINEL, stop_price: SENTINEL, price_effect: SENTINEL, client_order_id: SENTINEL, expiry_date: SENTINEL, notional_value: SENTINEL, trading_session: 'regular', extra: {})
|
|
1001
|
+
_body = {}
|
|
1002
|
+
_body[:order_type] = order_type if order_type != SENTINEL
|
|
1003
|
+
_body[:time_in_force] = time_in_force if time_in_force != SENTINEL
|
|
1004
|
+
_body[:legs] = legs if legs != SENTINEL
|
|
1005
|
+
_body[:limit_price] = limit_price if limit_price != SENTINEL
|
|
1006
|
+
_body[:stop_price] = stop_price if stop_price != SENTINEL
|
|
1007
|
+
_body[:price_effect] = price_effect if price_effect != SENTINEL
|
|
1008
|
+
_body[:client_order_id] = client_order_id if client_order_id != SENTINEL
|
|
1009
|
+
_body[:expiry_date] = expiry_date if expiry_date != SENTINEL
|
|
1010
|
+
_body[:notional_value] = notional_value if notional_value != SENTINEL
|
|
1011
|
+
_body[:trading_session] = trading_session if trading_session != SENTINEL
|
|
1012
|
+
simple_trade_form = _body
|
|
1013
|
+
place_simple_order_with_http_info_impl(account_id, user_id, user_secret, simple_trade_form, extra)
|
|
1014
|
+
end
|
|
1015
|
+
|
|
1016
|
+
# Place a simple order (beta)
|
|
1017
|
+
# **Beta.** Places a single-leg or multi-leg order using a common request format for equities, equity options, futures, and future options. This endpoint is experimental; breaking changes are possible during the experimental phase. Equity and equity-option orders use the existing brokerage trading capabilities. Futures and future options are currently supported only on tastytrade. Order types, time in force, optional fields, and strategy combinations remain subject to brokerage support. See the [brokerage trading support page](https://support.snaptrade.com/brokerages). An order may contain equity/option legs or future/future_option legs, but cannot mix those two families. Equity/option strategies must share the same underlying symbol. Each strategy is submitted as one brokerage order; unsupported strategies are never split into independent orders. Tastytrade supports single-leg outright futures and up to four future-option legs, and does not support multi-leg market orders. All string choices use lower snake_case and are case-sensitive. Symbols retain their native format: equity tickers, OCC equity-option symbols, or the exact tastytrade BrokerageInstrument ticker for futures and future options, including any spaces. A successful response contains only the brokerage order ID. Use the existing order endpoints to retrieve order details.
|
|
1018
|
+
# @param account_id [String] The ID of the account to execute the trade on.
|
|
1019
|
+
# @param user_id [String]
|
|
1020
|
+
# @param user_secret [String]
|
|
1021
|
+
# @param simple_trade_form [SimpleTradeForm]
|
|
1022
|
+
# @param [Hash] opts the optional parameters
|
|
1023
|
+
# @return [SimpleTradeResponse]
|
|
1024
|
+
private def place_simple_order_impl(account_id, user_id, user_secret, simple_trade_form, opts = {})
|
|
1025
|
+
data, _status_code, _headers = place_simple_order_with_http_info(account_id, user_id, user_secret, simple_trade_form, opts)
|
|
1026
|
+
data
|
|
1027
|
+
end
|
|
1028
|
+
|
|
1029
|
+
# Place a simple order (beta)
|
|
1030
|
+
# **Beta.** Places a single-leg or multi-leg order using a common request format for equities, equity options, futures, and future options. This endpoint is experimental; breaking changes are possible during the experimental phase. Equity and equity-option orders use the existing brokerage trading capabilities. Futures and future options are currently supported only on tastytrade. Order types, time in force, optional fields, and strategy combinations remain subject to brokerage support. See the [brokerage trading support page](https://support.snaptrade.com/brokerages). An order may contain equity/option legs or future/future_option legs, but cannot mix those two families. Equity/option strategies must share the same underlying symbol. Each strategy is submitted as one brokerage order; unsupported strategies are never split into independent orders. Tastytrade supports single-leg outright futures and up to four future-option legs, and does not support multi-leg market orders. All string choices use lower snake_case and are case-sensitive. Symbols retain their native format: equity tickers, OCC equity-option symbols, or the exact tastytrade BrokerageInstrument ticker for futures and future options, including any spaces. A successful response contains only the brokerage order ID. Use the existing order endpoints to retrieve order details.
|
|
1031
|
+
# @param account_id [String] The ID of the account to execute the trade on.
|
|
1032
|
+
# @param user_id [String]
|
|
1033
|
+
# @param user_secret [String]
|
|
1034
|
+
# @param simple_trade_form [SimpleTradeForm]
|
|
1035
|
+
# @param [Hash] opts the optional parameters
|
|
1036
|
+
# @return [Array<(SimpleTradeResponse, Integer, Hash)>] SimpleTradeResponse data, response status code and response headers
|
|
1037
|
+
private def place_simple_order_with_http_info_impl(account_id, user_id, user_secret, simple_trade_form, opts = {})
|
|
1038
|
+
if @api_client.config.debugging
|
|
1039
|
+
@api_client.config.logger.debug 'Calling API: ExperimentalEndpointsApi.place_simple_order ...'
|
|
1040
|
+
end
|
|
1041
|
+
# verify the required parameter 'account_id' is set
|
|
1042
|
+
if @api_client.config.client_side_validation && account_id.nil?
|
|
1043
|
+
fail ArgumentError, "Missing the required parameter 'account_id' when calling ExperimentalEndpointsApi.place_simple_order"
|
|
1044
|
+
end
|
|
1045
|
+
# verify the required parameter 'user_id' is set
|
|
1046
|
+
if @api_client.config.client_side_validation && user_id.nil?
|
|
1047
|
+
fail ArgumentError, "Missing the required parameter 'user_id' when calling ExperimentalEndpointsApi.place_simple_order"
|
|
1048
|
+
end
|
|
1049
|
+
# verify the required parameter 'user_secret' is set
|
|
1050
|
+
if @api_client.config.client_side_validation && user_secret.nil?
|
|
1051
|
+
fail ArgumentError, "Missing the required parameter 'user_secret' when calling ExperimentalEndpointsApi.place_simple_order"
|
|
1052
|
+
end
|
|
1053
|
+
# verify the required parameter 'simple_trade_form' is set
|
|
1054
|
+
if @api_client.config.client_side_validation && simple_trade_form.nil?
|
|
1055
|
+
fail ArgumentError, "Missing the required parameter 'simple_trade_form' when calling ExperimentalEndpointsApi.place_simple_order"
|
|
1056
|
+
end
|
|
1057
|
+
# resource path
|
|
1058
|
+
local_var_path = '/accounts/{accountId}/trading/simple'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
|
|
1059
|
+
|
|
1060
|
+
# query parameters
|
|
1061
|
+
query_params = opts[:query_params] || {}
|
|
1062
|
+
query_params[:'userId'] = user_id
|
|
1063
|
+
query_params[:'userSecret'] = user_secret
|
|
1064
|
+
|
|
1065
|
+
# header parameters
|
|
1066
|
+
header_params = opts[:header_params] || {}
|
|
1067
|
+
# HTTP header 'Accept' (if needed)
|
|
1068
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
1069
|
+
# HTTP header 'Content-Type'
|
|
1070
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
|
1071
|
+
if !content_type.nil?
|
|
1072
|
+
header_params['Content-Type'] = content_type
|
|
1073
|
+
end
|
|
1074
|
+
|
|
1075
|
+
# form parameters
|
|
1076
|
+
form_params = opts[:form_params] || {}
|
|
1077
|
+
|
|
1078
|
+
# http body (model)
|
|
1079
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(simple_trade_form)
|
|
1080
|
+
|
|
1081
|
+
# return_type
|
|
1082
|
+
return_type = opts[:debug_return_type] || 'SimpleTradeResponse'
|
|
1083
|
+
|
|
1084
|
+
# auth_names
|
|
1085
|
+
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
|
1086
|
+
|
|
1087
|
+
new_options = opts.merge(
|
|
1088
|
+
:operation => :"ExperimentalEndpointsApi.place_simple_order",
|
|
1089
|
+
:header_params => header_params,
|
|
1090
|
+
:query_params => query_params,
|
|
1091
|
+
:form_params => form_params,
|
|
1092
|
+
:body => post_body,
|
|
1093
|
+
:auth_names => auth_names,
|
|
1094
|
+
:return_type => return_type
|
|
1095
|
+
)
|
|
1096
|
+
|
|
1097
|
+
data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
|
|
1098
|
+
if @api_client.config.debugging
|
|
1099
|
+
@api_client.config.logger.debug "API called: ExperimentalEndpointsApi#place_simple_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
1100
|
+
end
|
|
1101
|
+
return data, status_code, headers, response
|
|
1102
|
+
end
|
|
927
1103
|
end
|
|
928
1104
|
|
|
929
1105
|
# top-level client access to avoid having the user to insantiate their own API instances
|