snaptrade 2.0.162 → 2.0.164

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: c3d0b0cc8be4545206c323ad3a5c5f12b3d554b2e68cb9c0d824f8c9e487916e
4
- data.tar.gz: 0203e68a5490b53f71c06b8b9a67a25131676c25907e8f702e65bc42be947e08
3
+ metadata.gz: 6aee2776cc7b4ec7d0cbac4053f65dab85369751532b9f393b2b4c789d53d24f
4
+ data.tar.gz: 40443d9b818a57d31157d5787d1b0165f9947d269c7fcf054a0c3ed99a88fe19
5
5
  SHA512:
6
- metadata.gz: 77e7ad45a7b99c316d50f4c680ac78a94ef4102b26792c891d572e6b2c75eefde3595fa186c41e322cdc4f73e3b73cb1c0d28972ac169f9abe591b851d199807
7
- data.tar.gz: 1b1c02c6fd99c6ff4d2d12963ede139f399420d1a244842080044e8f2c07eb86e3f01bb66faa559c939d6f24af870dfc6012acc785a9dba8c87661b545253593
6
+ metadata.gz: ca2eb20e98539f3d56878d33f5de544b30d9583cb8b75e487633314dae0388768719bcb2a9f01d752a42dc246f02499c26d5acaf50871385311889a438d1dda7
7
+ data.tar.gz: dab02c2aef92ac040d17cd48ca4fc1013a2e75f5c5e0710b976e92eb4176a090bbcd17ec24003311c3eedd2b2125022e02aec0ddbaed66306347f166e9417752
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- snaptrade (2.0.162)
4
+ snaptrade (2.0.164)
5
5
  faraday (>= 1.0.1, < 3.0)
6
6
  faraday-multipart (~> 1.0, >= 1.0.4)
7
7
 
@@ -29,7 +29,7 @@ GEM
29
29
  method_source (1.1.0)
30
30
  multipart-post (2.4.1)
31
31
  parallel (1.27.0)
32
- parser (3.3.10.1)
32
+ parser (3.3.10.2)
33
33
  ast (~> 2.4.1)
34
34
  racc
