snaptrade 3.0.57 → 3.0.58

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.
@@ -239,406 +239,6 @@ module SnapTrade
239
239
  end
240
240
 
241
241
 
242
- # Get account order detail
243
- #
244
- # Returns the detail of a single order, identified by the brokerage order ID in the path, in the same `kind`-discriminated format as `/accounts/{accountId}/orders/all`.
245
- #
246
- # The order carries a `legs` list with at least one leg; switch on `legs[].instrument.kind` and `order_type.kind` to know which fields are present. Multi-leg orders are a single order with multiple legs.
247
- #
248
- # This endpoint is always realtime and does not rely on cached data, except that an order in a terminal state (executed, canceled, rejected, failed, expired, replaced) may be served from a short-lived cache since it can no longer change.
249
- #
250
- # This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint.
251
- #
252
- # **Experimental:** this endpoint may change without notice.
253
- #
254
- # @param account_id [String]
255
- # @param brokerage_order_id [String]
256
- # @param user_id [String]
257
- # @param user_secret [String]
258
- # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
259
- def get_account_order(account_id:, brokerage_order_id:, user_id:, user_secret:, extra: {})
260
- data, _status_code, _headers = get_account_order_with_http_info_impl(account_id, brokerage_order_id, user_id, user_secret, extra)
261
- data
262
- end
263
-
264
- # Get account order detail
265
- #
266
- # Returns the detail of a single order, identified by the brokerage order ID in the path, in the same `kind`-discriminated format as `/accounts/{accountId}/orders/all`.
267
- #
268
- # The order carries a `legs` list with at least one leg; switch on `legs[].instrument.kind` and `order_type.kind` to know which fields are present. Multi-leg orders are a single order with multiple legs.
269
- #
270
- # This endpoint is always realtime and does not rely on cached data, except that an order in a terminal state (executed, canceled, rejected, failed, expired, replaced) may be served from a short-lived cache since it can no longer change.
271
- #
272
- # This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint.
273
- #
274
- # **Experimental:** this endpoint may change without notice.
275
- #
276
- # @param account_id [String]
277
- # @param brokerage_order_id [String]
278
- # @param user_id [String]
279
- # @param user_secret [String]
280
- # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
281
- def get_account_order_with_http_info(account_id:, brokerage_order_id:, user_id:, user_secret:, extra: {})
282
- get_account_order_with_http_info_impl(account_id, brokerage_order_id, user_id, user_secret, extra)
283
- end
284
-
285
- # Get account order detail
286
- # Returns the detail of a single order, identified by the brokerage order ID in the path, in the same `kind`-discriminated format as `/accounts/{accountId}/orders/all`. The order carries a `legs` list with at least one leg; switch on `legs[].instrument.kind` and `order_type.kind` to know which fields are present. Multi-leg orders are a single order with multiple legs. This endpoint is always realtime and does not rely on cached data, except that an order in a terminal state (executed, canceled, rejected, failed, expired, replaced) may be served from a short-lived cache since it can no longer change. This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint. **Experimental:** this endpoint may change without notice.
287
- # @param account_id [String]
288
- # @param brokerage_order_id [String]
289
- # @param user_id [String]
290
- # @param user_secret [String]
291
- # @param [Hash] opts the optional parameters
292
- # @return [AccountOrder]
293
- private def get_account_order_impl(account_id, brokerage_order_id, user_id, user_secret, opts = {})
294
- data, _status_code, _headers = get_account_order_with_http_info(account_id, brokerage_order_id, user_id, user_secret, opts)
295
- data
296
- end
297
-
298
- # Get account order detail
299
- # Returns the detail of a single order, identified by the brokerage order ID in the path, in the same `kind`-discriminated format as `/accounts/{accountId}/orders/all`. The order carries a `legs` list with at least one leg; switch on `legs[].instrument.kind` and `order_type.kind` to know which fields are present. Multi-leg orders are a single order with multiple legs. This endpoint is always realtime and does not rely on cached data, except that an order in a terminal state (executed, canceled, rejected, failed, expired, replaced) may be served from a short-lived cache since it can no longer change. This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint. **Experimental:** this endpoint may change without notice.
300
- # @param account_id [String]
301
- # @param brokerage_order_id [String]
302
- # @param user_id [String]
303
- # @param user_secret [String]
304
- # @param [Hash] opts the optional parameters
305
- # @return [Array<(AccountOrder, Integer, Hash)>] AccountOrder data, response status code and response headers
306
- private def get_account_order_with_http_info_impl(account_id, brokerage_order_id, user_id, user_secret, opts = {})
307
- if @api_client.config.debugging
308
- @api_client.config.logger.debug 'Calling API: ExperimentalEndpointsApi.get_account_order ...'
309
- end
310
- # verify the required parameter 'account_id' is set
311
- if @api_client.config.client_side_validation && account_id.nil?
312
- fail ArgumentError, "Missing the required parameter 'account_id' when calling ExperimentalEndpointsApi.get_account_order"
313
- end
314
- # verify the required parameter 'brokerage_order_id' is set
315
- if @api_client.config.client_side_validation && brokerage_order_id.nil?
316
- fail ArgumentError, "Missing the required parameter 'brokerage_order_id' when calling ExperimentalEndpointsApi.get_account_order"
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_account_order"
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_account_order"
325
- end
326
- # resource path
327
- local_var_path = '/accounts/{accountId}/orders/{brokerageOrderId}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'brokerageOrderId' + '}', CGI.escape(brokerage_order_id.to_s))
328
-
329
- # query parameters
330
- query_params = opts[:query_params] || {}
331
- query_params[:'userId'] = user_id
332
- query_params[:'userSecret'] = user_secret
333
-
334
- # header parameters
335
- header_params = opts[:header_params] || {}
336
- # HTTP header 'Accept' (if needed)
337
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
338
-
339
- # form parameters
340
- form_params = opts[:form_params] || {}
341
-
342
- # http body (model)
343
- post_body = opts[:debug_body]
344
-
345
- # return_type
346
- return_type = opts[:debug_return_type] || 'AccountOrder'
347
-
348
- # auth_names
349
- auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
350
-
351
- new_options = opts.merge(
352
- :operation => :"ExperimentalEndpointsApi.get_account_order",
353
- :header_params => header_params,
354
- :query_params => query_params,
355
- :form_params => form_params,
356
- :body => post_body,
357
- :auth_names => auth_names,
358
- :return_type => return_type
359
- )
360
-
361
- data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
362
- if @api_client.config.debugging
363
- @api_client.config.logger.debug "API called: ExperimentalEndpointsApi#get_account_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
364
- end
365
- return data, status_code, headers, response
366
- end
367
-
368
-
369
- # List all account orders
370
- #
371
- # Returns a list of recent orders in the specified account, in the same `kind`-discriminated format as `/accounts/{accountId}/positions/all`.
372
- #
373
- # 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`.
374
- #
375
- # `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`.
376
- #
377
- # **Experimental:** this endpoint may change without notice.
378
- #
379
- # 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.
380
- #
381
- # @param user_id [String]
382
- # @param user_secret [String]
383
- # @param account_id [String]
384
- # @param state [String] defaults to \"all\"
385
- # @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.
386
- # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
387
- def get_all_account_orders(user_id:, user_secret:, account_id:, state: SENTINEL, days: SENTINEL, extra: {})
388
- extra[:state] = state if state != SENTINEL
389
- extra[:days] = days if days != SENTINEL
390
- data, _status_code, _headers = get_all_account_orders_with_http_info_impl(user_id, user_secret, account_id, extra)
391
- data
392
- end
393
-
394
- # List all account orders
395
- #
396
- # Returns a list of recent orders in the specified account, in the same `kind`-discriminated format as `/accounts/{accountId}/positions/all`.
397
- #
398
- # 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`.
399
- #
400
- # `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`.
401
- #
402
- # **Experimental:** this endpoint may change without notice.
403
- #
404
- # 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.
405
- #
406
- # @param user_id [String]
407
- # @param user_secret [String]
408
- # @param account_id [String]
409
- # @param state [String] defaults to \"all\"
410
- # @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.
411
- # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
412
- def get_all_account_orders_with_http_info(user_id:, user_secret:, account_id:, state: SENTINEL, days: SENTINEL, extra: {})
413
- extra[:state] = state if state != SENTINEL
414
- extra[:days] = days if days != SENTINEL
415
- get_all_account_orders_with_http_info_impl(user_id, user_secret, account_id, extra)
416
- end
417
-
418
- # List all account orders
419
- # 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.
420
- # @param user_id [String]
421
- # @param user_secret [String]
422
- # @param account_id [String]
423
- # @param [Hash] opts the optional parameters
424
- # @option opts [String] :state defaults to \"all\"
425
- # @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.
426
- # @return [AllAccountOrdersResponse]
427
- private def get_all_account_orders_impl(user_id, user_secret, account_id, opts = {})
428
- data, _status_code, _headers = get_all_account_orders_with_http_info(user_id, user_secret, account_id, opts)
429
- data
430
- end
431
-
432
- # List all account orders
433
- # 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.
434
- # @param user_id [String]
435
- # @param user_secret [String]
436
- # @param account_id [String]
437
- # @param [Hash] opts the optional parameters
438
- # @option opts [String] :state defaults to \"all\"
439
- # @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.
440
- # @return [Array<(AllAccountOrdersResponse, Integer, Hash)>] AllAccountOrdersResponse data, response status code and response headers
441
- private def get_all_account_orders_with_http_info_impl(user_id, user_secret, account_id, opts = {})
442
- if @api_client.config.debugging
443
- @api_client.config.logger.debug 'Calling API: ExperimentalEndpointsApi.get_all_account_orders ...'
444
- end
445
- # verify the required parameter 'user_id' is set
446
- if @api_client.config.client_side_validation && user_id.nil?
447
- fail ArgumentError, "Missing the required parameter 'user_id' when calling ExperimentalEndpointsApi.get_all_account_orders"
448
- end
449
- # verify the required parameter 'user_secret' is set
450
- if @api_client.config.client_side_validation && user_secret.nil?
451
- fail ArgumentError, "Missing the required parameter 'user_secret' when calling ExperimentalEndpointsApi.get_all_account_orders"
452
- end
453
- # verify the required parameter 'account_id' is set
454
- if @api_client.config.client_side_validation && account_id.nil?
455
- fail ArgumentError, "Missing the required parameter 'account_id' when calling ExperimentalEndpointsApi.get_all_account_orders"
456
- end
457
- allowable_values = ["all", "open", "executed"]
458
- if @api_client.config.client_side_validation && opts[:'state'] && !allowable_values.include?(opts[:'state'])
459
- fail ArgumentError, "invalid value for \"state\", must be one of #{allowable_values}"
460
- end
461
- if @api_client.config.client_side_validation && !opts[:'days'].nil? && opts[:'days'] > 90
462
- fail ArgumentError, 'invalid value for "opts[:"days"]" when calling ExperimentalEndpointsApi.get_all_account_orders, must be smaller than or equal to 90.'
463
- end
464
-
465
- if @api_client.config.client_side_validation && !opts[:'days'].nil? && opts[:'days'] < 1
466
- fail ArgumentError, 'invalid value for "opts[:"days"]" when calling ExperimentalEndpointsApi.get_all_account_orders, must be greater than or equal to 1.'
467
- end
468
-
469
- # resource path
470
- local_var_path = '/accounts/{accountId}/orders/all'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
471
-
472
- # query parameters
473
- query_params = opts[:query_params] || {}
474
- query_params[:'userId'] = user_id
475
- query_params[:'userSecret'] = user_secret
476
- query_params[:'state'] = opts[:'state'] if !opts[:'state'].nil?
477
- query_params[:'days'] = opts[:'days'] if !opts[:'days'].nil?
478
-
479
- # header parameters
480
- header_params = opts[:header_params] || {}
481
- # HTTP header 'Accept' (if needed)
482
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
483
-
484
- # form parameters
485
- form_params = opts[:form_params] || {}
486
-
487
- # http body (model)
488
- post_body = opts[:debug_body]
489
-
490
- # return_type
491
- return_type = opts[:debug_return_type] || 'AllAccountOrdersResponse'
492
-
493
- # auth_names
494
- auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
495
-
496
- new_options = opts.merge(
497
- :operation => :"ExperimentalEndpointsApi.get_all_account_orders",
498
- :header_params => header_params,
499
- :query_params => query_params,
500
- :form_params => form_params,
501
- :body => post_body,
502
- :auth_names => auth_names,
503
- :return_type => return_type
504
- )
505
-
506
- data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
507
- if @api_client.config.debugging
508
- @api_client.config.logger.debug "API called: ExperimentalEndpointsApi#get_all_account_orders\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
509
- end
510
- return data, status_code, headers, response
511
- end
512
-
513
-
514
- # List all account recent orders (last 24 hours only)
515
- #
516
- # A lightweight endpoint that returns the latest page of orders placed in the last 24 hours in the specified account, in the same `kind`-discriminated format as `/accounts/{accountId}/orders/all`. For most brokerages, the default page size is 100 meaning the endpoint will return a max of 100 orders.
517
- # This endpoint is realtime and can be used to quickly check if account state has recently changed due to an execution, or check status of recently placed orders.
518
- # Differs from `/accounts/{accountId}/orders/all` in that it is always realtime, and only checks the last 24 hours as opposed to the last 30 days.
519
- # By default only returns executed orders, but that can be changed by setting *only_executed* to false.
520
- #
521
- # Every order carries a `legs` list with at least one leg; switch on `legs[].instrument.kind` and `order_type.kind` to know which fields are present. `data_freshness.as_of` is the time of this live request.
522
- #
523
- # **Experimental:** this endpoint may change without notice.
524
- #
525
- # **Because of the cost of realtime requests, each call to this endpoint incurs an additional charge. You can find the exact cost for your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing)**
526
- #
527
- # @param user_id [String]
528
- # @param user_secret [String]
529
- # @param account_id [String]
530
- # @param only_executed [Boolean] Defaults to true. Indicates if request should fetch only executed orders. Set to false to retrieve non executed orders as well
531
- # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
532
- def get_all_account_recent_orders(user_id:, user_secret:, account_id:, only_executed: SENTINEL, extra: {})
533
- extra[:only_executed] = only_executed if only_executed != SENTINEL
534
- data, _status_code, _headers = get_all_account_recent_orders_with_http_info_impl(user_id, user_secret, account_id, extra)
535
- data
536
- end
537
-
538
- # List all account recent orders (last 24 hours only)
539
- #
540
- # A lightweight endpoint that returns the latest page of orders placed in the last 24 hours in the specified account, in the same `kind`-discriminated format as `/accounts/{accountId}/orders/all`. For most brokerages, the default page size is 100 meaning the endpoint will return a max of 100 orders.
541
- # This endpoint is realtime and can be used to quickly check if account state has recently changed due to an execution, or check status of recently placed orders.
542
- # Differs from `/accounts/{accountId}/orders/all` in that it is always realtime, and only checks the last 24 hours as opposed to the last 30 days.
543
- # By default only returns executed orders, but that can be changed by setting *only_executed* to false.
544
- #
545
- # Every order carries a `legs` list with at least one leg; switch on `legs[].instrument.kind` and `order_type.kind` to know which fields are present. `data_freshness.as_of` is the time of this live request.
546
- #
547
- # **Experimental:** this endpoint may change without notice.
548
- #
549
- # **Because of the cost of realtime requests, each call to this endpoint incurs an additional charge. You can find the exact cost for your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing)**
550
- #
551
- # @param user_id [String]
552
- # @param user_secret [String]
553
- # @param account_id [String]
554
- # @param only_executed [Boolean] Defaults to true. Indicates if request should fetch only executed orders. Set to false to retrieve non executed orders as well
555
- # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
556
- def get_all_account_recent_orders_with_http_info(user_id:, user_secret:, account_id:, only_executed: SENTINEL, extra: {})
557
- extra[:only_executed] = only_executed if only_executed != SENTINEL
558
- get_all_account_recent_orders_with_http_info_impl(user_id, user_secret, account_id, extra)
559
- end
560
-
561
- # List all account recent orders (last 24 hours only)
562
- # A lightweight endpoint that returns the latest page of orders placed in the last 24 hours in the specified account, in the same `kind`-discriminated format as `/accounts/{accountId}/orders/all`. For most brokerages, the default page size is 100 meaning the endpoint will return a max of 100 orders. This endpoint is realtime and can be used to quickly check if account state has recently changed due to an execution, or check status of recently placed orders. Differs from `/accounts/{accountId}/orders/all` in that it is always realtime, and only checks the last 24 hours as opposed to the last 30 days. By default only returns executed orders, but that can be changed by setting *only_executed* to false. Every order carries a `legs` list with at least one leg; switch on `legs[].instrument.kind` and `order_type.kind` to know which fields are present. `data_freshness.as_of` is the time of this live request. **Experimental:** this endpoint may change without notice. **Because of the cost of realtime requests, each call to this endpoint incurs an additional charge. You can find the exact cost for your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing)**
563
- # @param user_id [String]
564
- # @param user_secret [String]
565
- # @param account_id [String]
566
- # @param [Hash] opts the optional parameters
567
- # @option opts [Boolean] :only_executed Defaults to true. Indicates if request should fetch only executed orders. Set to false to retrieve non executed orders as well
568
- # @return [AllAccountOrdersResponse]
569
- private def get_all_account_recent_orders_impl(user_id, user_secret, account_id, opts = {})
570
- data, _status_code, _headers = get_all_account_recent_orders_with_http_info(user_id, user_secret, account_id, opts)
571
- data
572
- end
573
-
574
- # List all account recent orders (last 24 hours only)
575
- # A lightweight endpoint that returns the latest page of orders placed in the last 24 hours in the specified account, in the same &#x60;kind&#x60;-discriminated format as &#x60;/accounts/{accountId}/orders/all&#x60;. For most brokerages, the default page size is 100 meaning the endpoint will return a max of 100 orders. This endpoint is realtime and can be used to quickly check if account state has recently changed due to an execution, or check status of recently placed orders. Differs from &#x60;/accounts/{accountId}/orders/all&#x60; in that it is always realtime, and only checks the last 24 hours as opposed to the last 30 days. By default only returns executed orders, but that can be changed by setting *only_executed* to false. Every order carries a &#x60;legs&#x60; list with at least one leg; switch on &#x60;legs[].instrument.kind&#x60; and &#x60;order_type.kind&#x60; to know which fields are present. &#x60;data_freshness.as_of&#x60; is the time of this live request. **Experimental:** this endpoint may change without notice. **Because of the cost of realtime requests, each call to this endpoint incurs an additional charge. You can find the exact cost for your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing)**
576
- # @param user_id [String]
577
- # @param user_secret [String]
578
- # @param account_id [String]
579
- # @param [Hash] opts the optional parameters
580
- # @option opts [Boolean] :only_executed Defaults to true. Indicates if request should fetch only executed orders. Set to false to retrieve non executed orders as well
581
- # @return [Array<(AllAccountOrdersResponse, Integer, Hash)>] AllAccountOrdersResponse data, response status code and response headers
582
- private def get_all_account_recent_orders_with_http_info_impl(user_id, user_secret, account_id, opts = {})
583
- if @api_client.config.debugging
584
- @api_client.config.logger.debug 'Calling API: ExperimentalEndpointsApi.get_all_account_recent_orders ...'
585
- end
586
- # verify the required parameter 'user_id' is set
587
- if @api_client.config.client_side_validation && user_id.nil?
588
- fail ArgumentError, "Missing the required parameter 'user_id' when calling ExperimentalEndpointsApi.get_all_account_recent_orders"
589
- end
590
- # verify the required parameter 'user_secret' is set
591
- if @api_client.config.client_side_validation && user_secret.nil?
592
- fail ArgumentError, "Missing the required parameter 'user_secret' when calling ExperimentalEndpointsApi.get_all_account_recent_orders"
593
- end
594
- # verify the required parameter 'account_id' is set
595
- if @api_client.config.client_side_validation && account_id.nil?
596
- fail ArgumentError, "Missing the required parameter 'account_id' when calling ExperimentalEndpointsApi.get_all_account_recent_orders"
597
- end
598
- # resource path
599
- local_var_path = '/accounts/{accountId}/orders/recent'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
600
-
601
- # query parameters
602
- query_params = opts[:query_params] || {}
603
- query_params[:'userId'] = user_id
604
- query_params[:'userSecret'] = user_secret
605
- query_params[:'only_executed'] = opts[:'only_executed'] if !opts[:'only_executed'].nil?
606
-
607
- # header parameters
608
- header_params = opts[:header_params] || {}
609
- # HTTP header 'Accept' (if needed)
610
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
611
-
612
- # form parameters
613
- form_params = opts[:form_params] || {}
614
-
615
- # http body (model)
616
- post_body = opts[:debug_body]
617
-
618
- # return_type
619
- return_type = opts[:debug_return_type] || 'AllAccountOrdersResponse'
620
-
621
- # auth_names
622
- auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
623
-
624
- new_options = opts.merge(
625
- :operation => :"ExperimentalEndpointsApi.get_all_account_recent_orders",
626
- :header_params => header_params,
627
- :query_params => query_params,
628
- :form_params => form_params,
629
- :body => post_body,
630
- :auth_names => auth_names,
631
- :return_type => return_type
632
- )
633
-
634
- data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
635
- if @api_client.config.debugging
636
- @api_client.config.logger.debug "API called: ExperimentalEndpointsApi#get_all_account_recent_orders\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
637
- end
638
- return data, status_code, headers, response
639
- end
640
-
641
-
642
242
  # Get account order detail (V2)
