snaptrade 2.0.185 → 2.0.187
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 +52 -2
- data/lib/snaptrade/api/experimental_endpoints_api.rb +141 -0
- data/lib/snaptrade/models/account_order_record.rb +23 -1
- data/lib/snaptrade/models/account_order_record_option_symbol.rb +1 -1
- data/lib/snaptrade/models/account_order_record_quote_universal_symbol.rb +1 -1
- data/lib/snaptrade/models/account_order_record_universal_symbol.rb +1 -1
- data/lib/snaptrade/models/account_order_record_v2.rb +57 -1
- data/lib/snaptrade/models/account_position.rb +288 -0
- data/lib/snaptrade/models/account_universal_activity_option_symbol.rb +1 -1
- data/lib/snaptrade/models/account_universal_activity_symbol.rb +1 -1
- data/lib/snaptrade/models/all_account_positions_response.rb +262 -0
- data/lib/snaptrade/models/complex_order_leg.rb +1 -1
- data/lib/snaptrade/models/complex_order_leg_order_role.rb +38 -0
- data/lib/snaptrade/models/crypto_instrument.rb +311 -0
- data/lib/snaptrade/models/crypto_instrument_kind.rb +36 -0
- data/lib/snaptrade/models/etf_instrument.rb +311 -0
- data/lib/snaptrade/models/etf_instrument_kind.rb +36 -0
- data/lib/snaptrade/models/future_instrument.rb +326 -0
- data/lib/snaptrade/models/future_instrument_kind.rb +36 -0
- data/lib/snaptrade/models/instrument.rb +61 -0
- data/lib/snaptrade/models/kind.rb +36 -0
- data/lib/snaptrade/models/option_instrument.rb +322 -0
- data/lib/snaptrade/models/option_instrument_kind.rb +36 -0
- data/lib/snaptrade/models/options_symbol.rb +1 -1
- data/lib/snaptrade/models/options_symbol_option_type.rb +37 -0
- data/lib/snaptrade/models/order_updated_response_order.rb +23 -1
- data/lib/snaptrade/models/other_instrument.rb +311 -0
- data/lib/snaptrade/models/other_instrument_kind.rb +36 -0
- data/lib/snaptrade/models/stock_instrument.rb +311 -0
- data/lib/snaptrade/models/{symbol_figi_instrument.rb → stock_instrument_figi_instrument.rb} +3 -3
- data/lib/snaptrade/models/symbol.rb +1 -1
- data/lib/snaptrade/models/underlying_option_instrument.rb +57 -0
- data/lib/snaptrade/models/underlying_symbol.rb +1 -1
- data/lib/snaptrade/models/universal_symbol.rb +1 -1
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +19 -1
- data/spec/api/experimental_endpoints_api_spec.rb +16 -0
- data/spec/models/account_order_record_spec.rb +12 -0
- data/spec/models/account_order_record_v2_spec.rb +16 -0
- data/spec/models/account_position_spec.rb +65 -0
- data/spec/models/all_account_positions_response_spec.rb +47 -0
- data/spec/models/complex_order_leg_order_role_spec.rb +23 -0
- data/spec/models/crypto_instrument_kind_spec.rb +23 -0
- data/spec/models/crypto_instrument_spec.rb +71 -0
- data/spec/models/etf_instrument_kind_spec.rb +23 -0
- data/spec/models/etf_instrument_spec.rb +71 -0
- data/spec/models/future_instrument_kind_spec.rb +23 -0
- data/spec/models/future_instrument_spec.rb +77 -0
- data/spec/models/instrument_spec.rb +38 -0
- data/spec/models/kind_spec.rb +23 -0
- data/spec/models/option_instrument_kind_spec.rb +23 -0
- data/spec/models/option_instrument_spec.rb +71 -0
- data/spec/models/options_symbol_option_type_spec.rb +23 -0
- data/spec/models/order_updated_response_order_spec.rb +12 -0
- data/spec/models/other_instrument_kind_spec.rb +23 -0
- data/spec/models/other_instrument_spec.rb +71 -0
- data/spec/models/{symbol_figi_instrument_spec.rb → stock_instrument_figi_instrument_spec.rb} +6 -6
- data/spec/models/stock_instrument_spec.rb +71 -0
- data/spec/models/underlying_option_instrument_spec.rb +38 -0
- metadata +222 -168
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: eb4521beb152b33455ba85fb0f22b57d4cb4f1112831c888c4aa47ca01347092
|
|
4
|
+
data.tar.gz: cabb03509707ea085af558908cdaf7f322feff23b2c96d771e2c4c06cbc0cfed
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6ca1520d727cffeb91dbcdbcd6fe3cdb6839dc45cceb06202750280dcd841c0822eac4049a835e99ecee9be2c3b80ed691ac087f7b211b71f8ab32fb6a2e32b0
|
|
7
|
+
data.tar.gz: 3f201b7383cc1b2b1929e0a5a2f8dec2941098de7de44c2e435178400c5e1c5a25545869920b84ac85dd433bbda854bbbe9eb576a81b83f23741bd4d647c93cc
|
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.187)
|
|
10
10
|
[](https://snaptrade.com/)
|
|
11
11
|
|
|
12
12
|
</div>
|
|
@@ -46,6 +46,7 @@ Connect brokerage accounts to your app for live positions and trading
|
|
|
46
46
|
* [`snaptrade.connections.return_rates`](#snaptradeconnectionsreturn_rates)
|
|
47
47
|
* [`snaptrade.connections.session_events`](#snaptradeconnectionssession_events)
|
|
48
48
|
* [`snaptrade.experimental_endpoints.get_account_balance_history`](#snaptradeexperimental_endpointsget_account_balance_history)
|
|
49
|
+
* [`snaptrade.experimental_endpoints.get_all_account_positions`](#snaptradeexperimental_endpointsget_all_account_positions)
|
|
49
50
|
* [`snaptrade.experimental_endpoints.get_user_account_order_detail_v2`](#snaptradeexperimental_endpointsget_user_account_order_detail_v2)
|
|
50
51
|
* [`snaptrade.experimental_endpoints.get_user_account_orders_v2`](#snaptradeexperimental_endpointsget_user_account_orders_v2)
|
|
51
52
|
* [`snaptrade.experimental_endpoints.get_user_account_recent_orders_v2`](#snaptradeexperimental_endpointsget_user_account_recent_orders_v2)
|
|
@@ -89,7 +90,7 @@ Connect brokerage accounts to your app for live positions and trading
|
|
|
89
90
|
Add to Gemfile:
|
|
90
91
|
|
|
91
92
|
```ruby
|
|
92
|
-
gem 'snaptrade', '~> 2.0.
|
|
93
|
+
gem 'snaptrade', '~> 2.0.187'
|
|
93
94
|
```
|
|
94
95
|
|
|
95
96
|
## Getting Started<a id="getting-started"></a>
|
|
@@ -1218,6 +1219,55 @@ p result
|
|
|
1218
1219
|
---
|
|
1219
1220
|
|
|
1220
1221
|
|
|
1222
|
+
### `snaptrade.experimental_endpoints.get_all_account_positions`<a id="snaptradeexperimental_endpointsget_all_account_positions"></a>
|
|
1223
|
+
|
|
1224
|
+
Returns a paginated list of all positions in the specified account.
|
|
1225
|
+
|
|
1226
|
+
The `results` list can contain multiple instrument types in the same response page, including stocks, ETFs, crypto, futures, and option positions. Use the `instrument.kind` discriminator to determine the schema for each position's `instrument`.
|
|
1227
|
+
|
|
1228
|
+
Stock positions may also include `cash_equivalent`, and may include `tax_lots` when tax lot data is enabled for the account.
|
|
1229
|
+
|
|
1230
|
+
If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
|
|
1231
|
+
|
|
1232
|
+
|
|
1233
|
+
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
|
1234
|
+
|
|
1235
|
+
```ruby
|
|
1236
|
+
result = snaptrade.experimental_endpoints.get_all_account_positions(
|
|
1237
|
+
user_id: "snaptrade-user-123",
|
|
1238
|
+
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
1239
|
+
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
1240
|
+
page: 1,
|
|
1241
|
+
page_size: 100,
|
|
1242
|
+
)
|
|
1243
|
+
p result
|
|
1244
|
+
```
|
|
1245
|
+
|
|
1246
|
+
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
1247
|
+
|
|
1248
|
+
##### user_id: `String`<a id="user_id-string"></a>
|
|
1249
|
+
##### user_secret: `String`<a id="user_secret-string"></a>
|
|
1250
|
+
##### account_id: `String`<a id="account_id-string"></a>
|
|
1251
|
+
##### page: `Integer`<a id="page-integer"></a>
|
|
1252
|
+
The page number to return. Defaults to 1.
|
|
1253
|
+
|
|
1254
|
+
##### page_size: `Integer`<a id="page_size-integer"></a>
|
|
1255
|
+
The number of positions to return per page. Defaults to 100 with a maximum of
|
|
1256
|
+
1000.
|
|
1257
|
+
|
|
1258
|
+
#### 🔄 Return<a id="🔄-return"></a>
|
|
1259
|
+
|
|
1260
|
+
[AllAccountPositionsResponse](./lib/snaptrade/models/all_account_positions_response.rb)
|
|
1261
|
+
|
|
1262
|
+
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
|
1263
|
+
|
|
1264
|
+
`/accounts/{accountId}/positions/all` `GET`
|
|
1265
|
+
|
|
1266
|
+
[🔙 **Back to Table of Contents**](#table-of-contents)
|
|
1267
|
+
|
|
1268
|
+
---
|
|
1269
|
+
|
|
1270
|
+
|
|
1221
1271
|
### `snaptrade.experimental_endpoints.get_user_account_order_detail_v2`<a id="snaptradeexperimental_endpointsget_user_account_order_detail_v2"></a>
|
|
1222
1272
|
|
|
1223
1273
|
Returns the detail of a single order using the brokerage order ID provided as a path parameter.
|
|
@@ -120,6 +120,147 @@ module SnapTrade
|
|
|
120
120
|
end
|
|
121
121
|
|
|
122
122
|
|
|
123
|
+
# List all account positions
|
|
124
|
+
#
|
|
125
|
+
# Returns a paginated list of all positions in the specified account.
|
|
126
|
+
#
|
|
127
|
+
# The `results` list can contain multiple instrument types in the same response page, including stocks, ETFs, crypto, futures, and option positions. Use the `instrument.kind` discriminator to determine the schema for each position's `instrument`.
|
|
128
|
+
#
|
|
129
|
+
# Stock positions may also include `cash_equivalent`, and may include `tax_lots` when tax lot data is enabled for the account.
|
|
130
|
+
#
|
|
131
|
+
# If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
|
|
132
|
+
#
|
|
133
|
+
# @param user_id [String]
|
|
134
|
+
# @param user_secret [String]
|
|
135
|
+
# @param account_id [String]
|
|
136
|
+
# @param page [Integer] The page number to return. Defaults to 1.
|
|
137
|
+
# @param page_size [Integer] The number of positions to return per page. Defaults to 100 with a maximum of 1000.
|
|
138
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
139
|
+
def get_all_account_positions(user_id:, user_secret:, account_id:, page: SENTINEL, page_size: SENTINEL, extra: {})
|
|
140
|
+
extra[:page] = page if page != SENTINEL
|
|
141
|
+
extra[:page_size] = page_size if page_size != SENTINEL
|
|
142
|
+
data, _status_code, _headers = get_all_account_positions_with_http_info_impl(user_id, user_secret, account_id, extra)
|
|
143
|
+
data
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
# List all account positions
|
|
147
|
+
#
|
|
148
|
+
# Returns a paginated list of all positions in the specified account.
|
|
149
|
+
#
|
|
150
|
+
# The `results` list can contain multiple instrument types in the same response page, including stocks, ETFs, crypto, futures, and option positions. Use the `instrument.kind` discriminator to determine the schema for each position's `instrument`.
|
|
151
|
+
#
|
|
152
|
+
# Stock positions may also include `cash_equivalent`, and may include `tax_lots` when tax lot data is enabled for the account.
|
|
153
|
+
#
|
|
154
|
+
# If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
|
|
155
|
+
#
|
|
156
|
+
# @param user_id [String]
|
|
157
|
+
# @param user_secret [String]
|
|
158
|
+
# @param account_id [String]
|
|
159
|
+
# @param page [Integer] The page number to return. Defaults to 1.
|
|
160
|
+
# @param page_size [Integer] The number of positions to return per page. Defaults to 100 with a maximum of 1000.
|
|
161
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
162
|
+
def get_all_account_positions_with_http_info(user_id:, user_secret:, account_id:, page: SENTINEL, page_size: SENTINEL, extra: {})
|
|
163
|
+
extra[:page] = page if page != SENTINEL
|
|
164
|
+
extra[:page_size] = page_size if page_size != SENTINEL
|
|
165
|
+
get_all_account_positions_with_http_info_impl(user_id, user_secret, account_id, extra)
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
# List all account positions
|
|
169
|
+
# Returns a paginated list of all positions in the specified account. The `results` list can contain multiple instrument types in the same response page, including stocks, ETFs, crypto, futures, and option positions. Use the `instrument.kind` discriminator to determine the schema for each position's `instrument`. Stock positions may also include `cash_equivalent`, and may include `tax_lots` when tax lot data is enabled for the account. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
|
|
170
|
+
# @param user_id [String]
|
|
171
|
+
# @param user_secret [String]
|
|
172
|
+
# @param account_id [String]
|
|
173
|
+
# @param [Hash] opts the optional parameters
|
|
174
|
+
# @option opts [Integer] :page The page number to return. Defaults to 1.
|
|
175
|
+
# @option opts [Integer] :page_size The number of positions to return per page. Defaults to 100 with a maximum of 1000.
|
|
176
|
+
# @return [AllAccountPositionsResponse]
|
|
177
|
+
private def get_all_account_positions_impl(user_id, user_secret, account_id, opts = {})
|
|
178
|
+
data, _status_code, _headers = get_all_account_positions_with_http_info(user_id, user_secret, account_id, opts)
|
|
179
|
+
data
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
# List all account positions
|
|
183
|
+
# Returns a paginated list of all positions in the specified account. The `results` list can contain multiple instrument types in the same response page, including stocks, ETFs, crypto, futures, and option positions. Use the `instrument.kind` discriminator to determine the schema for each position's `instrument`. Stock positions may also include `cash_equivalent`, and may include `tax_lots` when tax lot data is enabled for the account. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
|
|
184
|
+
# @param user_id [String]
|
|
185
|
+
# @param user_secret [String]
|
|
186
|
+
# @param account_id [String]
|
|
187
|
+
# @param [Hash] opts the optional parameters
|
|
188
|
+
# @option opts [Integer] :page The page number to return. Defaults to 1.
|
|
189
|
+
# @option opts [Integer] :page_size The number of positions to return per page. Defaults to 100 with a maximum of 1000.
|
|
190
|
+
# @return [Array<(AllAccountPositionsResponse, Integer, Hash)>] AllAccountPositionsResponse data, response status code and response headers
|
|
191
|
+
private def get_all_account_positions_with_http_info_impl(user_id, user_secret, account_id, opts = {})
|
|
192
|
+
if @api_client.config.debugging
|
|
193
|
+
@api_client.config.logger.debug 'Calling API: ExperimentalEndpointsApi.get_all_account_positions ...'
|
|
194
|
+
end
|
|
195
|
+
# verify the required parameter 'user_id' is set
|
|
196
|
+
if @api_client.config.client_side_validation && user_id.nil?
|
|
197
|
+
fail ArgumentError, "Missing the required parameter 'user_id' when calling ExperimentalEndpointsApi.get_all_account_positions"
|
|
198
|
+
end
|
|
199
|
+
# verify the required parameter 'user_secret' is set
|
|
200
|
+
if @api_client.config.client_side_validation && user_secret.nil?
|
|
201
|
+
fail ArgumentError, "Missing the required parameter 'user_secret' when calling ExperimentalEndpointsApi.get_all_account_positions"
|
|
202
|
+
end
|
|
203
|
+
# verify the required parameter 'account_id' is set
|
|
204
|
+
if @api_client.config.client_side_validation && account_id.nil?
|
|
205
|
+
fail ArgumentError, "Missing the required parameter 'account_id' when calling ExperimentalEndpointsApi.get_all_account_positions"
|
|
206
|
+
end
|
|
207
|
+
if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1
|
|
208
|
+
fail ArgumentError, 'invalid value for "opts[:"page"]" when calling ExperimentalEndpointsApi.get_all_account_positions, must be greater than or equal to 1.'
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000
|
|
212
|
+
fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ExperimentalEndpointsApi.get_all_account_positions, must be smaller than or equal to 1000.'
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1
|
|
216
|
+
fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ExperimentalEndpointsApi.get_all_account_positions, must be greater than or equal to 1.'
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
# resource path
|
|
220
|
+
local_var_path = '/accounts/{accountId}/positions/all'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
|
|
221
|
+
|
|
222
|
+
# query parameters
|
|
223
|
+
query_params = opts[:query_params] || {}
|
|
224
|
+
query_params[:'userId'] = user_id
|
|
225
|
+
query_params[:'userSecret'] = user_secret
|
|
226
|
+
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
|
|
227
|
+
query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?
|
|
228
|
+
|
|
229
|
+
# header parameters
|
|
230
|
+
header_params = opts[:header_params] || {}
|
|
231
|
+
# HTTP header 'Accept' (if needed)
|
|
232
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
233
|
+
|
|
234
|
+
# form parameters
|
|
235
|
+
form_params = opts[:form_params] || {}
|
|
236
|
+
|
|
237
|
+
# http body (model)
|
|
238
|
+
post_body = opts[:debug_body]
|
|
239
|
+
|
|
240
|
+
# return_type
|
|
241
|
+
return_type = opts[:debug_return_type] || 'AllAccountPositionsResponse'
|
|
242
|
+
|
|
243
|
+
# auth_names
|
|
244
|
+
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
|
245
|
+
|
|
246
|
+
new_options = opts.merge(
|
|
247
|
+
:operation => :"ExperimentalEndpointsApi.get_all_account_positions",
|
|
248
|
+
:header_params => header_params,
|
|
249
|
+
:query_params => query_params,
|
|
250
|
+
:form_params => form_params,
|
|
251
|
+
:body => post_body,
|
|
252
|
+
:auth_names => auth_names,
|
|
253
|
+
:return_type => return_type
|
|
254
|
+
)
|
|
255
|
+
|
|
256
|
+
data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
|
|
257
|
+
if @api_client.config.debugging
|
|
258
|
+
@api_client.config.logger.debug "API called: ExperimentalEndpointsApi#get_all_account_positions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
259
|
+
end
|
|
260
|
+
return data, status_code, headers, response
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
|
|
123
264
|
# Get account order detail (V2)
|
|
124
265
|
#
|
|
125
266
|
# Returns the detail of a single order using the brokerage order ID provided as a path parameter.
|
|
@@ -16,6 +16,12 @@ module SnapTrade
|
|
|
16
16
|
# Order ID returned by brokerage. This is the unique identifier for the order in the brokerage system.
|
|
17
17
|
attr_accessor :brokerage_order_id
|
|
18
18
|
|
|
19
|
+
# The brokerage-assigned identifier that links all orders within a complex order (OCO, OTO, OTOCO) together. Null for non-complex orders or when the brokerage does not return a group identifier.
|
|
20
|
+
attr_accessor :brokerage_group_order_id
|
|
21
|
+
|
|
22
|
+
# The role of this order within a complex order group (OCO, OTO, OTOCO). Null for non-complex orders.
|
|
23
|
+
attr_accessor :order_role
|
|
24
|
+
|
|
19
25
|
# Indicates the status of an order. SnapTrade does a best effort to map brokerage statuses to statuses in this enum. Possible values include: - NONE - PENDING - ACCEPTED - FAILED - REJECTED - CANCELED - PARTIAL_CANCELED - CANCEL_PENDING - EXECUTED - PARTIAL - REPLACE_PENDING - REPLACED - EXPIRED - QUEUED - TRIGGERED - ACTIVATED
|
|
20
26
|
attr_accessor :status
|
|
21
27
|
|
|
@@ -80,6 +86,8 @@ module SnapTrade
|
|
|
80
86
|
def self.attribute_map
|
|
81
87
|
{
|
|
82
88
|
:'brokerage_order_id' => :'brokerage_order_id',
|
|
89
|
+
:'brokerage_group_order_id' => :'brokerage_group_order_id',
|
|
90
|
+
:'order_role' => :'order_role',
|
|
83
91
|
:'status' => :'status',
|
|
84
92
|
:'universal_symbol' => :'universal_symbol',
|
|
85
93
|
:'option_symbol' => :'option_symbol',
|
|
@@ -114,6 +122,8 @@ module SnapTrade
|
|
|
114
122
|
def self.openapi_types
|
|
115
123
|
{
|
|
116
124
|
:'brokerage_order_id' => :'String',
|
|
125
|
+
:'brokerage_group_order_id' => :'String',
|
|
126
|
+
:'order_role' => :'OrderRole',
|
|
117
127
|
:'status' => :'AccountOrderRecordStatus',
|
|
118
128
|
:'universal_symbol' => :'AccountOrderRecordUniversalSymbol',
|
|
119
129
|
:'option_symbol' => :'AccountOrderRecordOptionSymbol',
|
|
@@ -142,6 +152,8 @@ module SnapTrade
|
|
|
142
152
|
# List of attributes with nullable: true
|
|
143
153
|
def self.openapi_nullable
|
|
144
154
|
Set.new([
|
|
155
|
+
:'brokerage_group_order_id',
|
|
156
|
+
:'order_role',
|
|
145
157
|
:'total_quantity',
|
|
146
158
|
:'open_quantity',
|
|
147
159
|
:'canceled_quantity',
|
|
@@ -177,6 +189,14 @@ module SnapTrade
|
|
|
177
189
|
self.brokerage_order_id = attributes[:'brokerage_order_id']
|
|
178
190
|
end
|
|
179
191
|
|
|
192
|
+
if attributes.key?(:'brokerage_group_order_id')
|
|
193
|
+
self.brokerage_group_order_id = attributes[:'brokerage_group_order_id']
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
if attributes.key?(:'order_role')
|
|
197
|
+
self.order_role = attributes[:'order_role']
|
|
198
|
+
end
|
|
199
|
+
|
|
180
200
|
if attributes.key?(:'status')
|
|
181
201
|
self.status = attributes[:'status']
|
|
182
202
|
end
|
|
@@ -285,6 +305,8 @@ module SnapTrade
|
|
|
285
305
|
return true if self.equal?(o)
|
|
286
306
|
self.class == o.class &&
|
|
287
307
|
brokerage_order_id == o.brokerage_order_id &&
|
|
308
|
+
brokerage_group_order_id == o.brokerage_group_order_id &&
|
|
309
|
+
order_role == o.order_role &&
|
|
288
310
|
status == o.status &&
|
|
289
311
|
universal_symbol == o.universal_symbol &&
|
|
290
312
|
option_symbol == o.option_symbol &&
|
|
@@ -318,7 +340,7 @@ module SnapTrade
|
|
|
318
340
|
# Calculates hash code according to all attributes.
|
|
319
341
|
# @return [Integer] Hash code
|
|
320
342
|
def hash
|
|
321
|
-
[brokerage_order_id, status, universal_symbol, option_symbol, quote_universal_symbol, quote_currency, action, total_quantity, open_quantity, canceled_quantity, filled_quantity, execution_price, limit_price, stop_price, trailing_stop, order_type, time_in_force, time_placed, time_updated, time_executed, expiry_date, symbol, child_brokerage_order_ids].hash
|
|
343
|
+
[brokerage_order_id, brokerage_group_order_id, order_role, status, universal_symbol, option_symbol, quote_universal_symbol, quote_currency, action, total_quantity, open_quantity, canceled_quantity, filled_quantity, execution_price, limit_price, stop_price, trailing_stop, order_type, time_in_force, time_placed, time_updated, time_executed, expiry_date, symbol, child_brokerage_order_ids].hash
|
|
322
344
|
end
|
|
323
345
|
|
|
324
346
|
# Builds the object from hash
|
|
@@ -71,7 +71,7 @@ module SnapTrade
|
|
|
71
71
|
:'exchange' => :'SymbolExchange',
|
|
72
72
|
:'type' => :'SecurityType',
|
|
73
73
|
:'figi_code' => :'String',
|
|
74
|
-
:'figi_instrument' => :'
|
|
74
|
+
:'figi_instrument' => :'StockInstrumentFigiInstrument',
|
|
75
75
|
:'currencies' => :'Array<Currency>'
|
|
76
76
|
}
|
|
77
77
|
end
|
|
@@ -71,7 +71,7 @@ module SnapTrade
|
|
|
71
71
|
:'exchange' => :'SymbolExchange',
|
|
72
72
|
:'type' => :'SecurityType',
|
|
73
73
|
:'figi_code' => :'String',
|
|
74
|
-
:'figi_instrument' => :'
|
|
74
|
+
:'figi_instrument' => :'StockInstrumentFigiInstrument',
|
|
75
75
|
:'currencies' => :'Array<Currency>'
|
|
76
76
|
}
|
|
77
77
|
end
|
|
@@ -16,6 +16,12 @@ module SnapTrade
|
|
|
16
16
|
# Order ID returned by brokerage. This is the unique identifier for the order in the brokerage system.
|
|
17
17
|
attr_accessor :brokerage_order_id
|
|
18
18
|
|
|
19
|
+
# The brokerage-assigned identifier that links all orders within a complex order (OCO, OTO, OTOCO) together. Null for non-complex orders or when the brokerage does not return a group identifier.
|
|
20
|
+
attr_accessor :brokerage_group_order_id
|
|
21
|
+
|
|
22
|
+
# The role of this order within a complex order group (OCO, OTO, OTOCO). Null for non-complex orders.
|
|
23
|
+
attr_accessor :order_role
|
|
24
|
+
|
|
19
25
|
# Indicates the status of an order. SnapTrade does a best effort to map brokerage statuses to statuses in this enum. Possible values include: - NONE - PENDING - ACCEPTED - FAILED - REJECTED - CANCELED - PARTIAL_CANCELED - CANCEL_PENDING - EXECUTED - PARTIAL - REPLACE_PENDING - REPLACED - EXPIRED - QUEUED - TRIGGERED - ACTIVATED
|
|
20
26
|
attr_accessor :status
|
|
21
27
|
|
|
@@ -48,10 +54,34 @@ module SnapTrade
|
|
|
48
54
|
# List of legs that make up the order.
|
|
49
55
|
attr_accessor :legs
|
|
50
56
|
|
|
57
|
+
class EnumAttributeValidator
|
|
58
|
+
attr_reader :datatype
|
|
59
|
+
attr_reader :allowable_values
|
|
60
|
+
|
|
61
|
+
def initialize(datatype, allowable_values)
|
|
62
|
+
@allowable_values = allowable_values.map do |value|
|
|
63
|
+
case datatype.to_s
|
|
64
|
+
when /Integer/i
|
|
65
|
+
value.to_i
|
|
66
|
+
when /Float/i
|
|
67
|
+
value.to_f
|
|
68
|
+
else
|
|
69
|
+
value
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def valid?(value)
|
|
75
|
+
!value || allowable_values.include?(value)
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
51
79
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
52
80
|
def self.attribute_map
|
|
53
81
|
{
|
|
54
82
|
:'brokerage_order_id' => :'brokerage_order_id',
|
|
83
|
+
:'brokerage_group_order_id' => :'brokerage_group_order_id',
|
|
84
|
+
:'order_role' => :'order_role',
|
|
55
85
|
:'status' => :'status',
|
|
56
86
|
:'order_type' => :'order_type',
|
|
57
87
|
:'time_in_force' => :'time_in_force',
|
|
@@ -75,6 +105,8 @@ module SnapTrade
|
|
|
75
105
|
def self.openapi_types
|
|
76
106
|
{
|
|
77
107
|
:'brokerage_order_id' => :'String',
|
|
108
|
+
:'brokerage_group_order_id' => :'String',
|
|
109
|
+
:'order_role' => :'String',
|
|
78
110
|
:'status' => :'AccountOrderRecordStatus',
|
|
79
111
|
:'order_type' => :'String',
|
|
80
112
|
:'time_in_force' => :'String',
|
|
@@ -92,6 +124,8 @@ module SnapTrade
|
|
|
92
124
|
# List of attributes with nullable: true
|
|
93
125
|
def self.openapi_nullable
|
|
94
126
|
Set.new([
|
|
127
|
+
:'brokerage_group_order_id',
|
|
128
|
+
:'order_role',
|
|
95
129
|
:'order_type',
|
|
96
130
|
:'time_executed',
|
|
97
131
|
:'execution_price',
|
|
@@ -120,6 +154,14 @@ module SnapTrade
|
|
|
120
154
|
self.brokerage_order_id = attributes[:'brokerage_order_id']
|
|
121
155
|
end
|
|
122
156
|
|
|
157
|
+
if attributes.key?(:'brokerage_group_order_id')
|
|
158
|
+
self.brokerage_group_order_id = attributes[:'brokerage_group_order_id']
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
if attributes.key?(:'order_role')
|
|
162
|
+
self.order_role = attributes[:'order_role']
|
|
163
|
+
end
|
|
164
|
+
|
|
123
165
|
if attributes.key?(:'status')
|
|
124
166
|
self.status = attributes[:'status']
|
|
125
167
|
end
|
|
@@ -177,15 +219,29 @@ module SnapTrade
|
|
|
177
219
|
# Check to see if the all the properties in the model are valid
|
|
178
220
|
# @return true if the model is valid
|
|
179
221
|
def valid?
|
|
222
|
+
order_role_validator = EnumAttributeValidator.new('String', ["TRIGGER", "CONDITIONAL", "PEER"])
|
|
223
|
+
return false unless order_role_validator.valid?(@order_role)
|
|
180
224
|
true
|
|
181
225
|
end
|
|
182
226
|
|
|
227
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
228
|
+
# @param [Object] order_role Object to be assigned
|
|
229
|
+
def order_role=(order_role)
|
|
230
|
+
validator = EnumAttributeValidator.new('String', ["TRIGGER", "CONDITIONAL", "PEER"])
|
|
231
|
+
unless validator.valid?(order_role)
|
|
232
|
+
fail ArgumentError, "invalid value for \"order_role\", must be one of #{validator.allowable_values}."
|
|
233
|
+
end
|
|
234
|
+
@order_role = order_role
|
|
235
|
+
end
|
|
236
|
+
|
|
183
237
|
# Checks equality by comparing each attribute.
|
|
184
238
|
# @param [Object] Object to be compared
|
|
185
239
|
def ==(o)
|
|
186
240
|
return true if self.equal?(o)
|
|
187
241
|
self.class == o.class &&
|
|
188
242
|
brokerage_order_id == o.brokerage_order_id &&
|
|
243
|
+
brokerage_group_order_id == o.brokerage_group_order_id &&
|
|
244
|
+
order_role == o.order_role &&
|
|
189
245
|
status == o.status &&
|
|
190
246
|
order_type == o.order_type &&
|
|
191
247
|
time_in_force == o.time_in_force &&
|
|
@@ -208,7 +264,7 @@ module SnapTrade
|
|
|
208
264
|
# Calculates hash code according to all attributes.
|
|
209
265
|
# @return [Integer] Hash code
|
|
210
266
|
def hash
|
|
211
|
-
[brokerage_order_id, status, order_type, time_in_force, time_placed, time_executed, quote_currency, execution_price, limit_price, stop_price, trailing_stop, legs].hash
|
|
267
|
+
[brokerage_order_id, brokerage_group_order_id, order_role, status, order_type, time_in_force, time_placed, time_executed, quote_currency, execution_price, limit_price, stop_price, trailing_stop, legs].hash
|
|
212
268
|
end
|
|
213
269
|
|
|
214
270
|
# Builds the object from hash
|