snaptrade 3.0.45 → 3.0.47

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.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +54 -2
  3. data/lib/snaptrade/api/experimental_endpoints_api.rb +145 -0
  4. data/lib/snaptrade/models/account_order.rb +438 -0
  5. data/lib/snaptrade/models/account_order_group.rb +241 -0
  6. data/lib/snaptrade/models/account_order_leg.rb +302 -0
  7. data/lib/snaptrade/models/account_order_record_v2.rb +35 -1
  8. data/lib/snaptrade/models/account_order_time_in_force.rb +44 -0
  9. data/lib/snaptrade/models/all_account_orders_response.rb +239 -0
  10. data/lib/snaptrade/models/all_account_orders_response_data_freshness.rb +223 -0
  11. data/lib/snaptrade/models/limit_order_type.rb +237 -0
  12. data/lib/snaptrade/models/limit_order_type_kind.rb +36 -0
  13. data/lib/snaptrade/models/market_order_type.rb +222 -0
  14. data/lib/snaptrade/models/market_order_type_kind.rb +36 -0
  15. data/lib/snaptrade/models/order_type_configuration.rb +63 -0
  16. data/lib/snaptrade/models/other_order_type.rb +257 -0
  17. data/lib/snaptrade/models/other_order_type_kind.rb +36 -0
  18. data/lib/snaptrade/models/stop_limit_order_type.rb +252 -0
  19. data/lib/snaptrade/models/stop_limit_order_type_kind.rb +36 -0
  20. data/lib/snaptrade/models/stop_order_type.rb +237 -0
  21. data/lib/snaptrade/models/stop_order_type_kind.rb +36 -0
  22. data/lib/snaptrade/models/trailing_stop_limit_order_type.rb +262 -0
  23. data/lib/snaptrade/models/trailing_stop_limit_order_type_kind.rb +36 -0
  24. data/lib/snaptrade/models/trailing_stop_order_type.rb +247 -0
  25. data/lib/snaptrade/models/trailing_stop_order_type_kind.rb +36 -0
  26. data/lib/snaptrade/version.rb +1 -1
  27. data/lib/snaptrade.rb +21 -0
  28. data/spec/api/experimental_endpoints_api_spec.rb +16 -0
  29. data/spec/models/account_order_group_spec.rb +35 -0
  30. data/spec/models/account_order_leg_spec.rb +71 -0
  31. data/spec/models/account_order_record_v2_spec.rb +4 -0
  32. data/spec/models/account_order_spec.rb +125 -0
  33. data/spec/models/account_order_time_in_force_spec.rb +23 -0
  34. data/spec/models/all_account_orders_response_data_freshness_spec.rb +29 -0
  35. data/spec/models/all_account_orders_response_spec.rb +35 -0
  36. data/spec/models/limit_order_type_kind_spec.rb +23 -0
  37. data/spec/models/limit_order_type_spec.rb +35 -0
  38. data/spec/models/market_order_type_kind_spec.rb +23 -0
  39. data/spec/models/market_order_type_spec.rb +29 -0
  40. data/spec/models/order_type_configuration_spec.rb +38 -0
  41. data/spec/models/other_order_type_kind_spec.rb +23 -0
  42. data/spec/models/other_order_type_spec.rb +47 -0
  43. data/spec/models/stop_limit_order_type_kind_spec.rb +23 -0
  44. data/spec/models/stop_limit_order_type_spec.rb +41 -0
  45. data/spec/models/stop_order_type_kind_spec.rb +23 -0
  46. data/spec/models/stop_order_type_spec.rb +35 -0
  47. data/spec/models/trailing_stop_limit_order_type_kind_spec.rb +23 -0
  48. data/spec/models/trailing_stop_limit_order_type_spec.rb +47 -0
  49. data/spec/models/trailing_stop_order_type_kind_spec.rb +23 -0
  50. data/spec/models/trailing_stop_order_type_spec.rb +41 -0
  51. metadata +318 -255
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ce4d46886840a1c798d4761e2c2868211981256806478af56797a253cc488068
4
- data.tar.gz: 6aa9f25a0fcee2612ace7dc477e70a9655b8e5b01b97420c8913a88eca0b1b4f
3
+ metadata.gz: 9495aff8f87ff9355205872b8f1e9d147368ae87179f5f27ff5ce3d4ca66e81b
4
+ data.tar.gz: 340d5635738c84456bfb77f0f416ad578b3d44ee8b4205e3573b95d81070c4ca
5
5
  SHA512:
6
- metadata.gz: 17623a0a0f5645cdf8c5af182d2e90d0a6c109bc6d2c4f8cdb7c215e4233c7419eb7ea46236140d0bc0869f640990da726dfc1499970fca78726899d6d9a072b
7
- data.tar.gz: ae129ffcc42a43b3dd3c523fa9802d625342230afe3833431a76abfd9002745b87b9a83323b7f15a02b4cbcfb8397a30626552d54f113605e15e4286f1acef1a
6
+ metadata.gz: 6fda79ace4d30a886f8e1e4ef3dbc4b03332ccbac905d8e365192cb01fdb04483d86d25938a3de60686f64601b866221917ae791f3365259d7d069a04dd6efe8
7
+ data.tar.gz: 07d58e9c247e2d0ae4d0d5257ff74580686c33e9997c1e870a1386fd004731bdc7375b14133caeac7cd8e474b1c8ed4328d896ec63e2eaebcd58c6dd1dbfb9b0
data/README.md CHANGED
@@ -63,7 +63,7 @@ backoff with jitter rather than from the headers.
63
63
  See https://docs.snaptrade.com/docs/ratelimiting.
64
64
 
65
65
 
66
- [![npm](https://img.shields.io/badge/gem-v3.0.45-blue)](https://rubygems.org/gems/snaptrade/versions/3.0.45)
66
+ [![npm](https://img.shields.io/badge/gem-v3.0.47-blue)](https://rubygems.org/gems/snaptrade/versions/3.0.47)
67
67
  [![More Info](https://img.shields.io/badge/More%20Info-Click%20Here-orange)](https://snaptrade.com/)
68
68
 
69
69
  </div>
@@ -108,6 +108,7 @@ See https://docs.snaptrade.com/docs/ratelimiting.
108
108
  * [`snaptrade.connections.sync_brokerage_authorization_transactions`](#snaptradeconnectionssync_brokerage_authorization_transactions)
109
109
  * [`snaptrade.experimental_endpoints.add_subscription`](#snaptradeexperimental_endpointsadd_subscription)
110
110
  * [`snaptrade.experimental_endpoints.cancel_subscription`](#snaptradeexperimental_endpointscancel_subscription)
111
+ * [`snaptrade.experimental_endpoints.get_all_account_orders`](#snaptradeexperimental_endpointsget_all_account_orders)
111
112
  * [`snaptrade.experimental_endpoints.get_user_account_order_detail_v2`](#snaptradeexperimental_endpointsget_user_account_order_detail_v2)
112
113
  * [`snaptrade.experimental_endpoints.get_user_account_orders_v2`](#snaptradeexperimental_endpointsget_user_account_orders_v2)
113
114
  * [`snaptrade.experimental_endpoints.get_user_account_recent_orders_v2`](#snaptradeexperimental_endpointsget_user_account_recent_orders_v2)
@@ -146,7 +147,7 @@ See https://docs.snaptrade.com/docs/ratelimiting.
146
147
  Add to Gemfile:
147
148
 
148
149
  ```ruby
149
- gem 'snaptrade', '~> 3.0.45'
150
+ gem 'snaptrade', '~> 3.0.47'
150
151
  ```
151
152
 
152
153
  ## Getting Started<a id="getting-started"></a>
@@ -1507,6 +1508,57 @@ reference the account in SnapTrade.
1507
1508
  ---
1508
1509
 
1509
1510
 
1511
+ ### `snaptrade.experimental_endpoints.get_all_account_orders`<a id="snaptradeexperimental_endpointsget_all_account_orders"></a>
1512
+
1513
+ Returns a list of recent orders in the specified account, in the same `kind`-discriminated format as `/accounts/{accountId}/positions/all`.
1514
+
1515
+ Every order carries a `legs` list with at least one leg. Each leg's `instrument` uses the same `Instrument` union as positions; switch on `instrument.kind` to know which fields are present. Multi-leg orders (spreads, strangles, covered calls) are a single order with multiple legs. Orders that belong to a complex order group (OCO, OTO, OTOCO) share a `group.id`.
1516
+
1517
+ `order_type` is an object discriminated by `kind`. Each kind declares the price fields it requires (`limit_price` on `limit`, `stop_price` on `stop`, both on `stop_limit`, `trail` on `trailing_stop`), so a consumer never has to null-check a price that cannot exist for that kind. When the brokerage reports an order type we cannot normalize, `kind` is `other` and the brokerage's own label is in `raw_type`.
1518
+
1519
+ **Experimental:** this endpoint may change without notice.
1520
+
1521
+ 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.
1522
+
1523
+
1524
+ #### 🛠️ Usage<a id="🛠️-usage"></a>
1525
+
1526
+ ```ruby
1527
+ result = snaptrade.experimental_endpoints.get_all_account_orders(
1528
+ user_id: "snaptrade-user-123",
1529
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
1530
+ account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
1531
+ state: "all",
1532
+ days: 30,
1533
+ )
1534
+ p result
1535
+ ```
1536
+
1537
+ #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1538
+
1539
+ ##### user_id: `String`<a id="user_id-string"></a>
1540
+ ##### user_secret: `String`<a id="user_secret-string"></a>
1541
+ ##### account_id: `String`<a id="account_id-string"></a>
1542
+ ##### state: `String`<a id="state-string"></a>
1543
+ defaults to \"all\"
1544
+
1545
+ ##### days: `Integer`<a id="days-integer"></a>
1546
+ Number of days in the past to fetch the most recent orders. Defaults to the last
1547
+ 30 days if no value is passed in. Values greater than 90 will be capped at 90.
1548
+
1549
+ #### 🔄 Return<a id="🔄-return"></a>
1550
+
1551
+ [AllAccountOrdersResponse](./lib/snaptrade/models/all_account_orders_response.rb)
1552
+
1553
+ #### 🌐 Endpoint<a id="🌐-endpoint"></a>
1554
+
1555
+ `/accounts/{accountId}/orders/all` `GET`
1556
+
1557
+ [🔙 **Back to Table of Contents**](#table-of-contents)
1558
+
1559
+ ---
1560
+
1561
+
1510
1562
  ### `snaptrade.experimental_endpoints.get_user_account_order_detail_v2`<a id="snaptradeexperimental_endpointsget_user_account_order_detail_v2"></a>
1511
1563
 
1512
1564
  Returns the detail of a single order using the brokerage order ID provided as a path parameter.
@@ -239,6 +239,151 @@ module SnapTrade
239
239
  end
240
240
 
241
241
 
242
+ # List all account orders
243
+ #
244
+ # Returns a list of recent orders in the specified account, in the same `kind`-discriminated format as `/accounts/{accountId}/positions/all`.
245
+ #
246
+ # Every order carries a `legs` list with at least one leg. Each leg's `instrument` uses the same `Instrument` union as positions; switch on `instrument.kind` to know which fields are present. Multi-leg orders (spreads, strangles, covered calls) are a single order with multiple legs. Orders that belong to a complex order group (OCO, OTO, OTOCO) share a `group.id`.
247
+ #
248
+ # `order_type` is an object discriminated by `kind`. Each kind declares the price fields it requires (`limit_price` on `limit`, `stop_price` on `stop`, both on `stop_limit`, `trail` on `trailing_stop`), so a consumer never has to null-check a price that cannot exist for that kind. When the brokerage reports an order type we cannot normalize, `kind` is `other` and the brokerage's own label is in `raw_type`.
249
+ #
250
+ # **Experimental:** this endpoint may change without notice.
251
+ #
252
+ # 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.
253
+ #
254
+ # @param user_id [String]
255
+ # @param user_secret [String]
256
+ # @param account_id [String]
257
+ # @param state [String] defaults to \"all\"
258
+ # @param days [Integer] Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in. Values greater than 90 will be capped at 90.
259
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
260
+ def get_all_account_orders(user_id:, user_secret:, account_id:, state: SENTINEL, days: SENTINEL, extra: {})
261
+ extra[:state] = state if state != SENTINEL
262
+ extra[:days] = days if days != SENTINEL
263
+ data, _status_code, _headers = get_all_account_orders_with_http_info_impl(user_id, user_secret, account_id, extra)
264
+ data
265
+ end
266
+
267
+ # List all account orders
268
+ #
269
+ # Returns a list of recent orders in the specified account, in the same `kind`-discriminated format as `/accounts/{accountId}/positions/all`.
270
+ #
271
+ # Every order carries a `legs` list with at least one leg. Each leg's `instrument` uses the same `Instrument` union as positions; switch on `instrument.kind` to know which fields are present. Multi-leg orders (spreads, strangles, covered calls) are a single order with multiple legs. Orders that belong to a complex order group (OCO, OTO, OTOCO) share a `group.id`.
272
+ #
273
+ # `order_type` is an object discriminated by `kind`. Each kind declares the price fields it requires (`limit_price` on `limit`, `stop_price` on `stop`, both on `stop_limit`, `trail` on `trailing_stop`), so a consumer never has to null-check a price that cannot exist for that kind. When the brokerage reports an order type we cannot normalize, `kind` is `other` and the brokerage's own label is in `raw_type`.
274
+ #
275
+ # **Experimental:** this endpoint may change without notice.
276
+ #
277
+ # 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.
278
+ #
279
+ # @param user_id [String]
280
+ # @param user_secret [String]
281
+ # @param account_id [String]
282
+ # @param state [String] defaults to \"all\"
283
+ # @param days [Integer] Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in. Values greater than 90 will be capped at 90.
284
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
285
+ def get_all_account_orders_with_http_info(user_id:, user_secret:, account_id:, state: SENTINEL, days: SENTINEL, extra: {})
286
+ extra[:state] = state if state != SENTINEL
287
+ extra[:days] = days if days != SENTINEL
288
+ get_all_account_orders_with_http_info_impl(user_id, user_secret, account_id, extra)
289
+ end
290
+
291
+ # List all account orders
292
+ # Returns a list of recent orders in the specified account, in the same `kind`-discriminated format as `/accounts/{accountId}/positions/all`. Every order carries a `legs` list with at least one leg. Each leg's `instrument` uses the same `Instrument` union as positions; switch on `instrument.kind` to know which fields are present. Multi-leg orders (spreads, strangles, covered calls) are a single order with multiple legs. Orders that belong to a complex order group (OCO, OTO, OTOCO) share a `group.id`. `order_type` is an object discriminated by `kind`. Each kind declares the price fields it requires (`limit_price` on `limit`, `stop_price` on `stop`, both on `stop_limit`, `trail` on `trailing_stop`), so a consumer never has to null-check a price that cannot exist for that kind. When the brokerage reports an order type we cannot normalize, `kind` is `other` and the brokerage's own label is in `raw_type`. **Experimental:** this endpoint may change without notice. 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.
293
+ # @param user_id [String]
294
+ # @param user_secret [String]
295
+ # @param account_id [String]
296
+ # @param [Hash] opts the optional parameters
297
+ # @option opts [String] :state defaults to \"all\"
298
+ # @option opts [Integer] :days Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in. Values greater than 90 will be capped at 90.
299
+ # @return [AllAccountOrdersResponse]
300
+ private def get_all_account_orders_impl(user_id, user_secret, account_id, opts = {})
301
+ data, _status_code, _headers = get_all_account_orders_with_http_info(user_id, user_secret, account_id, opts)
302
+ data
303
+ end
304
+
305
+ # List all account orders
306
+ # Returns a list of recent orders in the specified account, in the same &#x60;kind&#x60;-discriminated format as &#x60;/accounts/{accountId}/positions/all&#x60;. Every order carries a &#x60;legs&#x60; list with at least one leg. Each leg&#39;s &#x60;instrument&#x60; uses the same &#x60;Instrument&#x60; union as positions; switch on &#x60;instrument.kind&#x60; to know which fields are present. Multi-leg orders (spreads, strangles, covered calls) are a single order with multiple legs. Orders that belong to a complex order group (OCO, OTO, OTOCO) share a &#x60;group.id&#x60;. &#x60;order_type&#x60; is an object discriminated by &#x60;kind&#x60;. Each kind declares the price fields it requires (&#x60;limit_price&#x60; on &#x60;limit&#x60;, &#x60;stop_price&#x60; on &#x60;stop&#x60;, both on &#x60;stop_limit&#x60;, &#x60;trail&#x60; on &#x60;trailing_stop&#x60;), so a consumer never has to null-check a price that cannot exist for that kind. When the brokerage reports an order type we cannot normalize, &#x60;kind&#x60; is &#x60;other&#x60; and the brokerage&#39;s own label is in &#x60;raw_type&#x60;. **Experimental:** this endpoint may change without notice. 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.
307
+ # @param user_id [String]
308
+ # @param user_secret [String]
309
+ # @param account_id [String]
310
+ # @param [Hash] opts the optional parameters
311
+ # @option opts [String] :state defaults to \"all\"
312
+ # @option opts [Integer] :days Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in. Values greater than 90 will be capped at 90.
313
+ # @return [Array<(AllAccountOrdersResponse, Integer, Hash)>] AllAccountOrdersResponse data, response status code and response headers
314
+ private def get_all_account_orders_with_http_info_impl(user_id, user_secret, account_id, opts = {})
315
+ if @api_client.config.debugging
316
+ @api_client.config.logger.debug 'Calling API: ExperimentalEndpointsApi.get_all_account_orders ...'
317
+ end
318
+ # verify the required parameter 'user_id' is set
319
+ if @api_client.config.client_side_validation && user_id.nil?
320
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling ExperimentalEndpointsApi.get_all_account_orders"
321
+ end
322
+ # verify the required parameter 'user_secret' is set
323
+ if @api_client.config.client_side_validation && user_secret.nil?
324
+ fail ArgumentError, "Missing the required parameter 'user_secret' when calling ExperimentalEndpointsApi.get_all_account_orders"
325
+ end
326
+ # verify the required parameter 'account_id' is set
327
+ if @api_client.config.client_side_validation && account_id.nil?
328
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling ExperimentalEndpointsApi.get_all_account_orders"
329
+ end
330
+ allowable_values = ["all", "open", "executed"]
331
+ if @api_client.config.client_side_validation && opts[:'state'] && !allowable_values.include?(opts[:'state'])
332
+ fail ArgumentError, "invalid value for \"state\", must be one of #{allowable_values}"
333
+ end
334
+ if @api_client.config.client_side_validation && !opts[:'days'].nil? && opts[:'days'] > 90
335
+ fail ArgumentError, 'invalid value for "opts[:"days"]" when calling ExperimentalEndpointsApi.get_all_account_orders, must be smaller than or equal to 90.'
336
+ end
337
+
338
+ if @api_client.config.client_side_validation && !opts[:'days'].nil? && opts[:'days'] < 1
339
+ fail ArgumentError, 'invalid value for "opts[:"days"]" when calling ExperimentalEndpointsApi.get_all_account_orders, must be greater than or equal to 1.'
340
+ end
341
+
342
+ # resource path
343
+ local_var_path = '/accounts/{accountId}/orders/all'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
344
+
345
+ # query parameters
346
+ query_params = opts[:query_params] || {}
347
+ query_params[:'userId'] = user_id
348
+ query_params[:'userSecret'] = user_secret
349
+ query_params[:'state'] = opts[:'state'] if !opts[:'state'].nil?
350
+ query_params[:'days'] = opts[:'days'] if !opts[:'days'].nil?
351
+
352
+ # header parameters
353
+ header_params = opts[:header_params] || {}
354
+ # HTTP header 'Accept' (if needed)
355
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
356
+
357
+ # form parameters
358
+ form_params = opts[:form_params] || {}
359
+
360
+ # http body (model)
361
+ post_body = opts[:debug_body]
362
+
363
+ # return_type
364
+ return_type = opts[:debug_return_type] || 'AllAccountOrdersResponse'
365
+
366
+ # auth_names
367
+ auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
368
+
369
+ new_options = opts.merge(
370
+ :operation => :"ExperimentalEndpointsApi.get_all_account_orders",
371
+ :header_params => header_params,
372
+ :query_params => query_params,
373
+ :form_params => form_params,
374
+ :body => post_body,
375
+ :auth_names => auth_names,
376
+ :return_type => return_type
377
+ )
378
+
379
+ data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
380
+ if @api_client.config.debugging
381
+ @api_client.config.logger.debug "API called: ExperimentalEndpointsApi#get_all_account_orders\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
382
+ end
383
+ return data, status_code, headers, response
384
+ end
385
+
386
+
242
387
  # Get account order detail (V2)
243
388
  #
244
389
  # Returns the detail of a single order using the brokerage order ID provided as a path parameter.