643
243
  #
644
244
  # Returns the detail of a single order using the brokerage order ID provided as a path parameter.
@@ -8,5 +8,5 @@ Contact: api@snaptrade.com
8
8
  =end
9
9
 
10
10
  module SnapTrade
11
- VERSION = '3.0.57'
11
+ VERSION = '3.0.58'
12
12
  end
@@ -88,6 +88,37 @@ describe 'AccountInformationApi' do
88
88
  end
89
89
  end
90
90
 
91
+ # unit tests for get_account_order
92
+ # Get account order detail
93
+ # Returns the detail of a single order, identified by the brokerage order ID in the path, in the same &#x60;kind&#x60;-discriminated format as &#x60;/accounts/{accountId}/orders/all&#x60;. The order carries a &#x60;legs&#x60; list with at least one leg; switch on &#x60;legs[].instrument.kind&#x60; and &#x60;order_type.kind&#x60; to know which fields are present. Multi-leg orders are a single order with multiple legs. This endpoint is always realtime and does not rely on cached data, except that an order in a terminal state (executed, canceled, rejected, failed, expired, replaced) may be served from a short-lived cache since it can no longer change. This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint. **Beta:** this endpoint and its response schema may change.
94
+ # @param account_id
95
+ # @param brokerage_order_id
96
+ # @param user_id
97
+ # @param user_secret
98
+ # @param [Hash] opts the optional parameters
99
+ # @return [AccountOrder]
100
+ describe 'get_account_order test' do
101
+ it 'should work' do
102
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
103
+ end
104
+ end
105
+
106
+ # unit tests for get_all_account_orders
107
+ # List all account orders
108
+ # 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;. **Beta:** this endpoint and its response schema may change. 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.
109
+ # @param user_id
110
+ # @param user_secret
111
+ # @param account_id
112
+ # @param [Hash] opts the optional parameters
113
+ # @option opts [String] :state defaults to \&quot;all\&quot;
114
+ # @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.
115
+ # @return [AllAccountOrdersResponse]
116
+ describe 'get_all_account_orders test' do
117
+ it 'should work' do
118
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
119
+ end
120
+ end
121
+
91
122
  # unit tests for get_all_account_positions
