snaptrade 2.0.172 → 2.0.173
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +8 -7
- data/lib/snaptrade/api/options_api.rb +20 -18
- data/lib/snaptrade/api/trading_api.rb +4 -4
- data/lib/snaptrade/models/option_quote.rb +22 -93
- data/lib/snaptrade/models/option_quote_greeks.rb +248 -0
- data/lib/snaptrade/models/order_updated_response.rb +2 -1
- data/lib/snaptrade/models/order_updated_response_order.rb +441 -0
- data/lib/snaptrade/models/position.rb +1 -1
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +2 -0
- data/spec/api/options_api_spec.rb +3 -3
- data/spec/api/trading_api_spec.rb +1 -1
- data/spec/models/option_quote_greeks_spec.rb +47 -0
- data/spec/models/option_quote_spec.rb +3 -45
- data/spec/models/order_updated_response_order_spec.rb +155 -0
- metadata +7 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 40f1eeb819c66adbdbfd5062e723d6054ef035a0823fa627dd8b48db6b0bbd33
|
|
4
|
+
data.tar.gz: bc9cd284fe21cf310a552f393ca8335618a1f46c6204b66e696501a5a31ab636
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b38349cca30af5d7293a558e98367985daf87c450f6b7a9ff341a424698309b33f23b9c078c032b3bf4f14d0d521a01acd2eb064a84834c0af0b63889d1e36a0
|
|
7
|
+
data.tar.gz: 959eb47e43cbc4872ed25717728cb7fa4e5093e042e6597ca629022fe84fff19b634798771eb1202cf63750420b6fa86766684dc33c8d6bb2df6052325786e1e
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
Connect brokerage accounts to your app for live positions and trading
|
|
8
8
|
|
|
9
|
-
[](https://rubygems.org/gems/snaptrade/versions/2.0.173)
|
|
10
10
|
[](https://snaptrade.com/)
|
|
11
11
|
|
|
12
12
|
</div>
|
|
@@ -49,7 +49,7 @@ Connect brokerage accounts to your app for live positions and trading
|
|
|
49
49
|
* [`snaptrade.experimental_endpoints.get_user_account_order_detail_v2`](#snaptradeexperimental_endpointsget_user_account_order_detail_v2)
|
|
50
50
|
* [`snaptrade.experimental_endpoints.get_user_account_orders_v2`](#snaptradeexperimental_endpointsget_user_account_orders_v2)
|
|
51
51
|
* [`snaptrade.experimental_endpoints.get_user_account_recent_orders_v2`](#snaptradeexperimental_endpointsget_user_account_recent_orders_v2)
|
|
52
|
-
* [`snaptrade.options.
|
|
52
|
+
* [`snaptrade.options.get_user_account_option_quotes`](#snaptradeoptionsget_user_account_option_quotes)
|
|
53
53
|
* [`snaptrade.options.list_option_holdings`](#snaptradeoptionslist_option_holdings)
|
|
54
54
|
* [`snaptrade.reference_data.get_currency_exchange_rate_pair`](#snaptradereference_dataget_currency_exchange_rate_pair)
|
|
55
55
|
* [`snaptrade.reference_data.get_partner_info`](#snaptradereference_dataget_partner_info)
|
|
@@ -87,7 +87,7 @@ Connect brokerage accounts to your app for live positions and trading
|
|
|
87
87
|
Add to Gemfile:
|
|
88
88
|
|
|
89
89
|
```ruby
|
|
90
|
-
gem 'snaptrade', '~> 2.0.
|
|
90
|
+
gem 'snaptrade', '~> 2.0.173'
|
|
91
91
|
```
|
|
92
92
|
|
|
93
93
|
## Getting Started<a id="getting-started"></a>
|
|
@@ -1334,15 +1334,16 @@ false to retrieve non executed orders as well
|
|
|
1334
1334
|
---
|
|
1335
1335
|
|
|
1336
1336
|
|
|
1337
|
-
### `snaptrade.options.
|
|
1337
|
+
### `snaptrade.options.get_user_account_option_quotes`<a id="snaptradeoptionsget_user_account_option_quotes"></a>
|
|
1338
1338
|
|
|
1339
|
-
Returns a
|
|
1339
|
+
Returns a quote for a single option contract. The option contract is specified using in the 21 character OCC format. For example `AAPL 251114C00240000` represents a call option on AAPL expiring on 2025-11-14 with a strike price of $240. For more information on the OCC format, see [here](https://en.wikipedia.org/wiki/Option_symbol#OCC_format)
|
|
1340
|
+
**Note:** These are derived values and are not suitable for trading purposes.
|
|
1340
1341
|
|
|
1341
1342
|
|
|
1342
1343
|
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
|
1343
1344
|
|
|
1344
1345
|
```ruby
|
|
1345
|
-
result = snaptrade.options.
|
|
1346
|
+
result = snaptrade.options.get_user_account_option_quotes(
|
|
1346
1347
|
user_id: "snaptrade-user-123",
|
|
1347
1348
|
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
1348
1349
|
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
@@ -1871,7 +1872,7 @@ p result
|
|
|
1871
1872
|
### `snaptrade.trading.get_option_impact`<a id="snaptradetradingget_option_impact"></a>
|
|
1872
1873
|
|
|
1873
1874
|
Simulates an option order with up to 4 legs and returns the estimated cost and transaction fees without placing it.
|
|
1874
|
-
Only supported for certain brokerages. Please refer to the [brokerage trading support page](https://snaptrade.
|
|
1875
|
+
Only supported for certain enabled brokerages. Please refer to the [brokerage trading support page](https://support.snaptrade.com/brokerages) for more information on which brokerages support this endpoint.
|
|
1875
1876
|
|
|
1876
1877
|
|
|
1877
1878
|
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
|
@@ -19,71 +19,73 @@ module SnapTrade
|
|
|
19
19
|
|
|
20
20
|
# Get option quote
|
|
21
21
|
#
|
|
22
|
-
# Returns a
|
|
22
|
+
# Returns a quote for a single option contract. The option contract is specified using in the 21 character OCC format. For example `AAPL 251114C00240000` represents a call option on AAPL expiring on 2025-11-14 with a strike price of $240. For more information on the OCC format, see [here](https://en.wikipedia.org/wiki/Option_symbol#OCC_format)
|
|
23
|
+
# **Note:** These are derived values and are not suitable for trading purposes.
|
|
23
24
|
#
|
|
24
25
|
# @param user_id [String]
|
|
25
26
|
# @param user_secret [String]
|
|
26
27
|
# @param account_id [String]
|
|
27
28
|
# @param symbol [String] The OCC-formatted option symbol.
|
|
28
29
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
29
|
-
def
|
|
30
|
-
data, _status_code, _headers =
|
|
30
|
+
def get_user_account_option_quotes(user_id:, user_secret:, account_id:, symbol:, extra: {})
|
|
31
|
+
data, _status_code, _headers = get_user_account_option_quotes_with_http_info_impl(user_id, user_secret, account_id, symbol, extra)
|
|
31
32
|
data
|
|
32
33
|
end
|
|
33
34
|
|
|
34
35
|
# Get option quote
|
|
35
36
|
#
|
|
36
|
-
# Returns a
|
|
37
|
+
# Returns a quote for a single option contract. The option contract is specified using in the 21 character OCC format. For example `AAPL 251114C00240000` represents a call option on AAPL expiring on 2025-11-14 with a strike price of $240. For more information on the OCC format, see [here](https://en.wikipedia.org/wiki/Option_symbol#OCC_format)
|
|
38
|
+
# **Note:** These are derived values and are not suitable for trading purposes.
|
|
37
39
|
#
|
|
38
40
|
# @param user_id [String]
|
|
39
41
|
# @param user_secret [String]
|
|
40
42
|
# @param account_id [String]
|
|
41
43
|
# @param symbol [String] The OCC-formatted option symbol.
|
|
42
44
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
43
|
-
def
|
|
44
|
-
|
|
45
|
+
def get_user_account_option_quotes_with_http_info(user_id:, user_secret:, account_id:, symbol:, extra: {})
|
|
46
|
+
get_user_account_option_quotes_with_http_info_impl(user_id, user_secret, account_id, symbol, extra)
|
|
45
47
|
end
|
|
46
48
|
|
|
47
49
|
# Get option quote
|
|
48
|
-
# Returns a
|
|
50
|
+
# Returns a quote for a single option contract. The option contract is specified using in the 21 character OCC format. For example `AAPL 251114C00240000` represents a call option on AAPL expiring on 2025-11-14 with a strike price of $240. For more information on the OCC format, see [here](https://en.wikipedia.org/wiki/Option_symbol#OCC_format) **Note:** These are derived values and are not suitable for trading purposes.
|
|
49
51
|
# @param user_id [String]
|
|
50
52
|
# @param user_secret [String]
|
|
51
53
|
# @param account_id [String]
|
|
52
54
|
# @param symbol [String] The OCC-formatted option symbol.
|
|
53
55
|
# @param [Hash] opts the optional parameters
|
|
54
56
|
# @return [OptionQuote]
|
|
55
|
-
private def
|
|
56
|
-
data, _status_code, _headers =
|
|
57
|
+
private def get_user_account_option_quotes_impl(user_id, user_secret, account_id, symbol, opts = {})
|
|
58
|
+
data, _status_code, _headers = get_user_account_option_quotes_with_http_info(user_id, user_secret, account_id, symbol, opts)
|
|
57
59
|
data
|
|
58
60
|
end
|
|
59
61
|
|
|
60
62
|
# Get option quote
|
|
61
|
-
# Returns a
|
|
63
|
+
# Returns a quote for a single option contract. The option contract is specified using in the 21 character OCC format. For example `AAPL 251114C00240000` represents a call option on AAPL expiring on 2025-11-14 with a strike price of $240. For more information on the OCC format, see [here](https://en.wikipedia.org/wiki/Option_symbol#OCC_format) **Note:** These are derived values and are not suitable for trading purposes.
|
|
62
64
|
# @param user_id [String]
|
|
63
65
|
# @param user_secret [String]
|
|
64
66
|
# @param account_id [String]
|
|
65
67
|
# @param symbol [String] The OCC-formatted option symbol.
|
|
66
68
|
# @param [Hash] opts the optional parameters
|
|
67
69
|
# @return [Array<(OptionQuote, Integer, Hash)>] OptionQuote data, response status code and response headers
|
|
68
|
-
private def
|
|
70
|
+
private def get_user_account_option_quotes_with_http_info_impl(user_id, user_secret, account_id, symbol, opts = {})
|
|
69
71
|
if @api_client.config.debugging
|
|
70
|
-
@api_client.config.logger.debug 'Calling API: OptionsApi.
|
|
72
|
+
@api_client.config.logger.debug 'Calling API: OptionsApi.get_user_account_option_quotes ...'
|
|
71
73
|
end
|
|
72
74
|
# verify the required parameter 'user_id' is set
|
|
73
75
|
if @api_client.config.client_side_validation && user_id.nil?
|
|
74
|
-
fail ArgumentError, "Missing the required parameter 'user_id' when calling OptionsApi.
|
|
76
|
+
fail ArgumentError, "Missing the required parameter 'user_id' when calling OptionsApi.get_user_account_option_quotes"
|
|
75
77
|
end
|
|
76
78
|
# verify the required parameter 'user_secret' is set
|
|
77
79
|
if @api_client.config.client_side_validation && user_secret.nil?
|
|
78
|
-
fail ArgumentError, "Missing the required parameter 'user_secret' when calling OptionsApi.
|
|
80
|
+
fail ArgumentError, "Missing the required parameter 'user_secret' when calling OptionsApi.get_user_account_option_quotes"
|
|
79
81
|
end
|
|
80
82
|
# verify the required parameter 'account_id' is set
|
|
81
83
|
if @api_client.config.client_side_validation && account_id.nil?
|
|
82
|
-
fail ArgumentError, "Missing the required parameter 'account_id' when calling OptionsApi.
|
|
84
|
+
fail ArgumentError, "Missing the required parameter 'account_id' when calling OptionsApi.get_user_account_option_quotes"
|
|
83
85
|
end
|
|
84
86
|
# verify the required parameter 'symbol' is set
|
|
85
87
|
if @api_client.config.client_side_validation && symbol.nil?
|
|
86
|
-
fail ArgumentError, "Missing the required parameter 'symbol' when calling OptionsApi.
|
|
88
|
+
fail ArgumentError, "Missing the required parameter 'symbol' when calling OptionsApi.get_user_account_option_quotes"
|
|
87
89
|
end
|
|
88
90
|
# resource path
|
|
89
91
|
local_var_path = '/accounts/{accountId}/quotes/options'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
|
|
@@ -112,7 +114,7 @@ module SnapTrade
|
|
|
112
114
|
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
|
113
115
|
|
|
114
116
|
new_options = opts.merge(
|
|
115
|
-
:operation => :"OptionsApi.
|
|
117
|
+
:operation => :"OptionsApi.get_user_account_option_quotes",
|
|
116
118
|
:header_params => header_params,
|
|
117
119
|
:query_params => query_params,
|
|
118
120
|
:form_params => form_params,
|
|
@@ -123,7 +125,7 @@ module SnapTrade
|
|
|
123
125
|
|
|
124
126
|
data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
|
|
125
127
|
if @api_client.config.debugging
|
|
126
|
-
@api_client.config.logger.debug "API called: OptionsApi#
|
|
128
|
+
@api_client.config.logger.debug "API called: OptionsApi#get_user_account_option_quotes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
127
129
|
end
|
|
128
130
|
return data, status_code, headers, response
|
|
129
131
|
end
|
|
@@ -381,7 +381,7 @@ module SnapTrade
|
|
|
381
381
|
# Get option order impact
|
|
382
382
|
#
|
|
383
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 the [brokerage trading support page](https://snaptrade.
|
|
384
|
+
# Only supported for certain enabled brokerages. Please refer to the [brokerage trading support page](https://support.snaptrade.com/brokerages) for more information on which brokerages support this endpoint.
|
|
385
385
|
#
|
|
386
386
|
# @param order_type [MlegOrderTypeStrict] The type of order to place.
|
|
387
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.
|
|
@@ -410,7 +410,7 @@ module SnapTrade
|
|
|
410
410
|
# Get option order impact
|
|
411
411
|
#
|
|
412
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 the [brokerage trading support page](https://snaptrade.
|
|
413
|
+
# Only supported for certain enabled brokerages. Please refer to the [brokerage trading support page](https://support.snaptrade.com/brokerages) for more information on which brokerages support this endpoint.
|
|
414
414
|
#
|
|
415
415
|
# @param order_type [MlegOrderTypeStrict] The type of order to place.
|
|
416
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.
|
|
@@ -436,7 +436,7 @@ module SnapTrade
|
|
|
436
436
|
end
|
|
437
437
|
|
|
438
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 the [brokerage trading support page](https://snaptrade.
|
|
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 enabled brokerages. Please refer to the [brokerage trading support page](https://support.snaptrade.com/brokerages) for more information on which brokerages support this endpoint.
|
|
440
440
|
# @param user_id [String]
|
|
441
441
|
# @param user_secret [String]
|
|
442
442
|
# @param account_id [String]
|
|
@@ -449,7 +449,7 @@ module SnapTrade
|
|
|
449
449
|
end
|
|
450
450
|
|
|
451
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 the [brokerage trading support page](https://snaptrade.
|
|
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 enabled brokerages. Please refer to the [brokerage trading support page](https://support.snaptrade.com/brokerages) for more information on which brokerages support this endpoint.
|
|
453
453
|
# @param user_id [String]
|
|
454
454
|
# @param user_secret [String]
|
|
455
455
|
# @param account_id [String]
|
|
@@ -16,54 +16,25 @@ module SnapTrade
|
|
|
16
16
|
# The OCC-formatted option symbol.
|
|
17
17
|
attr_accessor :symbol
|
|
18
18
|
|
|
19
|
-
# The
|
|
20
|
-
attr_accessor :
|
|
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
|
|
19
|
+
# The derived synthetic price of the contract.
|
|
20
|
+
attr_accessor :synthetic_price
|
|
42
21
|
|
|
43
22
|
# The implied volatility of the option contract.
|
|
44
23
|
attr_accessor :implied_volatility
|
|
45
24
|
|
|
46
|
-
# The
|
|
47
|
-
attr_accessor :underlying_price
|
|
48
|
-
|
|
49
|
-
# The timestamp of the quote.
|
|
25
|
+
# The timestamp of the last update for the option quote.
|
|
50
26
|
attr_accessor :timestamp
|
|
51
27
|
|
|
28
|
+
attr_accessor :greeks
|
|
29
|
+
|
|
52
30
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
53
31
|
def self.attribute_map
|
|
54
32
|
{
|
|
55
33
|
:'symbol' => :'symbol',
|
|
56
|
-
:'
|
|
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',
|
|
34
|
+
:'synthetic_price' => :'synthetic_price',
|
|
64
35
|
:'implied_volatility' => :'implied_volatility',
|
|
65
|
-
:'
|
|
66
|
-
:'
|
|
36
|
+
:'timestamp' => :'timestamp',
|
|
37
|
+
:'greeks' => :'greeks'
|
|
67
38
|
}
|
|
68
39
|
end
|
|
69
40
|
|
|
@@ -76,24 +47,17 @@ module SnapTrade
|
|
|
76
47
|
def self.openapi_types
|
|
77
48
|
{
|
|
78
49
|
:'symbol' => :'String',
|
|
79
|
-
:'
|
|
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',
|
|
50
|
+
:'synthetic_price' => :'Float',
|
|
87
51
|
:'implied_volatility' => :'Float',
|
|
88
|
-
:'
|
|
89
|
-
:'
|
|
52
|
+
:'timestamp' => :'Time',
|
|
53
|
+
:'greeks' => :'OptionQuoteGreeks'
|
|
90
54
|
}
|
|
91
55
|
end
|
|
92
56
|
|
|
93
57
|
# List of attributes with nullable: true
|
|
94
58
|
def self.openapi_nullable
|
|
95
59
|
Set.new([
|
|
96
|
-
:'timestamp'
|
|
60
|
+
:'timestamp',
|
|
97
61
|
])
|
|
98
62
|
end
|
|
99
63
|
|
|
@@ -116,49 +80,21 @@ module SnapTrade
|
|
|
116
80
|
self.symbol = attributes[:'symbol']
|
|
117
81
|
end
|
|
118
82
|
|
|
119
|
-
if attributes.key?(:'
|
|
120
|
-
self.
|
|
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']
|
|
83
|
+
if attributes.key?(:'synthetic_price')
|
|
84
|
+
self.synthetic_price = attributes[:'synthetic_price']
|
|
149
85
|
end
|
|
150
86
|
|
|
151
87
|
if attributes.key?(:'implied_volatility')
|
|
152
88
|
self.implied_volatility = attributes[:'implied_volatility']
|
|
153
89
|
end
|
|
154
90
|
|
|
155
|
-
if attributes.key?(:'underlying_price')
|
|
156
|
-
self.underlying_price = attributes[:'underlying_price']
|
|
157
|
-
end
|
|
158
|
-
|
|
159
91
|
if attributes.key?(:'timestamp')
|
|
160
92
|
self.timestamp = attributes[:'timestamp']
|
|
161
93
|
end
|
|
94
|
+
|
|
95
|
+
if attributes.key?(:'greeks')
|
|
96
|
+
self.greeks = attributes[:'greeks']
|
|
97
|
+
end
|
|
162
98
|
end
|
|
163
99
|
|
|
164
100
|
# Show invalid properties with the reasons. Usually used together with valid?
|
|
@@ -180,17 +116,10 @@ module SnapTrade
|
|
|
180
116
|
return true if self.equal?(o)
|
|
181
117
|
self.class == o.class &&
|
|
182
118
|
symbol == o.symbol &&
|
|
183
|
-
|
|
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 &&
|
|
119
|
+
synthetic_price == o.synthetic_price &&
|
|
191
120
|
implied_volatility == o.implied_volatility &&
|
|
192
|
-
|
|
193
|
-
|
|
121
|
+
timestamp == o.timestamp &&
|
|
122
|
+
greeks == o.greeks
|
|
194
123
|
end
|
|
195
124
|
|
|
196
125
|
# @see the `==` method
|
|
@@ -202,7 +131,7 @@ module SnapTrade
|
|
|
202
131
|
# Calculates hash code according to all attributes.
|
|
203
132
|
# @return [Integer] Hash code
|
|
204
133
|
def hash
|
|
205
|
-
[symbol,
|
|
134
|
+
[symbol, synthetic_price, implied_volatility, timestamp, greeks].hash
|
|
206
135
|
end
|
|
207
136
|
|
|
208
137
|
# Builds the object from hash
|
|
@@ -0,0 +1,248 @@
|
|
|
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
|
+
# The Greeks for the option contract.
|
|
15
|
+
class OptionQuoteGreeks
|
|
16
|
+
# Delta represents the rate of change between the option's price and a $1 change in the underlying asset's price.
|
|
17
|
+
attr_accessor :delta
|
|
18
|
+
|
|
19
|
+
# Gamma represents the rate of change between an option's delta and the underlying asset's price.
|
|
20
|
+
attr_accessor :gamma
|
|
21
|
+
|
|
22
|
+
# Theta represents the rate of change between the option price and time, or time sensitivity - sometimes known as an option's time decay.
|
|
23
|
+
attr_accessor :theta
|
|
24
|
+
|
|
25
|
+
# Vega represents the rate of change between an option's value and the underlying asset's implied volatility.
|
|
26
|
+
attr_accessor :vega
|
|
27
|
+
|
|
28
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
29
|
+
def self.attribute_map
|
|
30
|
+
{
|
|
31
|
+
:'delta' => :'delta',
|
|
32
|
+
:'gamma' => :'gamma',
|
|
33
|
+
:'theta' => :'theta',
|
|
34
|
+
:'vega' => :'vega'
|
|
35
|
+
}
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Returns all the JSON keys this model knows about
|
|
39
|
+
def self.acceptable_attributes
|
|
40
|
+
attribute_map.values
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Attribute type mapping.
|
|
44
|
+
def self.openapi_types
|
|
45
|
+
{
|
|
46
|
+
:'delta' => :'Float',
|
|
47
|
+
:'gamma' => :'Float',
|
|
48
|
+
:'theta' => :'Float',
|
|
49
|
+
:'vega' => :'Float'
|
|
50
|
+
}
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# List of attributes with nullable: true
|
|
54
|
+
def self.openapi_nullable
|
|
55
|
+
Set.new([
|
|
56
|
+
])
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# Initializes the object
|
|
60
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
61
|
+
def initialize(attributes = {})
|
|
62
|
+
if (!attributes.is_a?(Hash))
|
|
63
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::OptionQuoteGreeks` initialize method"
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
67
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
68
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
69
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::OptionQuoteGreeks`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
70
|
+
end
|
|
71
|
+
h[k.to_sym] = v
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if attributes.key?(:'delta')
|
|
75
|
+
self.delta = attributes[:'delta']
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
if attributes.key?(:'gamma')
|
|
79
|
+
self.gamma = attributes[:'gamma']
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
if attributes.key?(:'theta')
|
|
83
|
+
self.theta = attributes[:'theta']
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
if attributes.key?(:'vega')
|
|
87
|
+
self.vega = attributes[:'vega']
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
92
|
+
# @return Array for valid properties with the reasons
|
|
93
|
+
def list_invalid_properties
|
|
94
|
+
invalid_properties = Array.new
|
|
95
|
+
invalid_properties
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# Check to see if the all the properties in the model are valid
|
|
99
|
+
# @return true if the model is valid
|
|
100
|
+
def valid?
|
|
101
|
+
true
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# Checks equality by comparing each attribute.
|
|
105
|
+
# @param [Object] Object to be compared
|
|
106
|
+
def ==(o)
|
|
107
|
+
return true if self.equal?(o)
|
|
108
|
+
self.class == o.class &&
|
|
109
|
+
delta == o.delta &&
|
|
110
|
+
gamma == o.gamma &&
|
|
111
|
+
theta == o.theta &&
|
|
112
|
+
vega == o.vega
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# @see the `==` method
|
|
116
|
+
# @param [Object] Object to be compared
|
|
117
|
+
def eql?(o)
|
|
118
|
+
self == o
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# Calculates hash code according to all attributes.
|
|
122
|
+
# @return [Integer] Hash code
|
|
123
|
+
def hash
|
|
124
|
+
[delta, gamma, theta, vega].hash
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
# Builds the object from hash
|
|
128
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
129
|
+
# @return [Object] Returns the model itself
|
|
130
|
+
def self.build_from_hash(attributes)
|
|
131
|
+
new.build_from_hash(attributes)
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
# Builds the object from hash
|
|
135
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
136
|
+
# @return [Object] Returns the model itself
|
|
137
|
+
def build_from_hash(attributes)
|
|
138
|
+
return nil unless attributes.is_a?(Hash)
|
|
139
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
140
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
141
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
142
|
+
self.send("#{key}=", nil)
|
|
143
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
144
|
+
# check to ensure the input is an array given that the attribute
|
|
145
|
+
# is documented as an array but the input is not
|
|
146
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
147
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
148
|
+
end
|
|
149
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
150
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
151
|
+
end
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
self
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
# Deserializes the data based on type
|
|
158
|
+
# @param string type Data type
|
|
159
|
+
# @param string value Value to be deserialized
|
|
160
|
+
# @return [Object] Deserialized data
|
|
161
|
+
def _deserialize(type, value)
|
|
162
|
+
case type.to_sym
|
|
163
|
+
when :Time
|
|
164
|
+
Time.parse(value)
|
|
165
|
+
when :Date
|
|
166
|
+
Date.parse(value)
|
|
167
|
+
when :String
|
|
168
|
+
value.to_s
|
|
169
|
+
when :Integer
|
|
170
|
+
value.to_i
|
|
171
|
+
when :Float
|
|
172
|
+
value.to_f
|
|
173
|
+
when :Boolean
|
|
174
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
175
|
+
true
|
|
176
|
+
else
|
|
177
|
+
false
|
|
178
|
+
end
|
|
179
|
+
when :Object
|
|
180
|
+
# generic object (usually a Hash), return directly
|
|
181
|
+
value
|
|
182
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
183
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
184
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
185
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
186
|
+
k_type = Regexp.last_match[:k_type]
|
|
187
|
+
v_type = Regexp.last_match[:v_type]
|
|
188
|
+
{}.tap do |hash|
|
|
189
|
+
value.each do |k, v|
|
|
190
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
191
|
+
end
|
|
192
|
+
end
|
|
193
|
+
else # model
|
|
194
|
+
# models (e.g. Pet) or oneOf
|
|
195
|
+
klass = SnapTrade.const_get(type)
|
|
196
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
197
|
+
end
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
# Returns the string representation of the object
|
|
201
|
+
# @return [String] String presentation of the object
|
|
202
|
+
def to_s
|
|
203
|
+
to_hash.to_s
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
207
|
+
# @return [Hash] Returns the object in the form of hash
|
|
208
|
+
def to_body
|
|
209
|
+
to_hash
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
# Returns the object in the form of hash
|
|
213
|
+
# @return [Hash] Returns the object in the form of hash
|
|
214
|
+
def to_hash
|
|
215
|
+
hash = {}
|
|
216
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
217
|
+
value = self.send(attr)
|
|
218
|
+
if value.nil?
|
|
219
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
220
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
hash[param] = _to_hash(value)
|
|
224
|
+
end
|
|
225
|
+
hash
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
# Outputs non-array value in the form of hash
|
|
229
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
230
|
+
# @param [Object] value Any valid value
|
|
231
|
+
# @return [Hash] Returns the value in the form of hash
|
|
232
|
+
def _to_hash(value)
|
|
233
|
+
if value.is_a?(Array)
|
|
234
|
+
value.compact.map { |v| _to_hash(v) }
|
|
235
|
+
elsif value.is_a?(Hash)
|
|
236
|
+
{}.tap do |hash|
|
|
237
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
238
|
+
end
|
|
239
|
+
elsif value.respond_to? :to_hash
|
|
240
|
+
value.to_hash
|
|
241
|
+
else
|
|
242
|
+
value
|
|
243
|
+
end
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
end
|
|
@@ -34,13 +34,14 @@ module SnapTrade
|
|
|
34
34
|
def self.openapi_types
|
|
35
35
|
{
|
|
36
36
|
:'brokerage_order_id' => :'String',
|
|
37
|
-
:'order' => :'
|
|
37
|
+
:'order' => :'OrderUpdatedResponseOrder'
|
|
38
38
|
}
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
# List of attributes with nullable: true
|
|
42
42
|
def self.openapi_nullable
|
|
43
43
|
Set.new([
|
|
44
|
+
:'order'
|
|
44
45
|
])
|
|
45
46
|
end
|
|
46
47
|
|