class SnapTrade::TradingApi

def cancel_order(user_id:, user_secret:, account_id:, brokerage_order_id:, extra: {})

Parameters:
  • extra (Hash) -- additional parameters to pass along through :header_params, :query_params, or parameter name
  • brokerage_order_id (String) --
  • account_id (String) --
  • user_secret (String) --
  • user_id (String) --
def cancel_order(user_id:, user_secret:, account_id:, brokerage_order_id:, extra: {})
  data, _status_code, _headers = cancel_order_with_http_info_impl(user_id, user_secret, account_id, brokerage_order_id, extra)
  data
end

def cancel_order_impl(user_id, user_secret, account_id, brokerage_order_id, opts = {})

Returns:
  • (OrderUpdatedResponse) -

Parameters:
  • opts (Hash) -- the optional parameters
  • brokerage_order_id (String) --
  • account_id (String) --
  • user_secret (String) --
  • user_id (String) --
def cancel_order_impl(user_id, user_secret, account_id, brokerage_order_id, opts = {})
_status_code, _headers = cancel_order_with_http_info(user_id, user_secret, account_id, brokerage_order_id, opts)

def cancel_order_with_http_info(user_id:, user_secret:, account_id:, brokerage_order_id:, extra: {})

Parameters:
  • extra (Hash) -- additional parameters to pass along through :header_params, :query_params, or parameter name
  • brokerage_order_id (String) --
  • account_id (String) --
  • user_secret (String) --
  • user_id (String) --
def cancel_order_with_http_info(user_id:, user_secret:, account_id:, brokerage_order_id:, extra: {})
  cancel_order_with_http_info_impl(user_id, user_secret, account_id, brokerage_order_id, extra)
end

def cancel_order_with_http_info_impl(user_id, user_secret, account_id, brokerage_order_id, opts = {})

Returns:
  • (Array<(OrderUpdatedResponse, Integer, Hash)>) - OrderUpdatedResponse data, response status code and response headers

Parameters:
  • opts (Hash) -- the optional parameters
  • brokerage_order_id (String) --
  • account_id (String) --
  • user_secret (String) --
  • user_id (String) --
def cancel_order_with_http_info_impl(user_id, user_secret, account_id, brokerage_order_id, opts = {})
i_client.config.debugging
_client.config.logger.debug 'Calling API: TradingApi.cancel_order ...'
fy the required parameter 'user_id' is set
i_client.config.client_side_validation && user_id.nil?
 ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.cancel_order"
fy the required parameter 'user_secret' is set
i_client.config.client_side_validation && user_secret.nil?
 ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.cancel_order"
fy the required parameter 'account_id' is set
i_client.config.client_side_validation && account_id.nil?
 ArgumentError, "Missing the required parameter 'account_id' when calling TradingApi.cancel_order"
fy the required parameter 'brokerage_order_id' is set
i_client.config.client_side_validation && brokerage_order_id.nil?
 ArgumentError, "Missing the required parameter 'brokerage_order_id' when calling TradingApi.cancel_order"
urce path
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))
y parameters
params = opts[:query_params] || {}
params[:'userId'] = user_id
params[:'userSecret'] = user_secret
er parameters
_params = opts[:header_params] || {}
 header 'Accept' (if needed)
_params['Accept'] = @api_client.select_header_accept(['application/json'])
 parameters
arams = opts[:form_params] || {}
 body (model)
ody = opts[:debug_body]
rn_type
_type = opts[:debug_return_type] || 'OrderUpdatedResponse'
_names
ames = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
tions = opts.merge(
ration => :"TradingApi.cancel_order",
der_params => header_params,
ry_params => query_params,
m_params => form_params,
y => post_body,
h_names => auth_names,
urn_type => return_type
status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
i_client.config.debugging
_client.config.logger.debug "API called: TradingApi#cancel_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
 data, status_code, headers, response

def cancel_user_account_order(user_id:, user_secret:, account_id:, brokerage_order_id: SENTINEL, extra: {})

Parameters:
  • extra (Hash) -- additional parameters to pass along through :header_params, :query_params, or parameter name
  • body (TradingCancelUserAccountOrderRequest) --
  • brokerage_order_id (String) -- Order ID returned by brokerage. This is the unique identifier for the order in the brokerage system.
  • account_id (String) --
  • user_secret (String) --
  • user_id (String) --
def cancel_user_account_order(user_id:, user_secret:, account_id:, brokerage_order_id: SENTINEL, extra: {})
  _body = {}
  _body[:brokerage_order_id] = brokerage_order_id if brokerage_order_id != SENTINEL
  trading_cancel_user_account_order_request = _body
  data, _status_code, _headers = cancel_user_account_order_with_http_info_impl(user_id, user_secret, account_id, trading_cancel_user_account_order_request, extra)
  data
end

def cancel_user_account_order_impl(user_id, user_secret, account_id, trading_cancel_user_account_order_request, opts = {})

Returns:
  • (AccountOrderRecord) -

Parameters:
  • opts (Hash) -- the optional parameters
  • trading_cancel_user_account_order_request (TradingCancelUserAccountOrderRequest) --
  • account_id (String) --
  • user_secret (String) --
  • user_id (String) --
def cancel_user_account_order_impl(user_id, user_secret, account_id, trading_cancel_user_account_order_request, opts = {})
_status_code, _headers = cancel_user_account_order_with_http_info(user_id, user_secret, account_id, trading_cancel_user_account_order_request, opts)

def cancel_user_account_order_with_http_info(user_id:, user_secret:, account_id:, brokerage_order_id: SENTINEL, extra: {})

Parameters:
  • extra (Hash) -- additional parameters to pass along through :header_params, :query_params, or parameter name
  • body (TradingCancelUserAccountOrderRequest) --
  • brokerage_order_id (String) -- Order ID returned by brokerage. This is the unique identifier for the order in the brokerage system.
  • account_id (String) --
  • user_secret (String) --
  • user_id (String) --
def cancel_user_account_order_with_http_info(user_id:, user_secret:, account_id:, brokerage_order_id: SENTINEL, extra: {})
  _body = {}
  _body[:brokerage_order_id] = brokerage_order_id if brokerage_order_id != SENTINEL
  trading_cancel_user_account_order_request = _body
  cancel_user_account_order_with_http_info_impl(user_id, user_secret, account_id, trading_cancel_user_account_order_request, extra)
end

def cancel_user_account_order_with_http_info_impl(user_id, user_secret, account_id, trading_cancel_user_account_order_request, opts = {})

Returns:
  • (Array<(AccountOrderRecord, Integer, Hash)>) - AccountOrderRecord data, response status code and response headers

Parameters:
  • opts (Hash) -- the optional parameters
  • trading_cancel_user_account_order_request (TradingCancelUserAccountOrderRequest) --
  • account_id (String) --
  • user_secret (String) --
  • user_id (String) --
def cancel_user_account_order_with_http_info_impl(user_id, user_secret, account_id, trading_cancel_user_account_order_request, opts = {})
i_client.config.debugging
_client.config.logger.debug 'Calling API: TradingApi.cancel_user_account_order ...'
fy the required parameter 'user_id' is set
i_client.config.client_side_validation && user_id.nil?
 ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.cancel_user_account_order"
fy the required parameter 'user_secret' is set
i_client.config.client_side_validation && user_secret.nil?
 ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.cancel_user_account_order"
fy the required parameter 'account_id' is set
i_client.config.client_side_validation && account_id.nil?
 ArgumentError, "Missing the required parameter 'account_id' when calling TradingApi.cancel_user_account_order"
fy the required parameter 'trading_cancel_user_account_order_request' is set
i_client.config.client_side_validation && trading_cancel_user_account_order_request.nil?
 ArgumentError, "Missing the required parameter 'trading_cancel_user_account_order_request' when calling TradingApi.cancel_user_account_order"
urce path
var_path = '/accounts/{accountId}/orders/cancel'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
y parameters
params = opts[:query_params] || {}
params[:'userId'] = user_id
params[:'userSecret'] = user_secret
er parameters
_params = opts[:header_params] || {}
 header 'Accept' (if needed)
_params['Accept'] = @api_client.select_header_accept(['application/json'])
 header 'Content-Type'
t_type = @api_client.select_header_content_type(['application/json'])
ntent_type.nil?
er_params['Content-Type'] = content_type
 parameters
arams = opts[:form_params] || {}
 body (model)
ody = opts[:debug_body] || @api_client.object_to_http_body(trading_cancel_user_account_order_request)
rn_type
_type = opts[:debug_return_type] || 'AccountOrderRecord'
_names
ames = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
tions = opts.merge(
ration => :"TradingApi.cancel_user_account_order",
der_params => header_params,
ry_params => query_params,
m_params => form_params,
y => post_body,
h_names => auth_names,
urn_type => return_type
status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
i_client.config.debugging
_client.config.logger.debug "API called: TradingApi#cancel_user_account_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
 data, status_code, headers, response

def get_cryptocurrency_pair_quote(user_id:, user_secret:, account_id:, instrument_symbol:, extra: {})

Parameters:
  • extra (Hash) -- additional parameters to pass along through :header_params, :query_params, or parameter name
  • instrument_symbol (String) --
  • account_id (String) --
  • user_secret (String) --
  • user_id (String) --
def get_cryptocurrency_pair_quote(user_id:, user_secret:, account_id:, instrument_symbol:, extra: {})
  data, _status_code, _headers = get_cryptocurrency_pair_quote_with_http_info_impl(user_id, user_secret, account_id, instrument_symbol, extra)
  data
end

def get_cryptocurrency_pair_quote_impl(user_id, user_secret, account_id, instrument_symbol, opts = {})

Returns:
  • (CryptocurrencyPairQuote) -

Parameters:
  • opts (Hash) -- the optional parameters
  • instrument_symbol (String) --
  • account_id (String) --
  • user_secret (String) --
  • user_id (String) --
def get_cryptocurrency_pair_quote_impl(user_id, user_secret, account_id, instrument_symbol, opts = {})
_status_code, _headers = get_cryptocurrency_pair_quote_with_http_info(user_id, user_secret, account_id, instrument_symbol, opts)

def get_cryptocurrency_pair_quote_with_http_info(user_id:, user_secret:, account_id:, instrument_symbol:, extra: {})

Parameters:
  • extra (Hash) -- additional parameters to pass along through :header_params, :query_params, or parameter name
  • instrument_symbol (String) --
  • account_id (String) --
  • user_secret (String) --
  • user_id (String) --
def get_cryptocurrency_pair_quote_with_http_info(user_id:, user_secret:, account_id:, instrument_symbol:, extra: {})
  get_cryptocurrency_pair_quote_with_http_info_impl(user_id, user_secret, account_id, instrument_symbol, extra)
end

def get_cryptocurrency_pair_quote_with_http_info_impl(user_id, user_secret, account_id, instrument_symbol, opts = {})

Returns:
  • (Array<(CryptocurrencyPairQuote, Integer, Hash)>) - CryptocurrencyPairQuote data, response status code and response headers

Parameters:
  • opts (Hash) -- the optional parameters
  • instrument_symbol (String) --
  • account_id (String) --
  • user_secret (String) --
  • user_id (String) --
def get_cryptocurrency_pair_quote_with_http_info_impl(user_id, user_secret, account_id, instrument_symbol, opts = {})
i_client.config.debugging
_client.config.logger.debug 'Calling API: TradingApi.get_cryptocurrency_pair_quote ...'
fy the required parameter 'user_id' is set
i_client.config.client_side_validation && user_id.nil?
 ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.get_cryptocurrency_pair_quote"
fy the required parameter 'user_secret' is set
i_client.config.client_side_validation && user_secret.nil?
 ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.get_cryptocurrency_pair_quote"
fy the required parameter 'account_id' is set
i_client.config.client_side_validation && account_id.nil?
 ArgumentError, "Missing the required parameter 'account_id' when calling TradingApi.get_cryptocurrency_pair_quote"
fy the required parameter 'instrument_symbol' is set
i_client.config.client_side_validation && instrument_symbol.nil?
 ArgumentError, "Missing the required parameter 'instrument_symbol' when calling TradingApi.get_cryptocurrency_pair_quote"
urce path
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))
y parameters
params = opts[:query_params] || {}
params[:'userId'] = user_id
params[:'userSecret'] = user_secret
er parameters
_params = opts[:header_params] || {}
 header 'Accept' (if needed)