92
123
  # List all account positions
93
124
  # Returns a list of all positions in the specified account. The &#x60;results&#x60; list can contain multiple instrument types in the same response, including stocks, preferred stocks, ADRs, ETFs, mutual funds, closed-end funds, bonds, crypto, futures, option positions, future option positions, CFD positions, and tokenized asset positions. Use the &#x60;instrument.kind&#x60; discriminator to determine the schema for each position&#39;s &#x60;instrument&#x60;. **Beta:** future option positions (&#x60;instrument.kind: future_option&#x60;) are in beta. They are currently returned only for tastytrade and Interactive Brokers connections, and only for partners they have been enabled for — please contact the SnapTrade team to enable them. The &#x60;FutureOptionInstrument&#x60; schema may change. Positions counted in account cash balance or buying power include &#x60;cash_equivalent: true&#x60;. Security positions (&#x60;stock&#x60;, &#x60;preferred_stock&#x60;, &#x60;adr&#x60;, &#x60;etf&#x60;, &#x60;mutualfund&#x60;, &#x60;cef&#x60;, &#x60;crypto&#x60;, &#x60;bond&#x60;, and &#x60;other&#x60;) may include &#x60;tax_lots&#x60; when tax lot data is enabled for the account; derivative, CFD, tokenized asset, and cash positions never do. To see which institutions support tax lot data, please see our [supported institutions doc](https://support.snaptrade.com/brokerages). 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.
