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.
@@ -532,6 +532,278 @@ module SnapTrade
532
532
  end
533
533
 
534
534
 
535
+ # Get account order detail
536
+ #
537
+ # 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`.
538
+ #
539
+ # 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.
540
+ #
541
+ # 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.
542
+ #
543
+ # This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint.
544
+ #
545
+ # **Beta:** this endpoint and its response schema may change.
546
+ #
547
+ # @param account_id [String]
548
+ # @param brokerage_order_id [String]
549
+ # @param user_id [String]
550
+ # @param user_secret [String]
551
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
552
+ def get_account_order(account_id:, brokerage_order_id:, user_id:, user_secret:, extra: {})
553
+ data, _status_code, _headers = get_account_order_with_http_info_impl(account_id, brokerage_order_id, user_id, user_secret, extra)
554
+ data
555
+ end
556
+
557
+ # Get account order detail
558
+ #
559
+ # 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`.
560
+ #
561
+ # 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.
562
+ #
563
+ # 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.
564
+ #
565
+ # This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint.
566
+ #
567
+ # **Beta:** this endpoint and its response schema may change.
568
+ #
569
+ # @param account_id [String]
570
+ # @param brokerage_order_id [String]
571
+ # @param user_id [String]
572
+ # @param user_secret [String]
573
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
574
+ def get_account_order_with_http_info(account_id:, brokerage_order_id:, user_id:, user_secret:, extra: {})
575
+ get_account_order_with_http_info_impl(account_id, brokerage_order_id, user_id, user_secret, extra)
576
+ end
577
+
578
+ # Get account order detail
579
+ # 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. **Beta:** this endpoint and its response schema may change.
580
+ # @param account_id [String]
581
+ # @param brokerage_order_id [String]
582
+ # @param user_id [String]
583
+ # @param user_secret [String]
584
+ # @param [Hash] opts the optional parameters
585
+ # @return [AccountOrder]
586
+ private def get_account_order_impl(account_id, brokerage_order_id, user_id, user_secret, opts = {})
587
+ data, _status_code, _headers = get_account_order_with_http_info(account_id, brokerage_order_id, user_id, user_secret, opts)
588
+ data
589
+ end
590
+
591
+ # Get account order detail
592
+ # 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. **Beta:** this endpoint and its response schema may change.
593
+ # @param account_id [String]
594
+ # @param brokerage_order_id [String]
595
+ # @param user_id [String]
596
+ # @param user_secret [String]
597
+ # @param [Hash] opts the optional parameters
598
+ # @return [Array<(AccountOrder, Integer, Hash)>] AccountOrder data, response status code and response headers
599
+ private def get_account_order_with_http_info_impl(account_id, brokerage_order_id, user_id, user_secret, opts = {})
600
+ if @api_client.config.debugging
601
+ @api_client.config.logger.debug 'Calling API: AccountInformationApi.get_account_order ...'
602
+ end
603
+ # verify the required parameter 'account_id' is set
604
+ if @api_client.config.client_side_validation && account_id.nil?
605
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling AccountInformationApi.get_account_order"
606
+ end
607
+ # verify the required parameter 'brokerage_order_id' is set
608
+ if @api_client.config.client_side_validation && brokerage_order_id.nil?
609
+ fail ArgumentError, "Missing the required parameter 'brokerage_order_id' when calling AccountInformationApi.get_account_order"
610
+ end
611
+ # verify the required parameter 'user_id' is set
612
+ if @api_client.config.client_side_validation && user_id.nil?
613
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling AccountInformationApi.get_account_order"
614
+ end
615
+ # verify the required parameter 'user_secret' is set
616
+ if @api_client.config.client_side_validation && user_secret.nil?
617
+ fail ArgumentError, "Missing the required parameter 'user_secret' when calling AccountInformationApi.get_account_order"
618
+ end
619
+ # resource path
620
+ local_var_path = '/accounts/{accountId}/orders/{brokerageOrderId}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'brokerageOrderId' + '}', CGI.escape(brokerage_order_id.to_s))
621
+
622
+ # query parameters
623
+ query_params = opts[:query_params] || {}
624
+ query_params[:'userId'] = user_id
625
+ query_params[:'userSecret'] = user_secret
626
+
627
+ # header parameters
628
+ header_params = opts[:header_params] || {}
629
+ # HTTP header 'Accept' (if needed)
630
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
631
+
632
+ # form parameters
633
+ form_params = opts[:form_params] || {}
634
+
635
+ # http body (model)
636
+ post_body = opts[:debug_body]
637
+
638
+ # return_type
639
+ return_type = opts[:debug_return_type] || 'AccountOrder'
640
+
641
+ # auth_names
642
+ auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
643
+
644
+ new_options = opts.merge(
645
+ :operation => :"AccountInformationApi.get_account_order",
646
+ :header_params => header_params,
647
+ :query_params => query_params,
648
+ :form_params => form_params,
649
+ :body => post_body,
650
+ :auth_names => auth_names,
651
+ :return_type => return_type
652
+ )
653
+
654
+ data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
655
+ if @api_client.config.debugging
656
+ @api_client.config.logger.debug "API called: AccountInformationApi#get_account_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
657
+ end
658
+ return data, status_code, headers, response
659
+ end
660
+
661
+
662
+ # List all account orders
663
+ #
664
+ # Returns a list of recent orders in the specified account, in the same `kind`-discriminated format as `/accounts/{accountId}/positions/all`.
665
+ #
666
+ # 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`.
667
+ #
668
+ # `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`.
669
+ #
670
+ # **Beta:** this endpoint and its response schema may change.
671
+ #
672
+ # 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.
673
+ #
674
+ # @param user_id [String]
675
+ # @param user_secret [String]
676
+ # @param account_id [String]
677
+ # @param state [String] defaults to \"all\"
678
+ # @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.
679
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
680
+ def get_all_account_orders(user_id:, user_secret:, account_id:, state: SENTINEL, days: SENTINEL, extra: {})
681
+ extra[:state] = state if state != SENTINEL
682
+ extra[:days] = days if days != SENTINEL
683
+ data, _status_code, _headers = get_all_account_orders_with_http_info_impl(user_id, user_secret, account_id, extra)
684
+ data
685
+ end
686
+
687
+ # List all account orders
688
+ #
689
+ # Returns a list of recent orders in the specified account, in the same `kind`-discriminated format as `/accounts/{accountId}/positions/all`.
690
+ #
691
+ # 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`.
692
+ #
693
+ # `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`.
694
+ #
695
+ # **Beta:** this endpoint and its response schema may change.
696
+ #
697
+ # 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.
698
+ #
699
+ # @param user_id [String]
700
+ # @param user_secret [String]
701
+ # @param account_id [String]
702
+ # @param state [String] defaults to \"all\"
703
+ # @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.
704
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
705
+ def get_all_account_orders_with_http_info(user_id:, user_secret:, account_id:, state: SENTINEL, days: SENTINEL, extra: {})
706
+ extra[:state] = state if state != SENTINEL
707
+ extra[:days] = days if days != SENTINEL
708
+ get_all_account_orders_with_http_info_impl(user_id, user_secret, account_id, extra)
709
+ end
710
+
711
+ # List all account orders
712
+ # 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`. **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.
713
+ # @param user_id [String]
714
+ # @param user_secret [String]
715
+ # @param account_id [String]
716
+ # @param [Hash] opts the optional parameters
717
+ # @option opts [String] :state defaults to \"all\"
718
+ # @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.
719
+ # @return [AllAccountOrdersResponse]
720
+ private def get_all_account_orders_impl(user_id, user_secret, account_id, opts = {})
721
+ data, _status_code, _headers = get_all_account_orders_with_http_info(user_id, user_secret, account_id, opts)
722
+ data
723
+ end
724
+
725
+ # List all account orders
726
+ # 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.
727
+ # @param user_id [String]
728
+ # @param user_secret [String]
729
+ # @param account_id [String]
730
+ # @param [Hash] opts the optional parameters
731
+ # @option opts [String] :state defaults to \"all\"
732
+ # @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.
733
+ # @return [Array<(AllAccountOrdersResponse, Integer, Hash)>] AllAccountOrdersResponse data, response status code and response headers
734
+ private def get_all_account_orders_with_http_info_impl(user_id, user_secret, account_id, opts = {})
735
+ if @api_client.config.debugging
736
+ @api_client.config.logger.debug 'Calling API: AccountInformationApi.get_all_account_orders ...'
737
+ end
738
+ # verify the required parameter 'user_id' is set
739
+ if @api_client.config.client_side_validation && user_id.nil?
740
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling AccountInformationApi.get_all_account_orders"
741
+ end
742
+ # verify the required parameter 'user_secret' is set
743
+ if @api_client.config.client_side_validation && user_secret.nil?
744
+ fail ArgumentError, "Missing the required parameter 'user_secret' when calling AccountInformationApi.get_all_account_orders"
745
+ end
746
+ # verify the required parameter 'account_id' is set
747
+ if @api_client.config.client_side_validation && account_id.nil?
748
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling AccountInformationApi.get_all_account_orders"
749
+ end
750
+ allowable_values = ["all", "open", "executed"]
751
+ if @api_client.config.client_side_validation && opts[:'state'] && !allowable_values.include?(opts[:'state'])
752
+ fail ArgumentError, "invalid value for \"state\", must be one of #{allowable_values}"
753
+ end
754
+ if @api_client.config.client_side_validation && !opts[:'days'].nil? && opts[:'days'] > 90
755
+ fail ArgumentError, 'invalid value for "opts[:"days"]" when calling AccountInformationApi.get_all_account_orders, must be smaller than or equal to 90.'
756
+ end
757
+
758
+ if @api_client.config.client_side_validation && !opts[:'days'].nil? && opts[:'days'] < 1
759
+ fail ArgumentError, 'invalid value for "opts[:"days"]" when calling AccountInformationApi.get_all_account_orders, must be greater than or equal to 1.'
760
+ end
761
+
762
+ # resource path
763
+ local_var_path = '/accounts/{accountId}/orders/all'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
764
+
765
+ # query parameters
766
+ query_params = opts[:query_params] || {}
767
+ query_params[:'userId'] = user_id
768
+ query_params[:'userSecret'] = user_secret
769
+ query_params[:'state'] = opts[:'state'] if !opts[:'state'].nil?
770
+ query_params[:'days'] = opts[:'days'] if !opts[:'days'].nil?
771
+
772
+ # header parameters
773
+ header_params = opts[:header_params] || {}
774
+ # HTTP header 'Accept' (if needed)
775
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
776
+
777
+ # form parameters
778
+ form_params = opts[:form_params] || {}
779
+
780
+ # http body (model)
781
+ post_body = opts[:debug_body]
782
+
783
+ # return_type
784
+ return_type = opts[:debug_return_type] || 'AllAccountOrdersResponse'
785
+
786
+ # auth_names
787
+ auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
788
+
789
+ new_options = opts.merge(
790
+ :operation => :"AccountInformationApi.get_all_account_orders",
791
+ :header_params => header_params,
792
+ :query_params => query_params,
793
+ :form_params => form_params,
794
+ :body => post_body,
795
+ :auth_names => auth_names,
796
+ :return_type => return_type
797
+ )
798
+
799
+ data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
800
+ if @api_client.config.debugging
801
+ @api_client.config.logger.debug "API called: AccountInformationApi#get_all_account_orders\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
802
+ end
803
+ return data, status_code, headers, response
804
+ end
805
+
806
+
535
807
  # List all account positions