_params['Accept'] = @api_client.select_header_accept(['application/json'])
 parameters
arams = opts[:form_params] || {}
 body (model)
ody = opts[:debug_body]
rn_type
_type = opts[:debug_return_type] || 'CryptocurrencyPairQuote'
_names
ames = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
tions = opts.merge(
ration => :"TradingApi.get_cryptocurrency_pair_quote",
der_params => header_params,
ry_params => query_params,
m_params => form_params,
y => post_body,
h_names => auth_names,
urn_type => return_type
status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
i_client.config.debugging
_client.config.logger.debug "API called: TradingApi#get_cryptocurrency_pair_quote\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
 data, status_code, headers, response

def get_order_impact(account_id:, action:, universal_symbol_id:, order_type:, time_in_force:, user_id:, user_secret:, price: SENTINEL, stop: SENTINEL, units: SENTINEL, notional_value: SENTINEL, extra: {})

Parameters:
  • extra (Hash) -- additional parameters to pass along through :header_params, :query_params, or parameter name
  • body (ManualTradeForm) --
  • notional_value (ManualTradeFormNotionalValue) --
  • units (Float) --
  • stop (Float) -- The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
  • price (Float) -- The limit price for `Limit` and `StopLimit` orders.
  • user_secret (String) --
  • user_id (String) --
  • time_in_force (TimeInForceStrict) -- The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled.
  • 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.
  • universal_symbol_id (String) -- Unique identifier for the symbol within SnapTrade. This is the ID used to reference the symbol in SnapTrade API calls.
  • action (ActionStrict) -- The action describes the intent or side of a trade. This is either `BUY` or `SELL`.
  • account_id (String) -- Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
def get_order_impact(account_id:, action:, universal_symbol_id:, order_type:, time_in_force:, user_id:, user_secret:, price: SENTINEL, stop: SENTINEL, units: SENTINEL, notional_value: SENTINEL, extra: {})
  _body = {}
  _body[:account_id] = account_id if account_id != SENTINEL
  _body[:action] = action if action != SENTINEL
  _body[:universal_symbol_id] = universal_symbol_id if universal_symbol_id != SENTINEL
  _body[:order_type] = order_type if order_type != SENTINEL
  _body[:time_in_force] = time_in_force if time_in_force != SENTINEL
  _body[:price] = price if price != SENTINEL
  _body[:stop] = stop if stop != SENTINEL
  _body[:units] = units if units != SENTINEL
  _body[:notional_value] = notional_value if notional_value != SENTINEL
  manual_trade_form = _body
  data, _status_code, _headers = get_order_impact_with_http_info_impl(user_id, user_secret, manual_trade_form, extra)
  data
end

def get_order_impact_impl(user_id, user_secret, manual_trade_form, opts = {})

Returns:
  • (ManualTradeAndImpact) -

Parameters:
  • opts (Hash) -- the optional parameters
  • manual_trade_form (ManualTradeForm) --
  • user_secret (String) --
  • user_id (String) --
def get_order_impact_impl(user_id, user_secret, manual_trade_form, opts = {})
_status_code, _headers = get_order_impact_with_http_info(user_id, user_secret, manual_trade_form, opts)

def get_order_impact_with_http_info(account_id:, action:, universal_symbol_id:, order_type:, time_in_force:, user_id:, user_secret:, price: SENTINEL, stop: SENTINEL, units: SENTINEL, notional_value: SENTINEL, extra: {})

Parameters:
  • extra (Hash) -- additional parameters to pass along through :header_params, :query_params, or parameter name
  • body (ManualTradeForm) --
  • notional_value (ManualTradeFormNotionalValue) --
  • units (Float) --
  • stop (Float) -- The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
  • price (Float) -- The limit price for `Limit` and `StopLimit` orders.
  • user_secret (String) --
  • user_id (String) --
  • time_in_force (TimeInForceStrict) -- The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled.
  • 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.
  • universal_symbol_id (String) -- Unique identifier for the symbol within SnapTrade. This is the ID used to reference the symbol in SnapTrade API calls.
  • action (ActionStrict) -- The action describes the intent or side of a trade. This is either `BUY` or `SELL`.
  • account_id (String) -- Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
def get_order_impact_with_http_info(account_id:, action:, universal_symbol_id:, order_type:, time_in_force:, user_id:, user_secret:, price: SENTINEL, stop: SENTINEL, units: SENTINEL, notional_value: SENTINEL, extra: {})
  _body = {}
  _body[:account_id] = account_id if account_id != SENTINEL
  _body[:action] = action if action != SENTINEL
  _body[:universal_symbol_id] = universal_symbol_id if universal_symbol_id != SENTINEL
  _body[:order_type] = order_type if order_type != SENTINEL
  _body[:time_in_force] = time_in_force if time_in_force != SENTINEL
  _body[:price] = price if price != SENTINEL
  _body[:stop] = stop if stop != SENTINEL
  _body[:units] = units if units != SENTINEL
  _body[:notional_value] = notional_value if notional_value != SENTINEL
  manual_trade_form = _body
  get_order_impact_with_http_info_impl(user_id, user_secret, manual_trade_form, extra)
end

def get_order_impact_with_http_info_impl(user_id, user_secret, manual_trade_form, opts = {})

Returns:
  • (Array<(ManualTradeAndImpact, Integer, Hash)>) - ManualTradeAndImpact data, response status code and response headers

Parameters:
  • opts (Hash) -- the optional parameters
  • manual_trade_form (ManualTradeForm) --
  • user_secret (String) --
  • user_id (String) --
def get_order_impact_with_http_info_impl(user_id, user_secret, manual_trade_form, opts = {})
i_client.config.debugging
_client.config.logger.debug 'Calling API: TradingApi.get_order_impact ...'
fy the required parameter 'user_id' is set
i_client.config.client_side_validation && user_id.nil?
 ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.get_order_impact"
fy the required parameter 'user_secret' is set
i_client.config.client_side_validation && user_secret.nil?
 ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.get_order_impact"
fy the required parameter 'manual_trade_form' is set
i_client.config.client_side_validation && manual_trade_form.nil?
 ArgumentError, "Missing the required parameter 'manual_trade_form' when calling TradingApi.get_order_impact"
urce path
var_path = '/trade/impact'
y parameters
params = opts[:query_params] || {}
params[:'userId'] = user_id
params[:'userSecret'] = user_secret
er parameters
_params = opts[:header_params] || {}
 header 'Accept' (if needed)
_params['Accept'] = @api_client.select_header_accept(['application/json'])
 header 'Content-Type'
t_type = @api_client.select_header_content_type(['application/json'])
ntent_type.nil?
er_params['Content-Type'] = content_type
 parameters
arams = opts[:form_params] || {}
 body (model)
ody = opts[:debug_body] || @api_client.object_to_http_body(manual_trade_form)
rn_type
_type = opts[:debug_return_type] || 'ManualTradeAndImpact'
_names
ames = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
tions = opts.merge(
ration => :"TradingApi.get_order_impact",
der_params => header_params,
ry_params => query_params,
m_params => form_params,
y => post_body,
h_names => auth_names,
urn_type => return_type
status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
i_client.config.debugging
_client.config.logger.debug "API called: TradingApi#get_order_impact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
 data, status_code, headers, response

def get_user_account_quotes(user_id:, user_secret:, symbols:, account_id:, use_ticker: SENTINEL, extra: {})

Parameters:
  • extra (Hash) -- additional parameters to pass along through :header_params, :query_params, or parameter name
  • use_ticker (Boolean) -- Should be set to `True` if `symbols` are comprised of tickers. Defaults to `False` if not provided.
  • account_id (String) --
  • symbols (String) -- List of Universal Symbol IDs or tickers to get quotes for. When providing multiple values, use a comma as separator
  • user_secret (String) --
  • user_id (String) --
def get_user_account_quotes(user_id:, user_secret:, symbols:, account_id:, use_ticker: SENTINEL, extra: {})
  extra[:use_ticker] = use_ticker if use_ticker != SENTINEL
  data, _status_code, _headers = get_user_account_quotes_with_http_info_impl(user_id, user_secret, symbols, account_id, extra)
  data
end

def get_user_account_quotes_impl(user_id, user_secret, symbols, account_id, opts = {})

Returns:
  • (Array) -

Options Hash: (**opts)
  • :use_ticker (Boolean) -- Should be set to `True` if `symbols` are comprised of tickers. Defaults to `False` if not provided.

Parameters:
  • opts (Hash) -- the optional parameters
  • account_id (String) --
  • symbols (String) -- List of Universal Symbol IDs or tickers to get quotes for. When providing multiple values, use a comma as separator
  • user_secret (String) --
  • user_id (String) --
def get_user_account_quotes_impl(user_id, user_secret, symbols, account_id, opts = {})
_status_code, _headers = get_user_account_quotes_with_http_info(user_id, user_secret, symbols, account_id, opts)

def get_user_account_quotes_with_http_info(user_id:, user_secret:, symbols:, account_id:, use_ticker: SENTINEL, extra: {})

Parameters:
  • extra (Hash) -- additional parameters to pass along through :header_params, :query_params, or parameter name
  • use_ticker (Boolean) -- Should be set to `True` if `symbols` are comprised of tickers. Defaults to `False` if not provided.
  • account_id (String) --
  • symbols (String) -- List of Universal Symbol IDs or tickers to get quotes for. When providing multiple values, use a comma as separator
  • user_secret (String) --
  • user_id (String) --
def get_user_account_quotes_with_http_info(user_id:, user_secret:, symbols:, account_id:, use_ticker: SENTINEL, extra: {})
  extra[:use_ticker] = use_ticker if use_ticker != SENTINEL
  get_user_account_quotes_with_http_info_impl(user_id, user_secret, symbols, account_id, extra)
end

def get_user_account_quotes_with_http_info_impl(user_id, user_secret, symbols, account_id, opts = {})

Returns:
  • (Array<(Array, Integer, Hash)>) - Array data, response status code and response headers

Options Hash: (**opts)
  • :use_ticker (Boolean) -- Should be set to `True` if `symbols` are comprised of tickers. Defaults to `False` if not provided.

Parameters:
  • opts (Hash) -- the optional parameters
  • account_id (String) --
  • symbols (String) -- List of Universal Symbol IDs or tickers to get quotes for. When providing multiple values, use a comma as separator
  • user_secret (String) --
  • user_id (String) --
def get_user_account_quotes_with_http_info_impl(user_id, user_secret, symbols, account_id, opts = {})
i_client.config.debugging
_client.config.logger.debug 'Calling API: TradingApi.get_user_account_quotes ...'
fy the required parameter 'user_id' is set
i_client.config.client_side_validation && user_id.nil?
 ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.get_user_account_quotes"
fy the required parameter 'user_secret' is set
i_client.config.client_side_validation && user_secret.nil?
 ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.get_user_account_quotes"
fy the required parameter 'symbols' is set
i_client.config.client_side_validation && symbols.nil?
 ArgumentError, "Missing the required parameter 'symbols' when calling TradingApi.get_user_account_quotes"
fy the required parameter 'account_id' is set
i_client.config.client_side_validation && account_id.nil?
 ArgumentError, "Missing the required parameter 'account_id' when calling TradingApi.get_user_account_quotes"
urce path
var_path = '/accounts/{accountId}/quotes'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
y parameters
params = opts[:query_params] || {}
params[:'userId'] = user_id
params[:'userSecret'] = user_secret
params[:'symbols'] = symbols
params[:'use_ticker'] = opts[:'use_ticker'] if !opts[:'use_ticker'].nil?
er parameters
_params = opts[:header_params] || {}
 header 'Accept' (if needed)
_params['Accept'] = @api_client.select_header_accept(['application/json'])
 parameters
arams = opts[:form_params] || {}
 body (model)
ody = opts[:debug_body]
rn_type
_type = opts[:debug_return_type] || 'Array<SymbolsQuotesInner>'
_names
ames = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
tions = opts.merge(
ration => :"TradingApi.get_user_account_quotes",
der_params => header_params,
ry_params => query_params,
m_params => form_params,
y => post_body,
h_names => auth_names,
urn_type => return_type
status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
i_client.config.debugging
_client.config.logger.debug "API called: TradingApi#get_user_account_quotes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
 data, status_code, headers, response

def initialize(api_client = ApiClient.default)

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

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: {})

Parameters:
  • extra (Hash) -- additional parameters to pass along through :header_params, :query_params, or parameter name
  • body (ManualTradeFormBracket) --
  • units (Float) -- Number of shares for the order. This can be a decimal for fractional orders. Must be `null` if `notional_value` is provided.
  • stop (Float) -- The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
  • price (Float) -- The limit price for `Limit` and `StopLimit` orders.
  • symbol (String) -- The security's trading ticker symbol.
  • user_secret (String) --
  • user_id (String) --
  • account_id (String) -- The ID of the account to execute the trade on.
  • take_profit (TakeProfit) --
  • stop_loss (StopLoss) --
  • time_in_force (TimeInForceStrict) -- The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled.
  • 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.
  • instrument (TradingInstrument) --
  • 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.
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: {})
  _body = {}
  _body[:action] = action if action != SENTINEL
  _body[:symbol] = symbol if symbol != SENTINEL
  _body[:instrument] = instrument if instrument != SENTINEL
  _body[:order_type] = order_type if order_type != SENTINEL
  _body[:time_in_force] = time_in_force if time_in_force != SENTINEL
  _body[:price] = price if price != SENTINEL
  _body[:stop] = stop if stop != SENTINEL
  _body[:units] = units if units != SENTINEL
  _body[:stop_loss] = stop_loss if stop_loss != SENTINEL
  _body[:take_profit] = take_profit if take_profit != SENTINEL
  manual_trade_form_bracket = _body
  data, _status_code, _headers = place_bracket_order_with_http_info_impl(account_id, user_id, user_secret, manual_trade_form_bracket, extra)
  data
end

def place_bracket_order_impl(account_id, user_id, user_secret, manual_trade_form_bracket, opts = {})

Returns:
  • (AccountOrderRecord) -

Parameters:
  • opts (Hash) -- the optional parameters
  • manual_trade_form_bracket (ManualTradeFormBracket) --
  • user_secret (String) --
  • user_id (String) --
  • account_id (String) -- The ID of the account to execute the trade on.
def place_bracket_order_impl(account_id, user_id, user_secret, manual_trade_form_bracket, opts = {})
_status_code, _headers = place_bracket_order_with_http_info(account_id, user_id, user_secret, manual_trade_form_bracket, opts)

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: {})