@@ -102,6 +133,21 @@ describe 'AccountInformationApi' do
102
133
  end
103
134
  end
104
135
 
136
+ # unit tests for get_all_account_recent_orders
137
+ # List all account recent orders (last 24 hours only)
138
+ # A lightweight endpoint that returns the latest page of orders placed in the last 24 hours in the specified account, in the same &#x60;kind&#x60;-discriminated format as &#x60;/accounts/{accountId}/orders/all&#x60;. For most brokerages, the default page size is 100 meaning the endpoint will return a max of 100 orders. This endpoint is realtime and can be used to quickly check if account state has recently changed due to an execution, or check status of recently placed orders. Differs from &#x60;/accounts/{accountId}/orders/all&#x60; in that it is always realtime, and only checks the last 24 hours as opposed to the last 30 days. By default only returns executed orders, but that can be changed by setting *only_executed* to false. Every order carries a &#x60;legs&#x60; list with at least one leg; switch on &#x60;legs[].instrument.kind&#x60; and &#x60;order_type.kind&#x60; to know which fields are present. &#x60;data_freshness.as_of&#x60; is the time of this live request. **Beta:** this endpoint and its response schema may change. **Because of the cost of realtime requests, each call to this endpoint incurs an additional charge. You can find the exact cost for your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing)**
139
+ # @param user_id
140
+ # @param user_secret
141
+ # @param account_id
142
+ # @param [Hash] opts the optional parameters
143
+ # @option opts [Boolean] :only_executed Defaults to true. Indicates if request should fetch only executed orders. Set to false to retrieve non executed orders as well
144
+ # @return [AllAccountOrdersResponse]
145
+ describe 'get_all_account_recent_orders test' do
146
+ it 'should work' do
147
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
148
+ end
149
+ end
150
+
105
151
  # unit tests for get_user_account_balance
