snaptrade 2.1.0 → 3.0.0

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.
@@ -17,91 +17,6 @@ module SnapTrade
17
17
  @api_client = api_client
18
18
  end
19
19
 
20
- # Get exchange rate of a currency pair
21
- #
22
- # Returns an Exchange Rate Pair object for the specified Currency Pair.
23
- #
24
- # @param currency_pair [String] A currency pair based on currency code for example, {CAD-USD}
25
- # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
26
- def get_currency_exchange_rate_pair(currency_pair:, extra: {})
27
- data, _status_code, _headers = get_currency_exchange_rate_pair_with_http_info_impl(currency_pair, extra)
28
- data
29
- end
30
-
31
- # Get exchange rate of a currency pair
32
- #
33
- # Returns an Exchange Rate Pair object for the specified Currency Pair.
34
- #
35
- # @param currency_pair [String] A currency pair based on currency code for example, {CAD-USD}
36
- # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
37
- def get_currency_exchange_rate_pair_with_http_info(currency_pair:, extra: {})
38
- get_currency_exchange_rate_pair_with_http_info_impl(currency_pair, extra)
39
- end
40
-
41
- # Get exchange rate of a currency pair
42
- # Returns an Exchange Rate Pair object for the specified Currency Pair.
43
- # @param currency_pair [String] A currency pair based on currency code for example, {CAD-USD}
44
- # @param [Hash] opts the optional parameters
45
- # @return [ExchangeRatePairs]
46
- private def get_currency_exchange_rate_pair_impl(currency_pair, opts = {})
47
- data, _status_code, _headers = get_currency_exchange_rate_pair_with_http_info(currency_pair, opts)
48
- data
49
- end
50
-
51
- # Get exchange rate of a currency pair
52
- # Returns an Exchange Rate Pair object for the specified Currency Pair.
53
- # @param currency_pair [String] A currency pair based on currency code for example, {CAD-USD}
54
- # @param [Hash] opts the optional parameters
55
- # @return [Array<(ExchangeRatePairs, Integer, Hash)>] ExchangeRatePairs data, response status code and response headers
56
- private def get_currency_exchange_rate_pair_with_http_info_impl(currency_pair, opts = {})
57
- if @api_client.config.debugging
58
- @api_client.config.logger.debug 'Calling API: ReferenceDataApi.get_currency_exchange_rate_pair ...'
59
- end
60
- # verify the required parameter 'currency_pair' is set
61
- if @api_client.config.client_side_validation && currency_pair.nil?
62
- fail ArgumentError, "Missing the required parameter 'currency_pair' when calling ReferenceDataApi.get_currency_exchange_rate_pair"
63
- end
64
- # resource path
65
- local_var_path = '/currencies/rates/{currencyPair}'.sub('{' + 'currencyPair' + '}', CGI.escape(currency_pair.to_s))
66
-
67
- # query parameters
68
- query_params = opts[:query_params] || {}
69
-
70
- # header parameters
71
- header_params = opts[:header_params] || {}
72
- # HTTP header 'Accept' (if needed)
73
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
74
-
75
- # form parameters
76
- form_params = opts[:form_params] || {}
77
-
78
- # http body (model)
79
- post_body = opts[:debug_body]
80
-
81
- # return_type
82
- return_type = opts[:debug_return_type] || 'ExchangeRatePairs'
83
-
84
- # auth_names
85
- auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
86
-
87
- new_options = opts.merge(
88
- :operation => :"ReferenceDataApi.get_currency_exchange_rate_pair",
89
- :header_params => header_params,
90
- :query_params => query_params,
91
- :form_params => form_params,
92
- :body => post_body,
93
- :auth_names => auth_names,
94
- :return_type => return_type
95
- )
96
-
97
- data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
98
- if @api_client.config.debugging
99
- @api_client.config.logger.debug "API called: ReferenceDataApi#get_currency_exchange_rate_pair\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
100
- end
101
- return data, status_code, headers, response
102
- end
103
-
104
-
105
20
  # Get Client Info
106
21
  #
107
22
  # Returns configurations for your SnapTrade Client ID, including allowed brokerages and data access.
@@ -179,83 +94,6 @@ module SnapTrade
179
94
  end