Parameters:
  • extra (Hash) -- additional parameters to pass along through :header_params, :query_params, or parameter name
  • body (ManualTradeFormBracket) --
  • units (Float) -- Number of shares for the order. This can be a decimal for fractional orders. Must be `null` if `notional_value` is provided.
  • stop (Float) -- The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
  • price (Float) -- The limit price for `Limit` and `StopLimit` orders.
  • symbol (String) -- The security's trading ticker symbol.
  • user_secret (String) --
  • user_id (String) --
  • account_id (String) -- The ID of the account to execute the trade on.
  • take_profit (TakeProfit) --
  • stop_loss (StopLoss) --
  • time_in_force (TimeInForceStrict) -- The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled.
  • 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.
  • instrument (TradingInstrument) --
  • 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.
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: {})
  _body = {}
  _body[:action] = action if action != SENTINEL
  _body[:symbol] = symbol if symbol != SENTINEL
  _body[:instrument] = instrument if instrument != SENTINEL
  _body[:order_type] = order_type if order_type != SENTINEL
  _body[:time_in_force] = time_in_force if time_in_force != SENTINEL
  _body[:price] = price if price != SENTINEL
  _body[:stop] = stop if stop != SENTINEL
  _body[:units] = units if units != SENTINEL
  _body[:stop_loss] = stop_loss if stop_loss != SENTINEL
  _body[:take_profit] = take_profit if take_profit != SENTINEL
  manual_trade_form_bracket = _body
  place_bracket_order_with_http_info_impl(account_id, user_id, user_secret, manual_trade_form_bracket, extra)
