snaptrade 3.0.30 → 3.0.31
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 +118 -2
- data/lib/snaptrade/api/account_information_api.rb +6 -2
- data/lib/snaptrade/api/experimental_endpoints_api.rb +176 -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 +11 -1
- data/spec/api/account_information_api_spec.rb +1 -1
- data/spec/api/experimental_endpoints_api_spec.rb +15 -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 +261 -231
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1effb1f305a79d998a07364a160d695925a60f64daf153a0f1e3b276f568663d
|
|
4
|
+
data.tar.gz: 757327cc71cdbf1ea7f4ccee9075b582b35afc93d07a334d246cee8ff37b054f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 55e913bb5fc1d61102562495178f7567bca3f0c93e174bee7381d00041f6d7943476e8637098839e1223e0af08f1f8167df4ee2d235ce5e50045ee4c9895f4e6
|
|
7
|
+
data.tar.gz: 51ca83e7c04bb35df1ee98c746b0ee140f352fe5d90a4cbc2c249a0dacf3006004248e6f8f74916599eae899dd222dea7da6f14f0cd24424e267e6746a04f314
|
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.31)
|
|
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.31'
|
|
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
|
|
|
@@ -1610,6 +1613,119 @@ p result
|
|
|
1610
1613
|
---
|
|
1611
1614
|
|
|
1612
1615
|
|
|
1616
|
+
### `snaptrade.experimental_endpoints.place_simple_order`<a id="snaptradeexperimental_endpointsplace_simple_order"></a>
|
|
1617
|
+
|
|
1618
|
+
**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.
|
|
1619
|
+
|
|
1620
|
+
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).
|
|
1621
|
+
|
|
1622
|
+
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.
|
|
1623
|
+
|
|
1624
|
+
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.
|
|
1625
|
+
|
|
1626
|
+
A successful response contains only the brokerage order ID. Use the existing order endpoints to retrieve order details.
|
|
1627
|
+
|
|
1628
|
+
|
|
1629
|
+
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
|
1630
|
+
|
|
1631
|
+
```ruby
|
|
1632
|
+
result = snaptrade.experimental_endpoints.place_simple_order(
|
|
1633
|
+
order_type: "stop_limit",
|
|
1634
|
+
time_in_force: "day",
|
|
1635
|
+
legs: [
|
|
1636
|
+
{
|
|
1637
|
+
"instrument" => {
|
|
1638
|
+
"kind" => "future",
|
|
1639
|
+
"symbol" => "/ESZ6",
|
|
1640
|
+
},
|
|
1641
|
+
"action" => "buy",
|
|
1642
|
+
"units" => "1.25",
|
|
1643
|
+
}
|
|
1644
|
+
],
|
|
1645
|
+
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
1646
|
+
user_id: "snaptrade-user-123",
|
|
1647
|
+
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
1648
|
+
limit_price: "1.25",
|
|
1649
|
+
stop_price: "1.25",
|
|
1650
|
+
price_effect: "debit",
|
|
1651
|
+
client_order_id: "550e8400-e29b-41d4-a716-446655440000",
|
|
1652
|
+
expiry_date: "2026-12-18T20:00:00Z",
|
|
1653
|
+
notional_value: "1.25",
|
|
1654
|
+
trading_session: "regular",
|
|
1655
|
+
)
|
|
1656
|
+
p result
|
|
1657
|
+
```
|
|
1658
|
+
|
|
1659
|
+
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
1660
|
+
|
|
1661
|
+
##### order_type: [`SimpleTradeFormOrderType`](./lib/snaptrade/models/simple_trade_form_order_type.rb)<a id="order_type-simpletradeformordertypelibsnaptrademodelssimple_trade_form_order_typerb"></a>
|
|
1662
|
+
##### 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>
|
|
1663
|
+
Order duration, subject to brokerage and execution-path support. gtd requires
|
|
1664
|
+
expiry_date and a non-market single-leg equity/option order. Existing single-leg
|
|
1665
|
+
option routing does not support ioc. Futures and multi-leg orders do not support
|
|
1666
|
+
gtd through this endpoint.
|
|
1667
|
+
|
|
1668
|
+
##### legs: Array<[`SimpleTradeLeg`](./lib/snaptrade/models/simple_trade_leg.rb)><a id="legs-array"></a>
|
|
1669
|
+
Legs of one brokerage order. Use equity/option legs or future/future_option
|
|
1670
|
+
legs, without mixing the two families. Brokerage strategy and leg-count limits
|
|
1671
|
+
apply.
|
|
1672
|
+
|
|
1673
|
+
##### account_id: `String`<a id="account_id-string"></a>
|
|
1674
|
+
The ID of the account to execute the trade on.
|
|
1675
|
+
|
|
1676
|
+
##### user_id: `String`<a id="user_id-string"></a>
|
|
1677
|
+
##### user_secret: `String`<a id="user_secret-string"></a>
|
|
1678
|
+
##### limit_price: [`Float`](./lib/snaptrade/models/float.rb)<a id="limit_price-floatlibsnaptrademodelsfloatrb"></a>
|
|
1679
|
+
Required for limit and stop_limit orders, except that multi-leg price_effect
|
|
1680
|
+
even implies zero. Must be omitted or null for market and stop orders. For
|
|
1681
|
+
multi-leg orders this is the net strategy price. Negative prices are accepted
|
|
1682
|
+
only for futures-family orders, subject to brokerage support.
|
|
1683
|
+
|
|
1684
|
+
##### stop_price: [`Float`](./lib/snaptrade/models/float.rb)<a id="stop_price-floatlibsnaptrademodelsfloatrb"></a>
|
|
1685
|
+
Required for stop and stop_limit orders. Must be omitted or null for market and
|
|
1686
|
+
limit orders. Must be positive for equity/option orders; futures-family trigger
|
|
1687
|
+
prices are subject to brokerage support.
|
|
1688
|
+
|
|
1689
|
+
##### price_effect: [`SimpleTradeFormPriceEffect`](./lib/snaptrade/models/simple_trade_form_price_effect.rb)<a id="price_effect-simpletradeformpriceeffectlibsnaptrademodelssimple_trade_form_price_effectrb"></a>
|
|
1690
|
+
Only applicable to multi-leg limit and stop_limit orders. Requirements and
|
|
1691
|
+
supported values depend on the brokerage; tastytrade requires credit or debit.
|
|
1692
|
+
even implies a zero limit_price, which may be omitted and must be zero if
|
|
1693
|
+
supplied. Single-leg price effects are derived from the action.
|
|
1694
|
+
|
|
1695
|
+
##### client_order_id: [`String`](./lib/snaptrade/models/string.rb)<a id="client_order_id-stringlibsnaptrademodelsstringrb"></a>
|
|
1696
|
+
Optional canonical UUID, forwarded where the existing execution path supports it
|
|
1697
|
+
and for tastytrade futures orders. Requires the existing client-order-ID
|
|
1698
|
+
enablement; when disabled the value is ignored. Brokerage behavior on duplicates
|
|
1699
|
+
varies; SnapTrade does not enforce uniqueness. Tastytrade uses this as
|
|
1700
|
+
external-identifier for correlation and does not deduplicate submissions.
|
|
1701
|
+
|
|
1702
|
+
##### expiry_date: `Time`<a id="expiry_date-time"></a>
|
|
1703
|
+
ISO 8601 expiry timestamp, required for gtd and invalid with other durations. A
|
|
1704
|
+
missing timezone is treated as UTC. Supported only through existing single-leg
|
|
1705
|
+
Public and Sandbox execution paths.
|
|
1706
|
+
|
|
1707
|
+
##### notional_value: [`Float`](./lib/snaptrade/models/float.rb)<a id="notional_value-floatlibsnaptrademodelsfloatrb"></a>
|
|
1708
|
+
Positive order value, supported only for a single-equity market order on
|
|
1709
|
+
eligible brokerages and partners. Mutually exclusive with leg units. Omit or set
|
|
1710
|
+
units to null when supplied.
|
|
1711
|
+
|
|
1712
|
+
##### trading_session: [`SimpleTradeFormTradingSession`](./lib/snaptrade/models/simple_trade_form_trading_session.rb)<a id="trading_session-simpletradeformtradingsessionlibsnaptrademodelssimple_trade_form_trading_sessionrb"></a>
|
|
1713
|
+
extended uses existing single-leg equity/option brokerage support and requires
|
|
1714
|
+
extended-hours enablement. Futures and multi-leg orders only accept regular.
|
|
1715
|
+
|
|
1716
|
+
#### 🔄 Return<a id="🔄-return"></a>
|
|
1717
|
+
|
|
1718
|
+
[SimpleTradeResponse](./lib/snaptrade/models/simple_trade_response.rb)
|
|
1719
|
+
|
|
1720
|
+
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
|
1721
|
+
|
|
1722
|
+
`/accounts/{accountId}/trading/simple` `POST`
|
|
1723
|
+
|
|
1724
|
+
[🔙 **Back to Table of Contents**](#table-of-contents)
|
|
1725
|
+
|
|
1726
|
+
---
|
|
1727
|
+
|
|
1728
|
+
|
|
1613
1729
|
### `snaptrade.reference_data.get_partner_info`<a id="snaptradereference_dataget_partner_info"></a>
|
|
1614
1730
|
|
|
1615
1731
|
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]
|
|
@@ -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
|
|
@@ -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
|
|
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 only for stocks, ADRs, ETFs, mutual funds, and crypto positions. For these positions, an empty list means no tax lot data is available. Availability varies by brokerage and position. This field is omitted for all other instrument kinds 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.
|
|
@@ -13,7 +13,7 @@ require 'time'
|
|
|
13
13
|
module SnapTrade
|
|
14
14
|
# The response to the account value history endpoint, containing a list of estimated account values at different points in time.
|
|
15
15
|
class AccountValueHistoryResponse
|
|
16
|
-
# List of estimated account values over time returned by the endpoint.
|
|
16
|
+
# List of estimated account values over time returned by the endpoint. The data may contain gaps and is best used for charting trends, rather than as a complete or exact record of historical account values.
|
|
17
17
|
attr_accessor :history
|
|
18
18
|
|
|
19
19
|
# The ISO-4217 currency code for the account values.
|
|
@@ -11,7 +11,7 @@ require 'date'
|
|
|
11
11
|
require 'time'
|
|
12
12
|
|
|
13
13
|
module SnapTrade
|
|
14
|
-
class
|
|
14
|
+
class CashOrMargin
|
|
15
15
|
CASH = "cash".freeze
|
|
16
16
|
MARGIN = "margin".freeze
|
|
17
17
|
UNKNOWN = "unknown".freeze
|
|
@@ -31,8 +31,8 @@ module SnapTrade
|
|
|
31
31
|
# @param [String] The enum value in the form of the string
|
|
32
32
|
# @return [String] The enum value
|
|
33
33
|
def build_from_hash(value)
|
|
34
|
-
return value if
|
|
35
|
-
raise "Invalid ENUM value #{value} for class #
|
|
34
|
+
return value if CashOrMargin.all_vars.include?(value)
|
|
35
|
+
raise "Invalid ENUM value #{value} for class #CashOrMargin"
|
|
36
36
|
end
|
|
37
37
|
end
|
|
38
38
|
end
|
|
@@ -34,7 +34,7 @@ module SnapTrade
|
|
|
34
34
|
# URL of the institution's square logo.
|
|
35
35
|
attr_accessor :square_logo_url
|
|
36
36
|
|
|
37
|
-
# How mature the integration is. - `GENERALLY_AVAILABLE`: fully supported and validated for production use. - `BETA`: production-ready, with ongoing validation and improvements.
|
|
37
|
+
# How mature the integration is. - `GENERALLY_AVAILABLE`: fully supported and validated for production use. - `BETA`: production-ready, with ongoing validation and improvements. - `ALPHA`: early access with limited validation. Expect issues and incomplete functionality.
|
|
38
38
|
attr_accessor :release_stage
|
|
39
39
|
|
|
40
40
|
# Regions where end users can connect to this institution. - `US`: United States - `CA`: Canada - `EUROPE`: Europe, including the United Kingdom - `AU`: Australia - `IN`: India
|
|
@@ -46,7 +46,7 @@ module SnapTrade
|
|
|
46
46
|
attr_accessor :raw_type
|
|
47
47
|
|
|
48
48
|
# Whether the institution reports the account as a cash or margin account, normalized across institutions. - `cash`: A cash account. The account cannot borrow on margin. - `margin`: A margin account, including portfolio margin accounts. Some institutions also report retirement accounts with limited margin (for example, trading before funds settle) as margin accounts. - `unknown`: The institution does not report whether the account is cash or margin. **Beta:** only returned for some institutions and partners it has been enabled for. Omitted otherwise.
|
|
49
|
-
attr_accessor :
|
|
49
|
+
attr_accessor :cash_or_margin
|
|
50
50
|
|
|
51
51
|
# Indicates whether the account is a paper (simulated) trading account.
|
|
52
52
|
attr_accessor :is_paper
|
|
@@ -67,7 +67,7 @@ module SnapTrade
|
|
|
67
67
|
:'funding_date' => :'funding_date',
|
|
68
68
|
:'sync_status' => :'sync_status',
|
|
69
69
|
:'raw_type' => :'raw_type',
|
|
70
|
-
:'
|
|
70
|
+
:'cash_or_margin' => :'cash_or_margin',
|
|
71
71
|
:'is_paper' => :'is_paper',
|
|
72
72
|
:'net_value' => :'net_value'
|
|
73
73
|
}
|
|
@@ -92,7 +92,7 @@ module SnapTrade
|
|
|
92
92
|
:'funding_date' => :'Time',
|
|
93
93
|
:'sync_status' => :'ConnectionAccountSyncStatus',
|
|
94
94
|
:'raw_type' => :'String',
|
|
95
|
-
:'
|
|
95
|
+
:'cash_or_margin' => :'CashOrMargin',
|
|
96
96
|
:'is_paper' => :'Boolean',
|
|
97
97
|
:'net_value' => :'InvestmentAccountNetValue'
|
|
98
98
|
}
|
|
@@ -169,8 +169,8 @@ module SnapTrade
|
|
|
169
169
|
self.raw_type = attributes[:'raw_type']
|
|
170
170
|
end
|
|
171
171
|
|
|
172
|
-
if attributes.key?(:'
|
|
173
|
-
self.
|
|
172
|
+
if attributes.key?(:'cash_or_margin')
|
|
173
|
+
self.cash_or_margin = attributes[:'cash_or_margin']
|
|
174
174
|
end
|
|
175
175
|
|
|
176
176
|
if attributes.key?(:'is_paper')
|
|
@@ -241,7 +241,7 @@ module SnapTrade
|
|
|
241
241
|
funding_date == o.funding_date &&
|
|
242
242
|
sync_status == o.sync_status &&
|
|
243
243
|
raw_type == o.raw_type &&
|
|
244
|
-
|
|
244
|
+
cash_or_margin == o.cash_or_margin &&
|
|
245
245
|
is_paper == o.is_paper &&
|
|
246
246
|
net_value == o.net_value
|
|
247
247
|
end
|
|
@@ -255,7 +255,7 @@ module SnapTrade
|
|
|
255
255
|
# Calculates hash code according to all attributes.
|
|
256
256
|
# @return [Integer] Hash code
|
|
257
257
|
def hash
|
|
258
|
-
[kind, id, connection_id, display_name, masked_account_number, institution_account_id, institution_id, opening_date, funding_date, sync_status, raw_type,
|
|
258
|
+
[kind, id, connection_id, display_name, masked_account_number, institution_account_id, institution_id, opening_date, funding_date, sync_status, raw_type, cash_or_margin, is_paper, net_value].hash
|
|
259
259
|
end
|
|
260
260
|
|
|
261
261
|
# Builds the object from hash
|
|
@@ -35,7 +35,7 @@ module SnapTrade
|
|
|
35
35
|
# If the position is a cash equivalent (usually a money market fund) that is also counted in account cash balance and buying power
|
|
36
36
|
attr_accessor :cash_equivalent
|
|
37
37
|
|
|
38
|
-
# List of tax lots for the given position. Disabled by default,
|
|
38
|
+
# List of tax lots for the given position. Disabled by default, enable this feature in the [Add-on page of the Customer Dashboard](https://dashboard.snaptrade.com/add-ons)
|
|
39
39
|
attr_accessor :tax_lots
|
|
40
40
|
|
|
41
41
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
@@ -14,9 +14,10 @@ module SnapTrade
|
|
|
14
14
|
class ReleaseStage
|
|
15
15
|
GENERALLY_AVAILABLE = "GENERALLY_AVAILABLE".freeze
|
|
16
16
|
BETA = "BETA".freeze
|
|
17
|
+
ALPHA = "ALPHA".freeze
|
|
17
18
|
|
|
18
19
|
def self.all_vars
|
|
19
|
-
@all_vars ||= [GENERALLY_AVAILABLE, BETA].freeze
|
|
20
|
+
@all_vars ||= [GENERALLY_AVAILABLE, BETA, ALPHA].freeze
|
|
20
21
|
end
|
|
21
22
|
|
|
22
23
|
# Builds the enum from string
|