snaptrade 3.0.51 → 3.0.53
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 +28 -12
- data/lib/snaptrade/api/account_information_api.rb +4 -4
- data/lib/snaptrade/api/experimental_endpoints_api.rb +18 -10
- data/lib/snaptrade/api/trading_api.rb +4 -4
- data/lib/snaptrade/models/account_order.rb +8 -9
- data/lib/snaptrade/models/account_position.rb +1 -1
- data/lib/snaptrade/models/cash_instrument.rb +1 -1
- data/lib/snaptrade/models/manual_trade_form.rb +1 -1
- data/lib/snaptrade/models/manual_trade_form_with_options.rb +1 -1
- data/lib/snaptrade/models/priced_in_instrument.rb +53 -0
- data/lib/snaptrade/models/simple_trade_form.rb +2 -2
- data/lib/snaptrade/models/simple_trade_instrument.rb +1 -1
- data/lib/snaptrade/models/{manual_trade_form_notional_value.rb → trading_place_simple_order409_response.rb} +32 -12
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +2 -1
- data/spec/api/account_information_api_spec.rb +1 -1
- data/spec/api/experimental_endpoints_api_spec.rb +1 -1
- data/spec/models/account_order_spec.rb +1 -1
- data/spec/models/{manual_trade_form_notional_value_spec.rb → priced_in_instrument_spec.rb} +21 -6
- data/spec/models/trading_place_simple_order409_response_spec.rb +41 -0
- metadata +281 -278
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e741d2cc13ed54e51eae39424c976ccaae36998294c51166e6793b174cf54b3a
|
|
4
|
+
data.tar.gz: b6ac69e291f5c11a5513f551d801141dd14b40a4a5cb92bd94b76bf95215bc65
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 463b8172debd276275ec4e23a7d156bb760fb1e90815e08f2578e8d50f315d356fd8911d94fd32babd01279a2c497780beb6d80e0e9ffe0adcdde90e6a91d9b0
|
|
7
|
+
data.tar.gz: 9528ef178227e6eba7062e2d5d382dea4d38f22118e34aae18204fe0e867dc1bb82c47754956ab70fae51f6710a0b38669cbe77db6093d3f1fcc7ab2e3af4de1
|
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.53)
|
|
67
67
|
[](https://snaptrade.com/)
|
|
68
68
|
|
|
69
69
|
</div>
|
|
@@ -147,7 +147,7 @@ See https://docs.snaptrade.com/docs/ratelimiting.
|
|
|
147
147
|
Add to Gemfile:
|
|
148
148
|
|
|
149
149
|
```ruby
|
|
150
|
-
gem 'snaptrade', '~> 3.0.
|
|
150
|
+
gem 'snaptrade', '~> 3.0.53'
|
|
151
151
|
```
|
|
152
152
|
|
|
153
153
|
## Getting Started<a id="getting-started"></a>
|
|
@@ -407,7 +407,7 @@ The `results` list can contain multiple instrument types in the same response, i
|
|
|
407
407
|
|
|
408
408
|
**Beta:** future option positions (`instrument.kind: future_option`) are in beta. They are currently returned only for tastytrade and Interactive Brokers connections, and only for partners they have been enabled for — please contact the SnapTrade team to enable them. The `FutureOptionInstrument` schema may change.
|
|
409
409
|
|
|
410
|
-
Positions counted in account cash balance or buying power include `cash_equivalent: true`. `stock`, `adr`, `etf`, `mutualfund`,
|
|
410
|
+
Positions counted in account cash balance or buying power include `cash_equivalent: true`. Security positions (`stock`, `adr`, `etf`, `mutualfund`, `cef`, `crypto`, `bond`, and `other`) may include `tax_lots` when tax lot data is enabled for the account; derivative, CFD, tokenized asset, and cash positions never do. To see which institutions support tax lot data, please see our [supported institutions doc](https://support.snaptrade.com/brokerages).
|
|
411
411
|
|
|
412
412
|
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.
|
|
413
413
|
|
|
@@ -1720,11 +1720,15 @@ p result
|
|
|
1720
1720
|
|
|
1721
1721
|
**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.
|
|
1722
1722
|
|
|
1723
|
-
Equity and equity-option orders use the existing brokerage trading capabilities. Futures and future options are
|
|
1723
|
+
Equity and equity-option orders use the existing brokerage trading capabilities. Futures are supported on tastytrade, Webull US, and TradeStation (live and SIM); future options are supported on tastytrade and TradeStation (live and SIM). 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).
|
|
1724
1724
|
|
|
1725
1725
|
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.
|
|
1726
1726
|
|
|
1727
|
-
|
|
1727
|
+
Webull US supports single-leg futures orders with buy or sell actions and positive whole-contract quantities. Supported order types are market, limit, stop, and stop_limit, with day or gtc duration. Futures options, multi-leg futures, trailing stops, and Webull Canada futures trading are not supported. Webull determines contract availability, margin requirements, and valid price increments.
|
|
1728
|
+
|
|
1729
|
+
TradeStation and TradeStation SIM support single-leg futures and futures-option orders in Futures accounts, with positive whole-contract quantities. Supported order types are market, limit, stop, and stop_limit, with day, gtc, ioc, or fok duration, subject to the contract and route's supported combinations. Futures use buy/sell; futures options use the open/close option actions. Multi-leg futures-family strategies are not supported. Prices are forwarded without rounding; TradeStation determines contract availability, permissions, margin requirements, and valid price increments.
|
|
1730
|
+
|
|
1731
|
+
All string choices use lower snake_case and are case-sensitive. Symbols retain their native format: equity tickers, OCC equity-option symbols, or brokerage-native futures symbols. For tastytrade, use the exact BrokerageInstrument ticker, including any spaces. For Webull US, use a specific unprefixed futures contract symbol such as ESZ6; slash-prefixed aliases, continuous/root-only symbols, and whitespace are not accepted. For TradeStation, use a specific two-digit-year contract such as ESZ26 or @ESZ26, or a futures-option symbol such as `ESZ26 C6000`, preserving the space and any session alias. The optional @ prefix is supported for dated futures contracts and is forwarded unchanged. Slash-prefixed aliases and root-only continuous symbols such as @ES are not accepted. A futures symbol does not need to be present in SnapTrade's local instrument catalog to submit an order.
|
|
1728
1732
|
|
|
1729
1733
|
A successful response contains only the brokerage order ID. Use the existing order endpoints to retrieve order details.
|
|
1730
1734
|
|
|
@@ -1766,7 +1770,9 @@ p result
|
|
|
1766
1770
|
Order duration, subject to brokerage and execution-path support. gtd requires
|
|
1767
1771
|
expiry_date and a non-market single-leg equity/option order. Existing single-leg
|
|
1768
1772
|
option routing does not support ioc. Futures and multi-leg orders do not support
|
|
1769
|
-
gtd through this endpoint.
|
|
1773
|
+
gtd through this endpoint. Webull US futures only support day and gtc.
|
|
1774
|
+
TradeStation futures and futures options accept day, gtc, ioc, and fok, subject
|
|
1775
|
+
to the contract and route's supported combinations.
|
|
1770
1776
|
|
|
1771
1777
|
##### legs: Array<[`SimpleTradeLeg`](./lib/snaptrade/models/simple_trade_leg.rb)><a id="legs-array"></a>
|
|
1772
1778
|
Legs of one brokerage order. Use equity/option legs or future/future_option
|
|
@@ -1797,10 +1803,20 @@ supplied. Single-leg price effects are derived from the action.
|
|
|
1797
1803
|
|
|
1798
1804
|
##### client_order_id: [`String`](./lib/snaptrade/models/string.rb)<a id="client_order_id-stringlibsnaptrademodelsstringrb"></a>
|
|
1799
1805
|
Optional canonical UUID, forwarded where the existing execution path supports it
|
|
1800
|
-
and for tastytrade futures orders. Requires
|
|
1801
|
-
enablement; when disabled the value is ignored.
|
|
1802
|
-
varies
|
|
1803
|
-
|
|
1806
|
+
and for tastytrade, Webull US, and TradeStation futures-family orders. Requires
|
|
1807
|
+
the existing client-order-ID enablement; when disabled the value is ignored.
|
|
1808
|
+
Brokerage behavior on duplicates varies. SnapTrade does not enforce uniqueness,
|
|
1809
|
+
except for requests authenticated with an OAuth access token, where a
|
|
1810
|
+
client_order_id the user has already used returns 409. Tastytrade uses this as
|
|
1811
|
+
external-identifier for correlation and does not deduplicate submissions. For
|
|
1812
|
+
Webull US futures, SnapTrade converts the supplied UUID (or its generated order
|
|
1813
|
+
UUID) to lowercase 32-character hexadecimal without hyphens. The original
|
|
1814
|
+
supplied UUID remains in SnapTrade's trade audit; the converted value is
|
|
1815
|
+
returned as brokerage_order_id for subsequent order reads. For TradeStation live
|
|
1816
|
+
and SIM, SnapTrade encodes the supplied UUID (or its generated order UUID) as
|
|
1817
|
+
22-character URL-safe base64 without padding and sends it as OrderConfirmID for
|
|
1818
|
+
brokerage duplicate prevention; the response contains TradeStation's separate
|
|
1819
|
+
order ID.
|
|
1804
1820
|
|
|
1805
1821
|
##### expiry_date: `Time`<a id="expiry_date-time"></a>
|
|
1806
1822
|
ISO 8601 expiry timestamp, required for gtd and invalid with other durations. A
|
|
@@ -2378,7 +2394,7 @@ The limit price for `Limit` and `StopLimit` orders.
|
|
|
2378
2394
|
The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
|
|
2379
2395
|
|
|
2380
2396
|
##### units: [`Float`](./lib/snaptrade/models/float.rb)<a id="units-floatlibsnaptrademodelsfloatrb"></a>
|
|
2381
|
-
##### notional_value: [`
|
|
2397
|
+
##### notional_value: [`NotionalValue`](./lib/snaptrade/models/notional_value.rb)<a id="notional_value-notionalvaluelibsnaptrademodelsnotional_valuerb"></a>
|
|
2382
2398
|
#### 🔄 Return<a id="🔄-return"></a>
|
|
2383
2399
|
|
|
2384
2400
|
[ManualTradeAndImpact](./lib/snaptrade/models/manual_trade_and_impact.rb)
|
|
@@ -2749,7 +2765,7 @@ be a decimal for fractional orders. Must be `null` if `notional_value` is
|
|
|
2749
2765
|
provided. If placing an Option order, this field represents the number of
|
|
2750
2766
|
contracts to buy or sell. (e.g., 1 contract = 100 shares).
|
|
2751
2767
|
|
|
2752
|
-
##### notional_value: [`
|
|
2768
|
+
##### notional_value: [`NotionalValue`](./lib/snaptrade/models/notional_value.rb)<a id="notional_value-notionalvaluelibsnaptrademodelsnotional_valuerb"></a>
|
|
2753
2769
|
##### client_order_id: [`String`](./lib/snaptrade/models/string.rb)<a id="client_order_id-stringlibsnaptrademodelsstringrb"></a>
|
|
2754
2770
|
#### 🔄 Return<a id="🔄-return"></a>
|
|
2755
2771
|
|
|
@@ -540,7 +540,7 @@ module SnapTrade
|
|
|
540
540
|
#
|
|
541
541
|
# **Beta:** future option positions (`instrument.kind: future_option`) are in beta. They are currently returned only for tastytrade and Interactive Brokers connections, and only for partners they have been enabled for — please contact the SnapTrade team to enable them. The `FutureOptionInstrument` schema may change.
|
|
542
542
|
#
|
|
543
|
-
# Positions counted in account cash balance or buying power include `cash_equivalent: true`. `stock`, `adr`, `etf`, `mutualfund`,
|
|
543
|
+
# Positions counted in account cash balance or buying power include `cash_equivalent: true`. Security positions (`stock`, `adr`, `etf`, `mutualfund`, `cef`, `crypto`, `bond`, and `other`) may include `tax_lots` when tax lot data is enabled for the account; derivative, CFD, tokenized asset, and cash positions never do. To see which institutions support tax lot data, please see our [supported institutions doc](https://support.snaptrade.com/brokerages).
|
|
544
544
|
#
|
|
545
545
|
# 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.
|
|
546
546
|
#
|
|
@@ -561,7 +561,7 @@ module SnapTrade
|
|
|
561
561
|
#
|
|
562
562
|
# **Beta:** future option positions (`instrument.kind: future_option`) are in beta. They are currently returned only for tastytrade and Interactive Brokers connections, and only for partners they have been enabled for — please contact the SnapTrade team to enable them. The `FutureOptionInstrument` schema may change.
|
|
563
563
|
#
|
|
564
|
-
# Positions counted in account cash balance or buying power include `cash_equivalent: true`. `stock`, `adr`, `etf`, `mutualfund`,
|
|
564
|
+
# Positions counted in account cash balance or buying power include `cash_equivalent: true`. Security positions (`stock`, `adr`, `etf`, `mutualfund`, `cef`, `crypto`, `bond`, and `other`) may include `tax_lots` when tax lot data is enabled for the account; derivative, CFD, tokenized asset, and cash positions never do. To see which institutions support tax lot data, please see our [supported institutions doc](https://support.snaptrade.com/brokerages).
|
|
565
565
|
#
|
|
566
566
|
# 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.
|
|
567
567
|
#
|
|
@@ -574,7 +574,7 @@ module SnapTrade
|
|
|
574
574
|
end
|
|
575
575
|
|
|
576
576
|
# List all account positions
|
|
577
|
-
# Returns a list of all positions in the specified account. The `results` list can contain multiple instrument types in the same response, including stocks, ADRs, ETFs, mutual funds, closed-end funds, bonds, crypto, futures, option positions, future option positions, CFD positions, and tokenized asset positions. Use the `instrument.kind` discriminator to determine the schema for each position's `instrument`. **Beta:** future option positions (`instrument.kind: future_option`) are in beta. They are currently returned only for tastytrade and Interactive Brokers connections, and only for partners they have been enabled for — please contact the SnapTrade team to enable them. The `FutureOptionInstrument` schema may change. Positions counted in account cash balance or buying power include `cash_equivalent: true`. `stock`, `adr`, `etf`, `mutualfund`,
|
|
577
|
+
# Returns a list of all positions in the specified account. The `results` list can contain multiple instrument types in the same response, including stocks, ADRs, ETFs, mutual funds, closed-end funds, bonds, crypto, futures, option positions, future option positions, CFD positions, and tokenized asset positions. Use the `instrument.kind` discriminator to determine the schema for each position's `instrument`. **Beta:** future option positions (`instrument.kind: future_option`) are in beta. They are currently returned only for tastytrade and Interactive Brokers connections, and only for partners they have been enabled for — please contact the SnapTrade team to enable them. The `FutureOptionInstrument` schema may change. Positions counted in account cash balance or buying power include `cash_equivalent: true`. Security positions (`stock`, `adr`, `etf`, `mutualfund`, `cef`, `crypto`, `bond`, and `other`) may include `tax_lots` when tax lot data is enabled for the account; derivative, CFD, tokenized asset, and cash positions never do. To see which institutions support tax lot data, please see our [supported institutions doc](https://support.snaptrade.com/brokerages). If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
|
|
578
578
|
# @param user_id [String]
|
|
579
579
|
# @param user_secret [String]
|
|
580
580
|
# @param account_id [String]
|
|
@@ -586,7 +586,7 @@ module SnapTrade
|
|
|
586
586
|
end
|
|
587
587
|
|
|
588
588
|
# List all account positions
|
|
589
|
-
# Returns a list of all positions in the specified account. The `results` list can contain multiple instrument types in the same response, including stocks, ADRs, ETFs, mutual funds, closed-end funds, bonds, crypto, futures, option positions, future option positions, CFD positions, and tokenized asset positions. Use the `instrument.kind` discriminator to determine the schema for each position's `instrument`. **Beta:** future option positions (`instrument.kind: future_option`) are in beta. They are currently returned only for tastytrade and Interactive Brokers connections, and only for partners they have been enabled for — please contact the SnapTrade team to enable them. The `FutureOptionInstrument` schema may change. Positions counted in account cash balance or buying power include `cash_equivalent: true`. `stock`, `adr`, `etf`, `mutualfund`,
|
|
589
|
+
# Returns a list of all positions in the specified account. The `results` list can contain multiple instrument types in the same response, including stocks, ADRs, ETFs, mutual funds, closed-end funds, bonds, crypto, futures, option positions, future option positions, CFD positions, and tokenized asset positions. Use the `instrument.kind` discriminator to determine the schema for each position's `instrument`. **Beta:** future option positions (`instrument.kind: future_option`) are in beta. They are currently returned only for tastytrade and Interactive Brokers connections, and only for partners they have been enabled for — please contact the SnapTrade team to enable them. The `FutureOptionInstrument` schema may change. Positions counted in account cash balance or buying power include `cash_equivalent: true`. Security positions (`stock`, `adr`, `etf`, `mutualfund`, `cef`, `crypto`, `bond`, and `other`) may include `tax_lots` when tax lot data is enabled for the account; derivative, CFD, tokenized asset, and cash positions never do. To see which institutions support tax lot data, please see our [supported institutions doc](https://support.snaptrade.com/brokerages). If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
|
|
590
590
|
# @param user_id [String]
|
|
591
591
|
# @param user_secret [String]
|
|
592
592
|
# @param account_id [String]
|
|
@@ -845,16 +845,20 @@ module SnapTrade
|
|
|
845
845
|
#
|
|
846
846
|
# **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.
|
|
847
847
|
#
|
|
848
|
-
# Equity and equity-option orders use the existing brokerage trading capabilities. Futures and future options are
|
|
848
|
+
# Equity and equity-option orders use the existing brokerage trading capabilities. Futures are supported on tastytrade, Webull US, and TradeStation (live and SIM); future options are supported on tastytrade and TradeStation (live and SIM). 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).
|
|
849
849
|
#
|
|
850
850
|
# 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.
|
|
851
851
|
#
|
|
852
|
-
#
|
|
852
|
+
# Webull US supports single-leg futures orders with buy or sell actions and positive whole-contract quantities. Supported order types are market, limit, stop, and stop_limit, with day or gtc duration. Futures options, multi-leg futures, trailing stops, and Webull Canada futures trading are not supported. Webull determines contract availability, margin requirements, and valid price increments.
|
|
853
|
+
#
|
|
854
|
+
# TradeStation and TradeStation SIM support single-leg futures and futures-option orders in Futures accounts, with positive whole-contract quantities. Supported order types are market, limit, stop, and stop_limit, with day, gtc, ioc, or fok duration, subject to the contract and route's supported combinations. Futures use buy/sell; futures options use the open/close option actions. Multi-leg futures-family strategies are not supported. Prices are forwarded without rounding; TradeStation determines contract availability, permissions, margin requirements, and valid price increments.
|
|
855
|
+
#
|
|
856
|
+
# All string choices use lower snake_case and are case-sensitive. Symbols retain their native format: equity tickers, OCC equity-option symbols, or brokerage-native futures symbols. For tastytrade, use the exact BrokerageInstrument ticker, including any spaces. For Webull US, use a specific unprefixed futures contract symbol such as ESZ6; slash-prefixed aliases, continuous/root-only symbols, and whitespace are not accepted. For TradeStation, use a specific two-digit-year contract such as ESZ26 or @ESZ26, or a futures-option symbol such as `ESZ26 C6000`, preserving the space and any session alias. The optional @ prefix is supported for dated futures contracts and is forwarded unchanged. Slash-prefixed aliases and root-only continuous symbols such as @ES are not accepted. A futures symbol does not need to be present in SnapTrade's local instrument catalog to submit an order.
|
|
853
857
|
#
|
|
854
858
|
# A successful response contains only the brokerage order ID. Use the existing order endpoints to retrieve order details.
|
|
855
859
|
#
|
|
856
860
|
# @param order_type [SimpleTradeFormOrderType]
|
|
857
|
-
# @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.
|
|
861
|
+
# @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. Webull US futures only support day and gtc. TradeStation futures and futures options accept day, gtc, ioc, and fok, subject to the contract and route's supported combinations.
|
|
858
862
|
# @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.
|
|
859
863
|
# @param account_id [String] The ID of the account to execute the trade on.
|
|
860
864
|
# @param user_id [String]
|
|
@@ -862,7 +866,7 @@ module SnapTrade
|
|
|
862
866
|
# @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.
|
|
863
867
|
# @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.
|
|
864
868
|
# @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.
|
|
865
|
-
# @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
|
|
869
|
+
# @param client_order_id [String] Optional canonical UUID, forwarded where the existing execution path supports it and for tastytrade, Webull US, and TradeStation futures-family orders. Requires the existing client-order-ID enablement; when disabled the value is ignored. Brokerage behavior on duplicates varies. SnapTrade does not enforce uniqueness, except for requests authenticated with an OAuth access token, where a client_order_id the user has already used returns 409. Tastytrade uses this as external-identifier for correlation and does not deduplicate submissions. For Webull US futures, SnapTrade converts the supplied UUID (or its generated order UUID) to lowercase 32-character hexadecimal without hyphens. The original supplied UUID remains in SnapTrade's trade audit; the converted value is returned as brokerage_order_id for subsequent order reads. For TradeStation live and SIM, SnapTrade encodes the supplied UUID (or its generated order UUID) as 22-character URL-safe base64 without padding and sends it as OrderConfirmID for brokerage duplicate prevention; the response contains TradeStation's separate order ID.
|
|
866
870
|
# @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.
|
|
867
871
|
# @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.
|
|
868
872
|
# @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.
|
|
@@ -889,16 +893,20 @@ module SnapTrade
|
|
|
889
893
|
#
|
|
890
894
|
# **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.
|
|
891
895
|
#
|
|
892
|
-
# Equity and equity-option orders use the existing brokerage trading capabilities. Futures and future options are
|
|
896
|
+
# Equity and equity-option orders use the existing brokerage trading capabilities. Futures are supported on tastytrade, Webull US, and TradeStation (live and SIM); future options are supported on tastytrade and TradeStation (live and SIM). 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).
|
|
893
897
|
#
|
|
894
898
|
# 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.
|
|
895
899
|
#
|
|
896
|
-
#
|
|
900
|
+
# Webull US supports single-leg futures orders with buy or sell actions and positive whole-contract quantities. Supported order types are market, limit, stop, and stop_limit, with day or gtc duration. Futures options, multi-leg futures, trailing stops, and Webull Canada futures trading are not supported. Webull determines contract availability, margin requirements, and valid price increments.
|
|
901
|
+
#
|
|
902
|
+
# TradeStation and TradeStation SIM support single-leg futures and futures-option orders in Futures accounts, with positive whole-contract quantities. Supported order types are market, limit, stop, and stop_limit, with day, gtc, ioc, or fok duration, subject to the contract and route's supported combinations. Futures use buy/sell; futures options use the open/close option actions. Multi-leg futures-family strategies are not supported. Prices are forwarded without rounding; TradeStation determines contract availability, permissions, margin requirements, and valid price increments.
|
|
903
|
+
#
|
|
904
|
+
# All string choices use lower snake_case and are case-sensitive. Symbols retain their native format: equity tickers, OCC equity-option symbols, or brokerage-native futures symbols. For tastytrade, use the exact BrokerageInstrument ticker, including any spaces. For Webull US, use a specific unprefixed futures contract symbol such as ESZ6; slash-prefixed aliases, continuous/root-only symbols, and whitespace are not accepted. For TradeStation, use a specific two-digit-year contract such as ESZ26 or @ESZ26, or a futures-option symbol such as `ESZ26 C6000`, preserving the space and any session alias. The optional @ prefix is supported for dated futures contracts and is forwarded unchanged. Slash-prefixed aliases and root-only continuous symbols such as @ES are not accepted. A futures symbol does not need to be present in SnapTrade's local instrument catalog to submit an order.
|
|
897
905
|
#
|
|
898
906
|
# A successful response contains only the brokerage order ID. Use the existing order endpoints to retrieve order details.
|
|
899
907
|
#
|
|
900
908
|
# @param order_type [SimpleTradeFormOrderType]
|
|
901
|
-
# @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.
|
|
909
|
+
# @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. Webull US futures only support day and gtc. TradeStation futures and futures options accept day, gtc, ioc, and fok, subject to the contract and route's supported combinations.
|
|
902
910
|
# @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.
|
|
903
911
|
# @param account_id [String] The ID of the account to execute the trade on.
|
|
904
912
|
# @param user_id [String]
|
|
@@ -906,7 +914,7 @@ module SnapTrade
|
|
|
906
914
|
# @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.
|
|
907
915
|
# @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.
|
|
908
916
|
# @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.
|
|
909
|
-
# @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
|
|
917
|
+
# @param client_order_id [String] Optional canonical UUID, forwarded where the existing execution path supports it and for tastytrade, Webull US, and TradeStation futures-family orders. Requires the existing client-order-ID enablement; when disabled the value is ignored. Brokerage behavior on duplicates varies. SnapTrade does not enforce uniqueness, except for requests authenticated with an OAuth access token, where a client_order_id the user has already used returns 409. Tastytrade uses this as external-identifier for correlation and does not deduplicate submissions. For Webull US futures, SnapTrade converts the supplied UUID (or its generated order UUID) to lowercase 32-character hexadecimal without hyphens. The original supplied UUID remains in SnapTrade's trade audit; the converted value is returned as brokerage_order_id for subsequent order reads. For TradeStation live and SIM, SnapTrade encodes the supplied UUID (or its generated order UUID) as 22-character URL-safe base64 without padding and sends it as OrderConfirmID for brokerage duplicate prevention; the response contains TradeStation's separate order ID.
|
|
910
918
|
# @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.
|
|
911
919
|
# @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.
|
|
912
920
|
# @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.
|
|
@@ -929,7 +937,7 @@ module SnapTrade
|
|
|
929
937
|
end
|
|
930
938
|
|
|
931
939
|
# Place a simple order (beta)
|
|
932
|
-
# **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
|
|
940
|
+
# **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 are supported on tastytrade, Webull US, and TradeStation (live and SIM); future options are supported on tastytrade and TradeStation (live and SIM). 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. Webull US supports single-leg futures orders with buy or sell actions and positive whole-contract quantities. Supported order types are market, limit, stop, and stop_limit, with day or gtc duration. Futures options, multi-leg futures, trailing stops, and Webull Canada futures trading are not supported. Webull determines contract availability, margin requirements, and valid price increments. TradeStation and TradeStation SIM support single-leg futures and futures-option orders in Futures accounts, with positive whole-contract quantities. Supported order types are market, limit, stop, and stop_limit, with day, gtc, ioc, or fok duration, subject to the contract and route's supported combinations. Futures use buy/sell; futures options use the open/close option actions. Multi-leg futures-family strategies are not supported. Prices are forwarded without rounding; TradeStation determines contract availability, permissions, margin requirements, and valid price increments. All string choices use lower snake_case and are case-sensitive. Symbols retain their native format: equity tickers, OCC equity-option symbols, or brokerage-native futures symbols. For tastytrade, use the exact BrokerageInstrument ticker, including any spaces. For Webull US, use a specific unprefixed futures contract symbol such as ESZ6; slash-prefixed aliases, continuous/root-only symbols, and whitespace are not accepted. For TradeStation, use a specific two-digit-year contract such as ESZ26 or @ESZ26, or a futures-option symbol such as `ESZ26 C6000`, preserving the space and any session alias. The optional @ prefix is supported for dated futures contracts and is forwarded unchanged. Slash-prefixed aliases and root-only continuous symbols such as @ES are not accepted. A futures symbol does not need to be present in SnapTrade's local instrument catalog to submit an order. A successful response contains only the brokerage order ID. Use the existing order endpoints to retrieve order details.
|
|
933
941
|
# @param account_id [String] The ID of the account to execute the trade on.
|
|
934
942
|
# @param user_id [String]
|
|
935
943
|
# @param user_secret [String]
|
|
@@ -942,7 +950,7 @@ module SnapTrade
|
|
|
942
950
|
end
|
|
943
951
|
|
|
944
952
|
# Place a simple order (beta)
|
|
945
|
-
# **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
|
|
953
|
+
# **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 are supported on tastytrade, Webull US, and TradeStation (live and SIM); future options are supported on tastytrade and TradeStation (live and SIM). 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. Webull US supports single-leg futures orders with buy or sell actions and positive whole-contract quantities. Supported order types are market, limit, stop, and stop_limit, with day or gtc duration. Futures options, multi-leg futures, trailing stops, and Webull Canada futures trading are not supported. Webull determines contract availability, margin requirements, and valid price increments. TradeStation and TradeStation SIM support single-leg futures and futures-option orders in Futures accounts, with positive whole-contract quantities. Supported order types are market, limit, stop, and stop_limit, with day, gtc, ioc, or fok duration, subject to the contract and route's supported combinations. Futures use buy/sell; futures options use the open/close option actions. Multi-leg futures-family strategies are not supported. Prices are forwarded without rounding; TradeStation determines contract availability, permissions, margin requirements, and valid price increments. All string choices use lower snake_case and are case-sensitive. Symbols retain their native format: equity tickers, OCC equity-option symbols, or brokerage-native futures symbols. For tastytrade, use the exact BrokerageInstrument ticker, including any spaces. For Webull US, use a specific unprefixed futures contract symbol such as ESZ6; slash-prefixed aliases, continuous/root-only symbols, and whitespace are not accepted. For TradeStation, use a specific two-digit-year contract such as ESZ26 or @ESZ26, or a futures-option symbol such as `ESZ26 C6000`, preserving the space and any session alias. The optional @ prefix is supported for dated futures contracts and is forwarded unchanged. Slash-prefixed aliases and root-only continuous symbols such as @ES are not accepted. A futures symbol does not need to be present in SnapTrade's local instrument catalog to submit an order. A successful response contains only the brokerage order ID. Use the existing order endpoints to retrieve order details.
|
|
946
954
|
# @param account_id [String] The ID of the account to execute the trade on.
|
|
947
955
|
# @param user_id [String]
|
|
948
956
|
# @param user_secret [String]
|
|
@@ -412,7 +412,7 @@ module SnapTrade
|
|
|
412
412
|
# @param price [Float] The limit price for `Limit` and `StopLimit` orders.
|
|
413
413
|
# @param stop [Float] The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
|
|
414
414
|
# @param units [Float]
|
|
415
|
-
# @param notional_value [
|
|
415
|
+
# @param notional_value [NotionalValue]
|
|
416
416
|
# @param body [ManualTradeForm]
|
|
417
417
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
418
418
|
def get_order_impact(account_id:, action:, universal_symbol_id:, order_type:, time_in_force:, user_id:, user_secret:, price: SENTINEL, stop: SENTINEL, units: SENTINEL, notional_value: SENTINEL, extra: {})
|
|
@@ -445,7 +445,7 @@ module SnapTrade
|
|
|
445
445
|
# @param price [Float] The limit price for `Limit` and `StopLimit` orders.
|
|
446
446
|
# @param stop [Float] The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
|
|
447
447
|
# @param units [Float]
|
|
448
|
-
# @param notional_value [
|
|
448
|
+
# @param notional_value [NotionalValue]
|
|
449
449
|
# @param body [ManualTradeForm]
|
|
450
450
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
451
451
|
def get_order_impact_with_http_info(account_id:, action:, universal_symbol_id:, order_type:, time_in_force:, user_id:, user_secret:, price: SENTINEL, stop: SENTINEL, units: SENTINEL, notional_value: SENTINEL, extra: {})
|
|
@@ -1150,7 +1150,7 @@ module SnapTrade
|
|
|
1150
1150
|
# @param price [Float] The limit price for `Limit` and `StopLimit` orders.
|
|
1151
1151
|
# @param stop [Float] The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
|
|
1152
1152
|
# @param units [Float] For Equity orders, this represents the number of shares for the order. This can be a decimal for fractional orders. Must be `null` if `notional_value` is provided. If placing an Option order, this field represents the number of contracts to buy or sell. (e.g., 1 contract = 100 shares).
|
|
1153
|
-
# @param notional_value [
|
|
1153
|
+
# @param notional_value [NotionalValue]
|
|
1154
1154
|
# @param client_order_id [String]
|
|
1155
1155
|
# @param body [ManualTradeFormWithOptions]
|
|
1156
1156
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
@@ -1195,7 +1195,7 @@ module SnapTrade
|
|
|
1195
1195
|
# @param price [Float] The limit price for `Limit` and `StopLimit` orders.
|
|
1196
1196
|
# @param stop [Float] The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
|
|
1197
1197
|
# @param units [Float] For Equity orders, this represents the number of shares for the order. This can be a decimal for fractional orders. Must be `null` if `notional_value` is provided. If placing an Option order, this field represents the number of contracts to buy or sell. (e.g., 1 contract = 100 shares).
|
|
1198
|
-
# @param notional_value [
|
|
1198
|
+
# @param notional_value [NotionalValue]
|
|
1199
1199
|
# @param client_order_id [String]
|
|
1200
1200
|
# @param body [ManualTradeFormWithOptions]
|
|
1201
1201
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
@@ -27,8 +27,7 @@ module SnapTrade
|
|
|
27
27
|
# When the order expires, for orders with a `time_in_force` of `GTD`.
|
|
28
28
|
attr_accessor :expiry_date
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
attr_accessor :price_currency
|
|
30
|
+
attr_accessor :priced_in
|
|
32
31
|
|
|
33
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.
|
|
34
33
|
attr_accessor :price_effect
|
|
@@ -70,7 +69,7 @@ module SnapTrade
|
|
|
70
69
|
:'order_type' => :'order_type',
|
|
71
70
|
:'time_in_force' => :'time_in_force',
|
|
72
71
|
:'expiry_date' => :'expiry_date',
|
|
73
|
-
:'
|
|
72
|
+
:'priced_in' => :'priced_in',
|
|
74
73
|
:'price_effect' => :'price_effect',
|
|
75
74
|
:'total_quantity' => :'total_quantity',
|
|
76
75
|
:'filled_quantity' => :'filled_quantity',
|
|
@@ -98,7 +97,7 @@ module SnapTrade
|
|
|
98
97
|
:'order_type' => :'OrderTypeConfiguration',
|
|
99
98
|
:'time_in_force' => :'AccountOrderTimeInForce',
|
|
100
99
|
:'expiry_date' => :'Time',
|
|
101
|
-
:'
|
|
100
|
+
:'priced_in' => :'PricedInInstrument',
|
|
102
101
|
:'price_effect' => :'PriceEffect',
|
|
103
102
|
:'total_quantity' => :'Float',
|
|
104
103
|
:'filled_quantity' => :'Float',
|
|
@@ -117,7 +116,7 @@ module SnapTrade
|
|
|
117
116
|
def self.openapi_nullable
|
|
118
117
|
Set.new([
|
|
119
118
|
:'expiry_date',
|
|
120
|
-
:'
|
|
119
|
+
:'priced_in',
|
|
121
120
|
:'total_quantity',
|
|
122
121
|
:'filled_quantity',
|
|
123
122
|
:'canceled_quantity',
|
|
@@ -165,8 +164,8 @@ module SnapTrade
|
|
|
165
164
|
self.expiry_date = attributes[:'expiry_date']
|
|
166
165
|
end
|
|
167
166
|
|
|
168
|
-
if attributes.key?(:'
|
|
169
|
-
self.
|
|
167
|
+
if attributes.key?(:'priced_in')
|
|
168
|
+
self.priced_in = attributes[:'priced_in']
|
|
170
169
|
end
|
|
171
170
|
|
|
172
171
|
if attributes.key?(:'price_effect')
|
|
@@ -288,7 +287,7 @@ module SnapTrade
|
|
|
288
287
|
order_type == o.order_type &&
|
|
289
288
|
time_in_force == o.time_in_force &&
|
|
290
289
|
expiry_date == o.expiry_date &&
|
|
291
|
-
|
|
290
|
+
priced_in == o.priced_in &&
|
|
292
291
|
price_effect == o.price_effect &&
|
|
293
292
|
total_quantity == o.total_quantity &&
|
|
294
293
|
filled_quantity == o.filled_quantity &&
|
|
@@ -311,7 +310,7 @@ module SnapTrade
|
|
|
311
310
|
# Calculates hash code according to all attributes.
|
|
312
311
|
# @return [Integer] Hash code
|
|
313
312
|
def hash
|
|
314
|
-
[brokerage_order_id, status, order_type, time_in_force, expiry_date,
|
|
313
|
+
[brokerage_order_id, status, order_type, time_in_force, expiry_date, priced_in, price_effect, total_quantity, filled_quantity, canceled_quantity, open_quantity, execution_price, time_placed, time_updated, time_executed, group, legs].hash
|
|
315
314
|
end
|
|
316
315
|
|
|
317
316
|
# Builds the object from hash
|
|
@@ -30,7 +30,7 @@ module SnapTrade
|
|
|
30
30
|
# Present for mutual fund positions and for other instrument kinds when true. A true value means the position is also counted in cash balance or buying power.
|
|
31
31
|
attr_accessor :cash_equivalent
|
|
32
32
|
|
|
33
|
-
# List of tax lots for the given position. Disabled by default; enable via the Customer Dashboard Add-ons page. When enabled, this field is included
|
|
33
|
+
# List of tax lots for the given position. Disabled by default; enable via the Customer Dashboard Add-ons page. When enabled, this field is included for security positions (`stock`, `adr`, `etf`, `mutualfund`, `cef`, `crypto`, `bond`, and `other`). For these positions, an empty list means no tax lot data is available. Availability varies by brokerage and position. This field is omitted for options, futures, future options, CFDs, tokenized assets, and cash, or when the feature is disabled.
|
|
34
34
|
attr_accessor :tax_lots
|
|
35
35
|
|
|
36
36
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
@@ -11,7 +11,7 @@ require 'date'
|
|
|
11
11
|
require 'time'
|
|
12
12
|
|
|
13
13
|
module SnapTrade
|
|
14
|
-
# A currency
|
|
14
|
+
# A fiat currency, identified by its ISO-4217 code.
|
|
15
15
|
class CashInstrument
|
|
16
16
|
# Type of security instrument.
|
|
17
17
|
attr_accessor :kind
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
# The asset an order's prices are denominated in. Use `kind` to determine which schema is present.
|
|
15
|
+
module PricedInInstrument
|
|
16
|
+
class << self
|
|
17
|
+
# List of class defined in oneOf (OpenAPI v3)
|
|
18
|
+
def openapi_one_of
|
|
19
|
+
[
|
|
20
|
+
:'CashInstrument',
|
|
21
|
+
:'CryptoInstrument'
|
|
22
|
+
]
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Discriminator's property name (OpenAPI v3)
|
|
26
|
+
def openapi_discriminator_name
|
|
27
|
+
:'kind'
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Discriminator's mapping (OpenAPI v3)
|
|
31
|
+
def openapi_discriminator_mapping
|
|
32
|
+
{
|
|
33
|
+
:'cash' => :'CashInstrument',
|
|
34
|
+
:'crypto' => :'CryptoInstrument'
|
|
35
|
+
}
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Builds the object
|
|
39
|
+
# @param [Mixed] Data to be matched against the list of oneOf items
|
|
40
|
+
# @return [Object] Returns the model or the data itself
|
|
41
|
+
def build(data)
|
|
42
|
+
discriminator_value = data[openapi_discriminator_name]
|
|
43
|
+
return nil if discriminator_value.nil?
|
|
44
|
+
|
|
45
|
+
klass = openapi_discriminator_mapping[discriminator_value.to_s.to_sym]
|
|
46
|
+
return nil unless klass
|
|
47
|
+
|
|
48
|
+
SnapTrade.const_get(klass).build_from_hash(data)
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
end
|
|
@@ -14,7 +14,7 @@ module SnapTrade
|
|
|
14
14
|
class SimpleTradeForm
|
|
15
15
|
attr_accessor :order_type
|
|
16
16
|
|
|
17
|
-
# 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.
|
|
17
|
+
# 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. Webull US futures only support day and gtc. TradeStation futures and futures options accept day, gtc, ioc, and fok, subject to the contract and route's supported combinations.
|
|
18
18
|
attr_accessor :time_in_force
|
|
19
19
|
|
|
20
20
|
# 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.
|
|
@@ -29,7 +29,7 @@ module SnapTrade
|
|
|
29
29
|
# 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.
|
|
30
30
|
attr_accessor :price_effect
|
|
31
31
|
|
|
32
|
-
# 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
|
|
32
|
+
# Optional canonical UUID, forwarded where the existing execution path supports it and for tastytrade, Webull US, and TradeStation futures-family orders. Requires the existing client-order-ID enablement; when disabled the value is ignored. Brokerage behavior on duplicates varies. SnapTrade does not enforce uniqueness, except for requests authenticated with an OAuth access token, where a client_order_id the user has already used returns 409. Tastytrade uses this as external-identifier for correlation and does not deduplicate submissions. For Webull US futures, SnapTrade converts the supplied UUID (or its generated order UUID) to lowercase 32-character hexadecimal without hyphens. The original supplied UUID remains in SnapTrade's trade audit; the converted value is returned as brokerage_order_id for subsequent order reads. For TradeStation live and SIM, SnapTrade encodes the supplied UUID (or its generated order UUID) as 22-character URL-safe base64 without padding and sends it as OrderConfirmID for brokerage duplicate prevention; the response contains TradeStation's separate order ID.
|
|
33
33
|
attr_accessor :client_order_id
|
|
34
34
|
|
|
35
35
|
# 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.
|
|
@@ -14,7 +14,7 @@ module SnapTrade
|
|
|
14
14
|
class SimpleTradeInstrument
|
|
15
15
|
attr_accessor :kind
|
|
16
16
|
|
|
17
|
-
# Equity ticker, OCC equity-option symbol, or
|
|
17
|
+
# Equity ticker, OCC equity-option symbol, or brokerage-native futures symbol. Tastytrade future tickers begin with `/` and future-option tickers begin with `./`; preserve their spaces and punctuation. Webull US futures require a specific unprefixed contract symbol such as ESZ6, without whitespace. TradeStation (live and SIM) requires a specific two-digit-year contract such as ESZ26 or @ESZ26, or a futures-option symbol such as `ESZ26 C6000`, preserving the space and any session alias. TradeStation's optional @ prefix for dated futures contracts is forwarded unchanged. Webull and TradeStation do not accept slash aliases or root-only continuous symbols. Universal symbol IDs are not accepted.
|
|
18
18
|
attr_accessor :symbol
|
|
19
19
|
|
|
20
20
|
# Attribute mapping from ruby-style variable name to JSON key.
|