end

def place_bracket_order_with_http_info_impl(account_id, user_id, user_secret, manual_trade_form_bracket, opts = {})

Returns:
  • (Array<(AccountOrderRecord, Integer, Hash)>) - AccountOrderRecord data, response status code and response headers

Parameters:
  • opts (Hash) -- the optional parameters
  • manual_trade_form_bracket (ManualTradeFormBracket) --
  • user_secret (String) --
  • user_id (String) --
  • account_id (String) -- The ID of the account to execute the trade on.
def place_bracket_order_with_http_info_impl(account_id, user_id, user_secret, manual_trade_form_bracket, opts = {})
i_client.config.debugging
_client.config.logger.debug 'Calling API: TradingApi.place_bracket_order ...'
fy the required parameter 'account_id' is set
i_client.config.client_side_validation && account_id.nil?
 ArgumentError, "Missing the required parameter 'account_id' when calling TradingApi.place_bracket_order"
fy the required parameter 'user_id' is set
i_client.config.client_side_validation && user_id.nil?
 ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.place_bracket_order"
fy the required parameter 'user_secret' is set
i_client.config.client_side_validation && user_secret.nil?
 ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.place_bracket_order"
fy the required parameter 'manual_trade_form_bracket' is set
i_client.config.client_side_validation && manual_trade_form_bracket.nil?
 ArgumentError, "Missing the required parameter 'manual_trade_form_bracket' when calling TradingApi.place_bracket_order"
urce path
var_path = '/accounts/{accountId}/trading/bracket'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
y parameters
params = opts[:query_params] || {}
params[:'userId'] = user_id
params[:'userSecret'] = user_secret
er parameters
_params = opts[:header_params] || {}
 header 'Accept' (if needed)
_params['Accept'] = @api_client.select_header_accept(['application/json'])
 header 'Content-Type'
t_type = @api_client.select_header_content_type(['application/json'])
ntent_type.nil?
er_params['Content-Type'] = content_type
 parameters
arams = opts[:form_params] || {}
 body (model)
ody = opts[:debug_body] || @api_client.object_to_http_body(manual_trade_form_bracket)
rn_type
_type = opts[:debug_return_type] || 'AccountOrderRecord'
_names
ames = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
tions = opts.merge(
ration => :"TradingApi.place_bracket_order",
der_params => header_params,
ry_params => query_params,
m_params => form_params,
y => post_body,
h_names => auth_names,
urn_type => return_type
status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
i_client.config.debugging
_client.config.logger.debug "API called: TradingApi#place_bracket_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
 data, status_code, headers, response

def place_force_order(account_id:, action:, order_type:, time_in_force:, user_id:, user_secret:, universal_symbol_id: SENTINEL, symbol: SENTINEL, price: SENTINEL, stop: SENTINEL, units: SENTINEL, notional_value: SENTINEL, extra: {})

Parameters:
  • extra (Hash) -- additional parameters to pass along through :header_params, :query_params, or parameter name
  • body (ManualTradeFormWithOptions) --
  • notional_value (ManualTradeFormNotionalValue) --
  • units (Float) -- For Equity orders, this represents the number of shares for the order. This can be a decimal for fractional orders. Must be `null` if `notional_value` is provided. If placing an Option order, this field represents the number of contracts to buy or sell. (e.g., 1 contract = 100 shares).
  • stop (Float) -- The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
  • price (Float) -- The limit price for `Limit` and `StopLimit` orders.
  • symbol (String) -- The security's trading ticker symbol. This currently supports stock symbols and Options symbols in the 21 character OCC format. For example \"AAPL 131124C00240000\" represents a call option on AAPL expiring on 2024-11-13 with a strike price of $240. For more information on the OCC format, see [here](https://en.wikipedia.org/wiki/Option_symbol#OCC_format). If 'symbol' is provided, then 'universal_symbol_id' must be 'null'.
  • universal_symbol_id (String) -- The universal symbol ID of the security to trade. Must be 'null' if `symbol` is provided, otherwise must be provided.
  • user_secret (String) --
  • user_id (String) --
  • time_in_force (TimeInForceStrict) -- The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled.
  • 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.
  • 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.
  • account_id (String) -- Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
def place_force_order(account_id:, action:, order_type:, time_in_force:, user_id:, user_secret:, universal_symbol_id: SENTINEL, symbol: SENTINEL, price: SENTINEL, stop: SENTINEL, units: SENTINEL, notional_value: SENTINEL, extra: {})
  _body = {}
  _body[:account_id] = account_id if account_id != SENTINEL
  _body[:action] = action if action != SENTINEL
  _body[:universal_symbol_id] = universal_symbol_id if universal_symbol_id != SENTINEL
  _body[:symbol] = symbol if symbol != SENTINEL
  _body[:order_type] = order_type if order_type != SENTINEL
  _body[:time_in_force] = time_in_force if time_in_force != SENTINEL
  _body[:price] = price if price != SENTINEL
  _body[:stop] = stop if stop != SENTINEL
  _body[:units] = units if units != SENTINEL
  _body[:notional_value] = notional_value if notional_value != SENTINEL
  manual_trade_form_with_options = _body
  data, _status_code, _headers = place_force_order_with_http_info_impl(user_id, user_secret, manual_trade_form_with_options, extra)
  data
end

def place_force_order_impl(user_id, user_secret, manual_trade_form_with_options, opts = {})

Returns:
  • (AccountOrderRecord) -

Parameters:
  • opts (Hash) -- the optional parameters
  • manual_trade_form_with_options (ManualTradeFormWithOptions) --
  • user_secret (String) --
  • user_id (String) --
def place_force_order_impl(user_id, user_secret, manual_trade_form_with_options, opts = {})
_status_code, _headers = place_force_order_with_http_info(user_id, user_secret, manual_trade_form_with_options, opts)

def place_force_order_with_http_info(account_id:, action:, order_type:, time_in_force:, user_id:, user_secret:, universal_symbol_id: SENTINEL, symbol: SENTINEL, price: SENTINEL, stop: SENTINEL, units: SENTINEL, notional_value: SENTINEL, extra: {})

Parameters:
  • extra (Hash) -- additional parameters to pass along through :header_params, :query_params, or parameter name
  • body (ManualTradeFormWithOptions) --
  • notional_value (ManualTradeFormNotionalValue) --
  • units (Float) -- For Equity orders, this represents the number of shares for the order. This can be a decimal for fractional orders. Must be `null` if `notional_value` is provided. If placing an Option order, this field represents the number of contracts to buy or sell. (e.g., 1 contract = 100 shares).
  • stop (Float) -- The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
  • price (Float) -- The limit price for `Limit` and `StopLimit` orders.
  • symbol (String) -- The security's trading ticker symbol. This currently supports stock symbols and Options symbols in the 21 character OCC format. For example \"AAPL 131124C00240000\" represents a call option on AAPL expiring on 2024-11-13 with a strike price of $240. For more information on the OCC format, see [here](https://en.wikipedia.org/wiki/Option_symbol#OCC_format). If 'symbol' is provided, then 'universal_symbol_id' must be 'null'.
  • universal_symbol_id (String) -- The universal symbol ID of the security to trade. Must be 'null' if `symbol` is provided, otherwise must be provided.
  • user_secret (String) --
  • user_id (String) --
  • time_in_force (TimeInForceStrict) -- The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled.
  • 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.
  • 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.
  • account_id (String) -- Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
def place_force_order_with_http_info(account_id:, action:, order_type:, time_in_force:, user_id:, user_secret:, universal_symbol_id: SENTINEL, symbol: SENTINEL, price: SENTINEL, stop: SENTINEL, units: SENTINEL, notional_value: SENTINEL, extra: {})
  _body = {}
  _body[:account_id] = account_id if account_id != SENTINEL
  _body[:action] = action if action != SENTINEL
  _body[:universal_symbol_id] = universal_symbol_id if universal_symbol_id != SENTINEL
  _body[:symbol] = symbol if symbol != SENTINEL
  _body[:order_type] = order_type if order_type != SENTINEL
  _body[:time_in_force] = time_in_force if time_in_force != SENTINEL
  _body[:price] = price if price != SENTINEL
  _body[:stop] = stop if stop != SENTINEL
  _body[:units] = units if units != SENTINEL
  _body[:notional_value] = notional_value if notional_value != SENTINEL
  manual_trade_form_with_options = _body
  place_force_order_with_http_info_impl(user_id, user_secret, manual_trade_form_with_options, extra)
end

def place_force_order_with_http_info_impl(user_id, user_secret, manual_trade_form_with_options, opts = {})

Returns:
  • (Array<(AccountOrderRecord, Integer, Hash)>) - AccountOrderRecord data, response status code and response headers

Parameters:
  • opts (Hash) -- the optional parameters
  • manual_trade_form_with_options (ManualTradeFormWithOptions) --
  • user_secret (String) --
  • user_id (String) --
def place_force_order_with_http_info_impl(user_id, user_secret, manual_trade_form_with_options, opts = {})
i_client.config.debugging
_client.config.logger.debug 'Calling API: TradingApi.place_force_order ...'
fy the required parameter 'user_id' is set
i_client.config.client_side_validation && user_id.nil?
 ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.place_force_order"
fy the required parameter 'user_secret' is set
i_client.config.client_side_validation && user_secret.nil?
 ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.place_force_order"
fy the required parameter 'manual_trade_form_with_options' is set
i_client.config.client_side_validation && manual_trade_form_with_options.nil?
 ArgumentError, "Missing the required parameter 'manual_trade_form_with_options' when calling TradingApi.place_force_order"
urce path
var_path = '/trade/place'
y parameters
params = opts[:query_params] || {}
params[:'userId'] = user_id
params[:'userSecret'] = user_secret
er parameters
_params = opts[:header_params] || {}
 header 'Accept' (if needed)
_params['Accept'] = @api_client.select_header_accept(['application/json'])
 header 'Content-Type'
t_type = @api_client.select_header_content_type(['application/json'])
ntent_type.nil?
er_params['Content-Type'] = content_type
 parameters
arams = opts[:form_params] || {}
 body (model)
ody = opts[:debug_body] || @api_client.object_to_http_body(manual_trade_form_with_options)
rn_type
_type = opts[:debug_return_type] || 'AccountOrderRecord'
_names
ames = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
tions = opts.merge(
ration => :"TradingApi.place_force_order",
der_params => header_params,
ry_params => query_params,
m_params => form_params,
y => post_body,
h_names => auth_names,
urn_type => return_type
status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
i_client.config.debugging
_client.config.logger.debug "API called: TradingApi#place_force_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
 data, status_code, headers, response

def place_mleg_order(order_type:, time_in_force:, legs:, user_id:, user_secret:, account_id:, limit_price: SENTINEL, stop_price: SENTINEL, extra: {})

Parameters:
  • extra (Hash) -- additional parameters to pass along through :header_params, :query_params, or parameter name
  • body (MlegTradeForm) --
  • stop_price (Float) -- The stop price. Required if the order type is STOP_LOSS_MARKET, STOP_LOSS_LIMIT.
  • limit_price (Float) -- The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT.
  • account_id (String) --
  • user_secret (String) --
  • user_id (String) --
  • legs (Array) --
  • time_in_force (TimeInForceStrict) -- The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled.
  • order_type (MlegOrderTypeStrict) -- The type of order to place.
def place_mleg_order(order_type:, time_in_force:, legs:, user_id:, user_secret:, account_id:, limit_price: SENTINEL, stop_price: SENTINEL, extra: {})
  _body = {}
  _body[:order_type] = order_type if order_type != SENTINEL
  _body[:time_in_force] = time_in_force if time_in_force != SENTINEL
  _body[:limit_price] = limit_price if limit_price != SENTINEL
  _body[:stop_price] = stop_price if stop_price != SENTINEL
  _body[:legs] = legs if legs != SENTINEL
  mleg_trade_form = _body
  data, _status_code, _headers = place_mleg_order_with_http_info_impl(user_id, user_secret, account_id, mleg_trade_form, extra)
  data
end

def place_mleg_order_impl(user_id, user_secret, account_id, mleg_trade_form, opts = {})

Returns:
  • (MlegOrderResponse) -

Parameters:
  • opts (Hash) -- the optional parameters
  • mleg_trade_form (MlegTradeForm) --
  • account_id (String) --
  • user_secret (String) --
  • user_id (String) --
def place_mleg_order_impl(user_id, user_secret, account_id, mleg_trade_form, opts = {})
_status_code, _headers = place_mleg_order_with_http_info(user_id, user_secret, account_id, mleg_trade_form, opts)

def place_mleg_order_with_http_info(order_type:, time_in_force:, legs:, user_id:, user_secret:, account_id:, limit_price: SENTINEL, stop_price: SENTINEL, extra: {})

Parameters:
  • extra (Hash) -- additional parameters to pass along through :header_params, :query_params, or parameter name
  • body (MlegTradeForm) --
  • stop_price (Float) -- The stop price. Required if the order type is STOP_LOSS_MARKET, STOP_LOSS_LIMIT.
  • limit_price (Float) -- The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT.
  • account_id (String) --
  • user_secret (String) --
  • user_id (String) --
  • legs (Array) --
  • time_in_force (TimeInForceStrict) -- The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled.
  • order_type (MlegOrderTypeStrict) -- The type of order to place.
def place_mleg_order_with_http_info(order_type:, time_in_force:, legs:, user_id:, user_secret:, account_id:, limit_price: SENTINEL, stop_price: SENTINEL, extra: {})
  _body = {}
  _body[:order_type] = order_type if order_type != SENTINEL
  _body[:time_in_force] = time_in_force if time_in_force != SENTINEL
  _body[:limit_price] = limit_price if limit_price != SENTINEL
  _body[:stop_price] = stop_price if stop_price != SENTINEL
  _body[:legs] = legs if legs != SENTINEL
  mleg_trade_form = _body
  place_mleg_order_with_http_info_impl(user_id, user_secret, account_id, mleg_trade_form, extra)
end

def place_mleg_order_with_http_info_impl(user_id, user_secret, account_id, mleg_trade_form, opts = {})

Returns:
  • (Array<(MlegOrderResponse, Integer, Hash)>) - MlegOrderResponse data, response status code and response headers

Parameters:
  • opts (Hash) -- the optional parameters
  • mleg_trade_form (MlegTradeForm) --
  • account_id (String) --
  • user_secret (String) --
  • user_id (String) --
def place_mleg_order_with_http_info_impl(user_id, user_secret, account_id, mleg_trade_form, opts = {})
i_client.config.debugging
_client.config.logger.debug 'Calling API: TradingApi.place_mleg_order ...'
fy the required parameter 'user_id' is set
i_client.config.client_side_validation && user_id.nil?
 ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.place_mleg_order"
fy the required parameter 'user_secret' is set
i_client.config.client_side_validation && user_secret.nil?
 ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.place_mleg_order"
fy the required parameter 'account_id' is set
i_client.config.client_side_validation && account_id.nil?
 ArgumentError, "Missing the required parameter 'account_id' when calling TradingApi.place_mleg_order"
fy the required parameter 'mleg_trade_form' is set
i_client.config.client_side_validation && mleg_trade_form.nil?
 ArgumentError, "Missing the required parameter 'mleg_trade_form' when calling TradingApi.place_mleg_order"
urce path
var_path = '/accounts/{accountId}/trading/options'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
y parameters
params = opts[:query_params] || {}
params[:'userId'] = user_id
params[:'userSecret'] = user_secret
er parameters
_params = opts[:header_params] || {}
 header 'Accept' (if needed)
_params['Accept'] = @api_client.select_header_accept(['application/json'])
 header 'Content-Type'
t_type = @api_client.select_header_content_type(['application/json'])
ntent_type.nil?
er_params['Content-Type'] = content_type
 parameters
arams = opts[:form_params] || {}
 body (model)
ody = opts[:debug_body] || @api_client.object_to_http_body(mleg_trade_form)
rn_type
_type = opts[:debug_return_type] || 'MlegOrderResponse'
_names
ames = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
tions = opts.merge(
ration => :"TradingApi.place_mleg_order",
der_params => header_params,
ry_params => query_params,
m_params => form_params,
y => post_body,
h_names => auth_names,
urn_type => return_type
status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
i_client.config.debugging
_client.config.logger.debug "API called: TradingApi#place_mleg_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
 data, status_code, headers, response

def place_order(trade_id:, user_id:, user_secret:, wait_to_confirm: SENTINEL, extra: {})

Parameters:
  • extra (Hash) -- additional parameters to pass along through :header_params, :query_params, or parameter name
  • body (ValidatedTradeBody) --
  • wait_to_confirm (Boolean) -- Optional, defaults to true. Determines if a wait is performed to check on order status. If false, latency will be reduced but orders returned will be more likely to be of status `PENDING` as we will not wait to check on the status before responding to the request.
  • user_secret (String) --
  • user_id (String) --
  • trade_id (String) -- Obtained from calling the [check order impact endpoint](/reference/Trading/Trading_getOrderImpact)
def place_order(trade_id:, user_id:, user_secret:, wait_to_confirm: SENTINEL, extra: {})
  _body = {}
  _body[:wait_to_confirm] = wait_to_confirm if wait_to_confirm != SENTINEL
  extra[:validated_trade_body] = _body if !_body.empty?
  data, _status_code, _headers = place_order_with_http_info_impl(trade_id, user_id, user_secret, extra)
  data
end

def place_order_impl(trade_id, user_id, user_secret, opts = {})

Returns:
  • (AccountOrderRecord) -

Options Hash: (**opts)
  • :validated_trade_body (ValidatedTradeBody) --

Parameters:
  • opts (Hash) -- the optional parameters
  • user_secret (String) --
  • user_id (String) --
  • trade_id (String) -- Obtained from calling the [check order impact endpoint](/reference/Trading/Trading_getOrderImpact)
def place_order_impl(trade_id, user_id, user_secret, opts = {})
_status_code, _headers = place_order_with_http_info(trade_id, user_id, user_secret, opts)

def place_order_with_http_info(trade_id:, user_id:, user_secret:, wait_to_confirm: SENTINEL, extra: {})

Parameters:
  • extra (Hash) -- additional parameters to pass along through :header_params, :query_params, or parameter name
  • body (ValidatedTradeBody) --
  • wait_to_confirm (Boolean) -- Optional, defaults to true. Determines if a wait is performed to check on order status. If false, latency will be reduced but orders returned will be more likely to be of status `PENDING` as we will not wait to check on the status before responding to the request.
  • user_secret (String) --
  • user_id (String) --
  • trade_id (String) -- Obtained from calling the [check order impact endpoint](/reference/Trading/Trading_getOrderImpact)
def place_order_with_http_info(trade_id:, user_id:, user_secret:, wait_to_confirm: SENTINEL, extra: {})
  _body = {}
  _body[:wait_to_confirm] = wait_to_confirm if wait_to_confirm != SENTINEL
  extra[:validated_trade_body] = _body if !_body.empty?
  place_order_with_http_info_impl(trade_id, user_id, user_secret, extra)
end

def place_order_with_http_info_impl(trade_id, user_id, user_secret, opts = {})

Returns:
  • (Array<(AccountOrderRecord, Integer, Hash)>) - AccountOrderRecord data, response status code and response headers

Options Hash: (**opts)
  • :validated_trade_body (ValidatedTradeBody) --

Parameters:
  • opts (Hash) -- the optional parameters
  • user_secret (String) --
  • user_id (String) --
  • trade_id (String) -- Obtained from calling the [check order impact endpoint](/reference/Trading/Trading_getOrderImpact)
def place_order_with_http_info_impl(trade_id, user_id, user_secret, opts = {})
i_client.config.debugging
_client.config.logger.debug 'Calling API: TradingApi.place_order ...'
fy the required parameter 'trade_id' is set
i_client.config.client_side_validation && trade_id.nil?
 ArgumentError, "Missing the required parameter 'trade_id' when calling TradingApi.place_order"
fy the required parameter 'user_id' is set
i_client.config.client_side_validation && user_id.nil?
 ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.place_order"
fy the required parameter 'user_secret' is set
i_client.config.client_side_validation && user_secret.nil?
 ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.place_order"
urce path
var_path = '/trade/{tradeId}'.sub('{' + 'tradeId' + '}', CGI.escape(trade_id.to_s))
y parameters
params = opts[:query_params] || {}
params[:'userId'] = user_id
params[:'userSecret'] = user_secret
er parameters
_params = opts[:header_params] || {}
 header 'Accept' (if needed)
_params['Accept'] = @api_client.select_header_accept(['application/json'])
 header 'Content-Type'
t_type = @api_client.select_header_content_type(['application/json'])
ntent_type.nil?
er_params['Content-Type'] = content_type
 parameters
arams = opts[:form_params] || {}
 body (model)
ody = opts[:debug_body] || @api_client.object_to_http_body(opts[:'validated_trade_body'])
rn_type
_type = opts[:debug_return_type] || 'AccountOrderRecord'
_names
ames = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
tions = opts.merge(
ration => :"TradingApi.place_order",
der_params => header_params,
ry_params => query_params,
m_params => form_params,
y => post_body,
h_names => auth_names,
urn_type => return_type
status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
i_client.config.debugging
_client.config.logger.debug "API called: TradingApi#place_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
 data, status_code, headers, response

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: {})

Parameters:
  • extra (Hash) -- additional parameters to pass along through :header_params, :query_params, or parameter name
  • body (TradingPlaceSimpleOrderRequest) --
  • expiration_date (Time) -- The expiration date of the order. Required if the time_in_force is GTD.
  • 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.
  • 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.
  • limit_price (Float) -- The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT or TAKE_PROFIT_LIMIT.
  • account_id (String) --
  • user_secret (String) --
  • user_id (String) --
  • amount (Float) -- The amount of the base currency to buy or sell.
  • 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.
  • type (Type) -- The type of order to place.
  • side (ActionStrict) -- The action describes the intent or side of a trade. This is either `BUY` or `SELL`.
  • instrument (TradingInstrument) --
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: {})
  _body = {}
  _body[:instrument] = instrument if instrument != SENTINEL
  _body[:side] = side if side != SENTINEL
  _body[:type] = type if type != SENTINEL
  _body[:time_in_force] = time_in_force if time_in_force != SENTINEL
  _body[:amount] = amount if amount != SENTINEL
  _body[:limit_price] = limit_price if limit_price != SENTINEL
  _body[:stop_price] = stop_price if stop_price != SENTINEL
  _body[:post_only] = post_only if post_only != SENTINEL
  _body[:expiration_date] = expiration_date if expiration_date != SENTINEL
  trading_place_simple_order_request = _body
  data, _status_code, _headers = place_simple_order_with_http_info_impl(user_id, user_secret, account_id, trading_place_simple_order_request, extra)
  data
end

def place_simple_order_impl(user_id, user_secret, account_id, trading_place_simple_order_request, opts = {})

Returns:
  • (OrderUpdatedResponse) -

Parameters:
  • opts (Hash) -- the optional parameters
  • trading_place_simple_order_request (TradingPlaceSimpleOrderRequest) --
  • account_id (String) --
  • user_secret (String) --
  • user_id (String) --
def place_simple_order_impl(user_id, user_secret, account_id, trading_place_simple_order_request, opts = {})
_status_code, _headers = place_simple_order_with_http_info(user_id, user_secret, account_id, trading_place_simple_order_request, opts)

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: {})

Parameters:
  • extra (Hash) -- additional parameters to pass along through :header_params, :query_params, or parameter name
  • body (TradingPlaceSimpleOrderRequest) --
  • expiration_date (Time) -- The expiration date of the order. Required if the time_in_force is GTD.
  • 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.
  • 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.
  • limit_price (Float) -- The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT or TAKE_PROFIT_LIMIT.
  • account_id (String) --
  • user_secret (String) --
  • user_id (String) --
  • amount (Float) -- The amount of the base currency to buy or sell.
  • 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.
  • type (Type) -- The type of order to place.
  • side (ActionStrict) -- The action describes the intent or side of a trade. This is either `BUY` or `SELL`.
  • instrument (TradingInstrument) --
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: {})
  _body = {}
  _body[:instrument] = instrument if instrument != SENTINEL
  _body[:side] = side if side != SENTINEL
  _body[:type] = type if type != SENTINEL
  _body[:time_in_force] = time_in_force if time_in_force != SENTINEL
  _body[:amount] = amount if amount != SENTINEL
  _body[:limit_price] = limit_price if limit_price != SENTINEL
  _body[:stop_price] = stop_price if stop_price != SENTINEL
  _body[:post_only] = post_only if post_only != SENTINEL
  _body[:expiration_date] = expiration_date if expiration_date != SENTINEL
  trading_place_simple_order_request = _body
  place_simple_order_with_http_info_impl(user_id, user_secret, account_id, trading_place_simple_order_request, extra)
