snaptrade 2.0.86 → 2.0.88
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +376 -304
- data/lib/snaptrade/api/trading_api.rb +831 -14
- data/lib/snaptrade/models/cryptocurrency_pair.rb +12 -2
- data/lib/snaptrade/models/{crypto_spot_quote.rb → cryptocurrency_pair_quote.rb} +3 -3
- data/lib/snaptrade/models/manual_trade_form_bracket.rb +13 -19
- data/lib/snaptrade/models/manual_trade_replace_form.rb +285 -0
- data/lib/snaptrade/models/{crypto_spot_order_preview.rb → simple_order_preview.rb} +5 -5
- data/lib/snaptrade/models/{crypto_spot_order_preview_estimated_fee.rb → simple_order_preview_estimated_fee.rb} +3 -3
- data/lib/snaptrade/models/{crypto_spot_order_request_body_time_in_force.rb → simple_order_request_body_time_in_force.rb} +3 -3
- data/lib/snaptrade/models/{trading_crypto_spot_cancel_order_request.rb → trading_instrument.rb} +21 -16
- data/lib/snaptrade/models/trading_instrument_type.rb +38 -0
- data/lib/snaptrade/models/{trading_crypto_spot_place_order_request.rb → trading_place_simple_order_request.rb} +14 -14
- data/lib/snaptrade/models/{trading_crypto_spot_symbols200_response.rb → trading_search_cryptocurrency_pair_instruments200_response.rb} +3 -3
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +9 -10
- data/spec/api/trading_api_spec.rb +93 -0
- data/spec/models/{crypto_spot_quote_spec.rb → cryptocurrency_pair_quote_spec.rb} +6 -6
- data/spec/models/cryptocurrency_pair_spec.rb +6 -0
- data/spec/models/manual_trade_form_bracket_spec.rb +3 -3
- data/spec/models/manual_trade_replace_form_spec.rb +59 -0
- data/spec/models/{crypto_spot_order_preview_estimated_fee_spec.rb → simple_order_preview_estimated_fee_spec.rb} +6 -6
- data/spec/models/{crypto_spot_order_preview_spec.rb → simple_order_preview_spec.rb} +6 -6
- data/spec/models/simple_order_request_body_time_in_force_spec.rb +23 -0
- data/spec/models/trading_instrument_spec.rb +35 -0
- data/spec/models/trading_instrument_type_spec.rb +23 -0
- data/spec/models/{trading_crypto_spot_place_order_request_spec.rb → trading_place_simple_order_request_spec.rb} +7 -7
- data/spec/models/trading_search_cryptocurrency_pair_instruments200_response_spec.rb +29 -0
- metadata +29 -26
- data/lib/snaptrade/api/crypto_spot_trading_api.rb +0 -698
- data/spec/api/crypto_spot_trading_api_spec.rb +0 -107
- data/spec/models/crypto_spot_order_request_body_time_in_force_spec.rb +0 -23
- data/spec/models/trading_crypto_spot_cancel_order_request_spec.rb +0 -29
- data/spec/models/trading_crypto_spot_symbols200_response_spec.rb +0 -29
| @@ -17,6 +17,117 @@ module SnapTrade | |
| 17 17 | 
             
                  @api_client = api_client
         | 
| 18 18 | 
             
                end
         | 
| 19 19 |  | 
| 20 | 
            +
                # Cancel an order.
         | 
| 21 | 
            +
                #
         | 
| 22 | 
            +
                # Cancels an order in the specified account.
         | 
| 23 | 
            +
                #
         | 
| 24 | 
            +
                # @param user_id [String] 
         | 
| 25 | 
            +
                # @param user_secret [String] 
         | 
| 26 | 
            +
                # @param account_id [String] 
         | 
| 27 | 
            +
                # @param brokerage_order_id [String] 
         | 
| 28 | 
            +
                # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
         | 
| 29 | 
            +
                def cancel_order(user_id:, user_secret:, account_id:, brokerage_order_id:, extra: {})
         | 
| 30 | 
            +
                  data, _status_code, _headers = cancel_order_with_http_info_impl(user_id, user_secret, account_id, brokerage_order_id, extra)
         | 
| 31 | 
            +
                  data
         | 
| 32 | 
            +
                end
         | 
| 33 | 
            +
             | 
| 34 | 
            +
                # Cancel an order.
         | 
| 35 | 
            +
                #
         | 
| 36 | 
            +
                # Cancels an order in the specified account.
         | 
| 37 | 
            +
                #
         | 
| 38 | 
            +
                # @param user_id [String] 
         | 
| 39 | 
            +
                # @param user_secret [String] 
         | 
| 40 | 
            +
                # @param account_id [String] 
         | 
| 41 | 
            +
                # @param brokerage_order_id [String] 
         | 
| 42 | 
            +
                # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
         | 
| 43 | 
            +
                def cancel_order_with_http_info(user_id:, user_secret:, account_id:, brokerage_order_id:, extra: {})
         | 
| 44 | 
            +
                  cancel_order_with_http_info_impl(user_id, user_secret, account_id, brokerage_order_id, extra)
         | 
| 45 | 
            +
                end
         | 
| 46 | 
            +
             | 
| 47 | 
            +
                # Cancel an order.
         | 
| 48 | 
            +
                # Cancels an order in the specified account. 
         | 
| 49 | 
            +
                # @param user_id [String] 
         | 
| 50 | 
            +
                # @param user_secret [String] 
         | 
| 51 | 
            +
                # @param account_id [String] 
         | 
| 52 | 
            +
                # @param brokerage_order_id [String] 
         | 
| 53 | 
            +
                # @param [Hash] opts the optional parameters
         | 
| 54 | 
            +
                # @return [OrderUpdatedResponse]
         | 
| 55 | 
            +
                private def cancel_order_impl(user_id, user_secret, account_id, brokerage_order_id, opts = {})
         | 
| 56 | 
            +
                  data, _status_code, _headers = cancel_order_with_http_info(user_id, user_secret, account_id, brokerage_order_id, opts)
         | 
| 57 | 
            +
                  data
         | 
| 58 | 
            +
                end
         | 
| 59 | 
            +
             | 
| 60 | 
            +
                # Cancel an order.
         | 
| 61 | 
            +
                # Cancels an order in the specified account. 
         | 
| 62 | 
            +
                # @param user_id [String] 
         | 
| 63 | 
            +
                # @param user_secret [String] 
         | 
| 64 | 
            +
                # @param account_id [String] 
         | 
| 65 | 
            +
                # @param brokerage_order_id [String] 
         | 
| 66 | 
            +
                # @param [Hash] opts the optional parameters
         | 
| 67 | 
            +
                # @return [Array<(OrderUpdatedResponse, Integer, Hash)>] OrderUpdatedResponse data, response status code and response headers
         | 
| 68 | 
            +
                private def cancel_order_with_http_info_impl(user_id, user_secret, account_id, brokerage_order_id, opts = {})
         | 
| 69 | 
            +
                  if @api_client.config.debugging
         | 
| 70 | 
            +
                    @api_client.config.logger.debug 'Calling API: TradingApi.cancel_order ...'
         | 
| 71 | 
            +
                  end
         | 
| 72 | 
            +
                  # verify the required parameter 'user_id' is set
         | 
| 73 | 
            +
                  if @api_client.config.client_side_validation && user_id.nil?
         | 
| 74 | 
            +
                    fail ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.cancel_order"
         | 
| 75 | 
            +
                  end
         | 
| 76 | 
            +
                  # verify the required parameter 'user_secret' is set
         | 
| 77 | 
            +
                  if @api_client.config.client_side_validation && user_secret.nil?
         | 
| 78 | 
            +
                    fail ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.cancel_order"
         | 
| 79 | 
            +
                  end
         | 
| 80 | 
            +
                  # verify the required parameter 'account_id' is set
         | 
| 81 | 
            +
                  if @api_client.config.client_side_validation && account_id.nil?
         | 
| 82 | 
            +
                    fail ArgumentError, "Missing the required parameter 'account_id' when calling TradingApi.cancel_order"
         | 
| 83 | 
            +
                  end
         | 
| 84 | 
            +
                  # verify the required parameter 'brokerage_order_id' is set
         | 
| 85 | 
            +
                  if @api_client.config.client_side_validation && brokerage_order_id.nil?
         | 
| 86 | 
            +
                    fail ArgumentError, "Missing the required parameter 'brokerage_order_id' when calling TradingApi.cancel_order"
         | 
| 87 | 
            +
                  end
         | 
| 88 | 
            +
                  # resource path
         | 
| 89 | 
            +
                  local_var_path = '/accounts/{accountId}/trading/simple/{brokerageOrderId}/cancel'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'brokerageOrderId' + '}', CGI.escape(brokerage_order_id.to_s))
         | 
| 90 | 
            +
             | 
| 91 | 
            +
                  # query parameters
         | 
| 92 | 
            +
                  query_params = opts[:query_params] || {}
         | 
| 93 | 
            +
                  query_params[:'userId'] = user_id
         | 
| 94 | 
            +
                  query_params[:'userSecret'] = user_secret
         | 
| 95 | 
            +
             | 
| 96 | 
            +
                  # header parameters
         | 
| 97 | 
            +
                  header_params = opts[:header_params] || {}
         | 
| 98 | 
            +
                  # HTTP header 'Accept' (if needed)
         | 
| 99 | 
            +
                  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
         | 
| 100 | 
            +
             | 
| 101 | 
            +
                  # form parameters
         | 
| 102 | 
            +
                  form_params = opts[:form_params] || {}
         | 
| 103 | 
            +
             | 
| 104 | 
            +
                  # http body (model)
         | 
| 105 | 
            +
                  post_body = opts[:debug_body]
         | 
| 106 | 
            +
             | 
| 107 | 
            +
                  # return_type
         | 
| 108 | 
            +
                  return_type = opts[:debug_return_type] || 'OrderUpdatedResponse'
         | 
| 109 | 
            +
             | 
| 110 | 
            +
                  # auth_names
         | 
| 111 | 
            +
                  auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
         | 
| 112 | 
            +
             | 
