snaptrade 2.0.46 → 2.0.48
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -3
- data/README.md +28 -11
- data/lib/snaptrade/api/trading_api.rb +29 -25
- data/lib/snaptrade/api/transactions_and_reporting_api.rb +4 -4
- data/lib/snaptrade/models/account_order_record.rb +15 -15
- data/lib/snaptrade/models/account_order_record_universal_symbol.rb +17 -17
- data/lib/snaptrade/models/action_strict_with_options.rb +41 -0
- data/lib/snaptrade/models/brokerage.rb +26 -26
- data/lib/snaptrade/models/brokerage_authorization.rb +14 -14
- data/lib/snaptrade/models/holdings_status.rb +1 -0
- 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_with_options.rb +333 -0
- data/lib/snaptrade/models/manual_trade_symbol.rb +14 -14
- data/lib/snaptrade/models/option_brokerage_symbol.rb +13 -13
- data/lib/snaptrade/models/options_position.rb +15 -15
- data/lib/snaptrade/models/position.rb +16 -16
- data/lib/snaptrade/models/position_symbol.rb +10 -10
- data/lib/snaptrade/models/transactions_status.rb +1 -0
- data/lib/snaptrade/models/underlying_symbol.rb +17 -17
- data/lib/snaptrade/models/universal_activity.rb +1 -1
- data/lib/snaptrade/models/universal_symbol.rb +17 -17
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +2 -0
- data/spec/api/trading_api_spec.rb +1 -1
- data/spec/api/transactions_and_reporting_api_spec.rb +1 -1
- data/spec/models/account_order_record_spec.rb +6 -6
- data/spec/models/account_order_record_universal_symbol_spec.rb +3 -3
- data/spec/models/action_strict_with_options_spec.rb +23 -0
- data/spec/models/brokerage_authorization_spec.rb +6 -6
- data/spec/models/brokerage_spec.rb +8 -8
- data/spec/models/manual_trade_form_with_options_spec.rb +83 -0
- data/spec/models/manual_trade_symbol_spec.rb +6 -6
- data/spec/models/option_brokerage_symbol_spec.rb +3 -3
- data/spec/models/options_position_spec.rb +2 -2
- data/spec/models/position_spec.rb +2 -2
- data/spec/models/position_symbol_spec.rb +3 -3
- data/spec/models/underlying_symbol_spec.rb +3 -3
- data/spec/models/universal_symbol_spec.rb +3 -3
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4480346bca60bdd984cd30d296f1771142e6ee150ee552ea2c8170c83c901190
|
4
|
+
data.tar.gz: 7d8fcce4f0080e3bb5d96ae58f6f3a02085303383438bf59a9ae8ce891c163cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9dcfa495dc6502ad7cd2250e877b369121a0e6a91d2fb1335c005147f9ac52dcd1bb2d7b136d427fbc5b7785d6b457bfa6291070b5be5b49f3afb654d5e599ce
|
7
|
+
data.tar.gz: a654f8a16d185b35b579ff32c2b6d8a6a18603d7f14829aeee80a04721a05935d4a1070d20956b5d3331ba33bce843135289b078a5bb5e3b04799fe2dd210d0a
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
snaptrade (2.0.
|
4
|
+
snaptrade (2.0.48)
|
5
5
|
faraday (>= 1.0.1, < 3.0)
|
6
6
|
faraday-multipart (~> 1.0, >= 1.0.4)
|
7
7
|
|
@@ -44,7 +44,7 @@ GEM
|
|
44
44
|
regexp_parser (2.9.2)
|
45
45
|
reline (0.5.10)
|
46
46
|
io-console (~> 0.5)
|
47
|
-
rexml (3.3.
|
47
|
+
rexml (3.3.8)
|
48
48
|
rspec (3.13.0)
|
49
49
|
rspec-core (~> 3.13.0)
|
50
50
|
rspec-expectations (~> 3.13.0)
|
@@ -54,7 +54,7 @@ GEM
|
|
54
54
|
rspec-expectations (3.13.3)
|
55
55
|
diff-lcs (>= 1.2.0, < 2.0)
|
56
56
|
rspec-support (~> 3.13.0)
|
57
|
-
rspec-mocks (3.13.
|
57
|
+
rspec-mocks (3.13.2)
|
58
58
|
diff-lcs (>= 1.2.0, < 2.0)
|
59
59
|
rspec-support (~> 3.13.0)
|
60
60
|
rspec-support (3.13.1)
|
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
|
-
[![npm](https://img.shields.io/badge/gem-v2.0.
|
9
|
+
[![npm](https://img.shields.io/badge/gem-v2.0.48-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.48)
|
10
10
|
[![More Info](https://img.shields.io/badge/More%20Info-Click%20Here-orange)](https://snaptrade.com/)
|
11
11
|
|
12
12
|
</div>
|
@@ -70,7 +70,7 @@ Connect brokerage accounts to your app for live positions and trading
|
|
70
70
|
Add to Gemfile:
|
71
71
|
|
72
72
|
```ruby
|
73
|
-
gem 'snaptrade', '~> 2.0.
|
73
|
+
gem 'snaptrade', '~> 2.0.48'
|
74
74
|
```
|
75
75
|
|
76
76
|
## Getting Started<a id="getting-started"></a>
|
@@ -1436,7 +1436,7 @@ reference the account in SnapTrade.
|
|
1436
1436
|
|
1437
1437
|
##### action: [`ActionStrict`](./lib/snaptrade/models/action_strict.rb)<a id="action-actionstrictlibsnaptrademodelsaction_strictrb"></a>
|
1438
1438
|
The action describes the intent or side of a trade. This is either `BUY` or
|
1439
|
-
`SELL
|
1439
|
+
`SELL`.
|
1440
1440
|
|
1441
1441
|
##### universal_symbol_id: `String`<a id="universal_symbol_id-string"></a>
|
1442
1442
|
Unique identifier for the symbol within SnapTrade. This is the ID used to
|
@@ -1535,11 +1535,12 @@ It's recommended to trigger a manual refresh of the account after placing an ord
|
|
1535
1535
|
result = snaptrade.trading.place_force_order(
|
1536
1536
|
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
1537
1537
|
action: "BUY",
|
1538
|
-
universal_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
1539
1538
|
order_type: "Market",
|
1540
1539
|
time_in_force: "FOK",
|
1541
1540
|
user_id: "snaptrade-user-123",
|
1542
1541
|
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
1542
|
+
universal_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
1543
|
+
symbol: "AAPL 131124C00240000",
|
1543
1544
|
price: 31.33,
|
1544
1545
|
stop: 31.33,
|
1545
1546
|
units: 10.5,
|
@@ -1554,13 +1555,10 @@ p result
|
|
1554
1555
|
Unique identifier for the connected brokerage account. This is the UUID used to
|
1555
1556
|
reference the account in SnapTrade.
|
1556
1557
|
|
1557
|
-
##### action: [`
|
1558
|
+
##### action: [`ActionStrictWithOptions`](./lib/snaptrade/models/action_strict_with_options.rb)<a id="action-actionstrictwithoptionslibsnaptrademodelsaction_strict_with_optionsrb"></a>
|
1558
1559
|
The action describes the intent or side of a trade. This is either `BUY` or
|
1559
|
-
`SELL`
|
1560
|
-
|
1561
|
-
##### universal_symbol_id: `String`<a id="universal_symbol_id-string"></a>
|
1562
|
-
Unique identifier for the symbol within SnapTrade. This is the ID used to
|
1563
|
-
reference the symbol in SnapTrade API calls.
|
1560
|
+
`SELL` for Equity symbols or `BUY_TO_OPEN`, `BUY_TO_CLOSE`, `SELL_TO_OPEN` or
|
1561
|
+
`SELL_TO_CLOSE` for Options.
|
1564
1562
|
|
1565
1563
|
##### order_type: [`OrderTypeStrict`](./lib/snaptrade/models/order_type_strict.rb)<a id="order_type-ordertypestrictlibsnaptrademodelsorder_type_strictrb"></a>
|
1566
1564
|
The type of order to place. - For `Limit` and `StopLimit` orders, the `price`
|
@@ -1577,6 +1575,18 @@ immediately or be canceled completely.
|
|
1577
1575
|
|
1578
1576
|
##### user_id: `String`<a id="user_id-string"></a>
|
1579
1577
|
##### user_secret: `String`<a id="user_secret-string"></a>
|
1578
|
+
##### universal_symbol_id: [`String`](./lib/snaptrade/models/string.rb)<a id="universal_symbol_id-stringlibsnaptrademodelsstringrb"></a>
|
1579
|
+
The universal symbol ID of the security to trade. Must be 'null' if `symbol` is
|
1580
|
+
provided, otherwise must be provided.
|
1581
|
+
|
1582
|
+
##### symbol: `String`<a id="symbol-string"></a>
|
1583
|
+
The security's trading ticker symbol. This currently only support Options
|
1584
|
+
symbols in the 21 character OCC format. For example \"AAPL 131124C00240000\"
|
1585
|
+
represents a call option on AAPL expiring on 2024-11-13 with a strike price of
|
1586
|
+
$240. For more information on the OCC format, see
|
1587
|
+
[here](https://en.wikipedia.org/wiki/Option_symbol#OCC_format). If 'symbol' is
|
1588
|
+
provided, then 'universal_symbol_id' must be 'null'.
|
1589
|
+
|
1580
1590
|
##### price: `Float`<a id="price-float"></a>
|
1581
1591
|
The limit price for `Limit` and `StopLimit` orders.
|
1582
1592
|
|
@@ -1584,6 +1594,11 @@ The limit price for `Limit` and `StopLimit` orders.
|
|
1584
1594
|
The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
|
1585
1595
|
|
1586
1596
|
##### units: [`Float`](./lib/snaptrade/models/float.rb)<a id="units-floatlibsnaptrademodelsfloatrb"></a>
|
1597
|
+
For Equity orders, this represents the number of shares for the order. This can
|
1598
|
+
be a decimal for fractional orders. Must be `null` if `notional_value` is
|
1599
|
+
provided. If placing an Option order, this field represents the number of
|
1600
|
+
contracts to buy or sell. (e.g., 1 contract = 100 shares).
|
1601
|
+
|
1587
1602
|
##### notional_value: [`ManualTradeFormNotionalValue`](./lib/snaptrade/models/manual_trade_form_notional_value.rb)<a id="notional_value-manualtradeformnotionalvaluelibsnaptrademodelsmanual_trade_form_notional_valuerb"></a>
|
1588
1603
|
#### 🔄 Return<a id="🔄-return"></a>
|
1589
1604
|
|
@@ -1701,7 +1716,9 @@ values. Here are some of the most popular values: - `BUY` - Asset bought. -
|
|
1701
1716
|
`SELL` - Asset sold. - `DIVIDEND` - Dividend payout. - `CONTRIBUTION` - Cash
|
1702
1717
|
contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment.
|
1703
1718
|
- `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from
|
1704
|
-
the account.
|
1719
|
+
the account. - `OPTIONEXPIRATION` - Option expiration event. -
|
1720
|
+
`OPTIONASSIGNMENT` - Option assignment event. - `OPTIONEXERCISE` - Option
|
1721
|
+
exercise event.
|
1705
1722
|
|
1706
1723
|
#### 🔄 Return<a id="🔄-return"></a>
|
1707
1724
|
|
@@ -146,7 +146,7 @@ module SnapTrade
|
|
146
146
|
# Simulates an order and its impact on the account. This endpoint does not place the order with the brokerage. If successful, it returns a `Trade` object and the ID of the object can be used to place the order with the brokerage using the [place checked order endpoint](/reference/Trading/Trading_placeOrder). Please note that the `Trade` object returned expires after 5 minutes. Any order placed using an expired `Trade` will be rejected.
|
147
147
|
#
|
148
148
|
# @param account_id [String] Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
|
149
|
-
# @param action [ActionStrict] The action describes the intent or side of a trade. This is either `BUY` or `SELL
|
149
|
+
# @param action [ActionStrict] The action describes the intent or side of a trade. This is either `BUY` or `SELL`.
|
150
150
|
# @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.
|
151
151
|
# @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.
|
152
152
|
# @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.
|
@@ -179,7 +179,7 @@ module SnapTrade
|
|
179
179
|
# Simulates an order and its impact on the account. This endpoint does not place the order with the brokerage. If successful, it returns a `Trade` object and the ID of the object can be used to place the order with the brokerage using the [place checked order endpoint](/reference/Trading/Trading_placeOrder). Please note that the `Trade` object returned expires after 5 minutes. Any order placed using an expired `Trade` will be rejected.
|
180
180
|
#
|
181
181
|
# @param account_id [String] Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
|
182
|
-
# @param action [ActionStrict] The action describes the intent or side of a trade. This is either `BUY` or `SELL
|
182
|
+
# @param action [ActionStrict] The action describes the intent or side of a trade. This is either `BUY` or `SELL`.
|
183
183
|
# @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.
|
184
184
|
# @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.
|
185
185
|
# @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.
|
@@ -417,31 +417,33 @@ module SnapTrade
|
|
417
417
|
# It's recommended to trigger a manual refresh of the account after placing an order to ensure the account is up to date. You can use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint for this.
|
418
418
|
#
|
419
419
|
# @param account_id [String] Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
|
420
|
-
# @param action [
|
421
|
-
# @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.
|
420
|
+
# @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.
|
422
421
|
# @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.
|
423
422
|
# @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.
|
424
423
|
# @param user_id [String]
|
425
424
|
# @param user_secret [String]
|
425
|
+
# @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.
|
426
|
+
# @param symbol [String] The security's trading ticker symbol. This currently only support Options symbols in the 21 character OCC format. For example \"AAPL 131124C00240000\" represents a call option on AAPL expiring on 2024-11-13 with a strike price of $240. For more information on the OCC format, see [here](https://en.wikipedia.org/wiki/Option_symbol#OCC_format). If 'symbol' is provided, then 'universal_symbol_id' must be 'null'.
|
426
427
|
# @param price [Float] The limit price for `Limit` and `StopLimit` orders.
|
427
428
|
# @param stop [Float] The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
|
428
|
-
# @param units [Float]
|
429
|
+
# @param units [Float] For Equity orders, this represents the number of shares for the order. This can be a decimal for fractional orders. Must be `null` if `notional_value` is provided. If placing an Option order, this field represents the number of contracts to buy or sell. (e.g., 1 contract = 100 shares).
|
429
430
|
# @param notional_value [ManualTradeFormNotionalValue]
|
430
|
-
# @param body [
|
431
|
+
# @param body [ManualTradeFormWithOptions]
|
431
432
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
432
|
-
def place_force_order(account_id:, action:,
|
433
|
+
def place_force_order(account_id:, action:, order_type:, time_in_force:, user_id:, user_secret:, universal_symbol_id: SENTINEL, symbol: SENTINEL, price: SENTINEL, stop: SENTINEL, units: SENTINEL, notional_value: SENTINEL, extra: {})
|
433
434
|
_body = {}
|
434
435
|
_body[:account_id] = account_id if account_id != SENTINEL
|
435
436
|
_body[:action] = action if action != SENTINEL
|
436
437
|
_body[:universal_symbol_id] = universal_symbol_id if universal_symbol_id != SENTINEL
|
438
|
+
_body[:symbol] = symbol if symbol != SENTINEL
|
437
439
|
_body[:order_type] = order_type if order_type != SENTINEL
|
438
440
|
_body[:time_in_force] = time_in_force if time_in_force != SENTINEL
|
439
441
|
_body[:price] = price if price != SENTINEL
|
440
442
|
_body[:stop] = stop if stop != SENTINEL
|
441
443
|
_body[:units] = units if units != SENTINEL
|
442
444
|
_body[:notional_value] = notional_value if notional_value != SENTINEL
|
443
|
-
|
444
|
-
data, _status_code, _headers = place_force_order_with_http_info_impl(user_id, user_secret,
|
445
|
+
manual_trade_form_with_options = _body
|
446
|
+
data, _status_code, _headers = place_force_order_with_http_info_impl(user_id, user_secret, manual_trade_form_with_options, extra)
|
445
447
|
data
|
446
448
|
end
|
447
449
|
|
@@ -454,42 +456,44 @@ module SnapTrade
|
|
454
456
|
# It's recommended to trigger a manual refresh of the account after placing an order to ensure the account is up to date. You can use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint for this.
|
455
457
|
#
|
456
458
|
# @param account_id [String] Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
|
457
|
-
# @param action [
|
458
|
-
# @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.
|
459
|
+
# @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.
|
459
460
|
# @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.
|
460
461
|
# @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.
|
461
462
|
# @param user_id [String]
|
462
463
|
# @param user_secret [String]
|
464
|
+
# @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.
|
465
|
+
# @param symbol [String] The security's trading ticker symbol. This currently only support Options symbols in the 21 character OCC format. For example \"AAPL 131124C00240000\" represents a call option on AAPL expiring on 2024-11-13 with a strike price of $240. For more information on the OCC format, see [here](https://en.wikipedia.org/wiki/Option_symbol#OCC_format). If 'symbol' is provided, then 'universal_symbol_id' must be 'null'.
|
463
466
|
# @param price [Float] The limit price for `Limit` and `StopLimit` orders.
|
464
467
|
# @param stop [Float] The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
|
465
|
-
# @param units [Float]
|
468
|
+
# @param units [Float] For Equity orders, this represents the number of shares for the order. This can be a decimal for fractional orders. Must be `null` if `notional_value` is provided. If placing an Option order, this field represents the number of contracts to buy or sell. (e.g., 1 contract = 100 shares).
|
466
469
|
# @param notional_value [ManualTradeFormNotionalValue]
|
467
|
-
# @param body [
|
470
|
+
# @param body [ManualTradeFormWithOptions]
|
468
471
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
469
|
-
def place_force_order_with_http_info(account_id:, action:,
|
472
|
+
def place_force_order_with_http_info(account_id:, action:, order_type:, time_in_force:, user_id:, user_secret:, universal_symbol_id: SENTINEL, symbol: SENTINEL, price: SENTINEL, stop: SENTINEL, units: SENTINEL, notional_value: SENTINEL, extra: {})
|
470
473
|
_body = {}
|
471
474
|
_body[:account_id] = account_id if account_id != SENTINEL
|
472
475
|
_body[:action] = action if action != SENTINEL
|
473
476
|
_body[:universal_symbol_id] = universal_symbol_id if universal_symbol_id != SENTINEL
|
477
|
+
_body[:symbol] = symbol if symbol != SENTINEL
|
474
478
|
_body[:order_type] = order_type if order_type != SENTINEL
|
475
479
|
_body[:time_in_force] = time_in_force if time_in_force != SENTINEL
|
476
480
|
_body[:price] = price if price != SENTINEL
|
477
481
|
_body[:stop] = stop if stop != SENTINEL
|
478
482
|
_body[:units] = units if units != SENTINEL
|
479
483
|
_body[:notional_value] = notional_value if notional_value != SENTINEL
|
480
|
-
|
481
|
-
place_force_order_with_http_info_impl(user_id, user_secret,
|
484
|
+
manual_trade_form_with_options = _body
|
485
|
+
place_force_order_with_http_info_impl(user_id, user_secret, manual_trade_form_with_options, extra)
|
482
486
|
end
|
483
487
|
|
484
488
|
# Place order
|
485
489
|
# Places a brokerage order in the specified account. The order could be rejected by the brokerage if it is invalid or if the account does not have sufficient funds. This endpoint does not compute the impact to the account balance from the order and any potential commissions before submitting the order to the brokerage. If that is desired, you can use the [check order impact endpoint](/reference/Trading/Trading_getOrderImpact). It's recommended to trigger a manual refresh of the account after placing an order to ensure the account is up to date. You can use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint for this.
|
486
490
|
# @param user_id [String]
|
487
491
|
# @param user_secret [String]
|
488
|
-
# @param
|
492
|
+
# @param manual_trade_form_with_options [ManualTradeFormWithOptions]
|
489
493
|
# @param [Hash] opts the optional parameters
|
490
494
|
# @return [AccountOrderRecord]
|
491
|
-
private def place_force_order_impl(user_id, user_secret,
|
492
|
-
data, _status_code, _headers = place_force_order_with_http_info(user_id, user_secret,
|
495
|
+
private def place_force_order_impl(user_id, user_secret, manual_trade_form_with_options, opts = {})
|
496
|
+
data, _status_code, _headers = place_force_order_with_http_info(user_id, user_secret, manual_trade_form_with_options, opts)
|
493
497
|
data
|
494
498
|
end
|
495
499
|
|
@@ -497,10 +501,10 @@ module SnapTrade
|
|
497
501
|
# Places a brokerage order in the specified account. The order could be rejected by the brokerage if it is invalid or if the account does not have sufficient funds. This endpoint does not compute the impact to the account balance from the order and any potential commissions before submitting the order to the brokerage. If that is desired, you can use the [check order impact endpoint](/reference/Trading/Trading_getOrderImpact). It's recommended to trigger a manual refresh of the account after placing an order to ensure the account is up to date. You can use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint for this.
|
498
502
|
# @param user_id [String]
|
499
503
|
# @param user_secret [String]
|
500
|
-
# @param
|
504
|
+
# @param manual_trade_form_with_options [ManualTradeFormWithOptions]
|
501
505
|
# @param [Hash] opts the optional parameters
|
502
506
|
# @return [Array<(AccountOrderRecord, Integer, Hash)>] AccountOrderRecord data, response status code and response headers
|
503
|
-
private def place_force_order_with_http_info_impl(user_id, user_secret,
|
507
|
+
private def place_force_order_with_http_info_impl(user_id, user_secret, manual_trade_form_with_options, opts = {})
|
504
508
|
if @api_client.config.debugging
|
505
509
|
@api_client.config.logger.debug 'Calling API: TradingApi.place_force_order ...'
|
506
510
|
end
|
@@ -512,9 +516,9 @@ module SnapTrade
|
|
512
516
|
if @api_client.config.client_side_validation && user_secret.nil?
|
513
517
|
fail ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.place_force_order"
|
514
518
|
end
|
515
|
-
# verify the required parameter '
|
516
|
-
if @api_client.config.client_side_validation &&
|
517
|
-
fail ArgumentError, "Missing the required parameter '
|
519
|
+
# verify the required parameter 'manual_trade_form_with_options' is set
|
520
|
+
if @api_client.config.client_side_validation && manual_trade_form_with_options.nil?
|
521
|
+
fail ArgumentError, "Missing the required parameter 'manual_trade_form_with_options' when calling TradingApi.place_force_order"
|
518
522
|
end
|
519
523
|
# resource path
|
520
524
|
local_var_path = '/trade/place'
|
@@ -538,7 +542,7 @@ module SnapTrade
|
|
538
542
|
form_params = opts[:form_params] || {}
|
539
543
|
|
540
544
|
# http body (model)
|
541
|
-
post_body = opts[:debug_body] || @api_client.object_to_http_body(
|
545
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(manual_trade_form_with_options)
|
542
546
|
|
543
547
|
# return_type
|
544
548
|
return_type = opts[:debug_return_type] || 'AccountOrderRecord'
|
@@ -31,7 +31,7 @@ module SnapTrade
|
|
31
31
|
# @param end_date [Date] The end date (inclusive) of the transaction history to retrieve. If not provided, the default is the last transaction known to SnapTrade based on `trade_date`.
|
32
32
|
# @param accounts [String] Optional comma separated list of SnapTrade Account IDs used to filter the request to specific accounts. If not provided, the default is all known brokerage accounts for the user. The `brokerageAuthorizations` parameter takes precedence over this parameter.
|
33
33
|
# @param brokerage_authorizations [String] Optional comma separated list of SnapTrade Connection (Brokerage Authorization) IDs used to filter the request to only accounts that belong to those connections. If not provided, the default is all connections for the user. This parameter takes precedence over the `accounts` parameter.
|
34
|
-
# @param type [String] Optional comma separated list of transaction types to filter by. SnapTrade does a best effort to categorize brokerage transaction types into a common set of values. Here are some of the most popular values: - `BUY` - Asset bought. - `SELL` - Asset sold. - `DIVIDEND` - Dividend payout. - `CONTRIBUTION` - Cash contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment. - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account.
|
34
|
+
# @param type [String] Optional comma separated list of transaction types to filter by. SnapTrade does a best effort to categorize brokerage transaction types into a common set of values. Here are some of the most popular values: - `BUY` - Asset bought. - `SELL` - Asset sold. - `DIVIDEND` - Dividend payout. - `CONTRIBUTION` - Cash contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment. - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `OPTIONEXPIRATION` - Option expiration event. - `OPTIONASSIGNMENT` - Option assignment event. - `OPTIONEXERCISE` - Option exercise event.
|
35
35
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
36
36
|
def get_activities(user_id:, user_secret:, start_date: SENTINEL, end_date: SENTINEL, accounts: SENTINEL, brokerage_authorizations: SENTINEL, type: SENTINEL, extra: {})
|
37
37
|
extra[:start_date] = start_date if start_date != SENTINEL
|
@@ -57,7 +57,7 @@ module SnapTrade
|
|
57
57
|
# @param end_date [Date] The end date (inclusive) of the transaction history to retrieve. If not provided, the default is the last transaction known to SnapTrade based on `trade_date`.
|
58
58
|
# @param accounts [String] Optional comma separated list of SnapTrade Account IDs used to filter the request to specific accounts. If not provided, the default is all known brokerage accounts for the user. The `brokerageAuthorizations` parameter takes precedence over this parameter.
|
59
59
|
# @param brokerage_authorizations [String] Optional comma separated list of SnapTrade Connection (Brokerage Authorization) IDs used to filter the request to only accounts that belong to those connections. If not provided, the default is all connections for the user. This parameter takes precedence over the `accounts` parameter.
|
60
|
-
# @param type [String] Optional comma separated list of transaction types to filter by. SnapTrade does a best effort to categorize brokerage transaction types into a common set of values. Here are some of the most popular values: - `BUY` - Asset bought. - `SELL` - Asset sold. - `DIVIDEND` - Dividend payout. - `CONTRIBUTION` - Cash contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment. - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account.
|
60
|
+
# @param type [String] Optional comma separated list of transaction types to filter by. SnapTrade does a best effort to categorize brokerage transaction types into a common set of values. Here are some of the most popular values: - `BUY` - Asset bought. - `SELL` - Asset sold. - `DIVIDEND` - Dividend payout. - `CONTRIBUTION` - Cash contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment. - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `OPTIONEXPIRATION` - Option expiration event. - `OPTIONASSIGNMENT` - Option assignment event. - `OPTIONEXERCISE` - Option exercise event.
|
61
61
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
62
62
|
def get_activities_with_http_info(user_id:, user_secret:, start_date: SENTINEL, end_date: SENTINEL, accounts: SENTINEL, brokerage_authorizations: SENTINEL, type: SENTINEL, extra: {})
|
63
63
|
extra[:start_date] = start_date if start_date != SENTINEL
|
@@ -77,7 +77,7 @@ module SnapTrade
|
|
77
77
|
# @option opts [Date] :end_date The end date (inclusive) of the transaction history to retrieve. If not provided, the default is the last transaction known to SnapTrade based on `trade_date`.
|
78
78
|
# @option opts [String] :accounts Optional comma separated list of SnapTrade Account IDs used to filter the request to specific accounts. If not provided, the default is all known brokerage accounts for the user. The `brokerageAuthorizations` parameter takes precedence over this parameter.
|
79
79
|
# @option opts [String] :brokerage_authorizations Optional comma separated list of SnapTrade Connection (Brokerage Authorization) IDs used to filter the request to only accounts that belong to those connections. If not provided, the default is all connections for the user. This parameter takes precedence over the `accounts` parameter.
|
80
|
-
# @option opts [String] :type Optional comma separated list of transaction types to filter by. SnapTrade does a best effort to categorize brokerage transaction types into a common set of values. Here are some of the most popular values: - `BUY` - Asset bought. - `SELL` - Asset sold. - `DIVIDEND` - Dividend payout. - `CONTRIBUTION` - Cash contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment. - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account.
|
80
|
+
# @option opts [String] :type Optional comma separated list of transaction types to filter by. SnapTrade does a best effort to categorize brokerage transaction types into a common set of values. Here are some of the most popular values: - `BUY` - Asset bought. - `SELL` - Asset sold. - `DIVIDEND` - Dividend payout. - `CONTRIBUTION` - Cash contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment. - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `OPTIONEXPIRATION` - Option expiration event. - `OPTIONASSIGNMENT` - Option assignment event. - `OPTIONEXERCISE` - Option exercise event.
|
81
81
|
# @return [Array<UniversalActivity>]
|
82
82
|
private def get_activities_impl(user_id, user_secret, opts = {})
|
83
83
|
data, _status_code, _headers = get_activities_with_http_info(user_id, user_secret, opts)
|
@@ -93,7 +93,7 @@ module SnapTrade
|
|
93
93
|
# @option opts [Date] :end_date The end date (inclusive) of the transaction history to retrieve. If not provided, the default is the last transaction known to SnapTrade based on `trade_date`.
|
94
94
|
# @option opts [String] :accounts Optional comma separated list of SnapTrade Account IDs used to filter the request to specific accounts. If not provided, the default is all known brokerage accounts for the user. The `brokerageAuthorizations` parameter takes precedence over this parameter.
|
95
95
|
# @option opts [String] :brokerage_authorizations Optional comma separated list of SnapTrade Connection (Brokerage Authorization) IDs used to filter the request to only accounts that belong to those connections. If not provided, the default is all connections for the user. This parameter takes precedence over the `accounts` parameter.
|
96
|
-
# @option opts [String] :type Optional comma separated list of transaction types to filter by. SnapTrade does a best effort to categorize brokerage transaction types into a common set of values. Here are some of the most popular values: - `BUY` - Asset bought. - `SELL` - Asset sold. - `DIVIDEND` - Dividend payout. - `CONTRIBUTION` - Cash contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment. - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account.
|
96
|
+
# @option opts [String] :type Optional comma separated list of transaction types to filter by. SnapTrade does a best effort to categorize brokerage transaction types into a common set of values. Here are some of the most popular values: - `BUY` - Asset bought. - `SELL` - Asset sold. - `DIVIDEND` - Dividend payout. - `CONTRIBUTION` - Cash contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment. - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `OPTIONEXPIRATION` - Option expiration event. - `OPTIONASSIGNMENT` - Option assignment event. - `OPTIONEXERCISE` - Option exercise event.
|
97
97
|
# @return [Array<(Array<UniversalActivity>, Integer, Hash)>] Array<UniversalActivity> data, response status code and response headers
|
98
98
|
private def get_activities_with_http_info_impl(user_id, user_secret, opts = {})
|
99
99
|
if @api_client.config.debugging
|
@@ -19,9 +19,6 @@ module SnapTrade
|
|
19
19
|
# Indicates the status of an order. SnapTrade does a best effort to map brokerage statuses to statuses in this enum.
|
20
20
|
attr_accessor :status
|
21
21
|
|
22
|
-
# A unique ID for the security within SnapTrade, scoped to the brokerage account that the security belongs to. This is a legacy field and should not be used. Do not rely on this being a stable ID as it can change.
|
23
|
-
attr_accessor :symbol
|
24
|
-
|
25
22
|
attr_accessor :universal_symbol
|
26
23
|
|
27
24
|
attr_accessor :option_symbol
|
@@ -68,12 +65,14 @@ module SnapTrade
|
|
68
65
|
# The time the order expires. This value is not always available from the brokerage.
|
69
66
|
attr_accessor :expiry_date
|
70
67
|
|
68
|
+
# A unique ID for the security within SnapTrade, scoped to the brokerage account that the security belongs to. This is a legacy field and should not be used. Do not rely on this being a stable ID as it can change.
|
69
|
+
attr_accessor :symbol
|
70
|
+
|
71
71
|
# Attribute mapping from ruby-style variable name to JSON key.
|
72
72
|
def self.attribute_map
|
73
73
|
{
|
74
74
|
:'brokerage_order_id' => :'brokerage_order_id',
|
75
75
|
:'status' => :'status',
|
76
|
-
:'symbol' => :'symbol',
|
77
76
|
:'universal_symbol' => :'universal_symbol',
|
78
77
|
:'option_symbol' => :'option_symbol',
|
79
78
|
:'action' => :'action',
|
@@ -89,7 +88,8 @@ module SnapTrade
|
|
89
88
|
:'time_placed' => :'time_placed',
|
90
89
|
:'time_updated' => :'time_updated',
|
91
90
|
:'time_executed' => :'time_executed',
|
92
|
-
:'expiry_date' => :'expiry_date'
|
91
|
+
:'expiry_date' => :'expiry_date',
|
92
|
+
:'symbol' => :'symbol'
|
93
93
|
}
|
94
94
|
end
|
95
95
|
|
@@ -103,7 +103,6 @@ module SnapTrade
|
|
103
103
|
{
|
104
104
|
:'brokerage_order_id' => :'String',
|
105
105
|
:'status' => :'AccountOrderRecordStatus',
|
106
|
-
:'symbol' => :'String',
|
107
106
|
:'universal_symbol' => :'AccountOrderRecordUniversalSymbol',
|
108
107
|
:'option_symbol' => :'AccountOrderRecordOptionSymbol',
|
109
108
|
:'action' => :'String',
|
@@ -119,7 +118,8 @@ module SnapTrade
|
|
119
118
|
:'time_placed' => :'Time',
|
120
119
|
:'time_updated' => :'Time',
|
121
120
|
:'time_executed' => :'Time',
|
122
|
-
:'expiry_date' => :'Time'
|
121
|
+
:'expiry_date' => :'Time',
|
122
|
+
:'symbol' => :'String'
|
123
123
|
}
|
124
124
|
end
|
125
125
|
|
@@ -136,7 +136,7 @@ module SnapTrade
|
|
136
136
|
:'order_type',
|
137
137
|
:'time_updated',
|
138
138
|
:'time_executed',
|
139
|
-
:'expiry_date'
|
139
|
+
:'expiry_date',
|
140
140
|
])
|
141
141
|
end
|
142
142
|
|
@@ -163,10 +163,6 @@ module SnapTrade
|
|
163
163
|
self.status = attributes[:'status']
|
164
164
|
end
|
165
165
|
|
166
|
-
if attributes.key?(:'symbol')
|
167
|
-
self.symbol = attributes[:'symbol']
|
168
|
-
end
|
169
|
-
|
170
166
|
if attributes.key?(:'universal_symbol')
|
171
167
|
self.universal_symbol = attributes[:'universal_symbol']
|
172
168
|
end
|
@@ -230,6 +226,10 @@ module SnapTrade
|
|
230
226
|
if attributes.key?(:'expiry_date')
|
231
227
|
self.expiry_date = attributes[:'expiry_date']
|
232
228
|
end
|
229
|
+
|
230
|
+
if attributes.key?(:'symbol')
|
231
|
+
self.symbol = attributes[:'symbol']
|
232
|
+
end
|
233
233
|
end
|
234
234
|
|
235
235
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -252,7 +252,6 @@ module SnapTrade
|
|
252
252
|
self.class == o.class &&
|
253
253
|
brokerage_order_id == o.brokerage_order_id &&
|
254
254
|
status == o.status &&
|
255
|
-
symbol == o.symbol &&
|
256
255
|
universal_symbol == o.universal_symbol &&
|
257
256
|
option_symbol == o.option_symbol &&
|
258
257
|
action == o.action &&
|
@@ -268,7 +267,8 @@ module SnapTrade
|
|
268
267
|
time_placed == o.time_placed &&
|
269
268
|
time_updated == o.time_updated &&
|
270
269
|
time_executed == o.time_executed &&
|
271
|
-
expiry_date == o.expiry_date
|
270
|
+
expiry_date == o.expiry_date &&
|
271
|
+
symbol == o.symbol
|
272
272
|
end
|
273
273
|
|
274
274
|
# @see the `==` method
|
@@ -280,7 +280,7 @@ module SnapTrade
|
|
280
280
|
# Calculates hash code according to all attributes.
|
281
281
|
# @return [Integer] Hash code
|
282
282
|
def hash
|
283
|
-
[brokerage_order_id, status,
|
283
|
+
[brokerage_order_id, status, universal_symbol, option_symbol, action, total_quantity, open_quantity, canceled_quantity, filled_quantity, execution_price, limit_price, stop_price, order_type, time_in_force, time_placed, time_updated, time_executed, expiry_date, symbol].hash
|
284
284
|
end
|
285
285
|
|
286
286
|
# Builds the object from hash
|
@@ -31,14 +31,14 @@ module SnapTrade
|
|
31
31
|
|
32
32
|
attr_accessor :type
|
33
33
|
|
34
|
-
# This field is deprecated and should not be used. Please reach out to SnapTrade support if you have a valid usecase for this.
|
35
|
-
attr_accessor :currencies
|
36
|
-
|
37
34
|
# This identifier is unique per security per trading venue. See section 1.4.1 of the [FIGI Standard](https://www.openfigi.com/assets/local/figi-allocation-rules.pdf) for more information. This value should be the same as the `figi_code` in the `figi_instrument` child property.
|
38
35
|
attr_accessor :figi_code
|
39
36
|
|
40
37
|
attr_accessor :figi_instrument
|
41
38
|
|
39
|
+
# This field is deprecated and should not be used. Please reach out to SnapTrade support if you have a valid usecase for this.
|
40
|
+
attr_accessor :currencies
|
41
|
+
|
42
42
|
# Attribute mapping from ruby-style variable name to JSON key.
|
43
43
|
def self.attribute_map
|
44
44
|
{
|
@@ -49,9 +49,9 @@ module SnapTrade
|
|
49
49
|
:'currency' => :'currency',
|
50
50
|
:'exchange' => :'exchange',
|
51
51
|
:'type' => :'type',
|
52
|
-
:'currencies' => :'currencies',
|
53
52
|
:'figi_code' => :'figi_code',
|
54
|
-
:'figi_instrument' => :'figi_instrument'
|
53
|
+
:'figi_instrument' => :'figi_instrument',
|
54
|
+
:'currencies' => :'currencies'
|
55
55
|
}
|
56
56
|
end
|
57
57
|
|
@@ -70,9 +70,9 @@ module SnapTrade
|
|
70
70
|
:'currency' => :'SymbolCurrency',
|
71
71
|
:'exchange' => :'SymbolExchange',
|
72
72
|
:'type' => :'SecurityType',
|
73
|
-
:'currencies' => :'Array<Currency>',
|
74
73
|
:'figi_code' => :'String',
|
75
|
-
:'figi_instrument' => :'SymbolFigiInstrument'
|
74
|
+
:'figi_instrument' => :'SymbolFigiInstrument',
|
75
|
+
:'currencies' => :'Array<Currency>'
|
76
76
|
}
|
77
77
|
end
|
78
78
|
|
@@ -81,7 +81,7 @@ module SnapTrade
|
|
81
81
|
Set.new([
|
82
82
|
:'description',
|
83
83
|
:'figi_code',
|
84
|
-
:'figi_instrument'
|
84
|
+
:'figi_instrument',
|
85
85
|
])
|
86
86
|
end
|
87
87
|
|
@@ -135,12 +135,6 @@ module SnapTrade
|
|
135
135
|
self.type = attributes[:'type']
|
136
136
|
end
|
137
137
|
|
138
|
-
if attributes.key?(:'currencies')
|
139
|
-
if (value = attributes[:'currencies']).is_a?(Array)
|
140
|
-
self.currencies = value
|
141
|
-
end
|
142
|
-
end
|
143
|
-
|
144
138
|
if attributes.key?(:'figi_code')
|
145
139
|
self.figi_code = attributes[:'figi_code']
|
146
140
|
end
|
@@ -148,6 +142,12 @@ module SnapTrade
|
|
148
142
|
if attributes.key?(:'figi_instrument')
|
149
143
|
self.figi_instrument = attributes[:'figi_instrument']
|
150
144
|
end
|
145
|
+
|
146
|
+
if attributes.key?(:'currencies')
|
147
|
+
if (value = attributes[:'currencies']).is_a?(Array)
|
148
|
+
self.currencies = value
|
149
|
+
end
|
150
|
+
end
|
151
151
|
end
|
152
152
|
|
153
153
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -205,9 +205,9 @@ module SnapTrade
|
|
205
205
|
currency == o.currency &&
|
206
206
|
exchange == o.exchange &&
|
207
207
|
type == o.type &&
|
208
|
-
currencies == o.currencies &&
|
209
208
|
figi_code == o.figi_code &&
|
210
|
-
figi_instrument == o.figi_instrument
|
209
|
+
figi_instrument == o.figi_instrument &&
|
210
|
+
currencies == o.currencies
|
211
211
|
end
|
212
212
|
|
213
213
|
# @see the `==` method
|
@@ -219,7 +219,7 @@ module SnapTrade
|
|
219
219
|
# Calculates hash code according to all attributes.
|
220
220
|
# @return [Integer] Hash code
|
221
221
|
def hash
|
222
|
-
[id, symbol, raw_symbol, description, currency, exchange, type,
|
222
|
+
[id, symbol, raw_symbol, description, currency, exchange, type, figi_code, figi_instrument, currencies].hash
|
223
223
|
end
|
224
224
|
|
225
225
|
# Builds the object from hash
|
@@ -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 ActionStrictWithOptions
|
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 ActionStrictWithOptions.all_vars.include?(value)
|
38
|
+
raise "Invalid ENUM value #{value} for class #ActionStrictWithOptions"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|