end

def place_simple_order_with_http_info_impl(user_id, user_secret, account_id, trading_place_simple_order_request, opts = {})

Returns:
  • (Array<(OrderUpdatedResponse, Integer, Hash)>) - OrderUpdatedResponse data, response status code and response headers

Parameters:
  • opts (Hash) -- the optional parameters
  • trading_place_simple_order_request (TradingPlaceSimpleOrderRequest) --
  • account_id (String) --
  • user_secret (String) --
  • user_id (String) --
def place_simple_order_with_http_info_impl(user_id, user_secret, account_id, trading_place_simple_order_request, opts = {})
i_client.config.debugging
_client.config.logger.debug 'Calling API: TradingApi.place_simple_order ...'
fy the required parameter 'user_id' is set
i_client.config.client_side_validation && user_id.nil?
 ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.place_simple_order"
fy the required parameter 'user_secret' is set
i_client.config.client_side_validation && user_secret.nil?
 ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.place_simple_order"
fy the required parameter 'account_id' is set
i_client.config.client_side_validation && account_id.nil?
 ArgumentError, "Missing the required parameter 'account_id' when calling TradingApi.place_simple_order"
fy the required parameter 'trading_place_simple_order_request' is set
i_client.config.client_side_validation && trading_place_simple_order_request.nil?
 ArgumentError, "Missing the required parameter 'trading_place_simple_order_request' when calling TradingApi.place_simple_order"
urce path
var_path = '/accounts/{accountId}/trading/simple'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
y parameters
params = opts[:query_params] || {}
params[:'userId'] = user_id
params[:'userSecret'] = user_secret
er parameters
_params = opts[:header_params] || {}
 header 'Accept' (if needed)
_params['Accept'] = @api_client.select_header_accept(['application/json'])
 header 'Content-Type'
t_type = @api_client.select_header_content_type(['application/json'])
ntent_type.nil?
er_params['Content-Type'] = content_type
 parameters