35
35
  prism (1.9.0)
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.162-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.162)
9
+ [![npm](https://img.shields.io/badge/gem-v2.0.164-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.164)
10
10
  [![More Info](https://img.shields.io/badge/More%20Info-Click%20Here-orange)](https://snaptrade.com/)
11
11
 
12
12
  </div>
@@ -47,6 +47,7 @@ Connect brokerage accounts to your app for live positions and trading
47
47
  * [`snaptrade.experimental_endpoints.get_user_account_order_detail_v2`](#snaptradeexperimental_endpointsget_user_account_order_detail_v2)
48
48
  * [`snaptrade.experimental_endpoints.get_user_account_orders_v2`](#snaptradeexperimental_endpointsget_user_account_orders_v2)
49
49
  * [`snaptrade.experimental_endpoints.get_user_account_recent_orders_v2`](#snaptradeexperimental_endpointsget_user_account_recent_orders_v2)
50
+ * [`snaptrade.options.get_option_quote`](#snaptradeoptionsget_option_quote)
50
51
  * [`snaptrade.options.get_options_chain`](#snaptradeoptionsget_options_chain)
51
52
  * [`snaptrade.options.list_option_holdings`](#snaptradeoptionslist_option_holdings)
52
53
  * [`snaptrade.reference_data.get_currency_exchange_rate_pair`](#snaptradereference_dataget_currency_exchange_rate_pair)
@@ -64,6 +65,7 @@ Connect brokerage accounts to your app for live positions and trading
64
65
  * [`snaptrade.trading.cancel_order`](#snaptradetradingcancel_order)
65
66
  * [`snaptrade.trading.cancel_user_account_order`](#snaptradetradingcancel_user_account_order)
66
67
  * [`snaptrade.trading.get_cryptocurrency_pair_quote`](#snaptradetradingget_cryptocurrency_pair_quote)
68
+ * [`snaptrade.trading.get_option_impact`](#snaptradetradingget_option_impact)
67
69
  * [`snaptrade.trading.get_order_impact`](#snaptradetradingget_order_impact)
68
70
  * [`snaptrade.trading.get_user_account_quotes`](#snaptradetradingget_user_account_quotes)
69
71
  * [`snaptrade.trading.place_bracket_order`](#snaptradetradingplace_bracket_order)
@@ -84,7 +86,7 @@ Connect brokerage accounts to your app for live positions and trading
84
86
  Add to Gemfile:
85
87
 
86
88
  ```ruby
87
- gem 'snaptrade', '~> 2.0.162'
89
+ gem 'snaptrade', '~> 2.0.164'
88
90
  ```
89
91
 
90
92
  ## Getting Started<a id="getting-started"></a>
@@ -1262,6 +1264,44 @@ false to retrieve non executed orders as well
1262
1264
  ---
1263
1265
 
1264
1266
 
1267
+ ### `snaptrade.options.get_option_quote`<a id="snaptradeoptionsget_option_quote"></a>
1268
+
1269
+ Returns a real-time quote for a single option contract. The option contract is specified using an OCC-formatted symbol.
1270
+
1271
+ OCC format: `AAPL 251219C00150000` (underlying padded to 6 characters with spaces, followed by date, put/call, and strike).
1272
+
1273
+
1274
+ #### 🛠️ Usage<a id="🛠️-usage"></a>
1275
+
1276
+ ```ruby
1277
+ result = snaptrade.options.get_option_quote(
1278
+ user_id: "snaptrade-user-123",
1279
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
1280
+ symbol: "AAPL 251219C00150000",
1281
+ )
1282
+ p result
1283
+ ```
1284
+
1285
+ #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1286
+
1287
+ ##### user_id: `String`<a id="user_id-string"></a>
1288
+ ##### user_secret: `String`<a id="user_secret-string"></a>
1289
+ ##### symbol: `String`<a id="symbol-string"></a>
1290
+ The OCC-formatted option symbol.
1291
+
1292
+ #### 🔄 Return<a id="🔄-return"></a>
1293
+
1294
+ [OptionQuote](./lib/snaptrade/models/option_quote.rb)
1295
+
1296
+ #### 🌐 Endpoint<a id="🌐-endpoint"></a>
1297
+
1298
+ `/marketData/options/quotes` `GET`
1299
+
1300
+ [🔙 **Back to Table of Contents**](#table-of-contents)
1301
+
1302
+ ---
1303
+
1304
+
1265
1305
  ### `snaptrade.options.get_options_chain`<a id="snaptradeoptionsget_options_chain"></a>
1266
1306
 
1267
1307
  Returns the option chain for the specified symbol in the specified account.
@@ -1797,6 +1837,77 @@ p result
1797
1837
  ---
1798
1838
 
1799
1839
 
1840
+ ### `snaptrade.trading.get_option_impact`<a id="snaptradetradingget_option_impact"></a>
1841
+
1842
+ Simulates an option order with up to 4 legs and returns the estimated cost and transaction fees without placing it.
1843
+ Only supported for certain brokerages. Please refer to https://snaptrade.notion.site/brokerages for more information on brokerage trading support.
1844
+
1845
+
1846
+ #### 🛠️ Usage<a id="🛠️-usage"></a>
1847
+
1848
+ ```ruby
1849
+ result = snaptrade.trading.get_option_impact(
1850
+ order_type: "MARKET",
1851
+ time_in_force: "Day",
1852
+ legs: [
1853
+ {
1854
+ "instrument" => {
1855
+ "symbol" => "PBI 250718C00006000",
1856
+ "instrument_type" => "OPTION",
1857
+ },
1858
+ "action" => "BUY_TO_OPEN",
1859
+ "units" => 1,
1860
+ }
1861
+ ],
1862
+ user_id: "snaptrade-user-123",
1863
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
1864
+ account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
1865
+ limit_price: "",
1866
+ stop_price: "",
1867
+ price_effect: "DEBIT",
1868
+ )
1869
+ p result
1870
+ ```
1871
+
1872
+ #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1873
+
1874
+ ##### order_type: [`MlegOrderTypeStrict`](./lib/snaptrade/models/mleg_order_type_strict.rb)<a id="order_type-mlegordertypestrictlibsnaptrademodelsmleg_order_type_strictrb"></a>
1875
+ The type of order to place.
1876
+
1877
+ ##### time_in_force: [`TimeInForceStrict`](./lib/snaptrade/models/time_in_force_strict.rb)<a id="time_in_force-timeinforcestrictlibsnaptrademodelstime_in_force_strictrb"></a>
1878
+ The Time in Force type for the order. This field indicates how long the order
1879
+ will remain active before it is executed or expires. Here are the supported
1880
+ values: - `Day` - Day. The order is valid only for the trading day on which it
1881
+ is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed
1882
+ or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety
1883
+ immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order
1884
+ must be executed immediately. Any portion of the order that cannot be filled
1885
+ immediately will be canceled.
1886
+
1887
+ ##### legs: Array<[`MlegLeg`](./lib/snaptrade/models/mleg_leg.rb)><a id="legs-array"></a>
1888
+ ##### user_id: `String`<a id="user_id-string"></a>
1889
+ ##### user_secret: `String`<a id="user_secret-string"></a>
1890
+ ##### account_id: `String`<a id="account_id-string"></a>
1891
+ ##### limit_price: `Float`<a id="limit_price-float"></a>
1892
+ The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT.
1893
+
1894
+ ##### stop_price: `Float`<a id="stop_price-float"></a>
1895
+ The stop price. Required if the order type is STOP_LOSS_MARKET, STOP_LOSS_LIMIT.
1896
+
1897
+ ##### price_effect: [`MlegPriceEffectStrict`](./lib/snaptrade/models/mleg_price_effect_strict.rb)<a id="price_effect-mlegpriceeffectstrictlibsnaptrademodelsmleg_price_effect_strictrb"></a>
1898
+ #### 🔄 Return<a id="🔄-return"></a>
1899
+
1900
+ [OptionImpact](./lib/snaptrade/models/option_impact.rb)
1901
+
1902
+ #### 🌐 Endpoint<a id="🌐-endpoint"></a>
1903
+
1904
+ `/accounts/{accountId}/trading/options/impact` `POST`
1905
+
1906
+ [🔙 **Back to Table of Contents**](#table-of-contents)
1907
+
1908
+ ---
1909
+
1910
+
1800
1911
  ### `snaptrade.trading.get_order_impact`<a id="snaptradetradingget_order_impact"></a>
1801
1912
 
1802
1913
  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.
@@ -17,6 +17,114 @@ module SnapTrade
17
17
  @api_client = api_client
18
18
  end
19
19
 
20
+ # Get option quote
21
+ #
22
+ # Returns a real-time quote for a single option contract. The option contract is specified using an OCC-formatted symbol.
23
+ #
24
+ # OCC format: `AAPL 251219C00150000` (underlying padded to 6 characters with spaces, followed by date, put/call, and strike).
25
+ #
26
+ # @param user_id [String]
27
+ # @param user_secret [String]
28
+ # @param symbol [String] The OCC-formatted option symbol.
29
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
30
+ def get_option_quote(user_id:, user_secret:, symbol:, extra: {})
31
+ data, _status_code, _headers = get_option_quote_with_http_info_impl(user_id, user_secret, symbol, extra)
32
+ data
33
+ end
34
+
35
+ # Get option quote
36
+ #
37
+ # Returns a real-time quote for a single option contract. The option contract is specified using an OCC-formatted symbol.
38
+ #
39
+ # OCC format: `AAPL 251219C00150000` (underlying padded to 6 characters with spaces, followed by date, put/call, and strike).
40
+ #
41
+ # @param user_id [String]
42
+ # @param user_secret [String]
43
+ # @param symbol [String] The OCC-formatted option symbol.
44
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
45
+ def get_option_quote_with_http_info(user_id:, user_secret:, symbol:, extra: {})
46
+ get_option_quote_with_http_info_impl(user_id, user_secret, symbol, extra)
47
+ end
48
+
49
+ # Get option quote
50
+ # Returns a real-time quote for a single option contract. The option contract is specified using an OCC-formatted symbol. OCC format: `AAPL 251219C00150000` (underlying padded to 6 characters with spaces, followed by date, put/call, and strike).
51
+ # @param user_id [String]
52
+ # @param user_secret [String]
53
+ # @param symbol [String] The OCC-formatted option symbol.
54
+ # @param [Hash] opts the optional parameters
55
+ # @return [OptionQuote]
56
+ private def get_option_quote_impl(user_id, user_secret, symbol, opts = {})
57
+ data, _status_code, _headers = get_option_quote_with_http_info(user_id, user_secret, symbol, opts)
58
+ data
59
+ end
60
+
61
+ # Get option quote
62
+ # Returns a real-time quote for a single option contract. The option contract is specified using an OCC-formatted symbol. OCC format: &#x60;AAPL 251219C00150000&#x60; (underlying padded to 6 characters with spaces, followed by date, put/call, and strike).
63
+ # @param user_id [String]
64
+ # @param user_secret [String]
65
+ # @param symbol [String] The OCC-formatted option symbol.
66
+ # @param [Hash] opts the optional parameters
67
+ # @return [Array<(OptionQuote, Integer, Hash)>] OptionQuote data, response status code and response headers
68
+ private def get_option_quote_with_http_info_impl(user_id, user_secret, symbol, opts = {})
69
+ if @api_client.config.debugging
70
+ @api_client.config.logger.debug 'Calling API: OptionsApi.get_option_quote ...'
71
+ end
72
+ # verify the required parameter 'user_id' is set
73
+ if @api_client.config.client_side_validation && user_id.nil?
74
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling OptionsApi.get_option_quote"
75
+ end
76
+ # verify the required parameter 'user_secret' is set
77
+ if @api_client.config.client_side_validation && user_secret.nil?
78
+ fail ArgumentError, "Missing the required parameter 'user_secret' when calling OptionsApi.get_option_quote"
79
+ end
80
+ # verify the required parameter 'symbol' is set
81
+ if @api_client.config.client_side_validation && symbol.nil?
82
+ fail ArgumentError, "Missing the required parameter 'symbol' when calling OptionsApi.get_option_quote"
83
+ end
84
+ # resource path
85
+ local_var_path = '/marketData/options/quotes'
86
+
87
+ # query parameters
88
+ query_params = opts[:query_params] || {}
89
+ query_params[:'userId'] = user_id
90
+ query_params[:'userSecret'] = user_secret
91
+ query_params[:'symbol'] = symbol
92
+
93
+ # header parameters
94
+ header_params = opts[:header_params] || {}
95
+ # HTTP header 'Accept' (if needed)
96
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
97
+
98
+ # form parameters
99
+ form_params = opts[:form_params] || {}
100
+
101
+ # http body (model)
102
+ post_body = opts[:debug_body]
103
+
104
+ # return_type
105
+ return_type = opts[:debug_return_type] || 'OptionQuote'
106
+
107
+ # auth_names
108
+ auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
109
+
110
+ new_options = opts.merge(
111
+ :operation => :"OptionsApi.get_option_quote",
112
+ :header_params => header_params,
113
+ :query_params => query_params,
114
+ :form_params => form_params,
115
+ :body => post_body,
116
+ :auth_names => auth_names,
117
+ :return_type => return_type
118
+ )
119
+
120
+ data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
121
+ if @api_client.config.debugging
122
+ @api_client.config.logger.debug "API called: OptionsApi#get_option_quote\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
123
+ end
124
+ return data, status_code, headers, response
125
+ end
126
+
127
+
20
128
  # Get the options chain for a symbol
21
129
  #
22
130
  # Returns the option chain for the specified symbol in the specified account.
@@ -378,6 +378,152 @@ module SnapTrade
378
378
  end
379
379
 
380
380
 
381
+ # Get option order impact
382
+ #
383
+ # Simulates an option order with up to 4 legs and returns the estimated cost and transaction fees without placing it.
384
+ # Only supported for certain brokerages. Please refer to https://snaptrade.notion.site/brokerages for more information on brokerage trading support.
385
+ #
386
+ # @param order_type [MlegOrderTypeStrict] The type of order to place.
387
+ # @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.
388
+ # @param legs [Array<MlegLeg>]
389
+ # @param user_id [String]
390
+ # @param user_secret [String]
391
+ # @param account_id [String]
392
+ # @param limit_price [Float] The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT.
393
+ # @param stop_price [Float] The stop price. Required if the order type is STOP_LOSS_MARKET, STOP_LOSS_LIMIT.
394
+ # @param price_effect [MlegPriceEffectStrict]
395
+ # @param body [MlegTradeForm]
396
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
397
+ def get_option_impact(order_type:, time_in_force:, legs:, user_id:, user_secret:, account_id:, limit_price: SENTINEL, stop_price: SENTINEL, price_effect: SENTINEL, extra: {})
398
+ _body = {}
399
+ _body[:order_type] = order_type if order_type != SENTINEL
400
+ _body[:time_in_force] = time_in_force if time_in_force != SENTINEL
401
+ _body[:limit_price] = limit_price if limit_price != SENTINEL
402
+ _body[:stop_price] = stop_price if stop_price != SENTINEL
403
+ _body[:price_effect] = price_effect if price_effect != SENTINEL
404
+ _body[:legs] = legs if legs != SENTINEL
405
+ mleg_trade_form = _body
406
+ data, _status_code, _headers = get_option_impact_with_http_info_impl(user_id, user_secret, account_id, mleg_trade_form, extra)
407
+ data
408
+ end
409
+
410
+ # Get option order impact
411
+ #
412
+ # Simulates an option order with up to 4 legs and returns the estimated cost and transaction fees without placing it.
413
+ # Only supported for certain brokerages. Please refer to https://snaptrade.notion.site/brokerages for more information on brokerage trading support.
414
+ #
415
+ # @param order_type [MlegOrderTypeStrict] The type of order to place.
416
+ # @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.
417
+ # @param legs [Array<MlegLeg>]
418
+ # @param user_id [String]
419
+ # @param user_secret [String]
420
+ # @param account_id [String]
421
+ # @param limit_price [Float] The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT.
422
+ # @param stop_price [Float] The stop price. Required if the order type is STOP_LOSS_MARKET, STOP_LOSS_LIMIT.
423
+ # @param price_effect [MlegPriceEffectStrict]
424
+ # @param body [MlegTradeForm]
425
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
426
+ def get_option_impact_with_http_info(order_type:, time_in_force:, legs:, user_id:, user_secret:, account_id:, limit_price: SENTINEL, stop_price: SENTINEL, price_effect: SENTINEL, extra: {})
427
+ _body = {}
428
+ _body[:order_type] = order_type if order_type != SENTINEL
429
+ _body[:time_in_force] = time_in_force if time_in_force != SENTINEL
430
+ _body[:limit_price] = limit_price if limit_price != SENTINEL
431
+ _body[:stop_price] = stop_price if stop_price != SENTINEL
432
+ _body[:price_effect] = price_effect if price_effect != SENTINEL
433
+ _body[:legs] = legs if legs != SENTINEL
434
+ mleg_trade_form = _body
435
+ get_option_impact_with_http_info_impl(user_id, user_secret, account_id, mleg_trade_form, extra)
436
+ end
437
+
438
+ # Get option order impact
439
+ # Simulates an option order with up to 4 legs and returns the estimated cost and transaction fees without placing it. Only supported for certain brokerages. Please refer to https://snaptrade.notion.site/brokerages for more information on brokerage trading support.
440
+ # @param user_id [String]
441
+ # @param user_secret [String]
442
+ # @param account_id [String]
443
+ # @param mleg_trade_form [MlegTradeForm]
444
+ # @param [Hash] opts the optional parameters
445
+ # @return [OptionImpact]
446
+ private def get_option_impact_impl(user_id, user_secret, account_id, mleg_trade_form, opts = {})
447
+ data, _status_code, _headers = get_option_impact_with_http_info(user_id, user_secret, account_id, mleg_trade_form, opts)
448
+ data
449
+ end
450
+
451
+ # Get option order impact
452
+ # Simulates an option order with up to 4 legs and returns the estimated cost and transaction fees without placing it. Only supported for certain brokerages. Please refer to https://snaptrade.notion.site/brokerages for more information on brokerage trading support.
453
+ # @param user_id [String]
454
+ # @param user_secret [String]
455
+ # @param account_id [String]
456
+ # @param mleg_trade_form [MlegTradeForm]
457
+ # @param [Hash] opts the optional parameters
458
+ # @return [Array<(OptionImpact, Integer, Hash)>] OptionImpact data, response status code and response headers
459
+ private def get_option_impact_with_http_info_impl(user_id, user_secret, account_id, mleg_trade_form, opts = {})
460
+ if @api_client.config.debugging
461
+ @api_client.config.logger.debug 'Calling API: TradingApi.get_option_impact ...'
462
+ end
463
+ # verify the required parameter 'user_id' is set
464
+ if @api_client.config.client_side_validation && user_id.nil?
465
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.get_option_impact"
466
+ end
467
+ # verify the required parameter 'user_secret' is set
468
+ if @api_client.config.client_side_validation && user_secret.nil?
469
+ fail ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.get_option_impact"
470
+ end
471
+ # verify the required parameter 'account_id' is set
472
+ if @api_client.config.client_side_validation && account_id.nil?
473
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling TradingApi.get_option_impact"
474
+ end
475
+ # verify the required parameter 'mleg_trade_form' is set
476
+ if @api_client.config.client_side_validation && mleg_trade_form.nil?
477
+ fail ArgumentError, "Missing the required parameter 'mleg_trade_form' when calling TradingApi.get_option_impact"
478
+ end
479
+ # resource path
480
+ local_var_path = '/accounts/{accountId}/trading/options/impact'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
481
+
482
+ # query parameters
483
+ query_params = opts[:query_params] || {}
484
+ query_params[:'userId'] = user_id
485
+ query_params[:'userSecret'] = user_secret
486
+
487
+ # header parameters
488
+ header_params = opts[:header_params] || {}
489
+ # HTTP header 'Accept' (if needed)
490
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
491
+ # HTTP header 'Content-Type'
492
+ content_type = @api_client.select_header_content_type(['application/json'])
493
+ if !content_type.nil?
494
+ header_params['Content-Type'] = content_type
495
+ end
496
+
497
+ # form parameters
498
+ form_params = opts[:form_params] || {}
499
+
500
+ # http body (model)
501
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(mleg_trade_form)
502
+
503
+ # return_type
504
+ return_type = opts[:debug_return_type] || 'OptionImpact'
505
+
506
+ # auth_names
507
+ auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
508
+
509
+ new_options = opts.merge(
510
+ :operation => :"TradingApi.get_option_impact",
511
+ :header_params => header_params,
512
+ :query_params => query_params,
513
+ :form_params => form_params,
514
+ :body => post_body,
515
+ :auth_names => auth_names,
516
+ :return_type => return_type
517
+ )
518
+
519
+ data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
520
+ if @api_client.config.debugging
521
+ @api_client.config.logger.debug "API called: TradingApi#get_option_impact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
522
+ end
523
+ return data, status_code, headers, response
524
+ end
525
+
526
+
381
527
  # Check equity order impact
382
528
  #
383
529
  # 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.
@@ -0,0 +1,228 @@
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
+ # Estimated cost and fees for an option order before it is placed.
15
+ class OptionImpact
16
+ # Estimated option premium for the order (before fees).
17
+ attr_accessor :estimated_cost
18
+
19
+ # Estimated transaction fees and commissions for the order.
20
+ attr_accessor :estimated_transaction_fee
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'estimated_cost' => :'estimated_cost',
26
+ :'estimated_transaction_fee' => :'estimated_transaction_fee'
27
+ }
28
+ end
29
+
30
+ # Returns all the JSON keys this model knows about
31
+ def self.acceptable_attributes
32
+ attribute_map.values
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'estimated_cost' => :'String',
39
+ :'estimated_transaction_fee' => :'String'
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.openapi_nullable
45
+ Set.new([
46
+ ])
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ if (!attributes.is_a?(Hash))
53
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::OptionImpact` initialize method"
54
+ end
55
+
56
+ # check to see if the attribute exists and convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}) { |(k, v), h|
58
+ if (!self.class.attribute_map.key?(k.to_sym))
59
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::OptionImpact`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
60
+ end
61
+ h[k.to_sym] = v
62
+ }
63
+
64
+ if attributes.key?(:'estimated_cost')
65
+ self.estimated_cost = attributes[:'estimated_cost']
66
+ end
67
+
68
+ if attributes.key?(:'estimated_transaction_fee')
69
+ self.estimated_transaction_fee = attributes[:'estimated_transaction_fee']
70
+ end
71
+ end
72
+
73
+ # Show invalid properties with the reasons. Usually used together with valid?
74
+ # @return Array for valid properties with the reasons
75
+ def list_invalid_properties
76
+ invalid_properties = Array.new
77
+ invalid_properties
78
+ end
79
+
80
+ # Check to see if the all the properties in the model are valid
81
+ # @return true if the model is valid
82
+ def valid?
83
+ true
84
+ end
85
+
86
+ # Checks equality by comparing each attribute.
87
+ # @param [Object] Object to be compared
88
+ def ==(o)
89
+ return true if self.equal?(o)
90
+ self.class == o.class &&
91
+ estimated_cost == o.estimated_cost &&
92
+ estimated_transaction_fee == o.estimated_transaction_fee
93
+ end
94
+
95
+ # @see the `==` method
96
+ # @param [Object] Object to be compared
97
+ def eql?(o)
98
+ self == o
99
+ end
100
+
101
+ # Calculates hash code according to all attributes.
102
+ # @return [Integer] Hash code
103
+ def hash
104
+ [estimated_cost, estimated_transaction_fee].hash
105
+ end
106
+
107
+ # Builds the object from hash
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ # @return [Object] Returns the model itself
110
+ def self.build_from_hash(attributes)
111
+ new.build_from_hash(attributes)
112
+ end
113
+
114
+ # Builds the object from hash
115
+ # @param [Hash] attributes Model attributes in the form of hash
116
+ # @return [Object] Returns the model itself
117
+ def build_from_hash(attributes)
118
+ return nil unless attributes.is_a?(Hash)
119
+ attributes = attributes.transform_keys(&:to_sym)
120
+ self.class.openapi_types.each_pair do |key, type|
121
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
122
+ self.send("#{key}=", nil)
123
+ elsif type =~ /\AArray<(.*)>/i
124
+ # check to ensure the input is an array given that the attribute
125
+ # is documented as an array but the input is not
126
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
127
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
128
+ end
129
+ elsif !attributes[self.class.attribute_map[key]].nil?
130
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
131
+ end
132
+ end
133
+
134
+ self
135
+ end
136
+
137
+ # Deserializes the data based on type
138
+ # @param string type Data type
139
+ # @param string value Value to be deserialized
140
+ # @return [Object] Deserialized data
141
+ def _deserialize(type, value)
142
+ case type.to_sym
143
+ when :Time
144
+ Time.parse(value)
145
+ when :Date
146
+ Date.parse(value)
147
+ when :String
148
+ value.to_s
149
+ when :Integer
150
+ value.to_i
151
+ when :Float
152
+ value.to_f
153
+ when :Boolean
154
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
155
+ true
156
+ else
157
+ false
158
+ end
159
+ when :Object
160
+ # generic object (usually a Hash), return directly
161
+ value
162
+ when /\AArray<(?<inner_type>.+)>\z/
163
+ inner_type = Regexp.last_match[:inner_type]
164
+ value.map { |v| _deserialize(inner_type, v) }
165
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
166
+ k_type = Regexp.last_match[:k_type]
167
+ v_type = Regexp.last_match[:v_type]
168
+ {}.tap do |hash|
169
+ value.each do |k, v|
170
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
171
+ end
172
+ end
173
+ else # model
174
+ # models (e.g. Pet) or oneOf
175
+ klass = SnapTrade.const_get(type)
176
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
177
+ end
178
+ end
179
+
180
+ # Returns the string representation of the object
181
+ # @return [String] String presentation of the object
182
+ def to_s
183
+ to_hash.to_s
184
+ end
185
+
186
+ # to_body is an alias to to_hash (backward compatibility)
187
+ # @return [Hash] Returns the object in the form of hash
188
+ def to_body
189
+ to_hash
190
+ end
191
+
192
+ # Returns the object in the form of hash
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_hash
195
+ hash = {}
196
+ self.class.attribute_map.each_pair do |attr, param|
197
+ value = self.send(attr)
198
+ if value.nil?
199
+ is_nullable = self.class.openapi_nullable.include?(attr)
200
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
201
+ end
202
+
203
+ hash[param] = _to_hash(value)
204
+ end
205
+ hash
206
+ end
207
+
208
+ # Outputs non-array value in the form of hash
209
+ # For object, use to_hash. Otherwise, just return the value
210
+ # @param [Object] value Any valid value
211
+ # @return [Hash] Returns the value in the form of hash
212
+ def _to_hash(value)
213
+ if value.is_a?(Array)
214
+ value.compact.map { |v| _to_hash(v) }
215
+ elsif value.is_a?(Hash)
216
+ {}.tap do |hash|
217
+ value.each { |k, v| hash[k] = _to_hash(v) }
218
+ end
219
+ elsif value.respond_to? :to_hash
220
+ value.to_hash
221
+ else
222
+ value
223
+ end
224
+ end
225
+
226
+ end
227
+
228
+ end
@@ -0,0 +1,329 @@
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
+ # Real-time quote for a single option contract.
15
+ class OptionQuote
16
+ # The OCC-formatted option symbol.
17
+ attr_accessor :symbol
18
+
19
+ # The best bid price for the option contract.
20
+ attr_accessor :bid_price
21
+
22
+ # The number of contracts available at the bid price.
23
+ attr_accessor :bid_size
24
+
25
+ # The best ask price for the option contract.
26
+ attr_accessor :ask_price
27
+
28
+ # The number of contracts available at the ask price.
29
+ attr_accessor :ask_size
30
+
31
+ # The price of the last trade for the option contract.
32
+ attr_accessor :last_price
33
+
34
+ # The number of contracts in the last trade.
35
+ attr_accessor :last_size
36
+
37
+ # The total number of outstanding contracts.
38
+ attr_accessor :open_interest
39
+
40
+ # The total number of contracts traded during the current session.
41
+ attr_accessor :volume
42
+
43
+ # The implied volatility of the option contract.
44
+ attr_accessor :implied_volatility
45
+
46
+ # The current price of the underlying security.
47
+ attr_accessor :underlying_price
48
+
49
+ # The timestamp of the quote.
50
+ attr_accessor :timestamp
51
+
52
+ # Attribute mapping from ruby-style variable name to JSON key.
53
+ def self.attribute_map
54
+ {
55
+ :'symbol' => :'symbol',
56
+ :'bid_price' => :'bid_price',
57
+ :'bid_size' => :'bid_size',
58
+ :'ask_price' => :'ask_price',
59
+ :'ask_size' => :'ask_size',
60
+ :'last_price' => :'last_price',
61
+ :'last_size' => :'last_size',
62
+ :'open_interest' => :'open_interest',
63
+ :'volume' => :'volume',
64
+ :'implied_volatility' => :'implied_volatility',
65
+ :'underlying_price' => :'underlying_price',
66
+ :'timestamp' => :'timestamp'
67
+ }
68
+ end
69
+
70
+ # Returns all the JSON keys this model knows about
71
+ def self.acceptable_attributes
72
+ attribute_map.values
73
+ end
74
+
75
+ # Attribute type mapping.
76
+ def self.openapi_types
77
+ {
78
+ :'symbol' => :'String',
79
+ :'bid_price' => :'Float',
80
+ :'bid_size' => :'Integer',
81
+ :'ask_price' => :'Float',
82
+ :'ask_size' => :'Integer',
83
+ :'last_price' => :'Float',
84
+ :'last_size' => :'Integer',
85
+ :'open_interest' => :'Integer',
86
+ :'volume' => :'Integer',
87
+ :'implied_volatility' => :'Float',
88
+ :'underlying_price' => :'Float',
89
+ :'timestamp' => :'Time'
90
+ }
91
+ end
92
+
93
+ # List of attributes with nullable: true
94
+ def self.openapi_nullable
95
+ Set.new([
96
+ :'timestamp'
97
+ ])
98
+ end
99
+
100
+ # Initializes the object
101
+ # @param [Hash] attributes Model attributes in the form of hash
102
+ def initialize(attributes = {})
103
+ if (!attributes.is_a?(Hash))
104
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::OptionQuote` initialize method"
105
+ end
106
+
107
+ # check to see if the attribute exists and convert string to symbol for hash key
108
+ attributes = attributes.each_with_object({}) { |(k, v), h|
109
+ if (!self.class.attribute_map.key?(k.to_sym))
110
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::OptionQuote`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
111
+ end
112
+ h[k.to_sym] = v
113
+ }
114
+
115
+ if attributes.key?(:'symbol')
116
+ self.symbol = attributes[:'symbol']
117
+ end
118
+
119
+ if attributes.key?(:'bid_price')
120
+ self.bid_price = attributes[:'bid_price']
121
+ end
122
+
123
+ if attributes.key?(:'bid_size')
124
+ self.bid_size = attributes[:'bid_size']
125
+ end
126
+
127
+ if attributes.key?(:'ask_price')
128
+ self.ask_price = attributes[:'ask_price']
129
+ end
130
+
131
+ if attributes.key?(:'ask_size')
132
+ self.ask_size = attributes[:'ask_size']
133
+ end
134
+
135
+ if attributes.key?(:'last_price')
136
+ self.last_price = attributes[:'last_price']
137
+ end
138
+
139
+ if attributes.key?(:'last_size')
140
+ self.last_size = attributes[:'last_size']
141
+ end
142
+
143
+ if attributes.key?(:'open_interest')
144
+ self.open_interest = attributes[:'open_interest']
145
+ end
146
+
147
+ if attributes.key?(:'volume')
148
+ self.volume = attributes[:'volume']
149
+ end
150
+
151
+ if attributes.key?(:'implied_volatility')
152
+ self.implied_volatility = attributes[:'implied_volatility']
153
+ end
154
+
155
+ if attributes.key?(:'underlying_price')
156
+ self.underlying_price = attributes[:'underlying_price']
157
+ end
158
+
159
+ if attributes.key?(:'timestamp')
160
+ self.timestamp = attributes[:'timestamp']
161
+ end
162
+ end
163
+
164
+ # Show invalid properties with the reasons. Usually used together with valid?
165
+ # @return Array for valid properties with the reasons
166
+ def list_invalid_properties
167
+ invalid_properties = Array.new
168
+ invalid_properties
169
+ end
170
+
171
+ # Check to see if the all the properties in the model are valid
172
+ # @return true if the model is valid
173
+ def valid?
174
+ true
175
+ end
176
+
177
+ # Checks equality by comparing each attribute.
178
+ # @param [Object] Object to be compared
179
+ def ==(o)
180
+ return true if self.equal?(o)
181
+ self.class == o.class &&
182
+ symbol == o.symbol &&
183
+ bid_price == o.bid_price &&
184
+ bid_size == o.bid_size &&
185
+ ask_price == o.ask_price &&
186
+ ask_size == o.ask_size &&
187
+ last_price == o.last_price &&
188
+ last_size == o.last_size &&
189
+ open_interest == o.open_interest &&
190
+ volume == o.volume &&
191
+ implied_volatility == o.implied_volatility &&
192
+ underlying_price == o.underlying_price &&
193
+ timestamp == o.timestamp
194
+ end
195
+
196
+ # @see the `==` method
197
+ # @param [Object] Object to be compared
198
+ def eql?(o)
199
+ self == o
200
+ end
201
+
202
+ # Calculates hash code according to all attributes.
203
+ # @return [Integer] Hash code
204
+ def hash
205
+ [symbol, bid_price, bid_size, ask_price, ask_size, last_price, last_size, open_interest, volume, implied_volatility, underlying_price, timestamp].hash
206
+ end
207
+
208
+ # Builds the object from hash
209
+ # @param [Hash] attributes Model attributes in the form of hash
210
+ # @return [Object] Returns the model itself
211
+ def self.build_from_hash(attributes)
212
+ new.build_from_hash(attributes)
213
+ end
214
+
215
+ # Builds the object from hash
216
+ # @param [Hash] attributes Model attributes in the form of hash
217
+ # @return [Object] Returns the model itself
218
+ def build_from_hash(attributes)
219
+ return nil unless attributes.is_a?(Hash)
220
+ attributes = attributes.transform_keys(&:to_sym)
221
+ self.class.openapi_types.each_pair do |key, type|
222
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
223
+ self.send("#{key}=", nil)
224
+ elsif type =~ /\AArray<(.*)>/i
225
+ # check to ensure the input is an array given that the attribute
226
+ # is documented as an array but the input is not
227
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
228
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
229
+ end
230
+ elsif !attributes[self.class.attribute_map[key]].nil?
231
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
232
+ end
233
+ end
234
+
235
+ self
236
+ end
237
+
238
+ # Deserializes the data based on type
239
+ # @param string type Data type
240
+ # @param string value Value to be deserialized
241
+ # @return [Object] Deserialized data
242
+ def _deserialize(type, value)
243
+ case type.to_sym
244
+ when :Time
245
+ Time.parse(value)
246
+ when :Date
247
+ Date.parse(value)
248
+ when :String
249
+ value.to_s
250
+ when :Integer
251
+ value.to_i
252
+ when :Float
253
+ value.to_f
254
+ when :Boolean
255
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
256
+ true
257
+ else
258
+ false
259
+ end
260
+ when :Object
261
+ # generic object (usually a Hash), return directly
262
+ value
263
+ when /\AArray<(?<inner_type>.+)>\z/
264
+ inner_type = Regexp.last_match[:inner_type]
265
+ value.map { |v| _deserialize(inner_type, v) }
266
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
267
+ k_type = Regexp.last_match[:k_type]
268
+ v_type = Regexp.last_match[:v_type]
269
+ {}.tap do |hash|
270
+ value.each do |k, v|
271
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
272
+ end
273
+ end
274
+ else # model
275
+ # models (e.g. Pet) or oneOf
276
+ klass = SnapTrade.const_get(type)
277
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
278
+ end
279
+ end
280
+
281
+ # Returns the string representation of the object
282
+ # @return [String] String presentation of the object
283
+ def to_s
284
+ to_hash.to_s
285
+ end
286
+
287
+ # to_body is an alias to to_hash (backward compatibility)
288
+ # @return [Hash] Returns the object in the form of hash
289
+ def to_body
290
+ to_hash
291
+ end
292
+
293
+ # Returns the object in the form of hash
294
+ # @return [Hash] Returns the object in the form of hash
295
+ def to_hash
296
+ hash = {}
297
+ self.class.attribute_map.each_pair do |attr, param|
298
+ value = self.send(attr)
299
+ if value.nil?
300
+ is_nullable = self.class.openapi_nullable.include?(attr)
301
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
302
+ end
303
+
304
+ hash[param] = _to_hash(value)
305
+ end
306
+ hash
307
+ end
308
+
309
+ # Outputs non-array value in the form of hash
310
+ # For object, use to_hash. Otherwise, just return the value
311
+ # @param [Object] value Any valid value
312
+ # @return [Hash] Returns the value in the form of hash
313
+ def _to_hash(value)
314
+ if value.is_a?(Array)
315
+ value.compact.map { |v| _to_hash(v) }
316
+ elsif value.is_a?(Hash)
317
+ {}.tap do |hash|
318
+ value.each { |k, v| hash[k] = _to_hash(v) }
319
+ end
320
+ elsif value.respond_to? :to_hash
321
+ value.to_hash
322
+ else
323
+ value
324
+ end
325
+ end
326
+
327
+ end
328
+
329
+ end
@@ -8,5 +8,5 @@ Contact: api@snaptrade.com
8
8
  =end
9
9
 
10
10
  module SnapTrade
11
- VERSION = '2.0.162'
11
+ VERSION = '2.0.164'
12
12
  end
data/lib/snaptrade.rb CHANGED
@@ -115,8 +115,10 @@ require 'snaptrade/models/option_brokerage_symbol'
115
115
  require 'snaptrade/models/option_chain_inner'
116
116
  require 'snaptrade/models/option_chain_inner_chain_per_root_inner'
117
117
  require 'snaptrade/models/option_chain_inner_chain_per_root_inner_chain_per_strike_price_inner'
118
+ require 'snaptrade/models/option_impact'
118
119
  require 'snaptrade/models/option_leg'
119
120
  require 'snaptrade/models/option_leg_action'
121
+ require 'snaptrade/models/option_quote'
120
122
  require 'snaptrade/models/option_strategy'
121
123
  require 'snaptrade/models/option_strategy_legs_inner'
122
124
  require 'snaptrade/models/option_type'
@@ -27,6 +27,20 @@ describe 'OptionsApi' do
27
27
  end
28
28
  end
29
29
 
30
+ # unit tests for get_option_quote
31
+ # Get option quote
32
+ # Returns a real-time quote for a single option contract. The option contract is specified using an OCC-formatted symbol. OCC format: &#x60;AAPL 251219C00150000&#x60; (underlying padded to 6 characters with spaces, followed by date, put/call, and strike).
33
+ # @param user_id
34
+ # @param user_secret
35
+ # @param symbol The OCC-formatted option symbol.
36
+ # @param [Hash] opts the optional parameters
37
+ # @return [OptionQuote]
38
+ describe 'get_option_quote test' do
39
+ it 'should work' do
40
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
41
+ end
42
+ end
43
+
30
44
  # unit tests for get_options_chain
31
45
  # Get the options chain for a symbol
32
46
  # Returns the option chain for the specified symbol in the specified account.
@@ -72,6 +72,21 @@ describe 'TradingApi' do
72
72
  end
73
73
  end
74
74
 
75
+ # unit tests for get_option_impact
76
+ # Get option order impact
77
+ # Simulates an option order with up to 4 legs and returns the estimated cost and transaction fees without placing it. Only supported for certain brokerages. Please refer to https://snaptrade.notion.site/brokerages for more information on brokerage trading support.
78
+ # @param user_id
79
+ # @param user_secret
80
+ # @param account_id
81
+ # @param mleg_trade_form
82
+ # @param [Hash] opts the optional parameters
83
+ # @return [OptionImpact]
84
+ describe 'get_option_impact test' do
85
+ it 'should work' do
86
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
87
+ end
88
+ end
89
+
75
90
  # unit tests for get_order_impact
76
91
  # Check equity order impact
77
92
  # Simulates an order and its impact on the account. This endpoint does not place the order with the brokerage. If successful, it returns a &#x60;Trade&#x60; 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 &#x60;Trade&#x60; object returned expires after 5 minutes. Any order placed using an expired &#x60;Trade&#x60; will be rejected.
@@ -0,0 +1,35 @@
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 'spec_helper'
11
+ require 'json'
12
+ require 'date'
13
+
14
+ # Unit tests for SnapTrade::OptionImpact
15
+ describe SnapTrade::OptionImpact do
16
+ let(:instance) { SnapTrade::OptionImpact.new }
17
+
18
+ describe 'test an instance of OptionImpact' do
19
+ it 'should create an instance of OptionImpact' do
20
+ expect(instance).to be_instance_of(SnapTrade::OptionImpact)
21
+ end
22
+ end
23
+ describe 'test attribute "estimated_cost"' do
24
+ it 'should work' do
25
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
26
+ end
27
+ end
28
+
29
+ describe 'test attribute "estimated_transaction_fee"' do
30
+ it 'should work' do
31
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
32
+ end
33
+ end
34
+
35
+ end
@@ -0,0 +1,95 @@
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 'spec_helper'
11
+ require 'json'
12
+ require 'date'
13
+
14
+ # Unit tests for SnapTrade::OptionQuote
15
+ describe SnapTrade::OptionQuote do
16
+ let(:instance) { SnapTrade::OptionQuote.new }
17
+
18
+ describe 'test an instance of OptionQuote' do
19
+ it 'should create an instance of OptionQuote' do
20
+ expect(instance).to be_instance_of(SnapTrade::OptionQuote)
21
+ end
22
+ end
23
+ describe 'test attribute "symbol"' do
24
+ it 'should work' do
25
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
26
+ end
27
+ end
28
+
29
+ describe 'test attribute "bid_price"' do
30
+ it 'should work' do
31
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
32
+ end
33
+ end
34
+
35
+ describe 'test attribute "bid_size"' do
36
+ it 'should work' do
37
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
38
+ end
39
+ end
40
+
41
+ describe 'test attribute "ask_price"' do
42
+ it 'should work' do
43
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
44
+ end
45
+ end
46
+
47
+ describe 'test attribute "ask_size"' do
48
+ it 'should work' do
49
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
50
+ end
51
+ end
52
+
53
+ describe 'test attribute "last_price"' do
54
+ it 'should work' do
55
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
56
+ end
57
+ end
58
+
59
+ describe 'test attribute "last_size"' do
60
+ it 'should work' do
61
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
62
+ end
63
+ end
64
+
65
+ describe 'test attribute "open_interest"' do
66
+ it 'should work' do
67
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
68
+ end
69
+ end
70
+
71
+ describe 'test attribute "volume"' do
72
+ it 'should work' do
73
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
74
+ end
75
+ end
76
+
77
+ describe 'test attribute "implied_volatility"' do
78
+ it 'should work' do
79
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
80
+ end
81
+ end
82
+
83
+ describe 'test attribute "underlying_price"' do
84
+ it 'should work' do
85
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
86
+ end
87
+ end
88
+
89
+ describe 'test attribute "timestamp"' do
90
+ it 'should work' do
91
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
92
+ end
93
+ end
94
+
95
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snaptrade
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.162
4
+ version: 2.0.164
5
5
  platform: ruby
6
6
  authors:
7
7
  - SnapTrade
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-02-14 00:00:00.000000000 Z
11
+ date: 2026-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -195,8 +195,10 @@ files:
195
195
  - lib/snaptrade/models/option_chain_inner.rb
196
196
  - lib/snaptrade/models/option_chain_inner_chain_per_root_inner.rb
197
197
  - lib/snaptrade/models/option_chain_inner_chain_per_root_inner_chain_per_strike_price_inner.rb
198
+ - lib/snaptrade/models/option_impact.rb
198
199
  - lib/snaptrade/models/option_leg.rb
199
200
  - lib/snaptrade/models/option_leg_action.rb
201
+ - lib/snaptrade/models/option_quote.rb
200
202
  - lib/snaptrade/models/option_strategy.rb
201
203
  - lib/snaptrade/models/option_strategy_legs_inner.rb
202
204
  - lib/snaptrade/models/option_type.rb
@@ -371,8 +373,10 @@ files:
371
373
  - spec/models/option_chain_inner_chain_per_root_inner_chain_per_strike_price_inner_spec.rb
372
374
  - spec/models/option_chain_inner_chain_per_root_inner_spec.rb
373
375
  - spec/models/option_chain_inner_spec.rb
376
+ - spec/models/option_impact_spec.rb
374
377
  - spec/models/option_leg_action_spec.rb
375
378
  - spec/models/option_leg_spec.rb
379
+ - spec/models/option_quote_spec.rb
376
380
  - spec/models/option_strategy_legs_inner_spec.rb
377
381
  - spec/models/option_strategy_spec.rb
378
382
  - spec/models/option_type_spec.rb
@@ -596,6 +600,7 @@ test_files:
596
600
  - spec/models/account_order_record_child_brokerage_order_ids_spec.rb
597
601
  - spec/models/recent_orders_response_spec.rb
598
602
  - spec/models/account_order_record_v2_spec.rb
603
+ - spec/models/option_quote_spec.rb
599
604
  - spec/models/model425_failed_request_response_spec.rb
600
605
  - spec/models/connection_portal_version_spec.rb
601
606
  - spec/models/model403_failed_request_response_spec.rb
@@ -614,6 +619,7 @@ test_files:
614
619
  - spec/models/paginated_universal_activity_spec.rb
615
620
  - spec/models/crypto_order_form_time_in_force_spec.rb
616
621
  - spec/models/account_universal_activity_currency_spec.rb
622
+ - spec/models/option_impact_spec.rb
617
623
  - spec/models/model402_brokerage_auth_already_disabled_exception_spec.rb
618
624
  - spec/models/trading_search_cryptocurrency_pair_instruments200_response_spec.rb
619
625
  - spec/models/manual_trade_form_with_options_spec.rb