180
95
 
181
96
 
182
- # List security types
183
- #
184
- # Return all available security types supported by SnapTrade.
185
- #
186
- # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
187
- def get_security_types(extra: {})
188
- data, _status_code, _headers = get_security_types_with_http_info_impl(extra)
189
- data
190
- end
191
-
192
- # List security types
193
- #
194
- # Return all available security types supported by SnapTrade.
195
- #
196
- # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
197
- def get_security_types_with_http_info(extra: {})
198
- get_security_types_with_http_info_impl(extra)
199
- end
200
-
201
- # List security types
202
- # Return all available security types supported by SnapTrade.
203
- # @param [Hash] opts the optional parameters
204
- # @return [Array<SecurityType>]
205
- private def get_security_types_impl(opts = {})
206
- data, _status_code, _headers = get_security_types_with_http_info(opts)
207
- data
208
- end
209
-
210
- # List security types
211
- # Return all available security types supported by SnapTrade.
212
- # @param [Hash] opts the optional parameters
213
- # @return [Array<(Array<SecurityType>, Integer, Hash)>] Array<SecurityType> data, response status code and response headers
214
- private def get_security_types_with_http_info_impl(opts = {})
215
- if @api_client.config.debugging
216
- @api_client.config.logger.debug 'Calling API: ReferenceDataApi.get_security_types ...'
217
- end
218
- # resource path
219
- local_var_path = '/securityTypes'
220
-
221
- # query parameters
222
- query_params = opts[:query_params] || {}
223
-
224
- # header parameters
225
- header_params = opts[:header_params] || {}
226
- # HTTP header 'Accept' (if needed)
227
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
228
-
229
- # form parameters
230
- form_params = opts[:form_params] || {}
231
-
232
- # http body (model)
233
- post_body = opts[:debug_body]
234
-
235
- # return_type
236
- return_type = opts[:debug_return_type] || 'Array<SecurityType>'
237
-
238
- # auth_names
239
- auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
240
-
241
- new_options = opts.merge(
242
- :operation => :"ReferenceDataApi.get_security_types",
243
- :header_params => header_params,
244
- :query_params => query_params,
245
- :form_params => form_params,
246
- :body => post_body,
247
- :auth_names => auth_names,
248
- :return_type => return_type
249
- )
250
-
251
- data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
252
- if @api_client.config.debugging
253
- @api_client.config.logger.debug "API called: ReferenceDataApi#get_security_types\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
254
- end
255
- return data, status_code, headers, response
256
- end
257
-
258
-
259
97
  # Get exchanges
260
98
  #
261
99
  # Returns a list of all supported Exchanges.
@@ -758,160 +596,6 @@ module SnapTrade
758
596
  end
759
597
 
760
598
 
761
- # Get currencies
762
- #
763
- # Returns a list of all defined Currency objects.
764
- #
765
- # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
766
- def list_all_currencies(extra: {})
767
- data, _status_code, _headers = list_all_currencies_with_http_info_impl(extra)
768
- data
769
- end
770
-
771
- # Get currencies
772
- #
773
- # Returns a list of all defined Currency objects.
774
- #
775
- # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
776
- def list_all_currencies_with_http_info(extra: {})
777
- list_all_currencies_with_http_info_impl(extra)
778
- end
779
-
780
- # Get currencies
781
- # Returns a list of all defined Currency objects.
782
- # @param [Hash] opts the optional parameters
783
- # @return [Array<Currency>]
784
- private def list_all_currencies_impl(opts = {})
785
- data, _status_code, _headers = list_all_currencies_with_http_info(opts)
786
- data
787
- end
788
-
789
- # Get currencies
790
- # Returns a list of all defined Currency objects.
791
- # @param [Hash] opts the optional parameters
792
- # @return [Array<(Array<Currency>, Integer, Hash)>] Array<Currency> data, response status code and response headers
793
- private def list_all_currencies_with_http_info_impl(opts = {})
794
- if @api_client.config.debugging
795
- @api_client.config.logger.debug 'Calling API: ReferenceDataApi.list_all_currencies ...'
796
- end
797
- # resource path
798
- local_var_path = '/currencies'
799
-
800
- # query parameters
801
- query_params = opts[:query_params] || {}
802
-
803
- # header parameters
804
- header_params = opts[:header_params] || {}
805
- # HTTP header 'Accept' (if needed)
806
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
807
-
808
- # form parameters
809
- form_params = opts[:form_params] || {}
810
-
811
- # http body (model)
812
- post_body = opts[:debug_body]
813
-
814
- # return_type
815
- return_type = opts[:debug_return_type] || 'Array<Currency>'
816
-
817
- # auth_names
818
- auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
819
-
820
- new_options = opts.merge(
821
- :operation => :"ReferenceDataApi.list_all_currencies",
822
- :header_params => header_params,
823
- :query_params => query_params,
824
- :form_params => form_params,
825
- :body => post_body,
826
- :auth_names => auth_names,
827
- :return_type => return_type
828
- )
829
-
830
- data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
831
- if @api_client.config.debugging
832
- @api_client.config.logger.debug "API called: ReferenceDataApi#list_all_currencies\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
833
- end
834
- return data, status_code, headers, response
835
- end
836
-
837
-
838
- # Get currency exchange rates
839
- #
840
- # Returns a list of all Exchange Rate Pairs for all supported Currencies.
841
- #
842
- # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
843
- def list_all_currencies_rates(extra: {})
844
- data, _status_code, _headers = list_all_currencies_rates_with_http_info_impl(extra)
845
- data
846
- end
847
-
848
- # Get currency exchange rates
849
- #
850
- # Returns a list of all Exchange Rate Pairs for all supported Currencies.
851
- #
852
- # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
853
- def list_all_currencies_rates_with_http_info(extra: {})
854
- list_all_currencies_rates_with_http_info_impl(extra)
855
- end
856
-
857
- # Get currency exchange rates
858
- # Returns a list of all Exchange Rate Pairs for all supported Currencies.
859
- # @param [Hash] opts the optional parameters
860
- # @return [Array<ExchangeRatePairs>]
861
- private def list_all_currencies_rates_impl(opts = {})
862
- data, _status_code, _headers = list_all_currencies_rates_with_http_info(opts)
863
- data
864
- end
865
-
866
- # Get currency exchange rates
867
- # Returns a list of all Exchange Rate Pairs for all supported Currencies.
868
- # @param [Hash] opts the optional parameters
869
- # @return [Array<(Array<ExchangeRatePairs>, Integer, Hash)>] Array<ExchangeRatePairs> data, response status code and response headers
870
- private def list_all_currencies_rates_with_http_info_impl(opts = {})
871
- if @api_client.config.debugging
872
- @api_client.config.logger.debug 'Calling API: ReferenceDataApi.list_all_currencies_rates ...'
873
- end
874
- # resource path
875
- local_var_path = '/currencies/rates'
876
-
877
- # query parameters
878
- query_params = opts[:query_params] || {}
879
-
880
- # header parameters
881
- header_params = opts[:header_params] || {}
882
- # HTTP header 'Accept' (if needed)
883
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
884
-
885
- # form parameters
886
- form_params = opts[:form_params] || {}
887
-
888
- # http body (model)
889
- post_body = opts[:debug_body]
890
-
891
- # return_type
892
- return_type = opts[:debug_return_type] || 'Array<ExchangeRatePairs>'
893
-
894
- # auth_names
895
- auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
896
-
897
- new_options = opts.merge(
898
- :operation => :"ReferenceDataApi.list_all_currencies_rates",
899
- :header_params => header_params,
900
- :query_params => query_params,
901
- :form_params => form_params,
902
- :body => post_body,
903
- :auth_names => auth_names,
904
- :return_type => return_type
905
- )
906
-
907
- data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
908
- if @api_client.config.debugging
909
- @api_client.config.logger.debug "API called: ReferenceDataApi#list_all_currencies_rates\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
910
- end
911
- return data, status_code, headers, response
912
- end
913
-
914
-
915
599
  # Search account symbols
916
600
  #
917
601
  # Returns a list of Universal Symbol objects that match the given query. The matching takes into consideration both the ticker and the name of the symbol. Only the first 20 results are returned.
@@ -141,134 +141,6 @@ module SnapTrade
141
141
  end
142
142
 
143
143
 
144
- # Cancel equity order
145
- #
146
- # **Deprecated.** Use [the new cancel order endpoint](/reference/Trading/Trading_cancelOrder) instead.
147
- #
148
- # Attempts to cancel an open order with the brokerage. If the order is no longer cancellable, the request will be rejected.
149
- #
150
- # @param brokerage_order_id [String] Order ID returned by brokerage. This is the unique identifier for the order in the brokerage system.
151
- # @param user_id [String]
152
- # @param user_secret [String]
153
- # @param account_id [String]
154
- # @param body [AccountInformationGetUserAccountOrderDetailRequest]
155
- # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
156
- def cancel_user_account_order(brokerage_order_id:, user_id:, user_secret:, account_id:, extra: {})
157
- _body = {}
158
- _body[:brokerage_order_id] = brokerage_order_id if brokerage_order_id != SENTINEL
159
- account_information_get_user_account_order_detail_request = _body
160
- data, _status_code, _headers = cancel_user_account_order_with_http_info_impl(user_id, user_secret, account_id, account_information_get_user_account_order_detail_request, extra)
161
- data
162
- end
163
-
164
- # Cancel equity order
165
- #
166
- # **Deprecated.** Use [the new cancel order endpoint](/reference/Trading/Trading_cancelOrder) instead.
167
- #
168
- # Attempts to cancel an open order with the brokerage. If the order is no longer cancellable, the request will be rejected.
169
- #
170
- # @param brokerage_order_id [String] Order ID returned by brokerage. This is the unique identifier for the order in the brokerage system.
171
- # @param user_id [String]
172
- # @param user_secret [String]
173
- # @param account_id [String]
174
- # @param body [AccountInformationGetUserAccountOrderDetailRequest]
175
- # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
176
- def cancel_user_account_order_with_http_info(brokerage_order_id:, user_id:, user_secret:, account_id:, extra: {})
177
- _body = {}
178
- _body[:brokerage_order_id] = brokerage_order_id if brokerage_order_id != SENTINEL
179
- account_information_get_user_account_order_detail_request = _body
180
- cancel_user_account_order_with_http_info_impl(user_id, user_secret, account_id, account_information_get_user_account_order_detail_request, extra)
181
- end
182
-
183
- # Cancel equity order
184
- # **Deprecated.** Use [the new cancel order endpoint](/reference/Trading/Trading_cancelOrder) instead. Attempts to cancel an open order with the brokerage. If the order is no longer cancellable, the request will be rejected.
185
- # @param user_id [String]
186
- # @param user_secret [String]
187
- # @param account_id [String]
188
- # @param account_information_get_user_account_order_detail_request [AccountInformationGetUserAccountOrderDetailRequest]
189
- # @param [Hash] opts the optional parameters
190
- # @return [AccountOrderRecord]
191
- private def cancel_user_account_order_impl(user_id, user_secret, account_id, account_information_get_user_account_order_detail_request, opts = {})
192
- data, _status_code, _headers = cancel_user_account_order_with_http_info(user_id, user_secret, account_id, account_information_get_user_account_order_detail_request, opts)
193
- data
194
- end
195
-
196
- # Cancel equity order
197
- # **Deprecated.** Use [the new cancel order endpoint](/reference/Trading/Trading_cancelOrder) instead. Attempts to cancel an open order with the brokerage. If the order is no longer cancellable, the request will be rejected.
198
- # @param user_id [String]
199
- # @param user_secret [String]
200
- # @param account_id [String]
201
- # @param account_information_get_user_account_order_detail_request [AccountInformationGetUserAccountOrderDetailRequest]
202
- # @param [Hash] opts the optional parameters
203
- # @return [Array<(AccountOrderRecord, Integer, Hash)>] AccountOrderRecord data, response status code and response headers
204
- private def cancel_user_account_order_with_http_info_impl(user_id, user_secret, account_id, account_information_get_user_account_order_detail_request, opts = {})
205
- if @api_client.config.debugging
206
- @api_client.config.logger.debug 'Calling API: TradingApi.cancel_user_account_order ...'
207
- end
208
- # verify the required parameter 'user_id' is set
209
- if @api_client.config.client_side_validation && user_id.nil?
210
- fail ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.cancel_user_account_order"
211
- end
212
- # verify the required parameter 'user_secret' is set
213
- if @api_client.config.client_side_validation && user_secret.nil?
214
- fail ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.cancel_user_account_order"
215
- end
216
- # verify the required parameter 'account_id' is set
217
- if @api_client.config.client_side_validation && account_id.nil?
218
- fail ArgumentError, "Missing the required parameter 'account_id' when calling TradingApi.cancel_user_account_order"
219
- end
220
- # verify the required parameter 'account_information_get_user_account_order_detail_request' is set
221
- if @api_client.config.client_side_validation && account_information_get_user_account_order_detail_request.nil?
222
- fail ArgumentError, "Missing the required parameter 'account_information_get_user_account_order_detail_request' when calling TradingApi.cancel_user_account_order"
223
- end
224
- # resource path
225
- local_var_path = '/accounts/{accountId}/orders/cancel'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
226
-
227
- # query parameters
228
- query_params = opts[:query_params] || {}
229
- query_params[:'userId'] = user_id
230
- query_params[:'userSecret'] = user_secret
231
-
232
- # header parameters
233
- header_params = opts[:header_params] || {}
234
- # HTTP header 'Accept' (if needed)
235
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
236
- # HTTP header 'Content-Type'
237
- content_type = @api_client.select_header_content_type(['application/json'])
238
- if !content_type.nil?
239
- header_params['Content-Type'] = content_type
240
- end
241
-
242
- # form parameters
243
- form_params = opts[:form_params] || {}
244
-
245
- # http body (model)
246
- post_body = opts[:debug_body] || @api_client.object_to_http_body(account_information_get_user_account_order_detail_request)
247
-
248
- # return_type
249
- return_type = opts[:debug_return_type] || 'AccountOrderRecord'
250
-
251
- # auth_names
252
- auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
253
-
254
- new_options = opts.merge(
255
- :operation => :"TradingApi.cancel_user_account_order",
256
- :header_params => header_params,
257
- :query_params => query_params,
258
- :form_params => form_params,
259
- :body => post_body,
260
- :auth_names => auth_names,
261
- :return_type => return_type
262
- )
263
-
264
- data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
265
- if @api_client.config.debugging
266
- @api_client.config.logger.debug "API called: TradingApi#cancel_user_account_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
267
- end
268
- return data, status_code, headers, response
269
- end
270
-
271
-
272
144
  # Get crypto pair quote
273
145
  #
274
146
  # Gets a quote for the specified account.
@@ -919,168 +791,6 @@ module SnapTrade
919
791
  end
920
792
 
921
793
 
922
- # Place bracket order
923
- #
924
- # **Deprecated.** Use [the new complex order endpoint](/reference/Trading/Trading_placeComplexOrder) instead.
925
- #
926
- # Places a bracket order (entry order + OCO of stop loss and take profit). Disabled by default please contact support for
927
- # use. Only supported on certain brokerages
928
- #
929
- # @param action [ActionStrictWithOptions] The action describes the intent or side of a trade. This is either `BUY` or `SELL` for Equity symbols or `BUY_TO_OPEN`, `BUY_TO_CLOSE`, `SELL_TO_OPEN` or `SELL_TO_CLOSE` for Options.
930
- # @param instrument [TradingInstrument]
931
- # @param order_type [OrderTypeStrict] The type of order to place. - For `Limit` and `StopLimit` orders, the `price` field is required. - For `Stop` and `StopLimit` orders, the `stop` field is required.
932
- # @param time_in_force [TimeInForceStrict] The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled.
933
- # @param stop_loss [StopLoss]
934
- # @param take_profit [TakeProfit]
935
- # @param account_id [String] The ID of the account to execute the trade on.
936
- # @param user_id [String]
937
- # @param user_secret [String]
938
- # @param price [Float] The limit price for `Limit` and `StopLimit` orders.
939
- # @param stop [Float] The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
940
- # @param units [Float] Number of shares for the order. This can be a decimal for fractional orders. Must be `null` if `notional_value` is provided.
941
- # @param body [ManualTradeFormBracket]
942
- # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
943
- def place_bracket_order(action:, instrument:, order_type:, time_in_force:, stop_loss:, take_profit:, account_id:, user_id:, user_secret:, price: SENTINEL, stop: SENTINEL, units: SENTINEL, extra: {})
944
- _body = {}
945
- _body[:action] = action if action != SENTINEL
946
- _body[:instrument] = instrument if instrument != SENTINEL
947
- _body[:order_type] = order_type if order_type != SENTINEL
948
- _body[:time_in_force] = time_in_force if time_in_force != SENTINEL
949
- _body[:price] = price if price != SENTINEL
950
- _body[:stop] = stop if stop != SENTINEL
951
- _body[:units] = units if units != SENTINEL
952
- _body[:stop_loss] = stop_loss if stop_loss != SENTINEL
953
- _body[:take_profit] = take_profit if take_profit != SENTINEL
954
- manual_trade_form_bracket = _body
955
- data, _status_code, _headers = place_bracket_order_with_http_info_impl(account_id, user_id, user_secret, manual_trade_form_bracket, extra)
956
- data
957
- end
958
-
959
- # Place bracket order
960
- #
961
- # **Deprecated.** Use [the new complex order endpoint](/reference/Trading/Trading_placeComplexOrder) instead.
962
- #
963
- # Places a bracket order (entry order + OCO of stop loss and take profit). Disabled by default please contact support for
964
- # use. Only supported on certain brokerages
965
- #
966
- # @param action [ActionStrictWithOptions] The action describes the intent or side of a trade. This is either `BUY` or `SELL` for Equity symbols or `BUY_TO_OPEN`, `BUY_TO_CLOSE`, `SELL_TO_OPEN` or `SELL_TO_CLOSE` for Options.
967
- # @param instrument [TradingInstrument]
968
- # @param order_type [OrderTypeStrict] The type of order to place. - For `Limit` and `StopLimit` orders, the `price` field is required. - For `Stop` and `StopLimit` orders, the `stop` field is required.
969
- # @param time_in_force [TimeInForceStrict] The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled.
970
- # @param stop_loss [StopLoss]
971
- # @param take_profit [TakeProfit]
972
- # @param account_id [String] The ID of the account to execute the trade on.
973
- # @param user_id [String]
974
- # @param user_secret [String]
975
- # @param price [Float] The limit price for `Limit` and `StopLimit` orders.
976
- # @param stop [Float] The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
977
- # @param units [Float] Number of shares for the order. This can be a decimal for fractional orders. Must be `null` if `notional_value` is provided.
978
- # @param body [ManualTradeFormBracket]
979
- # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
980
- def place_bracket_order_with_http_info(action:, instrument:, order_type:, time_in_force:, stop_loss:, take_profit:, account_id:, user_id:, user_secret:, price: SENTINEL, stop: SENTINEL, units: SENTINEL, extra: {})
981
- _body = {}
982
- _body[:action] = action if action != SENTINEL
983
- _body[:instrument] = instrument if instrument != SENTINEL
984
- _body[:order_type] = order_type if order_type != SENTINEL
985
- _body[:time_in_force] = time_in_force if time_in_force != SENTINEL
986
- _body[:price] = price if price != SENTINEL
987
- _body[:stop] = stop if stop != SENTINEL
988
- _body[:units] = units if units != SENTINEL
989
- _body[:stop_loss] = stop_loss if stop_loss != SENTINEL
990
- _body[:take_profit] = take_profit if take_profit != SENTINEL
991
- manual_trade_form_bracket = _body
992
- place_bracket_order_with_http_info_impl(account_id, user_id, user_secret, manual_trade_form_bracket, extra)
993
- end
994
-
995
- # Place bracket order
996
- # **Deprecated.** Use [the new complex order endpoint](/reference/Trading/Trading_placeComplexOrder) instead. Places a bracket order (entry order + OCO of stop loss and take profit). Disabled by default please contact support for use. Only supported on certain brokerages
997
- # @param account_id [String] The ID of the account to execute the trade on.
998
- # @param user_id [String]
999
- # @param user_secret [String]
1000
- # @param manual_trade_form_bracket [ManualTradeFormBracket]
1001
- # @param [Hash] opts the optional parameters
1002
- # @return [AccountOrderRecord]
1003
- private def place_bracket_order_impl(account_id, user_id, user_secret, manual_trade_form_bracket, opts = {})
1004
- data, _status_code, _headers = place_bracket_order_with_http_info(account_id, user_id, user_secret, manual_trade_form_bracket, opts)
1005
- data
1006
- end
1007
-
1008
- # Place bracket order
1009
- # **Deprecated.** Use [the new complex order endpoint](/reference/Trading/Trading_placeComplexOrder) instead. Places a bracket order (entry order + OCO of stop loss and take profit). Disabled by default please contact support for use. Only supported on certain brokerages
1010
- # @param account_id [String] The ID of the account to execute the trade on.
1011
- # @param user_id [String]
1012
- # @param user_secret [String]
1013
- # @param manual_trade_form_bracket [ManualTradeFormBracket]
1014
- # @param [Hash] opts the optional parameters
1015
- # @return [Array<(AccountOrderRecord, Integer, Hash)>] AccountOrderRecord data, response status code and response headers
1016
- private def place_bracket_order_with_http_info_impl(account_id, user_id, user_secret, manual_trade_form_bracket, opts = {})
1017
- if @api_client.config.debugging
1018
- @api_client.config.logger.debug 'Calling API: TradingApi.place_bracket_order ...'
1019
- end
1020
- # verify the required parameter 'account_id' is set
1021
- if @api_client.config.client_side_validation && account_id.nil?
1022
- fail ArgumentError, "Missing the required parameter 'account_id' when calling TradingApi.place_bracket_order"
1023
- end
1024
- # verify the required parameter 'user_id' is set
1025
- if @api_client.config.client_side_validation && user_id.nil?
1026
- fail ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.place_bracket_order"
1027
- end
1028
- # verify the required parameter 'user_secret' is set
1029
- if @api_client.config.client_side_validation && user_secret.nil?
1030
- fail ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.place_bracket_order"
1031
- end
1032
- # verify the required parameter 'manual_trade_form_bracket' is set
1033
- if @api_client.config.client_side_validation && manual_trade_form_bracket.nil?
1034
- fail ArgumentError, "Missing the required parameter 'manual_trade_form_bracket' when calling TradingApi.place_bracket_order"
1035
- end
1036
- # resource path
1037
- local_var_path = '/accounts/{accountId}/trading/bracket'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
1038
-
1039
- # query parameters
1040
- query_params = opts[:query_params] || {}
1041
- query_params[:'userId'] = user_id
1042
- query_params[:'userSecret'] = user_secret
1043
-
1044
- # header parameters
1045
- header_params = opts[:header_params] || {}
1046
- # HTTP header 'Accept' (if needed)
1047
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1048
- # HTTP header 'Content-Type'
1049
- content_type = @api_client.select_header_content_type(['application/json'])
1050
- if !content_type.nil?
1051
- header_params['Content-Type'] = content_type
1052
- end
1053
-
1054
- # form parameters
1055
- form_params = opts[:form_params] || {}
1056
-
1057
- # http body (model)
1058
- post_body = opts[:debug_body] || @api_client.object_to_http_body(manual_trade_form_bracket)
1059
-
1060
- # return_type
1061
- return_type = opts[:debug_return_type] || 'AccountOrderRecord'
1062
-
1063
- # auth_names
1064
- auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
1065
-
1066
- new_options = opts.merge(
1067
- :operation => :"TradingApi.place_bracket_order",
1068
- :header_params => header_params,
1069
- :query_params => query_params,
1070
- :form_params => form_params,
1071
- :body => post_body,
1072
- :auth_names => auth_names,
1073
- :return_type => return_type
1074
- )
1075
-
1076
- data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
1077
- if @api_client.config.debugging
1078
- @api_client.config.logger.debug "API called: TradingApi#place_bracket_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1079
- end
1080
- return data, status_code, headers, response
1081
- end
1082
-
1083
-
1084
794
  # Place complex order
1085
795
  #
1086
796
  # Places a complex conditional order (OCO, OTO, or OTOCO).
@@ -8,5 +8,5 @@ Contact: api@snaptrade.com
8
8
  =end
9
9
 
10
10
  module SnapTrade
11
- VERSION = '2.1.0'
11
+ VERSION = '3.0.0'
12
12
  end