snaptrade 2.0.82 → 2.0.83

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 726ac08ff0ebf2e4a79d3d3f3ed545cd077e0aaa05fd997a9368808bf6c381a2
4
- data.tar.gz: 0c7fd3f99490b6f4102496e42369e51bec5a2440ef0a686861fd84edbb337d8a
3
+ metadata.gz: 95e13d763e275f59f1b34efd01c49cd1340ff31b1f33b8d91fefd64c9d5786f3
4
+ data.tar.gz: d33c0c331dcc75296bffe8b92ae2e5039ae5fd669eccc7f6d04888940878df30
5
5
  SHA512:
6
- metadata.gz: a81a563d5ee48f0a4437977c696d3d6608ee28c049b544025b4d7a258165eb4b45ec9fc21a9655e03d8489b9dad796c46299165450211b3050c77508199d76fa
7
- data.tar.gz: a1aeb621d3136dd90717b116f5685b44377e85aedeec0466534246a78c73632ff9ea46832ed4e0400bbf67c9f9f431fb0022fa653c9c5d3f52544462b45cc122
6
+ metadata.gz: 0e42cd8f7cc085c0c7d24fc13e73141df51fef33e85fc3755fc863262e3b1f212f4d742e36612a2a0a2da025f66585130d465733fecc87f37d03c3dec96a74d3
7
+ data.tar.gz: bc2270b7e5c9e6eb1c7bdda5045b0a5bb1884201b38a4e135d6997085dc8a3499d792fb7de5e878e6ee2340c856d7e0ce3e7cb6d1066ab0de6ed7dbefebe4cc1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- snaptrade (2.0.82)
4
+ snaptrade (2.0.83)
5
5
  faraday (>= 1.0.1, < 3.0)
6
6
  faraday-multipart (~> 1.0, >= 1.0.4)
7
7
 
@@ -67,7 +67,7 @@ GEM
67
67
  rubocop-ast (>= 1.2.0, < 2.0)
68
68
  ruby-progressbar (~> 1.7)
69
69
  unicode-display_width (>= 1.4.0, < 3.0)
70
- rubocop-ast (1.38.1)
70
+ rubocop-ast (1.40.0)
71
71
  parser (>= 3.3.1.0)
72
72
  ruby-progressbar (1.13.0)