arams = opts[:form_params] || {}
 body (model)
ody = opts[:debug_body] || @api_client.object_to_http_body(trading_place_simple_order_request)
rn_type
_type = opts[:debug_return_type] || 'OrderUpdatedResponse'
_names
ames = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
tions = opts.merge(
ration => :"TradingApi.place_simple_order",
der_params => header_params,
ry_params => query_params,
m_params => form_params,
y => post_body,
h_names => auth_names,
urn_type => return_type
status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
i_client.config.debugging
_client.config.logger.debug "API called: TradingApi#place_simple_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
 data, status_code, headers, response

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: {})

Parameters:
  • extra (Hash) -- additional parameters to pass along through :header_params, :query_params, or parameter name
  • body (TradingPlaceSimpleOrderRequest) --
  • expiration_date (Time) -- The expiration date of the order. Required if the time_in_force is GTD.
  • 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.
  • 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.
  • limit_price (Float) -- The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT or TAKE_PROFIT_LIMIT.
  • account_id (String) --
  • user_secret (String) --
  • user_id (String) --
  • amount (Float) -- The amount of the base currency to buy or sell.
  • 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.
  • type (Type) -- The type of order to place.
  • side (ActionStrict) -- The action describes the intent or side of a trade. This is either `BUY` or `SELL`.
  • instrument (TradingInstrument) --
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: {})
  _body = {}
  _body[:instrument] = instrument if instrument != SENTINEL
  _body[:side] = side if side != SENTINEL
  _body[:type] = type if type != SENTINEL
  _body[:time_in_force] = time_in_force if time_in_force != SENTINEL
  _body[:amount] = amount if amount != SENTINEL
  _body[:limit_price] = limit_price if limit_price != SENTINEL
  _body[:stop_price] = stop_price if stop_price != SENTINEL
  _body[:post_only] = post_only if post_only != SENTINEL
  _body[:expiration_date] = expiration_date if expiration_date != SENTINEL
  trading_place_simple_order_request = _body
  data, _status_code, _headers = preview_simple_order_with_http_info_impl(user_id, user_secret, account_id, trading_place_simple_order_request, extra)
  data
end

def preview_simple_order_impl(user_id, user_secret, account_id, trading_place_simple_order_request, opts = {})

Returns:
  • (SimpleOrderPreview) -

Parameters:
  • opts (Hash) -- the optional parameters
  • trading_place_simple_order_request (TradingPlaceSimpleOrderRequest) --
  • account_id (String) --
  • user_secret (String) --
  • user_id (String) --
def preview_simple_order_impl(user_id, user_secret, account_id, trading_place_simple_order_request, opts = {})
_status_code, _headers = preview_simple_order_with_http_info(user_id, user_secret, account_id, trading_place_simple_order_request, opts)

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: {})

Parameters:
  • extra (Hash) -- additional parameters to pass along through :header_params, :query_params, or parameter name
  • body (TradingPlaceSimpleOrderRequest) --
  • expiration_date (Time) -- The expiration date of the order. Required if the time_in_force is GTD.
  • 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.
  • 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.
  • limit_price (Float) -- The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT or TAKE_PROFIT_LIMIT.
  • account_id (String) --
  • user_secret (String) --
  • user_id (String) --
  • amount (Float) -- The amount of the base currency to buy or sell.
  • 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.
  • type (Type) -- The type of order to place.
  • side (ActionStrict) -- The action describes the intent or side of a trade. This is either `BUY` or `SELL`.
  • instrument (TradingInstrument) --
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: {})
  _body = {}
  _body[:instrument] = instrument if instrument != SENTINEL
  _body[:side] = side if side != SENTINEL
  _body[:type] = type if type != SENTINEL
  _body[:time_in_force] = time_in_force if time_in_force != SENTINEL
  _body[:amount] = amount if amount != SENTINEL
  _body[:limit_price] = limit_price if limit_price != SENTINEL
  _body[:stop_price] = stop_price if stop_price != SENTINEL
  _body[:post_only] = post_only if post_only != SENTINEL
  _body[:expiration_date] = expiration_date if expiration_date != SENTINEL
  trading_place_simple_order_request = _body
  preview_simple_order_with_http_info_impl(user_id, user_secret, account_id, trading_place_simple_order_request, extra)
end

def preview_simple_order_with_http_info_impl(user_id, user_secret, account_id, trading_place_simple_order_request, opts = {})

Returns:
  • (Array<(SimpleOrderPreview, Integer, Hash)>) - SimpleOrderPreview data, response status code and response headers

Parameters:
  • opts (Hash) -- the optional parameters
  • trading_place_simple_order_request (TradingPlaceSimpleOrderRequest) --
  • account_id (String) --
  • user_secret (String) --
  • user_id (String) --
def preview_simple_order_with_http_info_impl(user_id, user_secret, account_id, trading_place_simple_order_request, opts = {})
i_client.config.debugging
_client.config.logger.debug 'Calling API: TradingApi.preview_simple_order ...'
fy the required parameter 'user_id' is set
i_client.config.client_side_validation && user_id.nil?
 ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.preview_simple_order"
fy the required parameter 'user_secret' is set
i_client.config.client_side_validation && user_secret.nil?
 ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.preview_simple_order"
fy the required parameter 'account_id' is set
i_client.config.client_side_validation && account_id.nil?
 ArgumentError, "Missing the required parameter 'account_id' when calling TradingApi.preview_simple_order"
fy the required parameter 'trading_place_simple_order_request' is set
i_client.config.client_side_validation && trading_place_simple_order_request.nil?
 ArgumentError, "Missing the required parameter 'trading_place_simple_order_request' when calling TradingApi.preview_simple_order"
urce path
var_path = '/accounts/{accountId}/trading/simple/preview'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
y parameters
params = opts[:query_params] || {}
params[:'userId'] = user_id
params[:'userSecret'] = user_secret
er parameters
_params = opts[:header_params] || {}
 header 'Accept' (if needed)
_params['Accept'] = @api_client.select_header_accept(['application/json'])
 header 'Content-Type'
t_type = @api_client.select_header_content_type(['application/json'])
ntent_type.nil?
er_params['Content-Type'] = content_type
 parameters
arams = opts[:form_params] || {}
 body (model)
ody = opts[:debug_body] || @api_client.object_to_http_body(trading_place_simple_order_request)
rn_type
_type = opts[:debug_return_type] || 'SimpleOrderPreview'
_names
ames = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
tions = opts.merge(
ration => :"TradingApi.preview_simple_order",
der_params => header_params,
ry_params => query_params,
m_params => form_params,
y => post_body,
h_names => auth_names,
urn_type => return_type
status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
i_client.config.debugging
_client.config.logger.debug "API called: TradingApi#preview_simple_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
 data, status_code, headers, response

def replace_order(action:, order_type:, time_in_force:, account_id:, brokerage_order_id:, user_id:, user_secret:, price: SENTINEL, symbol: SENTINEL, stop: SENTINEL, units: SENTINEL, extra: {})

Parameters:
  • extra (Hash) -- additional parameters to pass along through :header_params, :query_params, or parameter name
  • body (ManualTradeReplaceForm) --
  • units (Float) --
  • stop (Float) -- The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
  • symbol (String) -- The security's trading ticker symbol
  • price (Float) -- The limit price for `Limit` and `StopLimit` orders.
  • user_secret (String) --
  • user_id (String) --
  • brokerage_order_id (String) -- The Brokerage Order ID of the order to replace.
  • account_id (String) -- The ID of the account to execute the trade on.
  • time_in_force (TimeInForceStrict) -- The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled.
  • 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.
  • action (ActionStrict) -- The action describes the intent or side of a trade. This is either `BUY` or `SELL`.
def replace_order(action:, order_type:, time_in_force:, account_id:, brokerage_order_id:, user_id:, user_secret:, price: SENTINEL, symbol: SENTINEL, stop: SENTINEL, units: SENTINEL, extra: {})
  _body = {}
  _body[:action] = action if action != SENTINEL
  _body[:order_type] = order_type if order_type != SENTINEL
  _body[:time_in_force] = time_in_force if time_in_force != SENTINEL
  _body[:price] = price if price != SENTINEL
  _body[:symbol] = symbol if symbol != SENTINEL
  _body[:stop] = stop if stop != SENTINEL
  _body[:units] = units if units != SENTINEL
  manual_trade_replace_form = _body
  data, _status_code, _headers = replace_order_with_http_info_impl(account_id, brokerage_order_id, user_id, user_secret, manual_trade_replace_form, extra)
  data
end

def replace_order_impl(account_id, brokerage_order_id, user_id, user_secret, manual_trade_replace_form, opts = {})

Returns:
  • (AccountOrderRecord) -

Parameters:
  • opts (Hash) -- the optional parameters
  • manual_trade_replace_form (ManualTradeReplaceForm) --
  • user_secret (String) --
  • user_id (String) --
  • brokerage_order_id (String) -- The Brokerage Order ID of the order to replace.
  • account_id (String) -- The ID of the account to execute the trade on.
def replace_order_impl(account_id, brokerage_order_id, user_id, user_secret, manual_trade_replace_form, opts = {})
_status_code, _headers = replace_order_with_http_info(account_id, brokerage_order_id, user_id, user_secret, manual_trade_replace_form, opts)

def replace_order_with_http_info(action:, order_type:, time_in_force:, account_id:, brokerage_order_id:, user_id:, user_secret:, price: SENTINEL, symbol: SENTINEL, stop: SENTINEL, units: SENTINEL, extra: {})

Parameters:
  • extra (Hash) -- additional parameters to pass along through :header_params, :query_params, or parameter name
  • body (ManualTradeReplaceForm) --
  • units (Float) --
  • stop (Float) -- The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
  • symbol (String) -- The security's trading ticker symbol
  • price (Float) -- The limit price for `Limit` and `StopLimit` orders.
  • user_secret (String) --
  • user_id (String) --
  • brokerage_order_id (String) -- The Brokerage Order ID of the order to replace.
  • account_id (String) -- The ID of the account to execute the trade on.
  • time_in_force (TimeInForceStrict) -- The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled.
  • 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.
  • action (ActionStrict) -- The action describes the intent or side of a trade. This is either `BUY` or `SELL`.
def replace_order_with_http_info(action:, order_type:, time_in_force:, account_id:, brokerage_order_id:, user_id:, user_secret:, price: SENTINEL, symbol: SENTINEL, stop: SENTINEL, units: SENTINEL, extra: {})
  _body = {}
  _body[:action] = action if action != SENTINEL
  _body[:order_type] = order_type if order_type != SENTINEL
  _body[:time_in_force] = time_in_force if time_in_force != SENTINEL
  _body[:price] = price if price != SENTINEL
  _body[:symbol] = symbol if symbol != SENTINEL
  _body[:stop] = stop if stop != SENTINEL
  _body[:units] = units if units != SENTINEL
  manual_trade_replace_form = _body
  replace_order_with_http_info_impl(account_id, brokerage_order_id, user_id, user_secret, manual_trade_replace_form, extra)
end

def replace_order_with_http_info_impl(account_id, brokerage_order_id, user_id, user_secret, manual_trade_replace_form, opts = {})

Returns:
  • (Array<(AccountOrderRecord, Integer, Hash)>) - AccountOrderRecord data, response status code and response headers

Parameters:
  • opts (Hash) -- the optional parameters
  • manual_trade_replace_form (ManualTradeReplaceForm) --
  • user_secret (String) --
  • user_id (String) --
  • brokerage_order_id (String) -- The Brokerage Order ID of the order to replace.
  • account_id (String) -- The ID of the account to execute the trade on.
def replace_order_with_http_info_impl(account_id, brokerage_order_id, user_id, user_secret, manual_trade_replace_form, opts = {})
i_client.config.debugging
_client.config.logger.debug 'Calling API: TradingApi.replace_order ...'
fy the required parameter 'account_id' is set
i_client.config.client_side_validation && account_id.nil?
 ArgumentError, "Missing the required parameter 'account_id' when calling TradingApi.replace_order"
fy the required parameter 'brokerage_order_id' is set
i_client.config.client_side_validation && brokerage_order_id.nil?
 ArgumentError, "Missing the required parameter 'brokerage_order_id' when calling TradingApi.replace_order"
fy the required parameter 'user_id' is set
i_client.config.client_side_validation && user_id.nil?
 ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.replace_order"
fy the required parameter 'user_secret' is set
i_client.config.client_side_validation && user_secret.nil?
 ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.replace_order"
fy the required parameter 'manual_trade_replace_form' is set
i_client.config.client_side_validation && manual_trade_replace_form.nil?
 ArgumentError, "Missing the required parameter 'manual_trade_replace_form' when calling TradingApi.replace_order"
urce path
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))
y parameters
params = opts[:query_params] || {}
params[:'userId'] = user_id
params[:'userSecret'] = user_secret
er parameters
_params = opts[:header_params] || {}
 header 'Accept' (if needed)
_params['Accept'] = @api_client.select_header_accept(['application/json'])
 header 'Content-Type'
t_type = @api_client.select_header_content_type(['application/json'])
ntent_type.nil?
er_params['Content-Type'] = content_type
 parameters
arams = opts[:form_params] || {}
 body (model)
ody = opts[:debug_body] || @api_client.object_to_http_body(manual_trade_replace_form)
rn_type
_type = opts[:debug_return_type] || 'AccountOrderRecord'
_names
ames = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
tions = opts.merge(
ration => :"TradingApi.replace_order",
der_params => header_params,
ry_params => query_params,
m_params => form_params,
y => post_body,
h_names => auth_names,
urn_type => return_type
status_code, headers, response = @api_client.call_api(:PATCH, local_var_path, new_options)
i_client.config.debugging
_client.config.logger.debug "API called: TradingApi#replace_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
 data, status_code, headers, response

def search_cryptocurrency_pair_instruments(user_id:, user_secret:, account_id:, base: SENTINEL, quote: SENTINEL, extra: {})

Parameters:
  • extra (Hash) -- additional parameters to pass along through :header_params, :query_params, or parameter name
  • quote (String) --
  • base (String) --
  • account_id (String) --
  • user_secret (String) --
  • user_id (String) --
def search_cryptocurrency_pair_instruments(user_id:, user_secret:, account_id:, base: SENTINEL, quote: SENTINEL, extra: {})
  extra[:base] = base if base != SENTINEL
  extra[:quote] = quote if quote != SENTINEL
  data, _status_code, _headers = search_cryptocurrency_pair_instruments_with_http_info_impl(user_id, user_secret, account_id, extra)
  data
end

def search_cryptocurrency_pair_instruments_impl(user_id, user_secret, account_id, opts = {})

Returns:
  • (TradingSearchCryptocurrencyPairInstruments200Response) -

Options Hash: (**opts)
  • :quote (String) --
  • :base (String) --

Parameters:
  • opts (Hash) -- the optional parameters
  • account_id (String) --
  • user_secret (String) --
  • user_id (String) --
def search_cryptocurrency_pair_instruments_impl(user_id, user_secret, account_id, opts = {})
_status_code, _headers = search_cryptocurrency_pair_instruments_with_http_info(user_id, user_secret, account_id, opts)

def search_cryptocurrency_pair_instruments_with_http_info(user_id:, user_secret:, account_id:, base: SENTINEL, quote: SENTINEL, extra: {})

Parameters:
  • extra (Hash) -- additional parameters to pass along through :header_params, :query_params, or parameter name
  • quote (String) --
  • base (String) --
  • account_id (String) --
  • user_secret (String) --
  • user_id (String) --
def search_cryptocurrency_pair_instruments_with_http_info(user_id:, user_secret:, account_id:, base: SENTINEL, quote: SENTINEL, extra: {})
  extra[:base] = base if base != SENTINEL
  extra[:quote] = quote if quote != SENTINEL
  search_cryptocurrency_pair_instruments_with_http_info_impl(user_id, user_secret, account_id, extra)
end

def search_cryptocurrency_pair_instruments_with_http_info_impl(user_id, user_secret, account_id, opts = {})

Returns:
  • (Array<(TradingSearchCryptocurrencyPairInstruments200Response, Integer, Hash)>) - TradingSearchCryptocurrencyPairInstruments200Response data, response status code and response headers

Options Hash: (**opts)
  • :quote (String) --
  • :base (String) --

Parameters:
  • opts (Hash) -- the optional parameters
  • account_id (String) --
  • user_secret (String) --
  • user_id (String) --
def search_cryptocurrency_pair_instruments_with_http_info_impl(user_id, user_secret, account_id, opts = {})
i_client.config.debugging
_client.config.logger.debug 'Calling API: TradingApi.search_cryptocurrency_pair_instruments ...'
fy the required parameter 'user_id' is set
i_client.config.client_side_validation && user_id.nil?
 ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.search_cryptocurrency_pair_instruments"
fy the required parameter 'user_secret' is set
i_client.config.client_side_validation && user_secret.nil?
 ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.search_cryptocurrency_pair_instruments"
fy the required parameter 'account_id' is set
i_client.config.client_side_validation && account_id.nil?
 ArgumentError, "Missing the required parameter 'account_id' when calling TradingApi.search_cryptocurrency_pair_instruments"
urce path
var_path = '/accounts/{accountId}/trading/instruments/cryptocurrencyPairs'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
y parameters
params = opts[:query_params] || {}
params[:'userId'] = user_id
params[:'userSecret'] = user_secret
params[:'base'] = opts[:'base'] if !opts[:'base'].nil?
params[:'quote'] = opts[:'quote'] if !opts[:'quote'].nil?
er parameters
_params = opts[:header_params] || {}
 header 'Accept' (if needed)
_params['Accept'] = @api_client.select_header_accept(['application/json'])
 parameters
arams = opts[:form_params] || {}
 body (model)
ody = opts[:debug_body]
rn_type
_type = opts[:debug_return_type] || 'TradingSearchCryptocurrencyPairInstruments200Response'
_names
ames = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
tions = opts.merge(
ration => :"TradingApi.search_cryptocurrency_pair_instruments",
der_params => header_params,
ry_params => query_params,
m_params => form_params,
y => post_body,
h_names => auth_names,
urn_type => return_type
status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
i_client.config.debugging
_client.config.logger.debug "API called: TradingApi#search_cryptocurrency_pair_instruments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
 data, status_code, headers, response