| 113 | 
            +
                  new_options = opts.merge(
         | 
| 114 | 
            +
                    :operation => :"TradingApi.cancel_order",
         | 
| 115 | 
            +
                    :header_params => header_params,
         | 
| 116 | 
            +
                    :query_params => query_params,
         | 
| 117 | 
            +
                    :form_params => form_params,
         | 
| 118 | 
            +
                    :body => post_body,
         | 
| 119 | 
            +
                    :auth_names => auth_names,
         | 
| 120 | 
            +
                    :return_type => return_type
         | 
| 121 | 
            +
                  )
         | 
| 122 | 
            +
             | 
| 123 | 
            +
                  data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
         | 
| 124 | 
            +
                  if @api_client.config.debugging
         | 
| 125 | 
            +
                    @api_client.config.logger.debug "API called: TradingApi#cancel_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
         | 
| 126 | 
            +
                  end
         | 
| 127 | 
            +
                  return data, status_code, headers, response
         | 
| 128 | 
            +
                end
         | 
| 129 | 
            +
             | 
| 130 | 
            +
             | 
| 20 131 | 
             
                # Cancel order
         | 
| 21 132 | 
             
                #
         | 
| 22 133 | 
             
                # Attempts to cancel an open order with the brokerage. If the order is no longer cancellable, the request will be rejected.
         | 
| @@ -141,6 +252,117 @@ module SnapTrade | |
| 141 252 | 
             
                end
         | 
| 142 253 |  | 
| 143 254 |  | 
| 255 | 
            +
                # Get cryptocurrency pair quote
         | 
| 256 | 
            +
                #
         | 
| 257 | 
            +
                # Gets a quote for the specified account.
         | 
| 258 | 
            +
                #
         | 
| 259 | 
            +
                # @param user_id [String] 
         | 
| 260 | 
            +
                # @param user_secret [String] 
         | 
| 261 | 
            +
                # @param account_id [String] 
         | 
| 262 | 
            +
                # @param instrument_symbol [String] 
         | 
| 263 | 
            +
                # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
         | 
| 264 | 
            +
                def get_cryptocurrency_pair_quote(user_id:, user_secret:, account_id:, instrument_symbol:, extra: {})
         | 
| 265 | 
            +
                  data, _status_code, _headers = get_cryptocurrency_pair_quote_with_http_info_impl(user_id, user_secret, account_id, instrument_symbol, extra)
         | 
| 266 | 
            +
                  data
         | 
| 267 | 
            +
                end
         | 
| 268 | 
            +
             | 
| 269 | 
            +
                # Get cryptocurrency pair quote
         | 
| 270 | 
            +
                #
         | 
| 271 | 
            +
                # Gets a quote for the specified account.
         | 
| 272 | 
            +
                #
         | 
| 273 | 
            +
                # @param user_id [String] 
         | 
| 274 | 
            +
                # @param user_secret [String] 
         | 
| 275 | 
            +
                # @param account_id [String] 
         | 
| 276 | 
            +
                # @param instrument_symbol [String] 
         | 
| 277 | 
            +
                # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
         | 
| 278 | 
            +
                def get_cryptocurrency_pair_quote_with_http_info(user_id:, user_secret:, account_id:, instrument_symbol:, extra: {})
         | 
| 279 | 
            +
                  get_cryptocurrency_pair_quote_with_http_info_impl(user_id, user_secret, account_id, instrument_symbol, extra)
         | 
| 280 | 
            +
                end
         | 
| 281 | 
            +
             | 
| 282 | 
            +
                # Get cryptocurrency pair quote
         | 
| 283 | 
            +
                # Gets a quote for the specified account. 
         | 
| 284 | 
            +
                # @param user_id [String] 
         | 
| 285 | 
            +
                # @param user_secret [String] 
         | 
| 286 | 
            +
                # @param account_id [String] 
         | 
| 287 | 
            +
                # @param instrument_symbol [String] 
         | 
| 288 | 
            +
                # @param [Hash] opts the optional parameters
         | 
| 289 | 
            +
                # @return [CryptocurrencyPairQuote]
         | 
| 290 | 
            +
                private def get_cryptocurrency_pair_quote_impl(user_id, user_secret, account_id, instrument_symbol, opts = {})
         | 
| 291 | 
            +
                  data, _status_code, _headers = get_cryptocurrency_pair_quote_with_http_info(user_id, user_secret, account_id, instrument_symbol, opts)
         | 
| 292 | 
            +
                  data
         | 
| 293 | 
            +
                end
         | 
| 294 | 
            +
             | 
| 295 | 
            +
                # Get cryptocurrency pair quote
         | 
| 296 | 
            +
                # Gets a quote for the specified account. 
         | 
| 297 | 
            +
                # @param user_id [String] 
         | 
| 298 | 
            +
                # @param user_secret [String] 
         | 
| 299 | 
            +
                # @param account_id [String] 
         | 
| 300 | 
            +
                # @param instrument_symbol [String] 
         | 
| 301 | 
            +
                # @param [Hash] opts the optional parameters
         | 
| 302 | 
            +
                # @return [Array<(CryptocurrencyPairQuote, Integer, Hash)>] CryptocurrencyPairQuote data, response status code and response headers
         | 
| 303 | 
            +
                private def get_cryptocurrency_pair_quote_with_http_info_impl(user_id, user_secret, account_id, instrument_symbol, opts = {})
         | 
| 304 | 
            +
                  if @api_client.config.debugging
         | 
| 305 | 
            +
                    @api_client.config.logger.debug 'Calling API: TradingApi.get_cryptocurrency_pair_quote ...'
         | 
| 306 | 
            +
                  end
         | 
| 307 | 
            +
                  # verify the required parameter 'user_id' is set
         | 
| 308 | 
            +
                  if @api_client.config.client_side_validation && user_id.nil?
         | 
| 309 | 
            +
                    fail ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.get_cryptocurrency_pair_quote"
         | 
| 310 | 
            +
                  end
         | 
| 311 | 
            +
                  # verify the required parameter 'user_secret' is set
         | 
| 312 | 
            +
                  if @api_client.config.client_side_validation && user_secret.nil?
         | 
| 313 | 
            +
                    fail ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.get_cryptocurrency_pair_quote"
         | 
| 314 | 
            +
                  end
         | 
| 315 | 
            +
                  # verify the required parameter 'account_id' is set
         | 
| 316 | 
            +
                  if @api_client.config.client_side_validation && account_id.nil?
         | 
| 317 | 
            +
                    fail ArgumentError, "Missing the required parameter 'account_id' when calling TradingApi.get_cryptocurrency_pair_quote"
         | 
| 318 | 
            +
                  end
         | 
| 319 | 
            +
                  # verify the required parameter 'instrument_symbol' is set
         | 
| 320 | 
            +
                  if @api_client.config.client_side_validation && instrument_symbol.nil?
         | 
| 321 | 
            +
                    fail ArgumentError, "Missing the required parameter 'instrument_symbol' when calling TradingApi.get_cryptocurrency_pair_quote"
         | 
| 322 | 
            +
                  end
         | 
| 323 | 
            +
                  # resource path
         | 
| 324 | 
            +
                  local_var_path = '/accounts/{accountId}/trading/instruments/cryptocurrencyPairs/{instrumentSymbol}/quote'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'instrumentSymbol' + '}', CGI.escape(instrument_symbol.to_s))
         | 
| 325 | 
            +
             | 
| 326 | 
            +
                  # query parameters
         | 
| 327 | 
            +
                  query_params = opts[:query_params] || {}
         | 
| 328 | 
            +
                  query_params[:'userId'] = user_id
         | 
| 329 | 
            +
                  query_params[:'userSecret'] = user_secret
         | 
| 330 | 
            +
             | 
| 331 | 
            +
                  # header parameters
         | 
| 332 | 
            +
                  header_params = opts[:header_params] || {}
         | 
| 333 | 
            +
                  # HTTP header 'Accept' (if needed)
         | 
| 334 | 
            +
                  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
         | 
| 335 | 
            +
             | 
| 336 | 
            +
                  # form parameters
         | 
| 337 | 
            +
                  form_params = opts[:form_params] || {}
         | 
| 338 | 
            +
             | 
| 339 | 
            +
                  # http body (model)
         | 
| 340 | 
            +
                  post_body = opts[:debug_body]
         | 
| 341 | 
            +
             | 
| 342 | 
            +
                  # return_type
         | 
| 343 | 
            +
                  return_type = opts[:debug_return_type] || 'CryptocurrencyPairQuote'
         | 
| 344 | 
            +
             | 
| 345 | 
            +
                  # auth_names
         | 
| 346 | 
            +
                  auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
         | 
| 347 | 
            +
             | 
| 348 | 
            +
                  new_options = opts.merge(
         | 
| 349 | 
            +
                    :operation => :"TradingApi.get_cryptocurrency_pair_quote",
         | 
| 350 | 
            +
                    :header_params => header_params,
         | 
| 351 | 
            +
                    :query_params => query_params,
         | 
| 352 | 
            +
                    :form_params => form_params,
         | 
| 353 | 
            +
                    :body => post_body,
         | 
| 354 | 
            +
                    :auth_names => auth_names,
         | 
| 355 | 
            +
                    :return_type => return_type
         | 
| 356 | 
            +
                  )
         | 
| 357 | 
            +
             | 
| 358 | 
            +
                  data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
         | 
| 359 | 
            +
                  if @api_client.config.debugging
         | 
| 360 | 
            +
                    @api_client.config.logger.debug "API called: TradingApi#get_cryptocurrency_pair_quote\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
         | 
| 361 | 
            +
                  end
         | 
| 362 | 
            +
                  return data, status_code, headers, response
         | 
| 363 | 
            +
                end
         | 
| 364 | 
            +
             | 
| 365 | 
            +
             | 
| 144 366 | 
             
                # Check order impact
         | 
| 145 367 | 
             
                #
         | 
| 146 368 | 
             
                # Simulates an order and its impact on the account. This endpoint does not place the order with the brokerage. If successful, it returns a `Trade` object and the ID of the object can be used to place the order with the brokerage using the [place checked order endpoint](/reference/Trading/Trading_placeOrder). Please note that the `Trade` object returned expires after 5 minutes. Any order placed using an expired `Trade` will be rejected.
         | 
| @@ -413,25 +635,26 @@ module SnapTrade | |
| 413 635 | 
             
                # Places a bracket order (entry order + OCO of stop loss and take profit). Disabled by default please contact support for
         | 