106
152
  # List account balances
107
153
  # Returns a list of balances for the account. Each element of the list has a distinct currency. Some brokerages like Questrade [allows holding multiple currencies in the same account](https://www.questrade.com/learning/questrade-basics/balances-and-reports/understanding-your-account-balances). 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&#39;t, Daily data is cached and refreshed once a day. Exact refresh timing may vary by brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint. 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.
@@ -53,52 +53,6 @@ describe 'ExperimentalEndpointsApi' do
53
53
  end
54
54
  end
55
55
 
56
- # unit tests for get_account_order
57
- # Get account order detail
58
- # Returns the detail of a single order, identified by the brokerage order ID in the path, in the same &#x60;kind&#x60;-discriminated format as &#x60;/accounts/{accountId}/orders/all&#x60;. The order carries a &#x60;legs&#x60; list with at least one leg; switch on &#x60;legs[].instrument.kind&#x60; and &#x60;order_type.kind&#x60; to know which fields are present. Multi-leg orders are a single order with multiple legs. This endpoint is always realtime and does not rely on cached data, except that an order in a terminal state (executed, canceled, rejected, failed, expired, replaced) may be served from a short-lived cache since it can no longer change. This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint. **Experimental:** this endpoint may change without notice.
59
- # @param account_id
60
- # @param brokerage_order_id
61
- # @param user_id
62
- # @param user_secret
63
- # @param [Hash] opts the optional parameters
64
- # @return [AccountOrder]
65
- describe 'get_account_order test' do
66
- it 'should work' do
67
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
68
- end
69
- end
70
-
71
- # unit tests for get_all_account_orders
72
- # List all account orders
73
- # 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.
74
- # @param user_id
75
- # @param user_secret
76
- # @param account_id
77
- # @param [Hash] opts the optional parameters
78
- # @option opts [String] :state defaults to \&quot;all\&quot;
79
- # @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.
80
- # @return [AllAccountOrdersResponse]
81
- describe 'get_all_account_orders test' do
82
- it 'should work' do
83
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
84
- end
85
- end
86
-
87
- # unit tests for get_all_account_recent_orders
88
- # List all account recent orders (last 24 hours only)
89
- # A lightweight endpoint that returns the latest page of orders placed in the last 24 hours in the specified account, in the same &#x60;kind&#x60;-discriminated format as &#x60;/accounts/{accountId}/orders/all&#x60;. For most brokerages, the default page size is 100 meaning the endpoint will return a max of 100 orders. This endpoint is realtime and can be used to quickly check if account state has recently changed due to an execution, or check status of recently placed orders. Differs from &#x60;/accounts/{accountId}/orders/all&#x60; in that it is always realtime, and only checks the last 24 hours as opposed to the last 30 days. By default only returns executed orders, but that can be changed by setting *only_executed* to false. Every order carries a &#x60;legs&#x60; list with at least one leg; switch on &#x60;legs[].instrument.kind&#x60; and &#x60;order_type.kind&#x60; to know which fields are present. &#x60;data_freshness.as_of&#x60; is the time of this live request. **Experimental:** this endpoint may change without notice. **Because of the cost of realtime requests, each call to this endpoint incurs an additional charge. You can find the exact cost for your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing)**
90
- # @param user_id
91
- # @param user_secret
92
- # @param account_id
93
- # @param [Hash] opts the optional parameters
94
- # @option opts [Boolean] :only_executed Defaults to true. Indicates if request should fetch only executed orders. Set to false to retrieve non executed orders as well
95
- # @return [AllAccountOrdersResponse]
96
- describe 'get_all_account_recent_orders test' do
97
- it 'should work' do
98
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
99
- end
100
- end
101
-
102
56
  # unit tests for get_user_account_order_detail_v2
103
57
  # Get account order detail (V2)
104
58
  # Returns the detail of a single order using the brokerage order ID provided as a path parameter. The V2 order response format includes all legs of the order in the &#x60;legs&#x60; list field. If the order is single legged, &#x60;legs&#x60; will be a list of one leg. This endpoint is always realtime and does not rely on cached data. This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint.