snaptrade 2.0.95 → 2.0.96
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/Gemfile.lock +1 -1
- data/README.md +91 -12
- data/lib/snaptrade/api/options_api.rb +2 -2
- data/lib/snaptrade/api/trading_api.rb +148 -8
- data/lib/snaptrade/models/manual_trade.rb +1 -1
- data/lib/snaptrade/models/manual_trade_form.rb +1 -1
- data/lib/snaptrade/models/manual_trade_form_bracket.rb +1 -1
- data/lib/snaptrade/models/manual_trade_form_with_options.rb +1 -1
- data/lib/snaptrade/models/manual_trade_replace_form.rb +1 -1
- data/lib/snaptrade/models/mleg_action_strict.rb +41 -0
- data/lib/snaptrade/models/mleg_leg.rb +251 -0
- data/lib/snaptrade/models/mleg_order_request_body_type.rb +39 -0
- data/lib/snaptrade/models/mleg_order_response.rb +238 -0
- data/lib/snaptrade/models/mleg_trading_instrument.rb +237 -0
- data/lib/snaptrade/models/mleg_trading_instrument_type.rb +37 -0
- data/lib/snaptrade/models/options_place_option_strategy_request.rb +1 -1
- data/lib/snaptrade/models/time_in_force_strict.rb +2 -1
- data/lib/snaptrade/models/trading_place_mleg_order_request.rb +275 -0
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +7 -0
- data/spec/api/trading_api_spec.rb +15 -0
- data/spec/models/mleg_action_strict_spec.rb +23 -0
- data/spec/models/mleg_leg_spec.rb +41 -0
- data/spec/models/mleg_order_request_body_type_spec.rb +23 -0
- data/spec/models/mleg_order_response_spec.rb +35 -0
- data/spec/models/mleg_trading_instrument_spec.rb +35 -0
- data/spec/models/mleg_trading_instrument_type_spec.rb +23 -0
- data/spec/models/trading_place_mleg_order_request_spec.rb +53 -0
- metadata +23 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fade933c9b4d0b1943370bb1c72b0e089258641331b02eff631da4fa11e82833
|
4
|
+
data.tar.gz: 8f659c138d2a82f20e215fe71036cdddacef59e6e8d731c35af0578278f4b0f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f52783d9a1a6a99916ffb865d1d51fb476fafb9195117c3dcb1c7abd74771d94a1113eaa4f88b772ff1d49b0d636e6edae94d18e08912260c532f39972d3dd6
|
7
|
+
data.tar.gz: bd0afbe6eedb451cc22bdf9d019649bf1aea79e90119b77dc51cce426d8d3cf32c328db27dd21b5fac8e325403dadd24d9f1b328010788b658929462a98d2266
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
Connect brokerage accounts to your app for live positions and trading
|
8
8
|
|
9
|
-
[](https://rubygems.org/gems/snaptrade/versions/2.0.96)
|
10
10
|
[](https://snaptrade.com/)
|
11
11
|
|
12
12
|
</div>
|
@@ -66,6 +66,7 @@ Connect brokerage accounts to your app for live positions and trading
|
|
66
66
|
* [`snaptrade.trading.get_user_account_quotes`](#snaptradetradingget_user_account_quotes)
|
67
67
|
* [`snaptrade.trading.place_bracket_order`](#snaptradetradingplace_bracket_order)
|
68
68
|
* [`snaptrade.trading.place_force_order`](#snaptradetradingplace_force_order)
|
69
|
+
* [`snaptrade.trading.place_mleg_order`](#snaptradetradingplace_mleg_order)
|
69
70
|
* [`snaptrade.trading.place_order`](#snaptradetradingplace_order)
|
70
71
|
* [`snaptrade.trading.place_simple_order`](#snaptradetradingplace_simple_order)
|
71
72
|
* [`snaptrade.trading.preview_simple_order`](#snaptradetradingpreview_simple_order)
|
@@ -81,7 +82,7 @@ Connect brokerage accounts to your app for live positions and trading
|
|
81
82
|
Add to Gemfile:
|
82
83
|
|
83
84
|
```ruby
|
84
|
-
gem 'snaptrade', '~> 2.0.
|
85
|
+
gem 'snaptrade', '~> 2.0.96'
|
85
86
|
```
|
86
87
|
|
87
88
|
## Getting Started<a id="getting-started"></a>
|
@@ -1218,7 +1219,7 @@ Places the option strategy order and returns the order record received from the
|
|
1218
1219
|
```ruby
|
1219
1220
|
result = snaptrade.options.place_option_strategy(
|
1220
1221
|
order_type: "Market",
|
1221
|
-
time_in_force: "
|
1222
|
+
time_in_force: "Day",
|
1222
1223
|
user_id: "snaptrade-user-123",
|
1223
1224
|
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
1224
1225
|
account_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
@@ -1241,7 +1242,9 @@ will remain active before it is executed or expires. Here are the supported
|
|
1241
1242
|
values: - `Day` - Day. The order is valid only for the trading day on which it
|
1242
1243
|
is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed
|
1243
1244
|
or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety
|
1244
|
-
immediately or be canceled completely.
|
1245
|
+
immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order
|
1246
|
+
must be executed immediately. Any portion of the order that cannot be filled
|
1247
|
+
immediately will be canceled.
|
1245
1248
|
|
1246
1249
|
##### user_id: `String`<a id="user_id-string"></a>
|
1247
1250
|
##### user_secret: `String`<a id="user_secret-string"></a>
|
@@ -1700,7 +1703,7 @@ result = snaptrade.trading.get_order_impact(
|
|
1700
1703
|
action: "BUY",
|
1701
1704
|
universal_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
1702
1705
|
order_type: "Market",
|
1703
|
-
time_in_force: "
|
1706
|
+
time_in_force: "Day",
|
1704
1707
|
user_id: "snaptrade-user-123",
|
1705
1708
|
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
1706
1709
|
price: 31.33,
|
@@ -1736,7 +1739,9 @@ will remain active before it is executed or expires. Here are the supported
|
|
1736
1739
|
values: - `Day` - Day. The order is valid only for the trading day on which it
|
1737
1740
|
is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed
|
1738
1741
|
or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety
|
1739
|
-
immediately or be canceled completely.
|
1742
|
+
immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order
|
1743
|
+
must be executed immediately. Any portion of the order that cannot be filled
|
1744
|
+
immediately will be canceled.
|
1740
1745
|
|
1741
1746
|
##### user_id: `String`<a id="user_id-string"></a>
|
1742
1747
|
##### user_secret: `String`<a id="user_secret-string"></a>
|
@@ -1820,7 +1825,7 @@ result = snaptrade.trading.place_bracket_order(
|
|
1820
1825
|
"type" => "EQUITY",
|
1821
1826
|
},
|
1822
1827
|
order_type: "Market",
|
1823
|
-
time_in_force: "
|
1828
|
+
time_in_force: "Day",
|
1824
1829
|
stop_loss: {
|
1825
1830
|
"stop_price" => "48.55",
|
1826
1831
|
"limit_price" => "48.50",
|
@@ -1858,7 +1863,9 @@ will remain active before it is executed or expires. Here are the supported
|
|
1858
1863
|
values: - `Day` - Day. The order is valid only for the trading day on which it
|
1859
1864
|
is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed
|
1860
1865
|
or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety
|
1861
|
-
immediately or be canceled completely.
|
1866
|
+
immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order
|
1867
|
+
must be executed immediately. Any portion of the order that cannot be filled
|
1868
|
+
immediately will be canceled.
|
1862
1869
|
|
1863
1870
|
##### stop_loss: [`StopLoss`](./lib/snaptrade/models/stop_loss.rb)<a id="stop_loss-stoplosslibsnaptrademodelsstop_lossrb"></a>
|
1864
1871
|
##### take_profit: [`TakeProfit`](./lib/snaptrade/models/take_profit.rb)<a id="take_profit-takeprofitlibsnaptrademodelstake_profitrb"></a>
|
@@ -1909,7 +1916,7 @@ result = snaptrade.trading.place_force_order(
|
|
1909
1916
|
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
1910
1917
|
action: "BUY",
|
1911
1918
|
order_type: "Market",
|
1912
|
-
time_in_force: "
|
1919
|
+
time_in_force: "Day",
|
1913
1920
|
user_id: "snaptrade-user-123",
|
1914
1921
|
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
1915
1922
|
universal_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
@@ -1944,7 +1951,9 @@ will remain active before it is executed or expires. Here are the supported
|
|
1944
1951
|
values: - `Day` - Day. The order is valid only for the trading day on which it
|
1945
1952
|
is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed
|
1946
1953
|
or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety
|
1947
|
-
immediately or be canceled completely.
|
1954
|
+
immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order
|
1955
|
+
must be executed immediately. Any portion of the order that cannot be filled
|
1956
|
+
immediately will be canceled.
|
1948
1957
|
|
1949
1958
|
##### user_id: `String`<a id="user_id-string"></a>
|
1950
1959
|
##### user_secret: `String`<a id="user_secret-string"></a>
|
@@ -1986,6 +1995,74 @@ contracts to buy or sell. (e.g., 1 contract = 100 shares).
|
|
1986
1995
|
---
|
1987
1996
|
|
1988
1997
|
|
1998
|
+
### `snaptrade.trading.place_mleg_order`<a id="snaptradetradingplace_mleg_order"></a>
|
1999
|
+
|
2000
|
+
Places a multi-leg option order. Only supported on certain option trading brokerages. https://snaptrade.notion.site/brokerages has information on brokerage trading support
|
2001
|
+
|
2002
|
+
|
2003
|
+
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
2004
|
+
|
2005
|
+
```ruby
|
2006
|
+
result = snaptrade.trading.place_mleg_order(
|
2007
|
+
type: "MARKET",
|
2008
|
+
time_in_force: "Day",
|
2009
|
+
legs: [
|
2010
|
+
{
|
2011
|
+
"instrument" => {
|
2012
|
+
"symbol" => "PBI 250718C00006000",
|
2013
|
+
"type" => "OPTION",
|
2014
|
+
},
|
2015
|
+
"action" => "BUY_TO_OPEN",
|
2016
|
+
"units" => 1,
|
2017
|
+
}
|
2018
|
+
],
|
2019
|
+
user_id: "snaptrade-user-123",
|
2020
|
+
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
2021
|
+
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
2022
|
+
limit_price: "",
|
2023
|
+
stop_price: "",
|
2024
|
+
)
|
2025
|
+
p result
|
2026
|
+
```
|
2027
|
+
|
2028
|
+
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
2029
|
+
|
2030
|
+
##### type: [`MlegOrderRequestBodyType`](./lib/snaptrade/models/mleg_order_request_body_type.rb)<a id="type-mlegorderrequestbodytypelibsnaptrademodelsmleg_order_request_body_typerb"></a>
|
2031
|
+
The type of order to place.
|
2032
|
+
|
2033
|
+
##### time_in_force: [`TimeInForceStrict`](./lib/snaptrade/models/time_in_force_strict.rb)<a id="time_in_force-timeinforcestrictlibsnaptrademodelstime_in_force_strictrb"></a>
|
2034
|
+
The Time in Force type for the order. This field indicates how long the order
|
2035
|
+
will remain active before it is executed or expires. Here are the supported
|
2036
|
+
values: - `Day` - Day. The order is valid only for the trading day on which it
|
2037
|
+
is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed
|
2038
|
+
or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety
|
2039
|
+
immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order
|
2040
|
+
must be executed immediately. Any portion of the order that cannot be filled
|
2041
|
+
immediately will be canceled.
|
2042
|
+
|
2043
|
+
##### legs: Array<[`MlegLeg`](./lib/snaptrade/models/mleg_leg.rb)><a id="legs-array"></a>
|
2044
|
+
##### user_id: `String`<a id="user_id-string"></a>
|
2045
|
+
##### user_secret: `String`<a id="user_secret-string"></a>
|
2046
|
+
##### account_id: `String`<a id="account_id-string"></a>
|
2047
|
+
##### limit_price: `Float`<a id="limit_price-float"></a>
|
2048
|
+
The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT.
|
2049
|
+
|
2050
|
+
##### stop_price: `Float`<a id="stop_price-float"></a>
|
2051
|
+
The stop price. Required if the order type is STOP_LOSS_MARKET, STOP_LOSS_LIMIT.
|
2052
|
+
|
2053
|
+
#### 🔄 Return<a id="🔄-return"></a>
|
2054
|
+
|
2055
|
+
[MlegOrderResponse](./lib/snaptrade/models/mleg_order_response.rb)
|
2056
|
+
|
2057
|
+
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
2058
|
+
|
2059
|
+
`/accounts/{accountId}/trading/options` `POST`
|
2060
|
+
|
2061
|
+
[🔙 **Back to Table of Contents**](#table-of-contents)
|
2062
|
+
|
2063
|
+
---
|
2064
|
+
|
2065
|
+
|
1989
2066
|
### `snaptrade.trading.place_order`<a id="snaptradetradingplace_order"></a>
|
1990
2067
|
|
1991
2068
|
Places the previously checked order with the brokerage. The `tradeId` is obtained from the [check order impact endpoint](/reference/Trading/Trading_getOrderImpact). If you prefer to place the order without checking for impact first, you can use the [place order endpoint](/reference/Trading/Trading_placeForceOrder).
|
@@ -2208,7 +2285,7 @@ returned in the response going forward. Only supported on some brokerages
|
|
2208
2285
|
result = snaptrade.trading.replace_order(
|
2209
2286
|
action: "BUY",
|
2210
2287
|
order_type: "Market",
|
2211
|
-
time_in_force: "
|
2288
|
+
time_in_force: "Day",
|
2212
2289
|
account_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
2213
2290
|
brokerage_order_id: "66a033fa-da74-4fcf-b527-feefdec9257e",
|
2214
2291
|
user_id: "snaptrade-user-123",
|
@@ -2238,7 +2315,9 @@ will remain active before it is executed or expires. Here are the supported
|
|
2238
2315
|
values: - `Day` - Day. The order is valid only for the trading day on which it
|
2239
2316
|
is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed
|
2240
2317
|
or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety
|
2241
|
-
immediately or be canceled completely.
|
2318
|
+
immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order
|
2319
|
+
must be executed immediately. Any portion of the order that cannot be filled
|
2320
|
+
immediately will be canceled.
|
2242
2321
|
|
2243
2322
|
##### account_id: `String`<a id="account_id-string"></a>
|
2244
2323
|
The ID of the account to execute the trade on.
|
@@ -484,7 +484,7 @@ module SnapTrade
|
|
484
484
|
# Places the option strategy order and returns the order record received from the brokerage.
|
485
485
|
#
|
486
486
|
# @param order_type [OrderTypeStrict] The type of order to place. - For `Limit` and `StopLimit` orders, the `price` field is required. - For `Stop` and `StopLimit` orders, the `stop` field is required.
|
487
|
-
# @param time_in_force [TimeInForceStrict] The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely.
|
487
|
+
# @param time_in_force [TimeInForceStrict] The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled.
|
488
488
|
# @param user_id [String]
|
489
489
|
# @param user_secret [String]
|
490
490
|
# @param account_id [String] The ID of the account to execute the strategy in.
|
@@ -507,7 +507,7 @@ module SnapTrade
|
|
507
507
|
# Places the option strategy order and returns the order record received from the brokerage.
|
508
508
|
#
|
509
509
|
# @param order_type [OrderTypeStrict] The type of order to place. - For `Limit` and `StopLimit` orders, the `price` field is required. - For `Stop` and `StopLimit` orders, the `stop` field is required.
|
510
|
-
# @param time_in_force [TimeInForceStrict] The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely.
|
510
|
+
# @param time_in_force [TimeInForceStrict] The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled.
|
511
511
|
# @param user_id [String]
|
512
512
|
# @param user_secret [String]
|
513
513
|
# @param account_id [String] The ID of the account to execute the strategy in.
|
@@ -371,7 +371,7 @@ module SnapTrade
|
|
371
371
|
# @param action [ActionStrict] The action describes the intent or side of a trade. This is either `BUY` or `SELL`.
|
372
372
|
# @param universal_symbol_id [String] Unique identifier for the symbol within SnapTrade. This is the ID used to reference the symbol in SnapTrade API calls.
|
373
373
|
# @param order_type [OrderTypeStrict] The type of order to place. - For `Limit` and `StopLimit` orders, the `price` field is required. - For `Stop` and `StopLimit` orders, the `stop` field is required.
|
374
|
-
# @param time_in_force [TimeInForceStrict] The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely.
|
374
|
+
# @param time_in_force [TimeInForceStrict] The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled.
|
375
375
|
# @param user_id [String]
|
376
376
|
# @param user_secret [String]
|
377
377
|
# @param price [Float] The limit price for `Limit` and `StopLimit` orders.
|
@@ -404,7 +404,7 @@ module SnapTrade
|
|
404
404
|
# @param action [ActionStrict] The action describes the intent or side of a trade. This is either `BUY` or `SELL`.
|
405
405
|
# @param universal_symbol_id [String] Unique identifier for the symbol within SnapTrade. This is the ID used to reference the symbol in SnapTrade API calls.
|
406
406
|
# @param order_type [OrderTypeStrict] The type of order to place. - For `Limit` and `StopLimit` orders, the `price` field is required. - For `Stop` and `StopLimit` orders, the `stop` field is required.
|
407
|
-
# @param time_in_force [TimeInForceStrict] The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely.
|
407
|
+
# @param time_in_force [TimeInForceStrict] The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled.
|
408
408
|
# @param user_id [String]
|
409
409
|
# @param user_secret [String]
|
410
410
|
# @param price [Float] The limit price for `Limit` and `StopLimit` orders.
|
@@ -638,7 +638,7 @@ module SnapTrade
|
|
638
638
|
# @param action [ActionStrictWithOptions] The action describes the intent or side of a trade. This is either `BUY` or `SELL` for Equity symbols or `BUY_TO_OPEN`, `BUY_TO_CLOSE`, `SELL_TO_OPEN` or `SELL_TO_CLOSE` for Options.
|
639
639
|
# @param instrument [TradingInstrument]
|
640
640
|
# @param order_type [OrderTypeStrict] The type of order to place. - For `Limit` and `StopLimit` orders, the `price` field is required. - For `Stop` and `StopLimit` orders, the `stop` field is required.
|
641
|
-
# @param time_in_force [TimeInForceStrict] The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely.
|
641
|
+
# @param time_in_force [TimeInForceStrict] The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled.
|
642
642
|
# @param stop_loss [StopLoss]
|
643
643
|
# @param take_profit [TakeProfit]
|
644
644
|
# @param account_id [String] The ID of the account to execute the trade on.
|
@@ -675,7 +675,7 @@ module SnapTrade
|
|
675
675
|
# @param action [ActionStrictWithOptions] The action describes the intent or side of a trade. This is either `BUY` or `SELL` for Equity symbols or `BUY_TO_OPEN`, `BUY_TO_CLOSE`, `SELL_TO_OPEN` or `SELL_TO_CLOSE` for Options.
|
676
676
|
# @param instrument [TradingInstrument]
|
677
677
|
# @param order_type [OrderTypeStrict] The type of order to place. - For `Limit` and `StopLimit` orders, the `price` field is required. - For `Stop` and `StopLimit` orders, the `stop` field is required.
|
678
|
-
# @param time_in_force [TimeInForceStrict] The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely.
|
678
|
+
# @param time_in_force [TimeInForceStrict] The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled.
|
679
679
|
# @param stop_loss [StopLoss]
|
680
680
|
# @param take_profit [TakeProfit]
|
681
681
|
# @param account_id [String] The ID of the account to execute the trade on.
|
@@ -803,7 +803,7 @@ module SnapTrade
|
|
803
803
|
# @param account_id [String] Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
|
804
804
|
# @param action [ActionStrictWithOptions] The action describes the intent or side of a trade. This is either `BUY` or `SELL` for Equity symbols or `BUY_TO_OPEN`, `BUY_TO_CLOSE`, `SELL_TO_OPEN` or `SELL_TO_CLOSE` for Options.
|
805
805
|
# @param order_type [OrderTypeStrict] The type of order to place. - For `Limit` and `StopLimit` orders, the `price` field is required. - For `Stop` and `StopLimit` orders, the `stop` field is required.
|
806
|
-
# @param time_in_force [TimeInForceStrict] The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely.
|
806
|
+
# @param time_in_force [TimeInForceStrict] The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled.
|
807
807
|
# @param user_id [String]
|
808
808
|
# @param user_secret [String]
|
809
809
|
# @param universal_symbol_id [String] The universal symbol ID of the security to trade. Must be 'null' if `symbol` is provided, otherwise must be provided.
|
@@ -842,7 +842,7 @@ module SnapTrade
|
|
842
842
|
# @param account_id [String] Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
|
843
843
|
# @param action [ActionStrictWithOptions] The action describes the intent or side of a trade. This is either `BUY` or `SELL` for Equity symbols or `BUY_TO_OPEN`, `BUY_TO_CLOSE`, `SELL_TO_OPEN` or `SELL_TO_CLOSE` for Options.
|
844
844
|
# @param order_type [OrderTypeStrict] The type of order to place. - For `Limit` and `StopLimit` orders, the `price` field is required. - For `Stop` and `StopLimit` orders, the `stop` field is required.
|
845
|
-
# @param time_in_force [TimeInForceStrict] The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely.
|
845
|
+
# @param time_in_force [TimeInForceStrict] The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled.
|
846
846
|
# @param user_id [String]
|
847
847
|
# @param user_secret [String]
|
848
848
|
# @param universal_symbol_id [String] The universal symbol ID of the security to trade. Must be 'null' if `symbol` is provided, otherwise must be provided.
|
@@ -952,6 +952,146 @@ module SnapTrade
|
|
952
952
|
end
|
953
953
|
|
954
954
|
|
955
|
+
# Place multi-leg option order
|
956
|
+
#
|
957
|
+
# Places a multi-leg option order. Only supported on certain option trading brokerages. https://snaptrade.notion.site/brokerages has information on brokerage trading support
|
958
|
+
#
|
959
|
+
# @param type [MlegOrderRequestBodyType] The type of order to place.
|
960
|
+
# @param time_in_force [TimeInForceStrict] The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled.
|
961
|
+
# @param legs [Array<MlegLeg>]
|
962
|
+
# @param user_id [String]
|
963
|
+
# @param user_secret [String]
|
964
|
+
# @param account_id [String]
|
965
|
+
# @param limit_price [Float] The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT.
|
966
|
+
# @param stop_price [Float] The stop price. Required if the order type is STOP_LOSS_MARKET, STOP_LOSS_LIMIT.
|
967
|
+
# @param body [TradingPlaceMlegOrderRequest]
|
968
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
969
|
+
def place_mleg_order(type:, time_in_force:, legs:, user_id:, user_secret:, account_id:, limit_price: SENTINEL, stop_price: SENTINEL, extra: {})
|
970
|
+
_body = {}
|
971
|
+
_body[:type] = type if type != SENTINEL
|
972
|
+
_body[:time_in_force] = time_in_force if time_in_force != SENTINEL
|
973
|
+
_body[:limit_price] = limit_price if limit_price != SENTINEL
|
974
|
+
_body[:stop_price] = stop_price if stop_price != SENTINEL
|
975
|
+
_body[:legs] = legs if legs != SENTINEL
|
976
|
+
trading_place_mleg_order_request = _body
|
977
|
+
data, _status_code, _headers = place_mleg_order_with_http_info_impl(user_id, user_secret, account_id, trading_place_mleg_order_request, extra)
|
978
|
+
data
|
979
|
+
end
|
980
|
+
|
981
|
+
# Place multi-leg option order
|
982
|
+
#
|
983
|
+
# Places a multi-leg option order. Only supported on certain option trading brokerages. https://snaptrade.notion.site/brokerages has information on brokerage trading support
|
984
|
+
#
|
985
|
+
# @param type [MlegOrderRequestBodyType] The type of order to place.
|
986
|
+
# @param time_in_force [TimeInForceStrict] The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled.
|
987
|
+
# @param legs [Array<MlegLeg>]
|
988
|
+
# @param user_id [String]
|
989
|
+
# @param user_secret [String]
|
990
|
+
# @param account_id [String]
|
991
|
+
# @param limit_price [Float] The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT.
|
992
|
+
# @param stop_price [Float] The stop price. Required if the order type is STOP_LOSS_MARKET, STOP_LOSS_LIMIT.
|
993
|
+
# @param body [TradingPlaceMlegOrderRequest]
|
994
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
995
|
+
def place_mleg_order_with_http_info(type:, time_in_force:, legs:, user_id:, user_secret:, account_id:, limit_price: SENTINEL, stop_price: SENTINEL, extra: {})
|
996
|
+
_body = {}
|
997
|
+
_body[:type] = type if type != SENTINEL
|
998
|
+
_body[:time_in_force] = time_in_force if time_in_force != SENTINEL
|
999
|
+
_body[:limit_price] = limit_price if limit_price != SENTINEL
|
1000
|
+
_body[:stop_price] = stop_price if stop_price != SENTINEL
|
1001
|
+
_body[:legs] = legs if legs != SENTINEL
|
1002
|
+
trading_place_mleg_order_request = _body
|
1003
|
+
place_mleg_order_with_http_info_impl(user_id, user_secret, account_id, trading_place_mleg_order_request, extra)
|
1004
|
+
end
|
1005
|
+
|
1006
|
+
# Place multi-leg option order
|
1007
|
+
# Places a multi-leg option order. Only supported on certain option trading brokerages. https://snaptrade.notion.site/brokerages has information on brokerage trading support
|
1008
|
+
# @param user_id [String]
|
1009
|
+
# @param user_secret [String]
|
1010
|
+
# @param account_id [String]
|
1011
|
+
# @param trading_place_mleg_order_request [TradingPlaceMlegOrderRequest]
|
1012
|
+
# @param [Hash] opts the optional parameters
|
1013
|
+
# @return [MlegOrderResponse]
|
1014
|
+
private def place_mleg_order_impl(user_id, user_secret, account_id, trading_place_mleg_order_request, opts = {})
|
1015
|
+
data, _status_code, _headers = place_mleg_order_with_http_info(user_id, user_secret, account_id, trading_place_mleg_order_request, opts)
|
1016
|
+
data
|
1017
|
+
end
|
1018
|
+
|
1019
|
+
# Place multi-leg option order
|
1020
|
+
# Places a multi-leg option order. Only supported on certain option trading brokerages. https://snaptrade.notion.site/brokerages has information on brokerage trading support
|
1021
|
+
# @param user_id [String]
|
1022
|
+
# @param user_secret [String]
|
1023
|
+
# @param account_id [String]
|
1024
|
+
# @param trading_place_mleg_order_request [TradingPlaceMlegOrderRequest]
|
1025
|
+
# @param [Hash] opts the optional parameters
|
1026
|
+
# @return [Array<(MlegOrderResponse, Integer, Hash)>] MlegOrderResponse data, response status code and response headers
|
1027
|
+
private def place_mleg_order_with_http_info_impl(user_id, user_secret, account_id, trading_place_mleg_order_request, opts = {})
|
1028
|
+
if @api_client.config.debugging
|
1029
|
+
@api_client.config.logger.debug 'Calling API: TradingApi.place_mleg_order ...'
|
1030
|
+
end
|
1031
|
+
# verify the required parameter 'user_id' is set
|
1032
|
+
if @api_client.config.client_side_validation && user_id.nil?
|
1033
|
+
fail ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.place_mleg_order"
|
1034
|
+
end
|
1035
|
+
# verify the required parameter 'user_secret' is set
|
1036
|
+
if @api_client.config.client_side_validation && user_secret.nil?
|
1037
|
+
fail ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.place_mleg_order"
|
1038
|
+
end
|
1039
|
+
# verify the required parameter 'account_id' is set
|
1040
|
+
if @api_client.config.client_side_validation && account_id.nil?
|
1041
|
+
fail ArgumentError, "Missing the required parameter 'account_id' when calling TradingApi.place_mleg_order"
|
1042
|
+
end
|
1043
|
+
# verify the required parameter 'trading_place_mleg_order_request' is set
|
1044
|
+
if @api_client.config.client_side_validation && trading_place_mleg_order_request.nil?
|
1045
|
+
fail ArgumentError, "Missing the required parameter 'trading_place_mleg_order_request' when calling TradingApi.place_mleg_order"
|
1046
|
+
end
|
1047
|
+
# resource path
|
1048
|
+
local_var_path = '/accounts/{accountId}/trading/options'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
|
1049
|
+
|
1050
|
+
# query parameters
|
1051
|
+
query_params = opts[:query_params] || {}
|
1052
|
+
query_params[:'userId'] = user_id
|
1053
|
+
query_params[:'userSecret'] = user_secret
|
1054
|
+
|
1055
|
+
# header parameters
|
1056
|
+
header_params = opts[:header_params] || {}
|
1057
|
+
# HTTP header 'Accept' (if needed)
|
1058
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
1059
|
+
# HTTP header 'Content-Type'
|
1060
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
1061
|
+
if !content_type.nil?
|
1062
|
+
header_params['Content-Type'] = content_type
|
1063
|
+
end
|
1064
|
+
|
1065
|
+
# form parameters
|
1066
|
+
form_params = opts[:form_params] || {}
|
1067
|
+
|
1068
|
+
# http body (model)
|
1069
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(trading_place_mleg_order_request)
|
1070
|
+
|
1071
|
+
# return_type
|
1072
|
+
return_type = opts[:debug_return_type] || 'MlegOrderResponse'
|
1073
|
+
|
1074
|
+
# auth_names
|
1075
|
+
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
1076
|
+
|
1077
|
+
new_options = opts.merge(
|
1078
|
+
:operation => :"TradingApi.place_mleg_order",
|
1079
|
+
:header_params => header_params,
|
1080
|
+
:query_params => query_params,
|
1081
|
+
:form_params => form_params,
|
1082
|
+
:body => post_body,
|
1083
|
+
:auth_names => auth_names,
|
1084
|
+
:return_type => return_type
|
1085
|
+
)
|
1086
|
+
|
1087
|
+
data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
|
1088
|
+
if @api_client.config.debugging
|
1089
|
+
@api_client.config.logger.debug "API called: TradingApi#place_mleg_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
1090
|
+
end
|
1091
|
+
return data, status_code, headers, response
|
1092
|
+
end
|
1093
|
+
|
1094
|
+
|
955
1095
|
# Place checked order
|
956
1096
|
#
|
957
1097
|
# Places the previously checked order with the brokerage. The `tradeId` is obtained from the [check order impact endpoint](/reference/Trading/Trading_getOrderImpact). If you prefer to place the order without checking for impact first, you can use the [place order endpoint](/reference/Trading/Trading_placeForceOrder).
|
@@ -1398,7 +1538,7 @@ module SnapTrade
|
|
1398
1538
|
#
|
1399
1539
|
# @param action [ActionStrict] The action describes the intent or side of a trade. This is either `BUY` or `SELL`.
|
1400
1540
|
# @param order_type [OrderTypeStrict] The type of order to place. - For `Limit` and `StopLimit` orders, the `price` field is required. - For `Stop` and `StopLimit` orders, the `stop` field is required.
|
1401
|
-
# @param time_in_force [TimeInForceStrict] The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely.
|
1541
|
+
# @param time_in_force [TimeInForceStrict] The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled.
|
1402
1542
|
# @param account_id [String] The ID of the account to execute the trade on.
|
1403
1543
|
# @param brokerage_order_id [String] The Brokerage Order ID of the order to replace.
|
1404
1544
|
# @param user_id [String]
|
@@ -1431,7 +1571,7 @@ module SnapTrade
|
|
1431
1571
|
#
|
1432
1572
|
# @param action [ActionStrict] The action describes the intent or side of a trade. This is either `BUY` or `SELL`.
|
1433
1573
|
# @param order_type [OrderTypeStrict] The type of order to place. - For `Limit` and `StopLimit` orders, the `price` field is required. - For `Stop` and `StopLimit` orders, the `stop` field is required.
|
1434
|
-
# @param time_in_force [TimeInForceStrict] The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely.
|
1574
|
+
# @param time_in_force [TimeInForceStrict] The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled.
|
1435
1575
|
# @param account_id [String] The ID of the account to execute the trade on.
|
1436
1576
|
# @param brokerage_order_id [String] The Brokerage Order ID of the order to replace.
|
1437
1577
|
# @param user_id [String]
|
@@ -22,7 +22,7 @@ module SnapTrade
|
|
22
22
|
# The type of order to place. - For `Limit` and `StopLimit` orders, the `price` field is required. - For `Stop` and `StopLimit` orders, the `stop` field is required.
|
23
23
|
attr_accessor :order_type
|
24
24
|
|
25
|
-
# The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely.
|
25
|
+
# The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled.
|
26
26
|
attr_accessor :time_in_force
|
27
27
|
|
28
28
|
attr_accessor :symbol
|
@@ -25,7 +25,7 @@ module SnapTrade
|
|
25
25
|
# The type of order to place. - For `Limit` and `StopLimit` orders, the `price` field is required. - For `Stop` and `StopLimit` orders, the `stop` field is required.
|
26
26
|
attr_accessor :order_type
|
27
27
|
|
28
|
-
# The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely.
|
28
|
+
# The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled.
|
29
29
|
attr_accessor :time_in_force
|
30
30
|
|
31
31
|
# The limit price for `Limit` and `StopLimit` orders.
|
@@ -24,7 +24,7 @@ module SnapTrade
|
|
24
24
|
# The type of order to place. - For `Limit` and `StopLimit` orders, the `price` field is required. - For `Stop` and `StopLimit` orders, the `stop` field is required.
|
25
25
|
attr_accessor :order_type
|
26
26
|
|
27
|
-
# The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely.
|
27
|
+
# The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled.
|
28
28
|
attr_accessor :time_in_force
|
29
29
|
|
30
30
|
# The limit price for `Limit` and `StopLimit` orders.
|
@@ -28,7 +28,7 @@ module SnapTrade
|
|
28
28
|
# The type of order to place. - For `Limit` and `StopLimit` orders, the `price` field is required. - For `Stop` and `StopLimit` orders, the `stop` field is required.
|
29
29
|
attr_accessor :order_type
|
30
30
|
|
31
|
-
# The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely.
|
31
|
+
# The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled.
|
32
32
|
attr_accessor :time_in_force
|
33
33
|
|
34
34
|
# The limit price for `Limit` and `StopLimit` orders.
|
@@ -19,7 +19,7 @@ module SnapTrade
|
|
19
19
|
# The type of order to place. - For `Limit` and `StopLimit` orders, the `price` field is required. - For `Stop` and `StopLimit` orders, the `stop` field is required.
|
20
20
|
attr_accessor :order_type
|
21
21
|
|
22
|
-
# The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely.
|
22
|
+
# The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled.
|
23
23
|
attr_accessor :time_in_force
|
24
24
|
|
25
25
|
# The limit price for `Limit` and `StopLimit` orders.
|
@@ -0,0 +1,41 @@
|
|
1
|
+
=begin
|
2
|
+
#SnapTrade
|
3
|
+
|
4
|
+
#Connect brokerage accounts to your app for live positions and trading
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
Contact: api@snaptrade.com
|
8
|
+
=end
|
9
|
+
|
10
|
+
require 'date'
|
11
|
+
require 'time'
|
12
|
+
|
13
|
+
module SnapTrade
|
14
|
+
class MlegActionStrict
|
15
|
+
BUY = "BUY".freeze
|
16
|
+
SELL = "SELL".freeze
|
17
|
+
BUY_TO_OPEN = "BUY_TO_OPEN".freeze
|
18
|
+
BUY_TO_CLOSE = "BUY_TO_CLOSE".freeze
|
19
|
+
SELL_TO_OPEN = "SELL_TO_OPEN".freeze
|
20
|
+
SELL_TO_CLOSE = "SELL_TO_CLOSE".freeze
|
21
|
+
|
22
|
+
def self.all_vars
|
23
|
+
@all_vars ||= [BUY, SELL, BUY_TO_OPEN, BUY_TO_CLOSE, SELL_TO_OPEN, SELL_TO_CLOSE].freeze
|
24
|
+
end
|
25
|
+
|
26
|
+
# Builds the enum from string
|
27
|
+
# @param [String] The enum value in the form of the string
|
28
|
+
# @return [String] The enum value
|
29
|
+
def self.build_from_hash(value)
|
30
|
+
new.build_from_hash(value)
|
31
|
+
end
|
32
|
+
|
33
|
+
# Builds the enum from string
|
34
|
+
# @param [String] The enum value in the form of the string
|
35
|
+
# @return [String] The enum value
|
36
|
+
def build_from_hash(value)
|
37
|
+
return value if MlegActionStrict.all_vars.include?(value)
|
38
|
+
raise "Invalid ENUM value #{value} for class #MlegActionStrict"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|