| 414 636 | 
             
                # use. Only supported on certain brokerages
         | 
| 415 637 | 
             
                #
         | 
| 416 | 
            -
                # @param account_id [String] Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
         | 
| 417 638 | 
             
                # @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.
         | 
| 418 | 
            -
                # @param  | 
| 639 | 
            +
                # @param instrument [TradingInstrument] 
         | 
| 419 640 | 
             
                # @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. 
         | 
| 420 641 | 
             
                # @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. 
         | 
| 421 642 | 
             
                # @param stop_loss [StopLoss] 
         | 
| 422 643 | 
             
                # @param take_profit [TakeProfit] 
         | 
| 644 | 
            +
                # @param account_id [String] The ID of the account to execute the trade on.
         | 
| 423 645 | 
             
                # @param user_id [String] 
         | 
| 424 646 | 
             
                # @param user_secret [String] 
         | 
| 647 | 
            +
                # @param symbol [String] The security's trading ticker symbol.
         | 
| 425 648 | 
             
                # @param price [Float] The limit price for `Limit` and `StopLimit` orders.
         | 
| 426 649 | 
             
                # @param stop [Float] The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
         | 
| 427 650 | 
             
                # @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.
         | 
| 428 651 | 
             
                # @param body [ManualTradeFormBracket] 
         | 
| 429 652 | 
             
                # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
         | 
| 430 | 
            -
                def place_bracket_order( | 
| 653 | 
            +
                def place_bracket_order(action:, instrument:, order_type:, time_in_force:, stop_loss:, take_profit:, account_id:, user_id:, user_secret:, symbol: SENTINEL, price: SENTINEL, stop: SENTINEL, units: SENTINEL, extra: {})
         | 
| 431 654 | 
             
                  _body = {}
         | 
| 432 | 
            -
                  _body[:account_id] = account_id if account_id != SENTINEL
         | 
| 433 655 | 
             
                  _body[:action] = action if action != SENTINEL
         | 
| 434 656 | 
             
                  _body[:symbol] = symbol if symbol != SENTINEL
         | 
| 657 | 
            +
                  _body[:instrument] = instrument if instrument != SENTINEL
         | 
| 435 658 | 
             
                  _body[:order_type] = order_type if order_type != SENTINEL
         | 
| 436 659 | 
             
                  _body[:time_in_force] = time_in_force if time_in_force != SENTINEL
         | 
| 437 660 | 
             
                  _body[:price] = price if price != SENTINEL
         | 
| @@ -440,7 +663,7 @@ module SnapTrade | |
| 440 663 | 
             
                  _body[:stop_loss] = stop_loss if stop_loss != SENTINEL
         | 
| 441 664 | 
             
                  _body[:take_profit] = take_profit if take_profit != SENTINEL
         | 
| 442 665 | 
             
                  manual_trade_form_bracket = _body
         | 
| 443 | 
            -
                  data, _status_code, _headers = place_bracket_order_with_http_info_impl(user_id, user_secret, manual_trade_form_bracket, extra)
         | 
| 666 | 
            +
                  data, _status_code, _headers = place_bracket_order_with_http_info_impl(account_id, user_id, user_secret, manual_trade_form_bracket, extra)
         | 
| 444 667 | 
             
                  data
         | 
| 445 668 | 
             
                end
         | 
| 446 669 |  | 
| @@ -449,25 +672,26 @@ module SnapTrade | |
| 449 672 | 
             
                # Places a bracket order (entry order + OCO of stop loss and take profit). Disabled by default please contact support for
         | 
| 450 673 | 
             
                # use. Only supported on certain brokerages
         | 
| 451 674 | 
             
                #
         | 
| 452 | 
            -
                # @param account_id [String] Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
         | 
| 453 675 | 
             
                # @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.
         | 
| 454 | 
            -
                # @param  | 
| 676 | 
            +
                # @param instrument [TradingInstrument] 
         | 
| 455 677 | 
             
                # @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. 
         | 
| 456 678 | 
             
                # @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. 
         | 
| 457 679 | 
             
                # @param stop_loss [StopLoss] 
         | 
| 458 680 | 
             
                # @param take_profit [TakeProfit] 
         | 
| 681 | 
            +
                # @param account_id [String] The ID of the account to execute the trade on.
         | 
| 459 682 | 
             
                # @param user_id [String] 
         | 
| 460 683 | 
             
                # @param user_secret [String] 
         | 
| 684 | 
            +
                # @param symbol [String] The security's trading ticker symbol.
         | 
| 461 685 | 
             
                # @param price [Float] The limit price for `Limit` and `StopLimit` orders.
         | 
| 462 686 | 
             
                # @param stop [Float] The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
         | 
| 463 687 | 
             
                # @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.
         | 
| 464 688 | 
             
                # @param body [ManualTradeFormBracket] 
         | 
| 465 689 | 
             
                # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
         | 
| 466 | 
            -
                def place_bracket_order_with_http_info( | 
| 690 | 
            +
                def place_bracket_order_with_http_info(action:, instrument:, order_type:, time_in_force:, stop_loss:, take_profit:, account_id:, user_id:, user_secret:, symbol: SENTINEL, price: SENTINEL, stop: SENTINEL, units: SENTINEL, extra: {})
         | 
| 467 691 | 
             
                  _body = {}
         | 
| 468 | 
            -
                  _body[:account_id] = account_id if account_id != SENTINEL
         | 
| 469 692 | 
             
                  _body[:action] = action if action != SENTINEL
         | 
| 470 693 | 
             
                  _body[:symbol] = symbol if symbol != SENTINEL
         | 
| 694 | 
            +
                  _body[:instrument] = instrument if instrument != SENTINEL
         | 
| 471 695 | 
             
                  _body[:order_type] = order_type if order_type != SENTINEL
         | 
| 472 696 | 
             
                  _body[:time_in_force] = time_in_force if time_in_force != SENTINEL
         | 
| 473 697 | 
             
                  _body[:price] = price if price != SENTINEL
         | 
| @@ -476,32 +700,38 @@ module SnapTrade | |
| 476 700 | 
             
                  _body[:stop_loss] = stop_loss if stop_loss != SENTINEL
         | 
| 477 701 | 
             
                  _body[:take_profit] = take_profit if take_profit != SENTINEL
         | 
| 478 702 | 
             
                  manual_trade_form_bracket = _body
         | 
| 479 | 
            -
                  place_bracket_order_with_http_info_impl(user_id, user_secret, manual_trade_form_bracket, extra)
         | 
| 703 | 
            +
                  place_bracket_order_with_http_info_impl(account_id, user_id, user_secret, manual_trade_form_bracket, extra)
         | 
| 480 704 | 
             
                end
         | 
| 481 705 |  | 
| 482 706 | 
             
                # Place a Bracket Order
         | 
| 483 707 | 
             
                # 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 
         | 
| 708 | 
            +
                # @param account_id [String] The ID of the account to execute the trade on.
         | 
| 484 709 | 
             
                # @param user_id [String] 
         | 
| 485 710 | 
             
                # @param user_secret [String] 
         | 
| 486 711 | 
             
                # @param manual_trade_form_bracket [ManualTradeFormBracket] 
         | 
| 487 712 | 
             
                # @param [Hash] opts the optional parameters
         | 
| 488 713 | 
             
                # @return [AccountOrderRecord]
         | 
| 489 | 
            -
                private def place_bracket_order_impl(user_id, user_secret, manual_trade_form_bracket, opts = {})
         | 
| 490 | 
            -
                  data, _status_code, _headers = place_bracket_order_with_http_info(user_id, user_secret, manual_trade_form_bracket, opts)
         | 
| 714 | 
            +
                private def place_bracket_order_impl(account_id, user_id, user_secret, manual_trade_form_bracket, opts = {})
         | 
| 715 | 
            +
                  data, _status_code, _headers = place_bracket_order_with_http_info(account_id, user_id, user_secret, manual_trade_form_bracket, opts)
         | 
| 491 716 | 
             
                  data
         | 
| 492 717 | 
             
                end
         | 
| 493 718 |  | 
| 494 719 | 
             
                # Place a Bracket Order
         | 
| 495 720 | 
             
                # 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 
         | 
| 721 | 
            +
                # @param account_id [String] The ID of the account to execute the trade on.
         | 
| 496 722 | 
             
                # @param user_id [String] 
         | 
| 497 723 | 
             
                # @param user_secret [String] 
         | 
| 498 724 | 
             
                # @param manual_trade_form_bracket [ManualTradeFormBracket] 
         | 
| 499 725 | 
             
                # @param [Hash] opts the optional parameters
         | 
| 500 726 | 
             
                # @return [Array<(AccountOrderRecord, Integer, Hash)>] AccountOrderRecord data, response status code and response headers
         | 
| 501 | 
            -
                private def place_bracket_order_with_http_info_impl(user_id, user_secret, manual_trade_form_bracket, opts = {})
         | 
| 727 | 
            +
                private def place_bracket_order_with_http_info_impl(account_id, user_id, user_secret, manual_trade_form_bracket, opts = {})
         | 
| 502 728 | 
             
                  if @api_client.config.debugging
         | 
| 503 729 | 
             
                    @api_client.config.logger.debug 'Calling API: TradingApi.place_bracket_order ...'
         | 
| 504 730 | 
             
                  end
         | 
| 731 | 
            +
                  # verify the required parameter 'account_id' is set
         | 
| 732 | 
            +
                  if @api_client.config.client_side_validation && account_id.nil?
         | 
| 733 | 
            +
                    fail ArgumentError, "Missing the required parameter 'account_id' when calling TradingApi.place_bracket_order"
         | 
| 734 | 
            +
                  end
         | 
| 505 735 | 
             
                  # verify the required parameter 'user_id' is set
         | 
| 506 736 | 
             
                  if @api_client.config.client_side_validation && user_id.nil?
         | 
| 507 737 | 
             
                    fail ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.place_bracket_order"
         | 
| @@ -515,7 +745,7 @@ module SnapTrade | |
| 515 745 | 
             
                    fail ArgumentError, "Missing the required parameter 'manual_trade_form_bracket' when calling TradingApi.place_bracket_order"
         | 
| 516 746 | 
             
                  end
         | 
| 517 747 | 
             
                  # resource path
         | 
| 518 | 
            -
                  local_var_path = '/ | 
| 748 | 
            +
                  local_var_path = '/accounts/{accountId}/trading/bracket'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
         | 
| 519 749 |  | 
| 520 750 | 
             
                  # query parameters
         | 
| 521 751 | 
             
                  query_params = opts[:query_params] || {}
         | 
| @@ -844,6 +1074,593 @@ module SnapTrade | |
| 844 1074 | 
             
                  end
         | 
| 845 1075 | 
             
                  return data, status_code, headers, response
         | 
| 846 1076 | 
             
                end
         | 
| 1077 | 
            +
             | 
| 1078 | 
            +
             | 
| 1079 | 
            +
                # Place order
         | 
| 1080 | 
            +
                #
         | 
| 1081 | 
            +
                # Places an order in the specified account.
         | 
| 1082 | 
            +
                # This endpoint does not compute the impact to the account balance from the order before submitting the order.
         | 
| 1083 | 
            +
                #
         | 
| 1084 | 
            +
                # @param instrument [TradingInstrument] 
         | 
| 1085 | 
            +
                # @param side [ActionStrict] The action describes the intent or side of a trade. This is either `BUY` or `SELL`.
         | 
| 1086 | 
            +
                # @param type [Type] The type of order to place.
         | 
| 1087 | 
            +
                # @param time_in_force [SimpleOrderRequestBodyTimeInForce] The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. - `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. - `GTD` - Good Til Date. The order is valid until the specified date. 
         | 
| 1088 | 
            +
                # @param amount [Float] The amount of the base currency to buy or sell.
         | 
| 1089 | 
            +
                # @param user_id [String] 
         | 
| 1090 | 
            +
                # @param user_secret [String] 
         | 
| 1091 | 
            +
                # @param account_id [String] 
         | 
| 1092 | 
            +
                # @param limit_price [Float] The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT or TAKE_PROFIT_LIMIT.
         | 
| 1093 | 
            +
                # @param stop_price [Float] The stop price. Required if the order type is STOP_LOSS_MARKET, STOP_LOSS_LIMIT, TAKE_PROFIT_MARKET or TAKE_PROFIT_LIMIT.
         | 
| 1094 | 
            +
                # @param post_only [Boolean] Valid and required only for order type LIMIT. If true orders that would be filled immediately are rejected to avoid incurring TAKER fees. 
         | 
| 1095 | 
            +
                # @param expiration_date [Time] The expiration date of the order. Required if the time_in_force is GTD.
         | 
| 1096 | 
            +
                # @param body [TradingPlaceSimpleOrderRequest] 
         | 
| 1097 | 
            +
                # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
         | 
| 1098 | 
            +
                def place_simple_order(instrument:, side:, type:, time_in_force:, amount:, user_id:, user_secret:, account_id:, limit_price: SENTINEL, stop_price: SENTINEL, post_only: SENTINEL, expiration_date: SENTINEL, extra: {})
         | 
| 1099 | 
            +
                  _body = {}
         | 
| 1100 | 
            +
                  _body[:instrument] = instrument if instrument != SENTINEL
         | 
| 1101 | 
            +
                  _body[:side] = side if side != SENTINEL
         | 
| 1102 | 
            +
                  _body[:type] = type if type != SENTINEL
         | 
| 1103 | 
            +
                  _body[:time_in_force] = time_in_force if time_in_force != SENTINEL
         | 
| 1104 | 
            +
                  _body[:amount] = amount if amount != SENTINEL
         | 
| 1105 | 
            +
                  _body[:limit_price] = limit_price if limit_price != SENTINEL
         | 
| 1106 | 
            +
                  _body[:stop_price] = stop_price if stop_price != SENTINEL
         | 
| 1107 | 
            +
                  _body[:post_only] = post_only if post_only != SENTINEL
         | 
| 1108 | 
            +
                  _body[:expiration_date] = expiration_date if expiration_date != SENTINEL
         | 
| 1109 | 
            +
                  trading_place_simple_order_request = _body
         | 
| 1110 | 
            +
                  data, _status_code, _headers = place_simple_order_with_http_info_impl(user_id, user_secret, account_id, trading_place_simple_order_request, extra)
         | 
| 1111 | 
            +
                  data
         | 
| 1112 | 
            +
                end
         | 
| 1113 | 
            +
             | 
| 1114 | 
            +
                # Place order
         | 
| 1115 | 
            +
                #
         | 
| 1116 | 
            +
                # Places an order in the specified account.
         | 
| 1117 | 
            +
                # This endpoint does not compute the impact to the account balance from the order before submitting the order.
         | 
| 1118 | 
            +
                #
         | 
| 1119 | 
            +
                # @param instrument [TradingInstrument] 
         | 
| 1120 | 
            +
                # @param side [ActionStrict] The action describes the intent or side of a trade. This is either `BUY` or `SELL`.
         | 
| 1121 | 
            +
                # @param type [Type] The type of order to place.
         | 
| 1122 | 
            +
                # @param time_in_force [SimpleOrderRequestBodyTimeInForce] The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. - `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. - `GTD` - Good Til Date. The order is valid until the specified date. 
         | 
| 1123 | 
            +
                # @param amount [Float] The amount of the base currency to buy or sell.
         | 
| 1124 | 
            +
                # @param user_id [String] 
         | 
| 1125 | 
            +
                # @param user_secret [String] 
         | 
| 1126 | 
            +
                # @param account_id [String] 
         | 
| 1127 | 
            +
                # @param limit_price [Float] The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT or TAKE_PROFIT_LIMIT.
         | 
| 1128 | 
            +
                # @param stop_price [Float] The stop price. Required if the order type is STOP_LOSS_MARKET, STOP_LOSS_LIMIT, TAKE_PROFIT_MARKET or TAKE_PROFIT_LIMIT.
         | 
| 1129 | 
            +
                # @param post_only [Boolean] Valid and required only for order type LIMIT. If true orders that would be filled immediately are rejected to avoid incurring TAKER fees. 
         | 
| 1130 | 
            +
                # @param expiration_date [Time] The expiration date of the order. Required if the time_in_force is GTD.
         | 
| 1131 | 
            +
                # @param body [TradingPlaceSimpleOrderRequest] 
         | 
| 1132 | 
            +
                # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
         | 
| 1133 | 
            +
                def place_simple_order_with_http_info(instrument:, side:, type:, time_in_force:, amount:, user_id:, user_secret:, account_id:, limit_price: SENTINEL, stop_price: SENTINEL, post_only: SENTINEL, expiration_date: SENTINEL, extra: {})
         | 
| 1134 | 
            +
                  _body = {}
         | 
| 1135 | 
            +
                  _body[:instrument] = instrument if instrument != SENTINEL
         | 
| 1136 | 
            +
                  _body[:side] = side if side != SENTINEL
         | 
| 1137 | 
            +
                  _body[:type] = type if type != SENTINEL
         | 
| 1138 | 
            +
                  _body[:time_in_force] = time_in_force if time_in_force != SENTINEL
         | 
| 1139 | 
            +
                  _body[:amount] = amount if amount != SENTINEL
         | 
| 1140 | 
            +
                  _body[:limit_price] = limit_price if limit_price != SENTINEL
         | 
| 1141 | 
            +
                  _body[:stop_price] = stop_price if stop_price != SENTINEL
         | 
| 1142 | 
            +
                  _body[:post_only] = post_only if post_only != SENTINEL
         | 
| 1143 | 
            +
                  _body[:expiration_date] = expiration_date if expiration_date != SENTINEL
         | 
| 1144 | 
            +
                  trading_place_simple_order_request = _body
         | 
| 1145 | 
            +
                  place_simple_order_with_http_info_impl(user_id, user_secret, account_id, trading_place_simple_order_request, extra)
         | 
| 1146 | 
            +
                end
         | 
| 1147 | 
            +
             | 
| 1148 | 
            +
                # Place order
         | 
| 1149 | 
            +
                # Places an order in the specified account. This endpoint does not compute the impact to the account balance from the order before submitting the order. 
         | 
| 1150 | 
            +
                # @param user_id [String] 
         | 
| 1151 | 
            +
                # @param user_secret [String] 
         | 
| 1152 | 
            +
                # @param account_id [String] 
         | 
| 1153 | 
            +
                # @param trading_place_simple_order_request [TradingPlaceSimpleOrderRequest] 
         | 
| 1154 | 
            +
                # @param [Hash] opts the optional parameters
         | 
| 1155 | 
            +
                # @return [OrderUpdatedResponse]
         | 
| 1156 | 
            +
                private def place_simple_order_impl(user_id, user_secret, account_id, trading_place_simple_order_request, opts = {})
         | 
| 1157 | 
            +
                  data, _status_code, _headers = place_simple_order_with_http_info(user_id, user_secret, account_id, trading_place_simple_order_request, opts)
         | 
| 1158 | 
            +
                  data
         | 
| 1159 | 
            +
                end
         | 
| 1160 | 
            +
             | 
| 1161 | 
            +
                # Place order
         | 
| 1162 | 
            +
                # Places an order in the specified account. This endpoint does not compute the impact to the account balance from the order before submitting the order. 
         | 
| 1163 | 
            +
                # @param user_id [String] 
         | 
| 1164 | 
            +
                # @param user_secret [String] 
         | 
| 1165 | 
            +
                # @param account_id [String] 
         | 
| 1166 | 
            +
                # @param trading_place_simple_order_request [TradingPlaceSimpleOrderRequest] 
         | 
| 1167 | 
            +
                # @param [Hash] opts the optional parameters
         | 
| 1168 | 
            +
                # @return [Array<(OrderUpdatedResponse, Integer, Hash)>] OrderUpdatedResponse data, response status code and response headers
         | 
| 1169 | 
            +
                private def place_simple_order_with_http_info_impl(user_id, user_secret, account_id, trading_place_simple_order_request, opts = {})
         | 
| 1170 | 
            +
                  if @api_client.config.debugging
         | 
| 1171 | 
            +
                    @api_client.config.logger.debug 'Calling API: TradingApi.place_simple_order ...'
         | 
| 1172 | 
            +
                  end
         | 
| 1173 | 
            +
                  # verify the required parameter 'user_id' is set
         | 
| 1174 | 
            +
                  if @api_client.config.client_side_validation && user_id.nil?
         | 
| 1175 | 
            +
                    fail ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.place_simple_order"
         | 
| 1176 | 
            +
                  end
         | 
| 1177 | 
            +
                  # verify the required parameter 'user_secret' is set
         | 
| 1178 | 
            +
                  if @api_client.config.client_side_validation && user_secret.nil?
         | 
| 1179 | 
            +
                    fail ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.place_simple_order"
         | 
| 1180 | 
            +
                  end
         | 
| 1181 | 
            +
                  # verify the required parameter 'account_id' is set
         | 
| 1182 | 
            +
                  if @api_client.config.client_side_validation && account_id.nil?
         | 
| 1183 | 
            +
                    fail ArgumentError, "Missing the required parameter 'account_id' when calling TradingApi.place_simple_order"
         | 
| 1184 | 
            +
                  end
         | 
| 1185 | 
            +
                  # verify the required parameter 'trading_place_simple_order_request' is set
         | 
| 1186 | 
            +
                  if @api_client.config.client_side_validation && trading_place_simple_order_request.nil?
         | 
| 1187 | 
            +
                    fail ArgumentError, "Missing the required parameter 'trading_place_simple_order_request' when calling TradingApi.place_simple_order"
         | 
| 1188 | 
            +
                  end
         | 
| 1189 | 
            +
                  # resource path
         | 
| 1190 | 
            +
                  local_var_path = '/accounts/{accountId}/trading/simple'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
         | 
| 1191 | 
            +
             | 
| 1192 | 
            +
                  # query parameters
         | 
| 1193 | 
            +
                  query_params = opts[:query_params] || {}
         | 
| 1194 | 
            +
                  query_params[:'userId'] = user_id
         | 
| 1195 | 
            +
                  query_params[:'userSecret'] = user_secret
         | 
| 1196 | 
            +
             | 
| 1197 | 
            +
                  # header parameters
         | 
| 1198 | 
            +
                  header_params = opts[:header_params] || {}
         | 
| 1199 | 
            +
                  # HTTP header 'Accept' (if needed)
         | 
| 1200 | 
            +
                  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
         | 
| 1201 | 
            +
                  # HTTP header 'Content-Type'
         | 
| 1202 | 
            +
                  content_type = @api_client.select_header_content_type(['application/json'])
         | 
| 1203 | 
            +
                  if !content_type.nil?
         | 
| 1204 | 
            +
                    header_params['Content-Type'] = content_type
         | 
| 1205 | 
            +
                  end
         | 
| 1206 | 
            +
             | 
| 1207 | 
            +
                  # form parameters
         | 
| 1208 | 
            +
                  form_params = opts[:form_params] || {}
         | 
| 1209 | 
            +
             | 
| 1210 | 
            +
                  # http body (model)
         | 
| 1211 | 
            +
                  post_body = opts[:debug_body] || @api_client.object_to_http_body(trading_place_simple_order_request)
         | 
| 1212 | 
            +
             | 
| 1213 | 
            +
                  # return_type
         | 
| 1214 | 
            +
                  return_type = opts[:debug_return_type] || 'OrderUpdatedResponse'
         | 
| 1215 | 
            +
             | 
| 1216 | 
            +
                  # auth_names
         | 
| 1217 | 
            +
                  auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
         | 
| 1218 | 
            +
             | 
| 1219 | 
            +
                  new_options = opts.merge(
         | 
| 1220 | 
            +
                    :operation => :"TradingApi.place_simple_order",
         | 
| 1221 | 
            +
                    :header_params => header_params,
         | 
| 1222 | 
            +
                    :query_params => query_params,
         | 
| 1223 | 
            +
                    :form_params => form_params,
         | 
| 1224 | 
            +
                    :body => post_body,
         | 
| 1225 | 
            +
                    :auth_names => auth_names,
         | 
| 1226 | 
            +
                    :return_type => return_type
         | 
| 1227 | 
            +
                  )
         | 
| 1228 | 
            +
             | 
| 1229 | 
            +
                  data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
         | 
| 1230 | 
            +
                  if @api_client.config.debugging
         | 
| 1231 | 
            +
                    @api_client.config.logger.debug "API called: TradingApi#place_simple_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
         | 
| 1232 | 
            +
                  end
         | 
| 1233 | 
            +
                  return data, status_code, headers, response
         | 
| 1234 | 
            +
                end
         | 
| 1235 | 
            +
             | 
| 1236 | 
            +
             | 
| 1237 | 
            +
                # Preview order
         | 
| 1238 | 
            +
                #
         | 
| 1239 | 
            +
                # Previews an order using the specified account.
         | 
| 1240 | 
            +
                #
         | 
| 1241 | 
            +
                # @param instrument [TradingInstrument] 
         | 
| 1242 | 
            +
                # @param side [ActionStrict] The action describes the intent or side of a trade. This is either `BUY` or `SELL`.
         | 
| 1243 | 
            +
                # @param type [Type] The type of order to place.
         | 
| 1244 | 
            +
                # @param time_in_force [SimpleOrderRequestBodyTimeInForce] The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. - `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. - `GTD` - Good Til Date. The order is valid until the specified date. 
         | 
| 1245 | 
            +
                # @param amount [Float] The amount of the base currency to buy or sell.
         | 
| 1246 | 
            +
                # @param user_id [String] 
         | 
| 1247 | 
            +
                # @param user_secret [String] 
         | 
| 1248 | 
            +
                # @param account_id [String] 
         | 
| 1249 | 
            +
                # @param limit_price [Float] The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT or TAKE_PROFIT_LIMIT.
         | 
| 1250 | 
            +
                # @param stop_price [Float] The stop price. Required if the order type is STOP_LOSS_MARKET, STOP_LOSS_LIMIT, TAKE_PROFIT_MARKET or TAKE_PROFIT_LIMIT.
         | 
| 1251 | 
            +
                # @param post_only [Boolean] Valid and required only for order type LIMIT. If true orders that would be filled immediately are rejected to avoid incurring TAKER fees. 
         | 
| 1252 | 
            +
                # @param expiration_date [Time] The expiration date of the order. Required if the time_in_force is GTD.
         | 
| 1253 | 
            +
                # @param body [TradingPlaceSimpleOrderRequest] 
         | 
| 1254 | 
            +
                # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
         | 
| 1255 | 
            +
                def preview_simple_order(instrument:, side:, type:, time_in_force:, amount:, user_id:, user_secret:, account_id:, limit_price: SENTINEL, stop_price: SENTINEL, post_only: SENTINEL, expiration_date: SENTINEL, extra: {})
         | 
| 1256 | 
            +
                  _body = {}
         | 
| 1257 | 
            +
                  _body[:instrument] = instrument if instrument != SENTINEL
         | 
| 1258 | 
            +
                  _body[:side] = side if side != SENTINEL
         | 
| 1259 | 
            +
                  _body[:type] = type if type != SENTINEL
         | 
| 1260 | 
            +
                  _body[:time_in_force] = time_in_force if time_in_force != SENTINEL
         | 
| 1261 | 
            +
                  _body[:amount] = amount if amount != SENTINEL
         | 
| 1262 | 
            +
                  _body[:limit_price] = limit_price if limit_price != SENTINEL
         | 
| 1263 | 
            +
                  _body[:stop_price] = stop_price if stop_price != SENTINEL
         | 
| 1264 | 
            +
                  _body[:post_only] = post_only if post_only != SENTINEL
         | 
| 1265 | 
            +
                  _body[:expiration_date] = expiration_date if expiration_date != SENTINEL
         | 
| 1266 | 
            +
                  trading_place_simple_order_request = _body
         | 
| 1267 | 
            +
                  data, _status_code, _headers = preview_simple_order_with_http_info_impl(user_id, user_secret, account_id, trading_place_simple_order_request, extra)
         | 
| 1268 | 
            +
                  data
         | 
| 1269 | 
            +
                end
         | 
| 1270 | 
            +
             | 
| 1271 | 
            +
                # Preview order
         | 
| 1272 | 
            +
                #
         | 
| 1273 | 
            +
                # Previews an order using the specified account.
         | 
| 1274 | 
            +
                #
         | 
| 1275 | 
            +
                # @param instrument [TradingInstrument] 
         | 
| 1276 | 
            +
                # @param side [ActionStrict] The action describes the intent or side of a trade. This is either `BUY` or `SELL`.
         | 
| 1277 | 
            +
                # @param type [Type] The type of order to place.
         | 
| 1278 | 
            +
                # @param time_in_force [SimpleOrderRequestBodyTimeInForce] The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. - `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. - `GTD` - Good Til Date. The order is valid until the specified date. 
         | 
| 1279 | 
            +
                # @param amount [Float] The amount of the base currency to buy or sell.
         | 
| 1280 | 
            +
                # @param user_id [String] 
         | 
| 1281 | 
            +
                # @param user_secret [String] 
         | 
| 1282 | 
            +
                # @param account_id [String] 
         | 
| 1283 | 
            +
                # @param limit_price [Float] The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT or TAKE_PROFIT_LIMIT.
         | 
| 1284 | 
            +
                # @param stop_price [Float] The stop price. Required if the order type is STOP_LOSS_MARKET, STOP_LOSS_LIMIT, TAKE_PROFIT_MARKET or TAKE_PROFIT_LIMIT.
         | 
| 1285 | 
            +
                # @param post_only [Boolean] Valid and required only for order type LIMIT. If true orders that would be filled immediately are rejected to avoid incurring TAKER fees. 
         | 
| 1286 | 
            +
                # @param expiration_date [Time] The expiration date of the order. Required if the time_in_force is GTD.
         | 
| 1287 | 
            +
                # @param body [TradingPlaceSimpleOrderRequest] 
         | 
| 1288 | 
            +
                # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
         | 
| 1289 | 
            +
                def preview_simple_order_with_http_info(instrument:, side:, type:, time_in_force:, amount:, user_id:, user_secret:, account_id:, limit_price: SENTINEL, stop_price: SENTINEL, post_only: SENTINEL, expiration_date: SENTINEL, extra: {})
         | 
| 1290 | 
            +
                  _body = {}
         | 
| 1291 | 
            +
                  _body[:instrument] = instrument if instrument != SENTINEL
         | 
| 1292 | 
            +
                  _body[:side] = side if side != SENTINEL
         | 
| 1293 | 
            +
                  _body[:type] = type if type != SENTINEL
         | 
| 1294 | 
            +
                  _body[:time_in_force] = time_in_force if time_in_force != SENTINEL
         | 
| 1295 | 
            +
                  _body[:amount] = amount if amount != SENTINEL
         | 
| 1296 | 
            +
                  _body[:limit_price] = limit_price if limit_price != SENTINEL
         | 
| 1297 | 
            +
                  _body[:stop_price] = stop_price if stop_price != SENTINEL
         | 
| 1298 | 
            +
                  _body[:post_only] = post_only if post_only != SENTINEL
         | 
| 1299 | 
            +
                  _body[:expiration_date] = expiration_date if expiration_date != SENTINEL
         | 
| 1300 | 
            +
                  trading_place_simple_order_request = _body
         | 
| 1301 | 
            +
                  preview_simple_order_with_http_info_impl(user_id, user_secret, account_id, trading_place_simple_order_request, extra)
         | 
| 1302 | 
            +
                end
         | 
| 1303 | 
            +
             | 
| 1304 | 
            +
                # Preview order
         | 
| 1305 | 
            +
                # Previews an order using the specified account. 
         | 
| 1306 | 
            +
                # @param user_id [String] 
         | 
| 1307 | 
            +
                # @param user_secret [String] 
         | 
| 1308 | 
            +
                # @param account_id [String] 
         | 
| 1309 | 
            +
                # @param trading_place_simple_order_request [TradingPlaceSimpleOrderRequest] 
         | 
| 1310 | 
            +
                # @param [Hash] opts the optional parameters
         | 
| 1311 | 
            +
                # @return [SimpleOrderPreview]
         | 
| 1312 | 
            +
                private def preview_simple_order_impl(user_id, user_secret, account_id, trading_place_simple_order_request, opts = {})
         | 
| 1313 | 
            +
                  data, _status_code, _headers = preview_simple_order_with_http_info(user_id, user_secret, account_id, trading_place_simple_order_request, opts)
         | 
| 1314 | 
            +
                  data
         | 
| 1315 | 
            +
                end
         | 
| 1316 | 
            +
             | 
| 1317 | 
            +
                # Preview order
         | 
| 1318 | 
            +
                # Previews an order using the specified account. 
         | 
| 1319 | 
            +
                # @param user_id [String] 
         | 
| 1320 | 
            +
                # @param user_secret [String] 
         | 
| 1321 | 
            +
                # @param account_id [String] 
         | 
| 1322 | 
            +
                # @param trading_place_simple_order_request [TradingPlaceSimpleOrderRequest] 
         | 
| 1323 | 
            +
                # @param [Hash] opts the optional parameters
         | 
| 1324 | 
            +
                # @return [Array<(SimpleOrderPreview, Integer, Hash)>] SimpleOrderPreview data, response status code and response headers
         | 
| 1325 | 
            +
                private def preview_simple_order_with_http_info_impl(user_id, user_secret, account_id, trading_place_simple_order_request, opts = {})
         | 
| 1326 | 
            +
                  if @api_client.config.debugging
         | 
| 1327 | 
            +
                    @api_client.config.logger.debug 'Calling API: TradingApi.preview_simple_order ...'
         | 
| 1328 | 
            +
                  end
         | 
| 1329 | 
            +
                  # verify the required parameter 'user_id' is set
         | 
| 1330 | 
            +
                  if @api_client.config.client_side_validation && user_id.nil?
         | 
| 1331 | 
            +
                    fail ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.preview_simple_order"
         | 
| 1332 | 
            +
                  end
         | 
| 1333 | 
            +
                  # verify the required parameter 'user_secret' is set
         | 
| 1334 | 
            +
                  if @api_client.config.client_side_validation && user_secret.nil?
         | 
| 1335 | 
            +
                    fail ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.preview_simple_order"
         | 
| 1336 | 
            +
                  end
         | 
| 1337 | 
            +
                  # verify the required parameter 'account_id' is set
         | 
| 1338 | 
            +
                  if @api_client.config.client_side_validation && account_id.nil?
         | 
| 1339 | 
            +
                    fail ArgumentError, "Missing the required parameter 'account_id' when calling TradingApi.preview_simple_order"
         | 
| 1340 | 
            +
                  end
         | 
| 1341 | 
            +
                  # verify the required parameter 'trading_place_simple_order_request' is set
         | 
| 1342 | 
            +
                  if @api_client.config.client_side_validation && trading_place_simple_order_request.nil?
         | 
| 1343 | 
            +
                    fail ArgumentError, "Missing the required parameter 'trading_place_simple_order_request' when calling TradingApi.preview_simple_order"
         | 
| 1344 | 
            +
                  end
         | 
| 1345 | 
            +
                  # resource path
         | 
| 1346 | 
            +
                  local_var_path = '/accounts/{accountId}/trading/simple/preview'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
         | 
| 1347 | 
            +
             | 
| 1348 | 
            +
                  # query parameters
         | 
| 1349 | 
            +
                  query_params = opts[:query_params] || {}
         | 
| 1350 | 
            +
                  query_params[:'userId'] = user_id
         | 
| 1351 | 
            +
                  query_params[:'userSecret'] = user_secret
         | 
| 1352 | 
            +
             | 
| 1353 | 
            +
                  # header parameters
         | 
| 1354 | 
            +
                  header_params = opts[:header_params] || {}
         | 
| 1355 | 
            +
                  # HTTP header 'Accept' (if needed)
         | 
| 1356 | 
            +
                  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
         | 
| 1357 | 
            +
                  # HTTP header 'Content-Type'
         | 
| 1358 | 
            +
                  content_type = @api_client.select_header_content_type(['application/json'])
         | 
| 1359 | 
            +
                  if !content_type.nil?
         | 
| 1360 | 
            +
                    header_params['Content-Type'] = content_type
         | 
| 1361 | 
            +
                  end
         | 
| 1362 | 
            +
             | 
| 1363 | 
            +
                  # form parameters
         | 
| 1364 | 
            +
                  form_params = opts[:form_params] || {}
         | 
| 1365 | 
            +
             | 
| 1366 | 
            +
                  # http body (model)
         | 
| 1367 | 
            +
                  post_body = opts[:debug_body] || @api_client.object_to_http_body(trading_place_simple_order_request)
         | 
| 1368 | 
            +
             | 
| 1369 | 
            +
                  # return_type
         | 
| 1370 | 
            +
                  return_type = opts[:debug_return_type] || 'SimpleOrderPreview'
         | 
| 1371 | 
            +
             | 
| 1372 | 
            +
                  # auth_names
         | 
| 1373 | 
            +
                  auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
         | 
| 1374 | 
            +
             | 
| 1375 | 
            +
                  new_options = opts.merge(
         | 
| 1376 | 
            +
                    :operation => :"TradingApi.preview_simple_order",
         | 
| 1377 | 
            +
                    :header_params => header_params,
         | 
| 1378 | 
            +
                    :query_params => query_params,
         | 
| 1379 | 
            +
                    :form_params => form_params,
         | 
| 1380 | 
            +
                    :body => post_body,
         | 
| 1381 | 
            +
                    :auth_names => auth_names,
         | 
| 1382 | 
            +
                    :return_type => return_type
         | 
| 1383 | 
            +
                  )
         | 
| 1384 | 
            +
             | 
| 1385 | 
            +
                  data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
         | 
| 1386 | 
            +
                  if @api_client.config.debugging
         | 
| 1387 | 
            +
                    @api_client.config.logger.debug "API called: TradingApi#preview_simple_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
         | 
| 1388 | 
            +
                  end
         | 
| 1389 | 
            +
                  return data, status_code, headers, response
         | 
| 1390 | 
            +
                end
         | 
| 1391 | 
            +
             | 
| 1392 | 
            +
             | 
| 1393 | 
            +
                # Replaces an order with a new one
         | 
| 1394 | 
            +
                #
         | 
| 1395 | 
            +
                # Replaces an existing pending order with a new one. The way this works is brokerage dependent, but usually involves cancelling
         | 
| 1396 | 
            +
                # the existing order and placing a new one. The order's brokerage_order_id may or may not change, be sure to use the one
         | 
| 1397 | 
            +
                # returned in the response going forward. Only supported on some brokerages
         | 
| 1398 | 
            +
                #
         | 
| 1399 | 
            +
                # @param action [ActionStrict] The action describes the intent or side of a trade. This is either `BUY` or `SELL`.
         | 
| 1400 | 
            +
                # @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. 
         | 
| 1401 | 
            +
                # @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. 
         | 
| 1402 | 
            +
                # @param account_id [String] The ID of the account to execute the trade on.
         | 
| 1403 | 
            +
                # @param brokerage_order_id [String] The Brokerage Order ID of the order to replace.
         | 
| 1404 | 
            +
                # @param user_id [String] 
         | 
| 1405 | 
            +
                # @param user_secret [String] 
         | 
| 1406 | 
            +
                # @param price [Float] The limit price for `Limit` and `StopLimit` orders.
         | 
| 1407 | 
            +
                # @param stop [Float] The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
         | 
| 1408 | 
            +
                # @param units [Float] 
         | 
| 1409 | 
            +
                # @param body [ManualTradeReplaceForm] 
         | 
| 1410 | 
            +
                # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
         | 
| 1411 | 
            +
                def replace_order(action:, order_type:, time_in_force:, account_id:, brokerage_order_id:, user_id:, user_secret:, price: SENTINEL, stop: SENTINEL, units: SENTINEL, extra: {})
         | 
| 1412 | 
            +
                  _body = {}
         | 
| 1413 | 
            +
                  _body[:action] = action if action != SENTINEL
         | 
| 1414 | 
            +
                  _body[:order_type] = order_type if order_type != SENTINEL
         | 
| 1415 | 
            +
                  _body[:time_in_force] = time_in_force if time_in_force != SENTINEL
         | 
| 1416 | 
            +
                  _body[:price] = price if price != SENTINEL
         | 
| 1417 | 
            +
                  _body[:stop] = stop if stop != SENTINEL
         | 
| 1418 | 
            +
                  _body[:units] = units if units != SENTINEL
         | 
| 1419 | 
            +
                  manual_trade_replace_form = _body
         | 
| 1420 | 
            +
                  data, _status_code, _headers = replace_order_with_http_info_impl(account_id, brokerage_order_id, user_id, user_secret, manual_trade_replace_form, extra)
         | 
| 1421 | 
            +
                  data
         | 
| 1422 | 
            +
                end
         | 
| 1423 | 
            +
             | 
| 1424 | 
            +
                # Replaces an order with a new one
         | 
| 1425 | 
            +
                #
         | 
| 1426 | 
            +
                # Replaces an existing pending order with a new one. The way this works is brokerage dependent, but usually involves cancelling
         | 
| 1427 | 
            +
                # the existing order and placing a new one. The order's brokerage_order_id may or may not change, be sure to use the one
         | 
| 1428 | 
            +
                # returned in the response going forward. Only supported on some brokerages
         | 
| 1429 | 
            +
                #
         | 
| 1430 | 
            +
                # @param action [ActionStrict] The action describes the intent or side of a trade. This is either `BUY` or `SELL`.
         | 
| 1431 | 
            +
                # @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. 
         | 
| 1432 | 
            +
                # @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. 
         | 
| 1433 | 
            +
                # @param account_id [String] The ID of the account to execute the trade on.
         | 
| 1434 | 
            +
                # @param brokerage_order_id [String] The Brokerage Order ID of the order to replace.
         | 
| 1435 | 
            +
                # @param user_id [String] 
         | 
| 1436 | 
            +
                # @param user_secret [String] 
         | 
| 1437 | 
            +
                # @param price [Float] The limit price for `Limit` and `StopLimit` orders.
         | 
| 1438 | 
            +
                # @param stop [Float] The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
         | 
| 1439 | 
            +
                # @param units [Float] 
         | 
| 1440 | 
            +
                # @param body [ManualTradeReplaceForm] 
         | 
| 1441 | 
            +
                # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
         | 
| 1442 | 
            +
                def replace_order_with_http_info(action:, order_type:, time_in_force:, account_id:, brokerage_order_id:, user_id:, user_secret:, price: SENTINEL, stop: SENTINEL, units: SENTINEL, extra: {})
         | 
| 1443 | 
            +
                  _body = {}
         | 
| 1444 | 
            +
                  _body[:action] = action if action != SENTINEL
         | 
| 1445 | 
            +
                  _body[:order_type] = order_type if order_type != SENTINEL
         | 
| 1446 | 
            +
                  _body[:time_in_force] = time_in_force if time_in_force != SENTINEL
         | 
| 1447 | 
            +
                  _body[:price] = price if price != SENTINEL
         | 
| 1448 | 
            +
                  _body[:stop] = stop if stop != SENTINEL
         | 
| 1449 | 
            +
                  _body[:units] = units if units != SENTINEL
         | 
| 1450 | 
            +
                  manual_trade_replace_form = _body
         | 
| 1451 | 
            +
                  replace_order_with_http_info_impl(account_id, brokerage_order_id, user_id, user_secret, manual_trade_replace_form, extra)
         | 
| 1452 | 
            +
                end
         | 
| 1453 | 
            +
             | 
| 1454 | 
            +
                # Replaces an order with a new one
         | 
| 1455 | 
            +
                # Replaces an existing pending order with a new one. The way this works is brokerage dependent, but usually involves cancelling the existing order and placing a new one. The order's brokerage_order_id may or may not change, be sure to use the one returned in the response going forward. Only supported on some brokerages 
         | 
| 1456 | 
            +
                # @param account_id [String] The ID of the account to execute the trade on.
         | 
| 1457 | 
            +
                # @param brokerage_order_id [String] The Brokerage Order ID of the order to replace.
         | 
| 1458 | 
            +
                # @param user_id [String] 
         | 
| 1459 | 
            +
                # @param user_secret [String] 
         | 
| 1460 | 
            +
                # @param manual_trade_replace_form [ManualTradeReplaceForm] 
         | 
| 1461 | 
            +
                # @param [Hash] opts the optional parameters
         | 
| 1462 | 
            +
                # @return [AccountOrderRecord]
         | 
| 1463 | 
            +
                private def replace_order_impl(account_id, brokerage_order_id, user_id, user_secret, manual_trade_replace_form, opts = {})
         | 
| 1464 | 
            +
                  data, _status_code, _headers = replace_order_with_http_info(account_id, brokerage_order_id, user_id, user_secret, manual_trade_replace_form, opts)
         | 
| 1465 | 
            +
                  data
         | 
| 1466 | 
            +
                end
         | 
| 1467 | 
            +
             | 
| 1468 | 
            +
                # Replaces an order with a new one
         | 
| 1469 | 
            +
                # Replaces an existing pending order with a new one. The way this works is brokerage dependent, but usually involves cancelling the existing order and placing a new one. The order's brokerage_order_id may or may not change, be sure to use the one returned in the response going forward. Only supported on some brokerages 
         | 
| 1470 | 
            +
                # @param account_id [String] The ID of the account to execute the trade on.
         | 
| 1471 | 
            +
                # @param brokerage_order_id [String] The Brokerage Order ID of the order to replace.
         | 
| 1472 | 
            +
                # @param user_id [String] 
         | 
| 1473 | 
            +
                # @param user_secret [String] 
         | 
| 1474 | 
            +
                # @param manual_trade_replace_form [ManualTradeReplaceForm] 
         | 
| 1475 | 
            +
                # @param [Hash] opts the optional parameters
         | 
| 1476 | 
            +
                # @return [Array<(AccountOrderRecord, Integer, Hash)>] AccountOrderRecord data, response status code and response headers
         | 
| 1477 | 
            +
                private def replace_order_with_http_info_impl(account_id, brokerage_order_id, user_id, user_secret, manual_trade_replace_form, opts = {})
         | 
| 1478 | 
            +
                  if @api_client.config.debugging
         | 
| 1479 | 
            +
                    @api_client.config.logger.debug 'Calling API: TradingApi.replace_order ...'
         | 
| 1480 | 
            +
                  end
         | 
| 1481 | 
            +
                  # verify the required parameter 'account_id' is set
         | 
| 1482 | 
            +
                  if @api_client.config.client_side_validation && account_id.nil?
         | 
| 1483 | 
            +
                    fail ArgumentError, "Missing the required parameter 'account_id' when calling TradingApi.replace_order"
         | 
| 1484 | 
            +
                  end
         | 
| 1485 | 
            +
                  # verify the required parameter 'brokerage_order_id' is set
         | 
| 1486 | 
            +
                  if @api_client.config.client_side_validation && brokerage_order_id.nil?
         | 
| 1487 | 
            +
                    fail ArgumentError, "Missing the required parameter 'brokerage_order_id' when calling TradingApi.replace_order"
         | 
| 1488 | 
            +
                  end
         | 
| 1489 | 
            +
                  # verify the required parameter 'user_id' is set
         | 
| 1490 | 
            +
                  if @api_client.config.client_side_validation && user_id.nil?
         | 
| 1491 | 
            +
                    fail ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.replace_order"
         | 
| 1492 | 
            +
                  end
         | 
| 1493 | 
            +
                  # verify the required parameter 'user_secret' is set
         | 
| 1494 | 
            +
                  if @api_client.config.client_side_validation && user_secret.nil?
         | 
| 1495 | 
            +
                    fail ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.replace_order"
         | 
| 1496 | 
            +
                  end
         | 
| 1497 | 
            +
                  # verify the required parameter 'manual_trade_replace_form' is set
         | 
| 1498 | 
            +
                  if @api_client.config.client_side_validation && manual_trade_replace_form.nil?
         | 
| 1499 | 
            +
                    fail ArgumentError, "Missing the required parameter 'manual_trade_replace_form' when calling TradingApi.replace_order"
         | 
| 1500 | 
            +
                  end
         | 
| 1501 | 
            +
                  # resource path
         | 
| 1502 | 
            +
                  local_var_path = '/accounts/{accountId}/trading/simple/{brokerageOrderId}/replace'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'brokerageOrderId' + '}', CGI.escape(brokerage_order_id.to_s))
         | 
| 1503 | 
            +
             | 
| 1504 | 
            +
                  # query parameters
         | 
| 1505 | 
            +
                  query_params = opts[:query_params] || {}
         | 
| 1506 | 
            +
                  query_params[:'userId'] = user_id
         | 
| 1507 | 
            +
                  query_params[:'userSecret'] = user_secret
         | 
| 1508 | 
            +
             | 
| 1509 | 
            +
                  # header parameters
         | 
| 1510 | 
            +
                  header_params = opts[:header_params] || {}
         | 
| 1511 | 
            +
                  # HTTP header 'Accept' (if needed)
         | 
| 1512 | 
            +
                  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
         | 
| 1513 | 
            +
                  # HTTP header 'Content-Type'
         | 
| 1514 | 
            +
                  content_type = @api_client.select_header_content_type(['application/json'])
         | 
| 1515 | 
            +
                  if !content_type.nil?
         | 
| 1516 | 
            +
                    header_params['Content-Type'] = content_type
         | 
| 1517 | 
            +
                  end
         | 
| 1518 | 
            +
             | 
| 1519 | 
            +
                  # form parameters
         | 
| 1520 | 
            +
                  form_params = opts[:form_params] || {}
         | 
| 1521 | 
            +
             | 
| 1522 | 
            +
                  # http body (model)
         | 
| 1523 | 
            +
                  post_body = opts[:debug_body] || @api_client.object_to_http_body(manual_trade_replace_form)
         | 
| 1524 | 
            +
             | 
| 1525 | 
            +
                  # return_type
         | 
| 1526 | 
            +
                  return_type = opts[:debug_return_type] || 'AccountOrderRecord'
         | 
| 1527 | 
            +
             | 
| 1528 | 
            +
                  # auth_names
         | 
| 1529 | 
            +
                  auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
         | 
| 1530 | 
            +
             | 
| 1531 | 
            +
                  new_options = opts.merge(
         | 
| 1532 | 
            +
                    :operation => :"TradingApi.replace_order",
         | 
| 1533 | 
            +
                    :header_params => header_params,
         | 
| 1534 | 
            +
                    :query_params => query_params,
         | 
| 1535 | 
            +
                    :form_params => form_params,
         | 
| 1536 | 
            +
                    :body => post_body,
         | 
| 1537 | 
            +
                    :auth_names => auth_names,
         | 
| 1538 | 
            +
                    :return_type => return_type
         | 
| 1539 | 
            +
                  )
         | 
| 1540 | 
            +
             | 
| 1541 | 
            +
                  data, status_code, headers, response = @api_client.call_api(:PATCH, local_var_path, new_options)
         | 
| 1542 | 
            +
                  if @api_client.config.debugging
         | 
| 1543 | 
            +
                    @api_client.config.logger.debug "API called: TradingApi#replace_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
         | 
| 1544 | 
            +
                  end
         | 
| 1545 | 
            +
                  return data, status_code, headers, response
         | 
| 1546 | 
            +
                end
         | 
| 1547 | 
            +
             | 
| 1548 | 
            +
             | 
| 1549 | 
            +
                # Search cryptocurrency pairs instruments
         | 
| 1550 | 
            +
                #
         | 
| 1551 | 
            +
                # Searches cryptocurrency pairs instruments accessible to the specified account.
         | 
| 1552 | 
            +
                #
         | 
| 1553 | 
            +
                # @param user_id [String] 
         | 
| 1554 | 
            +
                # @param user_secret [String] 
         | 
| 1555 | 
            +
                # @param account_id [String] 
         | 
| 1556 | 
            +
                # @param base [String] 
         | 
| 1557 | 
            +
                # @param quote [String] 
         | 
| 1558 | 
            +
                # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
         | 
| 1559 | 
            +
                def search_cryptocurrency_pair_instruments(user_id:, user_secret:, account_id:, base: SENTINEL, quote: SENTINEL, extra: {})
         | 
| 1560 | 
            +
                  extra[:base] = base if base != SENTINEL
         | 
| 1561 | 
            +
                  extra[:quote] = quote if quote != SENTINEL
         | 
| 1562 | 
            +
                  data, _status_code, _headers = search_cryptocurrency_pair_instruments_with_http_info_impl(user_id, user_secret, account_id, extra)
         | 
| 1563 | 
            +
                  data
         | 
| 1564 | 
            +
                end
         | 
| 1565 | 
            +
             | 
| 1566 | 
            +
                # Search cryptocurrency pairs instruments
         | 
| 1567 | 
            +
                #
         | 
| 1568 | 
            +
                # Searches cryptocurrency pairs instruments accessible to the specified account.
         | 
| 1569 | 
            +
                #
         | 
| 1570 | 
            +
                # @param user_id [String] 
         | 
| 1571 | 
            +
                # @param user_secret [String] 
         | 
| 1572 | 
            +
                # @param account_id [String] 
         | 
| 1573 | 
            +
                # @param base [String] 
         | 
| 1574 | 
            +
                # @param quote [String] 
         | 
| 1575 | 
            +
                # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
         | 
| 1576 | 
            +
                def search_cryptocurrency_pair_instruments_with_http_info(user_id:, user_secret:, account_id:, base: SENTINEL, quote: SENTINEL, extra: {})
         | 
| 1577 | 
            +
                  extra[:base] = base if base != SENTINEL
         | 
| 1578 | 
            +
                  extra[:quote] = quote if quote != SENTINEL
         | 
| 1579 | 
            +
                  search_cryptocurrency_pair_instruments_with_http_info_impl(user_id, user_secret, account_id, extra)
         | 
| 1580 | 
            +
                end
         | 
| 1581 | 
            +
             | 
| 1582 | 
            +
                # Search cryptocurrency pairs instruments
         | 
| 1583 | 
            +
                # Searches cryptocurrency pairs instruments accessible to the specified account. 
         | 
| 1584 | 
            +
                # @param user_id [String] 
         | 
| 1585 | 
            +
                # @param user_secret [String] 
         | 
| 1586 | 
            +
                # @param account_id [String] 
         | 
| 1587 | 
            +
                # @param [Hash] opts the optional parameters
         | 
| 1588 | 
            +
                # @option opts [String] :base 
         | 
| 1589 | 
            +
                # @option opts [String] :quote 
         | 
| 1590 | 
            +
                # @return [TradingSearchCryptocurrencyPairInstruments200Response]
         | 
| 1591 | 
            +
                private def search_cryptocurrency_pair_instruments_impl(user_id, user_secret, account_id, opts = {})
         | 
| 1592 | 
            +
                  data, _status_code, _headers = search_cryptocurrency_pair_instruments_with_http_info(user_id, user_secret, account_id, opts)
         | 
| 1593 | 
            +
                  data
         | 
| 1594 | 
            +
                end
         | 
| 1595 | 
            +
             | 
| 1596 | 
            +
                # Search cryptocurrency pairs instruments
         | 
| 1597 | 
            +
                # Searches cryptocurrency pairs instruments accessible to the specified account. 
         | 
| 1598 | 
            +
                # @param user_id [String] 
         | 
| 1599 | 
            +
                # @param user_secret [String] 
         | 
| 1600 | 
            +
                # @param account_id [String] 
         | 
| 1601 | 
            +
                # @param [Hash] opts the optional parameters
         | 
| 1602 | 
            +
                # @option opts [String] :base 
         | 
| 1603 | 
            +
                # @option opts [String] :quote 
         | 
| 1604 | 
            +
                # @return [Array<(TradingSearchCryptocurrencyPairInstruments200Response, Integer, Hash)>] TradingSearchCryptocurrencyPairInstruments200Response data, response status code and response headers
         | 
| 1605 | 
            +
                private def search_cryptocurrency_pair_instruments_with_http_info_impl(user_id, user_secret, account_id, opts = {})
         | 
| 1606 | 
            +
                  if @api_client.config.debugging
         | 
| 1607 | 
            +
                    @api_client.config.logger.debug 'Calling API: TradingApi.search_cryptocurrency_pair_instruments ...'
         | 
| 1608 | 
            +
                  end
         | 
| 1609 | 
            +
                  # verify the required parameter 'user_id' is set
         | 
| 1610 | 
            +
                  if @api_client.config.client_side_validation && user_id.nil?
         | 
| 1611 | 
            +
                    fail ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.search_cryptocurrency_pair_instruments"
         | 
| 1612 | 
            +
                  end
         | 
| 1613 | 
            +
                  # verify the required parameter 'user_secret' is set
         | 
| 1614 | 
            +
                  if @api_client.config.client_side_validation && user_secret.nil?
         | 
| 1615 | 
            +
                    fail ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.search_cryptocurrency_pair_instruments"
         | 
| 1616 | 
            +
                  end
         | 
| 1617 | 
            +
                  # verify the required parameter 'account_id' is set
         | 
| 1618 | 
            +
                  if @api_client.config.client_side_validation && account_id.nil?
         | 
| 1619 | 
            +
                    fail ArgumentError, "Missing the required parameter 'account_id' when calling TradingApi.search_cryptocurrency_pair_instruments"
         | 
| 1620 | 
            +
                  end
         | 
| 1621 | 
            +
                  # resource path
         | 
| 1622 | 
            +
                  local_var_path = '/accounts/{accountId}/trading/instruments/cryptocurrencyPairs'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
         | 
| 1623 | 
            +
             | 
| 1624 | 
            +
                  # query parameters
         | 
| 1625 | 
            +
                  query_params = opts[:query_params] || {}
         | 
| 1626 | 
            +
                  query_params[:'userId'] = user_id
         | 
| 1627 | 
            +
                  query_params[:'userSecret'] = user_secret
         | 
| 1628 | 
            +
                  query_params[:'base'] = opts[:'base'] if !opts[:'base'].nil?
         | 
| 1629 | 
            +
                  query_params[:'quote'] = opts[:'quote'] if !opts[:'quote'].nil?
         | 
| 1630 | 
            +
             | 
| 1631 | 
            +
                  # header parameters
         | 
| 1632 | 
            +
                  header_params = opts[:header_params] || {}
         | 
| 1633 | 
            +
                  # HTTP header 'Accept' (if needed)
         | 
| 1634 | 
            +
                  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
         | 
| 1635 | 
            +
             | 
| 1636 | 
            +
                  # form parameters
         | 
| 1637 | 
            +
                  form_params = opts[:form_params] || {}
         | 
| 1638 | 
            +
             | 
| 1639 | 
            +
                  # http body (model)
         | 
| 1640 | 
            +
                  post_body = opts[:debug_body]
         | 
| 1641 | 
            +
             | 
| 1642 | 
            +
                  # return_type
         | 
| 1643 | 
            +
                  return_type = opts[:debug_return_type] || 'TradingSearchCryptocurrencyPairInstruments200Response'
         | 
| 1644 | 
            +
             | 
| 1645 | 
            +
                  # auth_names
         | 
| 1646 | 
            +
                  auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
         | 
| 1647 | 
            +
             | 
| 1648 | 
            +
                  new_options = opts.merge(
         | 
| 1649 | 
            +
                    :operation => :"TradingApi.search_cryptocurrency_pair_instruments",
         | 
| 1650 | 
            +
                    :header_params => header_params,
         | 
| 1651 | 
            +
                    :query_params => query_params,
         | 
| 1652 | 
            +
                    :form_params => form_params,
         | 
| 1653 | 
            +
                    :body => post_body,
         | 
| 1654 | 
            +
                    :auth_names => auth_names,
         | 
| 1655 | 
            +
                    :return_type => return_type
         | 
| 1656 | 
            +
                  )
         | 
| 1657 | 
            +
             | 
| 1658 | 
            +
                  data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
         | 
| 1659 | 
            +
                  if @api_client.config.debugging
         | 
| 1660 | 
            +
                    @api_client.config.logger.debug "API called: TradingApi#search_cryptocurrency_pair_instruments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
         | 
| 1661 | 
            +
                  end
         | 
| 1662 | 
            +
                  return data, status_code, headers, response
         | 
| 1663 | 
            +
                end
         | 
| 847 1664 | 
             
              end
         | 
| 848 1665 |  | 
| 849 1666 | 
             
              # top-level client access to avoid having the user to insantiate their own API instances
         |