snaptrade 2.0.174 → 2.0.176
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 +3 -3
- data/README.md +42 -2
- data/lib/snaptrade/api/options_api.rb +114 -0
- data/lib/snaptrade/models/account_order_record.rb +3 -3
- data/lib/snaptrade/models/account_universal_activity.rb +1 -1
- data/lib/snaptrade/models/order_updated_response_order.rb +3 -3
- data/lib/snaptrade/version.rb +1 -1
- data/spec/api/options_api_spec.rb +15 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 00b5eec663396a575f8d1a6786b40d2f1d9b01edf9234b76b726e39b116bc1fd
|
|
4
|
+
data.tar.gz: 6b3eb40bc99223d221c9e141a9b724e09d599d365c356738d88220fa082b436e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 341f5d1e3c1c8db37afbe80b9ba099a8c2519f5d3eef7deb6cf2ba78c5734bc774ef8bb88651c794be2d88a127351b8e6b7e6cc721fbeeca511bf7de3ced9826
|
|
7
|
+
data.tar.gz: df7b2091ac632d23544365cfe20f154f9b46ad0b12e446acaf048978302e964c27f872b9085055bff2147e94bf702149a22695ebad3266706c0f63b2703518ce
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
snaptrade (2.0.
|
|
4
|
+
snaptrade (2.0.176)
|
|
5
5
|
faraday (>= 1.0.1, < 3.0)
|
|
6
6
|
faraday-multipart (~> 1.0, >= 1.0.4)
|
|
7
7
|
|
|
@@ -28,7 +28,7 @@ GEM
|
|
|
28
28
|
reline (>= 0.3.0)
|
|
29
29
|
method_source (1.1.0)
|
|
30
30
|
multipart-post (2.4.1)
|
|
31
|
-
parallel (1.
|
|
31
|
+
parallel (1.28.0)
|
|
32
32
|
parser (3.3.11.1)
|
|
33
33
|
ast (~> 2.4.1)
|
|
34
34
|
racc
|
|
@@ -42,7 +42,7 @@ GEM
|
|
|
42
42
|
racc (1.8.1)
|
|
43
43
|
rainbow (3.1.1)
|
|
44
44
|
rake (13.0.6)
|
|
45
|
-
regexp_parser (2.
|
|
45
|
+
regexp_parser (2.12.0)
|
|
46
46
|
reline (0.6.3)
|
|
47
47
|
io-console (~> 0.5)
|
|
48
48
|
rexml (3.4.4)
|
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.176)
|
|
10
10
|
[](https://snaptrade.com/)
|
|
11
11
|
|
|
12
12
|
</div>
|
|
@@ -49,6 +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.get_user_account_option_quotes`](#snaptradeoptionsget_user_account_option_quotes)
|
|
52
53
|
* [`snaptrade.options.list_option_holdings`](#snaptradeoptionslist_option_holdings)
|
|
53
54
|
* [`snaptrade.reference_data.get_currency_exchange_rate_pair`](#snaptradereference_dataget_currency_exchange_rate_pair)
|
|
54
55
|
* [`snaptrade.reference_data.get_partner_info`](#snaptradereference_dataget_partner_info)
|
|
@@ -86,7 +87,7 @@ Connect brokerage accounts to your app for live positions and trading
|
|
|
86
87
|
Add to Gemfile:
|
|
87
88
|
|
|
88
89
|
```ruby
|
|
89
|
-
gem 'snaptrade', '~> 2.0.
|
|
90
|
+
gem 'snaptrade', '~> 2.0.176'
|
|
90
91
|
```
|
|
91
92
|
|
|
92
93
|
## Getting Started<a id="getting-started"></a>
|
|
@@ -1333,6 +1334,45 @@ false to retrieve non executed orders as well
|
|
|
1333
1334
|
---
|
|
1334
1335
|
|
|
1335
1336
|
|
|
1337
|
+
### `snaptrade.options.get_user_account_option_quotes`<a id="snaptradeoptionsget_user_account_option_quotes"></a>
|
|
1338
|
+
|
|
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.
|
|
1341
|
+
|
|
1342
|
+
|
|
1343
|
+
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
|
1344
|
+
|
|
1345
|
+
```ruby
|
|
1346
|
+
result = snaptrade.options.get_user_account_option_quotes(
|
|
1347
|
+
user_id: "snaptrade-user-123",
|
|
1348
|
+
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
1349
|
+
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
1350
|
+
symbol: "AAPL 251219C00150000",
|
|
1351
|
+
)
|
|
1352
|
+
p result
|
|
1353
|
+
```
|
|
1354
|
+
|
|
1355
|
+
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
1356
|
+
|
|
1357
|
+
##### user_id: `String`<a id="user_id-string"></a>
|
|
1358
|
+
##### user_secret: `String`<a id="user_secret-string"></a>
|
|
1359
|
+
##### account_id: `String`<a id="account_id-string"></a>
|
|
1360
|
+
##### symbol: `String`<a id="symbol-string"></a>
|
|
1361
|
+
The OCC-formatted option symbol.
|
|
1362
|
+
|
|
1363
|
+
#### 🔄 Return<a id="🔄-return"></a>
|
|
1364
|
+
|
|
1365
|
+
[OptionQuote](./lib/snaptrade/models/option_quote.rb)
|
|
1366
|
+
|
|
1367
|
+
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
|
1368
|
+
|
|
1369
|
+
`/accounts/{accountId}/quotes/options` `GET`
|
|
1370
|
+
|
|
1371
|
+
[🔙 **Back to Table of Contents**](#table-of-contents)
|
|
1372
|
+
|
|
1373
|
+
---
|
|
1374
|
+
|
|
1375
|
+
|
|
1336
1376
|
### `snaptrade.options.list_option_holdings`<a id="snaptradeoptionslist_option_holdings"></a>
|
|
1337
1377
|
|
|
1338
1378
|
Returns a list of option positions in the specified account. For stock/ETF/crypto/mutual fund positions, please use the [positions endpoint](/reference/Account%20Information/AccountInformation_getUserAccountPositions).
|
|
@@ -17,6 +17,120 @@ module SnapTrade
|
|
|
17
17
|
@api_client = api_client
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
+
# Get option quote
|
|
21
|
+
#
|
|
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.
|
|
24
|
+
#
|
|
25
|
+
# @param user_id [String]
|
|
26
|
+
# @param user_secret [String]
|
|
27
|
+
# @param account_id [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_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)
|
|
32
|
+
data
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Get option quote
|
|
36
|
+
#
|
|
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.
|
|
39
|
+
#
|
|
40
|
+
# @param user_id [String]
|
|
41
|
+
# @param user_secret [String]
|
|
42
|
+
# @param account_id [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_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)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Get option quote
|
|
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.
|
|
51
|
+
# @param user_id [String]
|
|
52
|
+
# @param user_secret [String]
|
|
53
|
+
# @param account_id [String]
|
|
54
|
+
# @param symbol [String] The OCC-formatted option symbol.
|
|
55
|
+
# @param [Hash] opts the optional parameters
|
|
56
|
+
# @return [OptionQuote]
|
|
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)
|
|
59
|
+
data
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Get option quote
|
|
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.
|
|
64
|
+
# @param user_id [String]
|
|
65
|
+
# @param user_secret [String]
|
|
66
|
+
# @param account_id [String]
|
|
67
|
+
# @param symbol [String] The OCC-formatted option symbol.
|
|
68
|
+
# @param [Hash] opts the optional parameters
|
|
69
|
+
# @return [Array<(OptionQuote, Integer, Hash)>] OptionQuote data, response status code and response headers
|
|
70
|
+
private def get_user_account_option_quotes_with_http_info_impl(user_id, user_secret, account_id, symbol, opts = {})
|
|
71
|
+
if @api_client.config.debugging
|
|
72
|
+
@api_client.config.logger.debug 'Calling API: OptionsApi.get_user_account_option_quotes ...'
|
|
73
|
+
end
|
|
74
|
+
# verify the required parameter 'user_id' is set
|
|
75
|
+
if @api_client.config.client_side_validation && user_id.nil?
|
|
76
|
+
fail ArgumentError, "Missing the required parameter 'user_id' when calling OptionsApi.get_user_account_option_quotes"
|
|
77
|
+
end
|
|
78
|
+
# verify the required parameter 'user_secret' is set
|
|
79
|
+
if @api_client.config.client_side_validation && user_secret.nil?
|
|
80
|
+
fail ArgumentError, "Missing the required parameter 'user_secret' when calling OptionsApi.get_user_account_option_quotes"
|
|
81
|
+
end
|
|
82
|
+
# verify the required parameter 'account_id' is set
|
|
83
|
+
if @api_client.config.client_side_validation && account_id.nil?
|
|
84
|
+
fail ArgumentError, "Missing the required parameter 'account_id' when calling OptionsApi.get_user_account_option_quotes"
|
|
85
|
+
end
|
|
86
|
+
# verify the required parameter 'symbol' is set
|
|
87
|
+
if @api_client.config.client_side_validation && symbol.nil?
|
|
88
|
+
fail ArgumentError, "Missing the required parameter 'symbol' when calling OptionsApi.get_user_account_option_quotes"
|
|
89
|
+
end
|
|
90
|
+
# resource path
|
|
91
|
+
local_var_path = '/accounts/{accountId}/quotes/options'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
|
|
92
|
+
|
|
93
|
+
# query parameters
|
|
94
|
+
query_params = opts[:query_params] || {}
|
|
95
|
+
query_params[:'userId'] = user_id
|
|
96
|
+
query_params[:'userSecret'] = user_secret
|
|
97
|
+
query_params[:'symbol'] = symbol
|
|
98
|
+
|
|
99
|
+
# header parameters
|
|
100
|
+
header_params = opts[:header_params] || {}
|
|
101
|
+
# HTTP header 'Accept' (if needed)
|
|
102
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
103
|
+
|
|
104
|
+
# form parameters
|
|
105
|
+
form_params = opts[:form_params] || {}
|
|
106
|
+
|
|
107
|
+
# http body (model)
|
|
108
|
+
post_body = opts[:debug_body]
|
|
109
|
+
|
|
110
|
+
# return_type
|
|
111
|
+
return_type = opts[:debug_return_type] || 'OptionQuote'
|
|
112
|
+
|
|
113
|
+
# auth_names
|
|
114
|
+
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
|
115
|
+
|
|
116
|
+
new_options = opts.merge(
|
|
117
|
+
:operation => :"OptionsApi.get_user_account_option_quotes",
|
|
118
|
+
:header_params => header_params,
|
|
119
|
+
:query_params => query_params,
|
|
120
|
+
:form_params => form_params,
|
|
121
|
+
:body => post_body,
|
|
122
|
+
:auth_names => auth_names,
|
|
123
|
+
:return_type => return_type
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
|
|
127
|
+
if @api_client.config.debugging
|
|
128
|
+
@api_client.config.logger.debug "API called: OptionsApi#get_user_account_option_quotes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
129
|
+
end
|
|
130
|
+
return data, status_code, headers, response
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
|
|
20
134
|
# List account option positions
|
|
21
135
|
#
|
|
22
136
|
# Returns a list of option positions in the specified account. For stock/ETF/crypto/mutual fund positions, please use the [positions endpoint](/reference/Account%20Information/AccountInformation_getUserAccountPositions).
|
|
@@ -42,13 +42,13 @@ module SnapTrade
|
|
|
42
42
|
# The number of shares or contracts that have been filled. Can be a decimal number for fractional shares.
|
|
43
43
|
attr_accessor :filled_quantity
|
|
44
44
|
|
|
45
|
-
# The price at which the order was executed.
|
|
45
|
+
# The price at which the order was executed. For option orders, this represents the price per share.
|
|
46
46
|
attr_accessor :execution_price
|
|
47
47
|
|
|
48
|
-
# The limit price is maximum price one is willing to pay for a buy order or the minimum price one is willing to accept for a sell order. Should only apply to `Limit` and `StopLimit` orders.
|
|
48
|
+
# The limit price is maximum price one is willing to pay for a buy order or the minimum price one is willing to accept for a sell order. Should only apply to `Limit` and `StopLimit` orders. For option orders, this represents the price per share.
|
|
49
49
|
attr_accessor :limit_price
|
|
50
50
|
|
|
51
|
-
# The stop price is the price at which a stop order is triggered. Should only apply to `Stop` and `StopLimit` orders.
|
|
51
|
+
# The stop price is the price at which a stop order is triggered. Should only apply to `Stop` and `StopLimit` orders. For option orders, this represents the price per share.
|
|
52
52
|
attr_accessor :stop_price
|
|
53
53
|
|
|
54
54
|
# The type of order placed. The most common values are `Market`, `Limit`, `Stop`, and `StopLimit`. We try our best to map brokerage order types to these values. When mapping fails, we will return the brokerage's order type value.
|
|
@@ -20,7 +20,7 @@ module SnapTrade
|
|
|
20
20
|
|
|
21
21
|
attr_accessor :option_symbol
|
|
22
22
|
|
|
23
|
-
# The price of the security for the transaction. This is mostly applicable to `BUY`, `SELL`, and `DIVIDEND` transactions.
|
|
23
|
+
# The price of the security for the transaction. This is mostly applicable to `BUY`, `SELL`, and `DIVIDEND` transactions. For option transactions, this represents the price per share of the option contract.
|
|
24
24
|
attr_accessor :price
|
|
25
25
|
|
|
26
26
|
# The number of units of the security for the transaction. This is mostly applicable to `BUY`, `SELL`, and `DIVIDEND` transactions.
|
|
@@ -41,13 +41,13 @@ module SnapTrade
|
|
|
41
41
|
# The number of shares or contracts that have been filled. Can be a decimal number for fractional shares.
|
|
42
42
|
attr_accessor :filled_quantity
|
|
43
43
|
|
|
44
|
-
# The price at which the order was executed.
|
|
44
|
+
# The price at which the order was executed. For option orders, this represents the price per share.
|
|
45
45
|
attr_accessor :execution_price
|
|
46
46
|
|
|
47
|
-
# The limit price is maximum price one is willing to pay for a buy order or the minimum price one is willing to accept for a sell order. Should only apply to `Limit` and `StopLimit` orders.
|
|
47
|
+
# The limit price is maximum price one is willing to pay for a buy order or the minimum price one is willing to accept for a sell order. Should only apply to `Limit` and `StopLimit` orders. For option orders, this represents the price per share.
|
|
48
48
|
attr_accessor :limit_price
|
|
49
49
|
|
|
50
|
-
# The stop price is the price at which a stop order is triggered. Should only apply to `Stop` and `StopLimit` orders.
|
|
50
|
+
# The stop price is the price at which a stop order is triggered. Should only apply to `Stop` and `StopLimit` orders. For option orders, this represents the price per share.
|
|
51
51
|
attr_accessor :stop_price
|
|
52
52
|
|
|
53
53
|
# The type of order placed. The most common values are `Market`, `Limit`, `Stop`, and `StopLimit`. We try our best to map brokerage order types to these values. When mapping fails, we will return the brokerage's order type value.
|
data/lib/snaptrade/version.rb
CHANGED
|
@@ -27,6 +27,21 @@ describe 'OptionsApi' do
|
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
+
# unit tests for get_user_account_option_quotes
|
|
31
|
+
# Get option quote
|
|
32
|
+
# 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.
|
|
33
|
+
# @param user_id
|
|
34
|
+
# @param user_secret
|
|
35
|
+
# @param account_id
|
|
36
|
+
# @param symbol The OCC-formatted option symbol.
|
|
37
|
+
# @param [Hash] opts the optional parameters
|
|
38
|
+
# @return [OptionQuote]
|
|
39
|
+
describe 'get_user_account_option_quotes test' do
|
|
40
|
+
it 'should work' do
|
|
41
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
30
45
|
# unit tests for list_option_holdings
|
|
31
46
|
# List account option positions
|
|
32
47
|
# Returns a list of option positions in the specified account. For stock/ETF/crypto/mutual fund positions, please use the [positions endpoint](/reference/Account%20Information/AccountInformation_getUserAccountPositions). Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access: - If you do, this endpoint returns real-time data. - If you don't, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://support.snaptrade.com/brokerages-table?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for \"Cache Expiry Time\" to see the exact value for a specific brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint.
|
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.
|
|
4
|
+
version: 2.0.176
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- SnapTrade
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-04-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|