536
808
  #
537
809
  # Returns a list of all positions in the specified account.
@@ -651,6 +923,134 @@ module SnapTrade
651
923
  end
652
924
 
653
925
 
926
+ # List all account recent orders (last 24 hours only)
927
+ #
928
+ # 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.
929
+ # 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.
930
+ # 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.
931
+ # By default only returns executed orders, but that can be changed by setting *only_executed* to false.
932
+ #
933
+ # 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.
934
+ #
935
+ # **Beta:** this endpoint and its response schema may change.
936
+ #
937
+ # **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)**
938
+ #
939
+ # @param user_id [String]
940
+ # @param user_secret [String]
941
+ # @param account_id [String]
942
+ # @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
943
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
944
+ def get_all_account_recent_orders(user_id:, user_secret:, account_id:, only_executed: SENTINEL, extra: {})
945
+ extra[:only_executed] = only_executed if only_executed != SENTINEL
946
+ data, _status_code, _headers = get_all_account_recent_orders_with_http_info_impl(user_id, user_secret, account_id, extra)
947
+ data
948
+ end
949
+
950
+ # List all account recent orders (last 24 hours only)
951
+ #
952
+ # 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.
953
+ # 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.
954
+ # 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.
955
+ # By default only returns executed orders, but that can be changed by setting *only_executed* to false.
956
+ #
957
+ # 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.
958
+ #
959
+ # **Beta:** this endpoint and its response schema may change.
960
+ #
961
+ # **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)**
962
+ #
963
+ # @param user_id [String]
964
+ # @param user_secret [String]
965
+ # @param account_id [String]
966
+ # @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
967
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
968
+ def get_all_account_recent_orders_with_http_info(user_id:, user_secret:, account_id:, only_executed: SENTINEL, extra: {})
969
+ extra[:only_executed] = only_executed if only_executed != SENTINEL
970
+ get_all_account_recent_orders_with_http_info_impl(user_id, user_secret, account_id, extra)
971
+ end
972
+
973
+ # List all account recent orders (last 24 hours only)
974
+ # 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. **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)**
975
+ # @param user_id [String]
976
+ # @param user_secret [String]
977
+ # @param account_id [String]
978
+ # @param [Hash] opts the optional parameters
979
+ # @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
980
+ # @return [AllAccountOrdersResponse]
981
+ private def get_all_account_recent_orders_impl(user_id, user_secret, account_id, opts = {})
982
+ data, _status_code, _headers = get_all_account_recent_orders_with_http_info(user_id, user_secret, account_id, opts)
983
+ data
984
+ end
985
+
986
+ # List all account recent orders (last 24 hours only)
987
+ # 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)**
988
+ # @param user_id [String]
989
+ # @param user_secret [String]
990
+ # @param account_id [String]
991
+ # @param [Hash] opts the optional parameters
992
+ # @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
993
+ # @return [Array<(AllAccountOrdersResponse, Integer, Hash)>] AllAccountOrdersResponse data, response status code and response headers
994
+ private def get_all_account_recent_orders_with_http_info_impl(user_id, user_secret, account_id, opts = {})
995
+ if @api_client.config.debugging
996
+ @api_client.config.logger.debug 'Calling API: AccountInformationApi.get_all_account_recent_orders ...'
997
+ end
998
+ # verify the required parameter 'user_id' is set
999
+ if @api_client.config.client_side_validation && user_id.nil?
1000
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling AccountInformationApi.get_all_account_recent_orders"
1001
+ end
1002
+ # verify the required parameter 'user_secret' is set
1003
+ if @api_client.config.client_side_validation && user_secret.nil?
1004
+ fail ArgumentError, "Missing the required parameter 'user_secret' when calling AccountInformationApi.get_all_account_recent_orders"
1005
+ end
1006
+ # verify the required parameter 'account_id' is set
1007
+ if @api_client.config.client_side_validation && account_id.nil?
1008
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling AccountInformationApi.get_all_account_recent_orders"
1009
+ end
1010
+ # resource path
1011
+ local_var_path = '/accounts/{accountId}/orders/recent'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
1012
+
1013
+ # query parameters
1014
+ query_params = opts[:query_params] || {}
1015
+ query_params[:'userId'] = user_id
1016
+ query_params[:'userSecret'] = user_secret
1017
+ query_params[:'only_executed'] = opts[:'only_executed'] if !opts[:'only_executed'].nil?
1018
+
1019
+ # header parameters
1020
+ header_params = opts[:header_params] || {}
1021
+ # HTTP header 'Accept' (if needed)
1022
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1023
+
1024
+ # form parameters
1025
+ form_params = opts[:form_params] || {}
1026
+
1027
+ # http body (model)
1028
+ post_body = opts[:debug_body]
1029
+
1030
+ # return_type
1031
+ return_type = opts[:debug_return_type] || 'AllAccountOrdersResponse'
1032
+
1033
+ # auth_names
1034
+ auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
1035
+
1036
+ new_options = opts.merge(
1037
+ :operation => :"AccountInformationApi.get_all_account_recent_orders",
1038
+ :header_params => header_params,
1039
+ :query_params => query_params,
1040
+ :form_params => form_params,
1041
+ :body => post_body,
1042
+ :auth_names => auth_names,
1043
+ :return_type => return_type
1044
+ )
1045
+
1046
+ data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
1047
+ if @api_client.config.debugging
1048
+ @api_client.config.logger.debug "API called: AccountInformationApi#get_all_account_recent_orders\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1049
+ end
1050
+ return data, status_code, headers, response
1051
+ end
1052
+
1053
+
654
1054
  # List account balances
655
1055
  #
656
1056
  # 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).