73
73
  ruby2_keywords (0.0.5)
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.82-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.82)
9
+ [![npm](https://img.shields.io/badge/gem-v2.0.83-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.83)
10
10
  [![More Info](https://img.shields.io/badge/More%20Info-Click%20Here-orange)](https://snaptrade.com/)
11
11
 
12
12
  </div>
@@ -62,6 +62,7 @@ Connect brokerage accounts to your app for live positions and trading
62
62
  * [`snaptrade.trading.cancel_user_account_order`](#snaptradetradingcancel_user_account_order)
63
63
  * [`snaptrade.trading.get_order_impact`](#snaptradetradingget_order_impact)
64
64
  * [`snaptrade.trading.get_user_account_quotes`](#snaptradetradingget_user_account_quotes)
65
+ * [`snaptrade.trading.place_bracket_order`](#snaptradetradingplace_bracket_order)
65
66
  * [`snaptrade.trading.place_force_order`](#snaptradetradingplace_force_order)
66
67
  * [`snaptrade.trading.place_order`](#snaptradetradingplace_order)
67
68
  * [`snaptrade.transactions_and_reporting.get_activities`](#snaptradetransactions_and_reportingget_activities)
@@ -74,7 +75,7 @@ Connect brokerage accounts to your app for live positions and trading
74
75
  Add to Gemfile:
75
76
 
76
77
  ```ruby
77
- gem 'snaptrade', '~> 2.0.82'
78
+ gem 'snaptrade', '~> 2.0.83'
78
79
  ```
79
80
 
80
81
  ## Getting Started<a id="getting-started"></a>
@@ -1725,6 +1726,91 @@ Should be set to `True` if `symbols` are comprised of tickers. Defaults to
1725
1726
  ---
1726
1727
 
1727
1728
 
1729
+ ### `snaptrade.trading.place_bracket_order`<a id="snaptradetradingplace_bracket_order"></a>
1730
+
1731
+ Places a bracket order (entry order + OCO of stop loss and take profit). Disabled by default please contact support for
1732
+ use. Only supported on certain brokerages
1733
+
1734
+
1735
+ #### 🛠️ Usage<a id="🛠️-usage"></a>
1736
+
1737
+ ```ruby
1738
+ result = snaptrade.trading.place_bracket_order(
1739
+ account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
1740
+ action: "BUY",
1741
+ symbol: "AAPL",
1742
+ order_type: "Market",
1743
+ time_in_force: "FOK",
1744
+ stop_loss: {
1745
+ "stop_price" => "48.55",
1746
+ "limit_price" => "48.50",
1747
+ },
1748
+ take_profit: {
1749
+ "limit_price" => "49.95",
1750
+ },
1751
+ user_id: "snaptrade-user-123",
1752
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
1753
+ price: 31.33,
1754
+ stop: 31.33,
1755
+ units: 10.5,
1756
+ )
1757
+ p result
1758
+ ```
1759
+
1760
+ #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1761
+
1762
+ ##### account_id: `String`<a id="account_id-string"></a>
1763
+ Unique identifier for the connected brokerage account. This is the UUID used to
1764
+ reference the account in SnapTrade.
1765
+
1766
+ ##### action: [`ActionStrictWithOptions`](./lib/snaptrade/models/action_strict_with_options.rb)<a id="action-actionstrictwithoptionslibsnaptrademodelsaction_strict_with_optionsrb"></a>
1767
+ The action describes the intent or side of a trade. This is either `BUY` or
1768
+ `SELL` for Equity symbols or `BUY_TO_OPEN`, `BUY_TO_CLOSE`, `SELL_TO_OPEN` or
1769
+ `SELL_TO_CLOSE` for Options.
1770
+
1771
+ ##### symbol: `String`<a id="symbol-string"></a>
1772
+ The security's trading ticker symbol.
1773
+
1774
+ ##### order_type: [`OrderTypeStrict`](./lib/snaptrade/models/order_type_strict.rb)<a id="order_type-ordertypestrictlibsnaptrademodelsorder_type_strictrb"></a>
1775
+ The type of order to place. - For `Limit` and `StopLimit` orders, the `price`
1776
+ field is required. - For `Stop` and `StopLimit` orders, the `stop` field is
1777
+ required.
1778
+
1779
+ ##### time_in_force: [`TimeInForceStrict`](./lib/snaptrade/models/time_in_force_strict.rb)<a id="time_in_force-timeinforcestrictlibsnaptrademodelstime_in_force_strictrb"></a>
1780
+ The Time in Force type for the order. This field indicates how long the order
1781
+ will remain active before it is executed or expires. Here are the supported
1782
+ values: - `Day` - Day. The order is valid only for the trading day on which it
1783
+ is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed
1784
+ or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety
1785
+ immediately or be canceled completely.
1786
+
1787
+ ##### stop_loss: [`StopLoss`](./lib/snaptrade/models/stop_loss.rb)<a id="stop_loss-stoplosslibsnaptrademodelsstop_lossrb"></a>
1788
+ ##### take_profit: [`TakeProfit`](./lib/snaptrade/models/take_profit.rb)<a id="take_profit-takeprofitlibsnaptrademodelstake_profitrb"></a>
1789
+ ##### user_id: `String`<a id="user_id-string"></a>
1790
+ ##### user_secret: `String`<a id="user_secret-string"></a>
1791
+ ##### price: `Float`<a id="price-float"></a>
1792
+ The limit price for `Limit` and `StopLimit` orders.
1793
+
1794
+ ##### stop: `Float`<a id="stop-float"></a>
1795
+ The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
1796
+
1797
+ ##### units: `Float`<a id="units-float"></a>
1798
+ Number of shares for the order. This can be a decimal for fractional orders.
1799
+ Must be `null` if `notional_value` is provided.
1800
+
1801
+ #### 🔄 Return<a id="🔄-return"></a>
1802
+
1803
+ [AccountOrderRecord](./lib/snaptrade/models/account_order_record.rb)
1804
+
1805
+ #### 🌐 Endpoint<a id="🌐-endpoint"></a>
1806
+
1807
+ `/trade/placeBracketOrder` `POST`
1808
+
1809
+ [🔙 **Back to Table of Contents**](#table-of-contents)
1810
+
1811
+ ---
1812
+
1813
+
1728
1814
  ### `snaptrade.trading.place_force_order`<a id="snaptradetradingplace_force_order"></a>
1729
1815
 
1730
1816
  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.
@@ -1750,14 +1836,6 @@ result = snaptrade.trading.place_force_order(
1750
1836
  stop: 31.33,
1751
1837
  units: 10.5,
1752
1838
  notional_value: None,
1753
- order_class: "BRACKET",
1754
- stop_loss: {
1755
- "stop_price" => "48.55",
1756
- "limit_price" => "48.50",
1757
- },
1758
- take_profit: {
1759
- "limit_price" => "49.95",
1760
- },
1761
1839
  )
1762
1840
  p result
1763
1841
  ```
@@ -1793,10 +1871,10 @@ The universal symbol ID of the security to trade. Must be 'null' if `symbol` is
1793
1871
  provided, otherwise must be provided.
1794
1872
 
1795
1873
  ##### symbol: `String`<a id="symbol-string"></a>
1796
- The security's trading ticker symbol. This currently only support Options
1797
- symbols in the 21 character OCC format. For example \"AAPL 131124C00240000\"
1798
- represents a call option on AAPL expiring on 2024-11-13 with a strike price of
1799
- $240. For more information on the OCC format, see
1874
+ The security's trading ticker symbol. This currently supports stock symbols and
1875
+ Options symbols in the 21 character OCC format. For example \"AAPL
1876
+ 131124C00240000\" represents a call option on AAPL expiring on 2024-11-13 with a
1877
+ strike price of $240. For more information on the OCC format, see
1800
1878
  [here](https://en.wikipedia.org/wiki/Option_symbol#OCC_format). If 'symbol' is
1801
1879
  provided, then 'universal_symbol_id' must be 'null'.
1802
1880
 
@@ -1813,15 +1891,6 @@ provided. If placing an Option order, this field represents the number of
1813
1891
  contracts to buy or sell. (e.g., 1 contract = 100 shares).
1814
1892
 
1815
1893
  ##### notional_value: [`ManualTradeFormNotionalValue`](./lib/snaptrade/models/manual_trade_form_notional_value.rb)<a id="notional_value-manualtradeformnotionalvaluelibsnaptrademodelsmanual_trade_form_notional_valuerb"></a>
1816
- ##### order_class: [`OrderClass`](./lib/snaptrade/models/order_class.rb)<a id="order_class-orderclasslibsnaptrademodelsorder_classrb"></a>
1817
- The class of order intended to be placed. Defaults to SIMPLE for regular, one
1818
- legged trades. Set to BRACKET if looking to place a bracket
1819
- (One-triggers-a-one-cancels-the-other) order, then specify take profit and stop
1820
- loss conditions. Bracket orders currently only supported on Alpaca, Tradier, and
1821
- Tradestation, contact us for more details
1822
-
1823
- ##### stop_loss: [`ManualTradeFormWithOptionsStopLoss`](./lib/snaptrade/models/manual_trade_form_with_options_stop_loss.rb)<a id="stop_loss-manualtradeformwithoptionsstoplosslibsnaptrademodelsmanual_trade_form_with_options_stop_lossrb"></a>
1824
- ##### take_profit: [`ManualTradeFormWithOptionsTakeProfit`](./lib/snaptrade/models/manual_trade_form_with_options_take_profit.rb)<a id="take_profit-manualtradeformwithoptionstakeprofitlibsnaptrademodelsmanual_trade_form_with_options_take_profitrb"></a>
1825
1894
  #### 🔄 Return<a id="🔄-return"></a>
1826
1895
 
1827
1896
  [AccountOrderRecord](./lib/snaptrade/models/account_order_record.rb)
@@ -408,6 +408,160 @@ module SnapTrade
408
408
  end
409
409
 
410
410
 
411
+ # Place a Bracket Order
412
+ #
413
+ # Places a bracket order (entry order + OCO of stop loss and take profit). Disabled by default please contact support for
414
+ # use. Only supported on certain brokerages
415
+ #
416
+ # @param account_id [String] Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
417
+ # @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.
418
+ # @param symbol [String] The security's trading ticker symbol.
419
+ # @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.
420
+ # @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.
421
+ # @param stop_loss [StopLoss]
422
+ # @param take_profit [TakeProfit]
423
+ # @param user_id [String]
424
+ # @param user_secret [String]
425
+ # @param price [Float] The limit price for `Limit` and `StopLimit` orders.
426
+ # @param stop [Float] The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
427
+ # @param units [Float] Number of shares for the order. This can be a decimal for fractional orders. Must be `null` if `notional_value` is provided.
428
+ # @param body [ManualTradeFormBracket]
429
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
430
+ def place_bracket_order(account_id:, action:, symbol:, order_type:, time_in_force:, stop_loss:, take_profit:, user_id:, user_secret:, price: SENTINEL, stop: SENTINEL, units: SENTINEL, extra: {})
431
+ _body = {}
432
+ _body[:account_id] = account_id if account_id != SENTINEL
433
+ _body[:action] = action if action != SENTINEL
434
+ _body[:symbol] = symbol if symbol != SENTINEL
435
+ _body[:order_type] = order_type if order_type != SENTINEL
436
+ _body[:time_in_force] = time_in_force if time_in_force != SENTINEL
437
+ _body[:price] = price if price != SENTINEL
438
+ _body[:stop] = stop if stop != SENTINEL
439
+ _body[:units] = units if units != SENTINEL
440
+ _body[:stop_loss] = stop_loss if stop_loss != SENTINEL
441
+ _body[:take_profit] = take_profit if take_profit != SENTINEL
442
+ manual_trade_form_bracket = _body
443
+ data, _status_code, _headers = place_bracket_order_with_http_info_impl(user_id, user_secret, manual_trade_form_bracket, extra)
444
+ data
445
+ end
446
+
447
+ # Place a Bracket Order
448
+ #
449
+ # Places a bracket order (entry order + OCO of stop loss and take profit). Disabled by default please contact support for
450
+ # use. Only supported on certain brokerages
451
+ #
452
+ # @param account_id [String] Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
453
+ # @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.
454
+ # @param symbol [String] The security's trading ticker symbol.
455
+ # @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.
456
+ # @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.
457
+ # @param stop_loss [StopLoss]
458
+ # @param take_profit [TakeProfit]
459
+ # @param user_id [String]
460
+ # @param user_secret [String]
461
+ # @param price [Float] The limit price for `Limit` and `StopLimit` orders.
462
+ # @param stop [Float] The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
463
+ # @param units [Float] Number of shares for the order. This can be a decimal for fractional orders. Must be `null` if `notional_value` is provided.
464
+ # @param body [ManualTradeFormBracket]
465
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
466
+ def place_bracket_order_with_http_info(account_id:, action:, symbol:, order_type:, time_in_force:, stop_loss:, take_profit:, user_id:, user_secret:, price: SENTINEL, stop: SENTINEL, units: SENTINEL, extra: {})
467
+ _body = {}
468
+ _body[:account_id] = account_id if account_id != SENTINEL
469
+ _body[:action] = action if action != SENTINEL
470
+ _body[:symbol] = symbol if symbol != SENTINEL
471
+ _body[:order_type] = order_type if order_type != SENTINEL
472
+ _body[:time_in_force] = time_in_force if time_in_force != SENTINEL
473
+ _body[:price] = price if price != SENTINEL
474
+ _body[:stop] = stop if stop != SENTINEL
475
+ _body[:units] = units if units != SENTINEL
476
+ _body[:stop_loss] = stop_loss if stop_loss != SENTINEL
477
+ _body[:take_profit] = take_profit if take_profit != SENTINEL
478
+ manual_trade_form_bracket = _body
479
+ place_bracket_order_with_http_info_impl(user_id, user_secret, manual_trade_form_bracket, extra)
480
+ end
481
+
482
+ # Place a Bracket Order
483
+ # Places a bracket order (entry order + OCO of stop loss and take profit). Disabled by default please contact support for use. Only supported on certain brokerages
484
+ # @param user_id [String]
485
+ # @param user_secret [String]
486
+ # @param manual_trade_form_bracket [ManualTradeFormBracket]
487
+ # @param [Hash] opts the optional parameters
488
+ # @return [AccountOrderRecord]
489
+ private def place_bracket_order_impl(user_id, user_secret, manual_trade_form_bracket, opts = {})
490
+ data, _status_code, _headers = place_bracket_order_with_http_info(user_id, user_secret, manual_trade_form_bracket, opts)
491
+ data
492
+ end
493
+
494
+ # Place a Bracket Order
495
+ # Places a bracket order (entry order + OCO of stop loss and take profit). Disabled by default please contact support for use. Only supported on certain brokerages
496
+ # @param user_id [String]
497
+ # @param user_secret [String]
498
+ # @param manual_trade_form_bracket [ManualTradeFormBracket]
499
+ # @param [Hash] opts the optional parameters
500
+ # @return [Array<(AccountOrderRecord, Integer, Hash)>] AccountOrderRecord data, response status code and response headers
501
+ private def place_bracket_order_with_http_info_impl(user_id, user_secret, manual_trade_form_bracket, opts = {})
502
+ if @api_client.config.debugging
503
+ @api_client.config.logger.debug 'Calling API: TradingApi.place_bracket_order ...'
504
+ end
505
+ # verify the required parameter 'user_id' is set
506
+ if @api_client.config.client_side_validation && user_id.nil?
507
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.place_bracket_order"
508
+ end
509
+ # verify the required parameter 'user_secret' is set
510
+ if @api_client.config.client_side_validation && user_secret.nil?
511
+ fail ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.place_bracket_order"
512
+ end
513
+ # verify the required parameter 'manual_trade_form_bracket' is set
514
+ if @api_client.config.client_side_validation && manual_trade_form_bracket.nil?
515
+ fail ArgumentError, "Missing the required parameter 'manual_trade_form_bracket' when calling TradingApi.place_bracket_order"
516
+ end
517
+ # resource path
518
+ local_var_path = '/trade/placeBracketOrder'
519
+
520
+ # query parameters
521
+ query_params = opts[:query_params] || {}
522
+ query_params[:'userId'] = user_id
523
+ query_params[:'userSecret'] = user_secret
524
+
525
+ # header parameters
526
+ header_params = opts[:header_params] || {}
527
+ # HTTP header 'Accept' (if needed)
528
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
529
+ # HTTP header 'Content-Type'
530
+ content_type = @api_client.select_header_content_type(['application/json'])
531
+ if !content_type.nil?
532
+ header_params['Content-Type'] = content_type
533
+ end
534
+
535
+ # form parameters
536
+ form_params = opts[:form_params] || {}
537
+
538
+ # http body (model)
539
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(manual_trade_form_bracket)
540
+
541
+ # return_type
542
+ return_type = opts[:debug_return_type] || 'AccountOrderRecord'
543
+
544
+ # auth_names
545
+ auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
546
+
547
+ new_options = opts.merge(
548
+ :operation => :"TradingApi.place_bracket_order",
549
+ :header_params => header_params,
550
+ :query_params => query_params,
551
+ :form_params => form_params,
552
+ :body => post_body,
553
+ :auth_names => auth_names,
554
+ :return_type => return_type
555
+ )
556
+
557
+ data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
558
+ if @api_client.config.debugging
559
+ @api_client.config.logger.debug "API called: TradingApi#place_bracket_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
560
+ end
561
+ return data, status_code, headers, response
562
+ end
563
+
564
+
411
565
  # Place order
412
566
  #
413
567
  # 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.
@@ -423,17 +577,14 @@ module SnapTrade
423
577
  # @param user_id [String]
424
578
  # @param user_secret [String]
425
579
  # @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'.
580
+ # @param symbol [String] The security's trading ticker symbol. This currently supports stock symbols and 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'.
427
581
  # @param price [Float] The limit price for `Limit` and `StopLimit` orders.
428
582
  # @param stop [Float] The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
429
583
  # @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).
430
584
  # @param notional_value [ManualTradeFormNotionalValue]
431
- # @param order_class [OrderClass] The class of order intended to be placed. Defaults to SIMPLE for regular, one legged trades. Set to BRACKET if looking to place a bracket (One-triggers-a-one-cancels-the-other) order, then specify take profit and stop loss conditions. Bracket orders currently only supported on Alpaca, Tradier, and Tradestation, contact us for more details
432
- # @param stop_loss [ManualTradeFormWithOptionsStopLoss]
433
- # @param take_profit [ManualTradeFormWithOptionsTakeProfit]
434
585
  # @param body [ManualTradeFormWithOptions]
435
586
  # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
436
- 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, order_class: SENTINEL, stop_loss: SENTINEL, take_profit: SENTINEL, extra: {})
587
+ 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: {})
437
588
  _body = {}
438
589
  _body[:account_id] = account_id if account_id != SENTINEL
439
590
  _body[:action] = action if action != SENTINEL
@@ -445,9 +596,6 @@ module SnapTrade
445
596
  _body[:stop] = stop if stop != SENTINEL
446
597
  _body[:units] = units if units != SENTINEL
447
598
  _body[:notional_value] = notional_value if notional_value != SENTINEL
448
- _body[:order_class] = order_class if order_class != SENTINEL
449
- _body[:stop_loss] = stop_loss if stop_loss != SENTINEL
450
- _body[:take_profit] = take_profit if take_profit != SENTINEL
451
599
  manual_trade_form_with_options = _body
452
600
  data, _status_code, _headers = place_force_order_with_http_info_impl(user_id, user_secret, manual_trade_form_with_options, extra)
453
601
  data
@@ -468,17 +616,14 @@ module SnapTrade
468
616
  # @param user_id [String]
469
617
  # @param user_secret [String]
470
618
  # @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.
471
- # @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'.
619
+ # @param symbol [String] The security's trading ticker symbol. This currently supports stock symbols and 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'.
472
620
  # @param price [Float] The limit price for `Limit` and `StopLimit` orders.
473
621
  # @param stop [Float] The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
474
622
  # @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).
475
623
  # @param notional_value [ManualTradeFormNotionalValue]
476
- # @param order_class [OrderClass] The class of order intended to be placed. Defaults to SIMPLE for regular, one legged trades. Set to BRACKET if looking to place a bracket (One-triggers-a-one-cancels-the-other) order, then specify take profit and stop loss conditions. Bracket orders currently only supported on Alpaca, Tradier, and Tradestation, contact us for more details
477
- # @param stop_loss [ManualTradeFormWithOptionsStopLoss]
478
- # @param take_profit [ManualTradeFormWithOptionsTakeProfit]
479
624
  # @param body [ManualTradeFormWithOptions]
480
625
  # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
481
- 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, order_class: SENTINEL, stop_loss: SENTINEL, take_profit: SENTINEL, extra: {})
626
+ 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: {})
482
627
  _body = {}
483
628
  _body[:account_id] = account_id if account_id != SENTINEL
484
629
  _body[:action] = action if action != SENTINEL
@@ -490,9 +635,6 @@ module SnapTrade
490
635
  _body[:stop] = stop if stop != SENTINEL
491
636
  _body[:units] = units if units != SENTINEL
492
637
  _body[:notional_value] = notional_value if notional_value != SENTINEL
493
- _body[:order_class] = order_class if order_class != SENTINEL
494
- _body[:stop_loss] = stop_loss if stop_loss != SENTINEL
495
- _body[:take_profit] = take_profit if take_profit != SENTINEL
496
638
  manual_trade_form_with_options = _body
497
639
  place_force_order_with_http_info_impl(user_id, user_secret, manual_trade_form_with_options, extra)
498
640
  end
@@ -68,6 +68,8 @@ module SnapTrade
68
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
69
  attr_accessor :symbol
70
70
 
71
+ attr_accessor :child_brokerage_order_ids
72
+
71
73
  # Attribute mapping from ruby-style variable name to JSON key.
72
74
  def self.attribute_map
73
75
  {
@@ -89,7 +91,8 @@ module SnapTrade
89
91
  :'time_updated' => :'time_updated',
90
92
  :'time_executed' => :'time_executed',
91
93
  :'expiry_date' => :'expiry_date',
92
- :'symbol' => :'symbol'
94
+ :'symbol' => :'symbol',
95
+ :'child_brokerage_order_ids' => :'child_brokerage_order_ids'
93
96
  }
94
97
  end
95
98
 
@@ -119,7 +122,8 @@ module SnapTrade
119
122
  :'time_updated' => :'Time',
120
123
  :'time_executed' => :'Time',
121
124
  :'expiry_date' => :'Time',
122
- :'symbol' => :'String'
125
+ :'symbol' => :'String',
126
+ :'child_brokerage_order_ids' => :'AccountOrderRecordChildBrokerageOrderIds'
123
127
  }
124
128
  end
125
129
 
@@ -137,6 +141,7 @@ module SnapTrade
137
141
  :'time_updated',
138
142
  :'time_executed',
139
143
  :'expiry_date',
144
+ :'child_brokerage_order_ids'
140
145
  ])
141
146
  end
142
147
 
@@ -230,6 +235,10 @@ module SnapTrade
230
235
  if attributes.key?(:'symbol')
231
236
  self.symbol = attributes[:'symbol']
232
237
  end
238
+
239
+ if attributes.key?(:'child_brokerage_order_ids')
240
+ self.child_brokerage_order_ids = attributes[:'child_brokerage_order_ids']
241
+ end
233
242
  end
234
243
 
235
244
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -268,7 +277,8 @@ module SnapTrade
268
277
  time_updated == o.time_updated &&
269
278
  time_executed == o.time_executed &&
270
279
  expiry_date == o.expiry_date &&
271
- symbol == o.symbol
280
+ symbol == o.symbol &&
281
+ child_brokerage_order_ids == o.child_brokerage_order_ids
272
282
  end
273
283
 
274
284
  # @see the `==` method
@@ -280,7 +290,7 @@ module SnapTrade
280
290
  # Calculates hash code according to all attributes.
281
291
  # @return [Integer] Hash code
282
292
  def hash
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
293
+ [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, child_brokerage_order_ids].hash
284
294
  end
285
295
 
286
296
  # Builds the object from hash
@@ -11,13 +11,18 @@ require 'date'
11
11
  require 'time'
12
12
 
13
13
  module SnapTrade
14
- class ManualTradeFormWithOptionsTakeProfit
15
- attr_accessor :limit_price
14
+ class AccountOrderRecordChildBrokerageOrderIds
15
+ # The brokerage order ID for the take profit leg of the bracket order
16
+ attr_accessor :take_profit_order_id
17
+
18
+ # The brokerage order ID for the stop loss leg of the bracket order
19
+ attr_accessor :stop_loss_order_id
16
20
 
17
21
  # Attribute mapping from ruby-style variable name to JSON key.
18
22
  def self.attribute_map
19
23
  {
20
- :'limit_price' => :'limit_price'
24
+ :'take_profit_order_id' => :'take_profit_order_id',
25
+ :'stop_loss_order_id' => :'stop_loss_order_id'
21
26
  }
22
27
  end
23
28
 
@@ -29,7 +34,8 @@ module SnapTrade
29
34
  # Attribute type mapping.
30
35
  def self.openapi_types
31
36
  {
32
- :'limit_price' => :'String'
37
+ :'take_profit_order_id' => :'String',
38
+ :'stop_loss_order_id' => :'String'
33
39
  }
34
40
  end
35
41
 
@@ -42,7 +48,7 @@ module SnapTrade
42
48
  # List of class defined in allOf (OpenAPI v3)
43
49
  def self.openapi_all_of
44
50
  [
45
- :'TakeProfit'
51
+ :'ChildBrokerageOrderIDs'
46
52
  ]
47
53
  end
48
54
 
@@ -50,19 +56,23 @@ module SnapTrade
50
56
  # @param [Hash] attributes Model attributes in the form of hash
51
57
  def initialize(attributes = {})
52
58
  if (!attributes.is_a?(Hash))
53
- fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::ManualTradeFormWithOptionsTakeProfit` initialize method"
59
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::AccountOrderRecordChildBrokerageOrderIds` initialize method"
54
60
  end
55
61
 
56
62
  # check to see if the attribute exists and convert string to symbol for hash key
57
63
  attributes = attributes.each_with_object({}) { |(k, v), h|
58
64
  if (!self.class.attribute_map.key?(k.to_sym))
59
- fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::ManualTradeFormWithOptionsTakeProfit`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::AccountOrderRecordChildBrokerageOrderIds`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
60
66
  end
61
67
  h[k.to_sym] = v
62
68
  }
63
69
 
64
- if attributes.key?(:'limit_price')
65
- self.limit_price = attributes[:'limit_price']
70
+ if attributes.key?(:'take_profit_order_id')
71
+ self.take_profit_order_id = attributes[:'take_profit_order_id']
72
+ end
73
+
74
+ if attributes.key?(:'stop_loss_order_id')
75
+ self.stop_loss_order_id = attributes[:'stop_loss_order_id']
66
76
  end
67
77
  end
68
78
 
@@ -84,7 +94,8 @@ module SnapTrade
84
94
  def ==(o)
85
95
  return true if self.equal?(o)
86
96
  self.class == o.class &&
87
- limit_price == o.limit_price
97
+ take_profit_order_id == o.take_profit_order_id &&
98
+ stop_loss_order_id == o.stop_loss_order_id
88
99
  end
89
100
 
90
101
  # @see the `==` method
@@ -96,7 +107,7 @@ module SnapTrade
96
107
  # Calculates hash code according to all attributes.
97
108
  # @return [Integer] Hash code
98
109
  def hash
99
- [limit_price].hash
110
+ [take_profit_order_id, stop_loss_order_id].hash
100
111
  end
101
112
 
102
113
  # Builds the object from hash