snaptrade 1.14.0 → 1.15.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +10 -10
- data/Gemfile.lock +13 -11
- data/README.md +221 -221
- data/docs/APIStatusApi.md +57 -57
- data/docs/AccountInformationApi.md +535 -535
- data/docs/AuthenticationApi.md +314 -314
- data/docs/Brokerage.md +1 -1
- data/docs/ConnectionsApi.md +265 -265
- data/docs/ErrorLogsApi.md +68 -68
- data/docs/LoginRedirectURI.md +1 -1
- data/docs/ModelPortfolio.md +1 -1
- data/docs/OptionsApi.md +378 -378
- data/docs/OptionsPosition.md +1 -3
- data/docs/Position.md +1 -3
- data/docs/ReferenceDataApi.md +595 -595
- data/docs/SnapTradeLoginUserRequestBody.md +1 -1
- data/docs/TradingApi.md +478 -478
- data/docs/TransactionsAndReportingApi.md +183 -183
- data/docs/UniversalActivity.md +1 -1
- data/docs/UserSettings.md +1 -1
- data/lib/snaptrade/api/account_information_api.rb +801 -801
- data/lib/snaptrade/api/api_status_api.rb +98 -98
- data/lib/snaptrade/api/authentication_api.rb +481 -481
- data/lib/snaptrade/api/connections_api.rb +398 -398
- data/lib/snaptrade/api/error_logs_api.rb +112 -112
- data/lib/snaptrade/api/options_api.rb +591 -591
- data/lib/snaptrade/api/reference_data_api.rb +894 -894
- data/lib/snaptrade/api/trading_api.rb +741 -741
- data/lib/snaptrade/api/transactions_and_reporting_api.rb +283 -283
- data/lib/snaptrade/api_client.rb +427 -427
- data/lib/snaptrade/api_client_custom.rb +32 -32
- data/lib/snaptrade/api_error.rb +6 -6
- data/lib/snaptrade/configuration.rb +334 -334
- data/lib/snaptrade/models/account.rb +6 -6
- data/lib/snaptrade/models/account_holdings.rb +6 -6
- data/lib/snaptrade/models/account_holdings_account.rb +6 -6
- data/lib/snaptrade/models/account_order_record.rb +6 -6
- data/lib/snaptrade/models/account_order_record_status.rb +6 -6
- data/lib/snaptrade/models/account_simple.rb +6 -6
- data/lib/snaptrade/models/account_sync_status.rb +6 -6
- data/lib/snaptrade/models/action.rb +6 -6
- data/lib/snaptrade/models/auth_type.rb +6 -6
- data/lib/snaptrade/models/authentication_login_snap_trade_user200_response.rb +6 -6
- data/lib/snaptrade/models/balance.rb +6 -6
- data/lib/snaptrade/models/brokerage.rb +6 -6
- data/lib/snaptrade/models/brokerage_authorization.rb +6 -6
- data/lib/snaptrade/models/brokerage_authorization_type.rb +6 -6
- data/lib/snaptrade/models/brokerage_authorization_type_read_only.rb +6 -6
- data/lib/snaptrade/models/brokerage_authorization_type_read_only_brokerage.rb +6 -6
- data/lib/snaptrade/models/brokerage_authorization_type_read_only_type.rb +6 -6
- data/lib/snaptrade/models/brokerage_authorization_type_type.rb +6 -6
- data/lib/snaptrade/models/brokerage_symbol.rb +6 -6
- data/lib/snaptrade/models/brokerage_symbol_option_symbol.rb +6 -6
- data/lib/snaptrade/models/brokerage_symbol_symbol.rb +6 -6
- data/lib/snaptrade/models/brokerage_type.rb +6 -6
- data/lib/snaptrade/models/calculated_trade.rb +6 -6
- data/lib/snaptrade/models/cash_restriction.rb +6 -6
- data/lib/snaptrade/models/connection_type.rb +6 -6
- data/lib/snaptrade/models/connections_session_events200_response_inner.rb +6 -6
- data/lib/snaptrade/models/currency.rb +6 -6
- data/lib/snaptrade/models/delete_user_response.rb +6 -6
- data/lib/snaptrade/models/dividend_at_date.rb +6 -6
- data/lib/snaptrade/models/encrypted_response.rb +6 -6
- data/lib/snaptrade/models/encrypted_response_encrypted_message_data.rb +6 -6
- data/lib/snaptrade/models/exchange.rb +6 -6
- data/lib/snaptrade/models/exchange_rate_pairs.rb +6 -6
- data/lib/snaptrade/models/excluded_asset.rb +6 -6
- data/lib/snaptrade/models/jwt.rb +6 -6
- data/lib/snaptrade/models/login_redirect_uri.rb +6 -6
- data/lib/snaptrade/models/manual_trade.rb +6 -6
- data/lib/snaptrade/models/manual_trade_and_impact.rb +6 -6
- data/lib/snaptrade/models/manual_trade_balance.rb +6 -6
- data/lib/snaptrade/models/manual_trade_form.rb +6 -6
- data/lib/snaptrade/models/manual_trade_symbol.rb +6 -6
- data/lib/snaptrade/models/model400_failed_request_response.rb +6 -6
- data/lib/snaptrade/models/model401_failed_request_response.rb +6 -6
- data/lib/snaptrade/models/model403_failed_request_response.rb +6 -6
- data/lib/snaptrade/models/model404_failed_request_response.rb +6 -6
- data/lib/snaptrade/models/model_asset_class.rb +6 -6
- data/lib/snaptrade/models/model_asset_class_details.rb +6 -6
- data/lib/snaptrade/models/model_asset_class_target.rb +6 -6
- data/lib/snaptrade/models/model_portfolio.rb +6 -6
- data/lib/snaptrade/models/model_portfolio_asset_class.rb +6 -6
- data/lib/snaptrade/models/model_portfolio_details.rb +6 -6
- data/lib/snaptrade/models/model_portfolio_security.rb +6 -6
- data/lib/snaptrade/models/model_type.rb +6 -6
- data/lib/snaptrade/models/monthly_dividends.rb +6 -6
- data/lib/snaptrade/models/net_contributions.rb +6 -6
- data/lib/snaptrade/models/net_dividend.rb +6 -6
- data/lib/snaptrade/models/option_chain_inner.rb +6 -6
- data/lib/snaptrade/models/option_chain_inner_chain_per_root_inner.rb +6 -6
- data/lib/snaptrade/models/option_chain_inner_chain_per_root_inner_chain_per_strike_price_inner.rb +6 -6
- data/lib/snaptrade/models/option_leg.rb +6 -6
- data/lib/snaptrade/models/option_leg_action.rb +6 -6
- data/lib/snaptrade/models/option_strategy.rb +6 -6
- data/lib/snaptrade/models/option_strategy_legs_inner.rb +6 -6
- data/lib/snaptrade/models/options_get_option_strategy_request.rb +6 -6
- data/lib/snaptrade/models/options_holdings.rb +6 -6
- data/lib/snaptrade/models/options_place_option_strategy_request.rb +6 -6
- data/lib/snaptrade/models/options_position.rb +11 -22
- data/lib/snaptrade/models/options_position_currency.rb +6 -6
- data/lib/snaptrade/models/options_symbol.rb +6 -6
- data/lib/snaptrade/models/order_strategy_execute_body_order_type.rb +6 -6
- data/lib/snaptrade/models/order_strategy_execute_body_time_in_force.rb +6 -6
- data/lib/snaptrade/models/order_type.rb +6 -6
- data/lib/snaptrade/models/partner_data.rb +6 -6
- data/lib/snaptrade/models/past_value.rb +6 -6
- data/lib/snaptrade/models/performance_custom.rb +6 -6
- data/lib/snaptrade/models/portfolio_group.rb +6 -6
- data/lib/snaptrade/models/portfolio_group_info.rb +6 -6
- data/lib/snaptrade/models/portfolio_group_position.rb +6 -6
- data/lib/snaptrade/models/portfolio_group_settings.rb +6 -6
- data/lib/snaptrade/models/position.rb +11 -22
- data/lib/snaptrade/models/position_symbol.rb +6 -6
- data/lib/snaptrade/models/redirect_tokenand_pin.rb +6 -6
- data/lib/snaptrade/models/security_type.rb +6 -6
- data/lib/snaptrade/models/session_event.rb +6 -6
- data/lib/snaptrade/models/session_event_type.rb +6 -6
- data/lib/snaptrade/models/snap_trade_api_disclaimer_accept_status.rb +6 -6
- data/lib/snaptrade/models/snap_trade_holdings_account.rb +6 -6
- data/lib/snaptrade/models/snap_trade_holdings_account_account_id.rb +6 -6
- data/lib/snaptrade/models/snap_trade_holdings_total_value.rb +6 -6
- data/lib/snaptrade/models/snap_trade_login_user_request_body.rb +6 -6
- data/lib/snaptrade/models/snap_trade_register_user_request_body.rb +6 -6
- data/lib/snaptrade/models/state.rb +6 -6
- data/lib/snaptrade/models/status.rb +6 -6
- data/lib/snaptrade/models/strategy_impact.rb +6 -6
- data/lib/snaptrade/models/strategy_impact_legs_inner.rb +6 -6
- data/lib/snaptrade/models/strategy_order_place.rb +6 -6
- data/lib/snaptrade/models/strategy_order_place_orders_inner.rb +6 -6
- data/lib/snaptrade/models/strategy_order_place_orders_inner_legs_inner.rb +6 -6
- data/lib/snaptrade/models/strategy_order_record.rb +6 -6
- data/lib/snaptrade/models/strategy_order_record_order_type.rb +6 -6
- data/lib/snaptrade/models/strategy_order_record_status.rb +6 -6
- data/lib/snaptrade/models/strategy_order_record_time_in_force.rb +6 -6
- data/lib/snaptrade/models/strategy_quotes.rb +6 -6
- data/lib/snaptrade/models/strategy_quotes_greek.rb +6 -6
- data/lib/snaptrade/models/strategy_type.rb +6 -6
- data/lib/snaptrade/models/sub_period_return_rate.rb +6 -6
- data/lib/snaptrade/models/symbol.rb +6 -6
- data/lib/snaptrade/models/symbol_query.rb +6 -6
- data/lib/snaptrade/models/symbols_quotes_inner.rb +6 -6
- data/lib/snaptrade/models/target_asset.rb +6 -6
- data/lib/snaptrade/models/time_in_force.rb +6 -6
- data/lib/snaptrade/models/trade.rb +6 -6
- data/lib/snaptrade/models/trade_action.rb +6 -6
- data/lib/snaptrade/models/trade_execution_status.rb +6 -6
- data/lib/snaptrade/models/trade_execution_status_action.rb +6 -6
- data/lib/snaptrade/models/trade_impact.rb +6 -6
- data/lib/snaptrade/models/trading_cancel_user_account_order_request.rb +6 -6
- data/lib/snaptrade/models/trading_place_oco_order_request.rb +6 -6
- data/lib/snaptrade/models/transactions_status.rb +6 -6
- data/lib/snaptrade/models/type.rb +6 -6
- data/lib/snaptrade/models/underlying_symbol.rb +6 -6
- data/lib/snaptrade/models/universal_activity.rb +6 -6
- data/lib/snaptrade/models/universal_symbol.rb +6 -6
- data/lib/snaptrade/models/universal_symbol_ticker.rb +6 -6
- data/lib/snaptrade/models/us_exchange.rb +6 -6
- data/lib/snaptrade/models/user_error_log.rb +6 -6
- data/lib/snaptrade/models/user_i_dand_secret.rb +6 -6
- data/lib/snaptrade/models/user_settings.rb +7 -7
- data/lib/snaptrade/version.rb +13 -13
- data/lib/snaptrade.rb +214 -214
- data/snaptrade.gemspec +41 -41
- data/spec/api/account_information_api_spec.rb +135 -135
- data/spec/api/api_status_api_spec.rb +42 -42
- data/spec/api/authentication_api_spec.rb +88 -88
- data/spec/api/connections_api_spec.rb +82 -82
- data/spec/api/error_logs_api_spec.rb +43 -43
- data/spec/api/options_api_spec.rb +101 -101
- data/spec/api/reference_data_api_spec.rb +150 -150
- data/spec/api/trading_api_spec.rb +112 -112
- data/spec/api/transactions_and_reporting_api_spec.rb +67 -67
- data/spec/api_client_spec.rb +193 -193
- data/spec/configuration_spec.rb +6 -6
- data/spec/getting_started_spec.rb +108 -108
- data/spec/models/account_holdings_account_spec.rb +54 -54
- data/spec/models/account_holdings_spec.rb +48 -48
- data/spec/models/account_order_record_spec.rb +132 -132
- data/spec/models/account_order_record_status_spec.rb +24 -24
- data/spec/models/account_simple_spec.rb +48 -48
- data/spec/models/account_spec.rb +84 -84
- data/spec/models/account_sync_status_spec.rb +30 -30
- data/spec/models/action_spec.rb +24 -24
- data/spec/models/auth_type_spec.rb +24 -24
- data/spec/models/authentication_login_snap_trade_user200_response_spec.rb +27 -27
- data/spec/models/balance_spec.rb +36 -36
- data/spec/models/brokerage_authorization_spec.rb +78 -78
- data/spec/models/brokerage_authorization_type_read_only_brokerage_spec.rb +42 -42
- data/spec/models/brokerage_authorization_type_read_only_spec.rb +48 -48
- data/spec/models/brokerage_authorization_type_read_only_type_spec.rb +24 -24
- data/spec/models/brokerage_authorization_type_spec.rb +30 -30
- data/spec/models/brokerage_authorization_type_type_spec.rb +24 -24
- data/spec/models/brokerage_spec.rb +132 -132
- data/spec/models/brokerage_symbol_option_symbol_spec.rb +72 -72
- data/spec/models/brokerage_symbol_spec.rb +60 -60
- data/spec/models/brokerage_symbol_symbol_spec.rb +72 -72
- data/spec/models/brokerage_type_spec.rb +36 -36
- data/spec/models/calculated_trade_spec.rb +36 -36
- data/spec/models/cash_restriction_spec.rb +54 -54
- data/spec/models/connection_type_spec.rb +24 -24
- data/spec/models/connections_session_events200_response_inner_spec.rb +66 -66
- data/spec/models/currency_spec.rb +42 -42
- data/spec/models/delete_user_response_spec.rb +36 -36
- data/spec/models/dividend_at_date_spec.rb +42 -42
- data/spec/models/encrypted_response_encrypted_message_data_spec.rb +42 -42
- data/spec/models/encrypted_response_spec.rb +36 -36
- data/spec/models/exchange_rate_pairs_spec.rb +42 -42
- data/spec/models/exchange_spec.rb +72 -72
- data/spec/models/excluded_asset_spec.rb +30 -30
- data/spec/models/jwt_spec.rb +30 -30
- data/spec/models/login_redirect_uri_spec.rb +36 -36
- data/spec/models/manual_trade_and_impact_spec.rb +42 -42
- data/spec/models/manual_trade_balance_spec.rb +42 -42
- data/spec/models/manual_trade_form_spec.rb +72 -72
- data/spec/models/manual_trade_spec.rb +72 -72
- data/spec/models/manual_trade_symbol_spec.rb +60 -60
- data/spec/models/model400_failed_request_response_spec.rb +36 -36
- data/spec/models/model401_failed_request_response_spec.rb +36 -36
- data/spec/models/model403_failed_request_response_spec.rb +36 -36
- data/spec/models/model404_failed_request_response_spec.rb +36 -36
- data/spec/models/model_asset_class_details_spec.rb +36 -36
- data/spec/models/model_asset_class_spec.rb +36 -36
- data/spec/models/model_asset_class_target_spec.rb +30 -30
- data/spec/models/model_portfolio_asset_class_spec.rb +36 -36
- data/spec/models/model_portfolio_details_spec.rb +42 -42
- data/spec/models/model_portfolio_security_spec.rb +36 -36
- data/spec/models/model_portfolio_spec.rb +42 -42
- data/spec/models/model_type_spec.rb +24 -24
- data/spec/models/monthly_dividends_spec.rb +36 -36
- data/spec/models/net_contributions_spec.rb +42 -42
- data/spec/models/net_dividend_spec.rb +42 -42
- data/spec/models/option_chain_inner_chain_per_root_inner_chain_per_strike_price_inner_spec.rb +42 -42
- data/spec/models/option_chain_inner_chain_per_root_inner_spec.rb +42 -42
- data/spec/models/option_chain_inner_spec.rb +54 -54
- data/spec/models/option_leg_action_spec.rb +24 -24
- data/spec/models/option_leg_spec.rb +42 -42
- data/spec/models/option_strategy_legs_inner_spec.rb +48 -48
- data/spec/models/option_strategy_spec.rb +54 -54
- data/spec/models/options_get_option_strategy_request_spec.rb +42 -42
- data/spec/models/options_holdings_spec.rb +60 -60
- data/spec/models/options_place_option_strategy_request_spec.rb +42 -42
- data/spec/models/options_position_currency_spec.rb +42 -42
- data/spec/models/options_position_spec.rb +66 -72
- data/spec/models/options_symbol_spec.rb +72 -72
- data/spec/models/order_strategy_execute_body_order_type_spec.rb +24 -24
- data/spec/models/order_strategy_execute_body_time_in_force_spec.rb +24 -24
- data/spec/models/order_type_spec.rb +24 -24
- data/spec/models/partner_data_spec.rb +96 -96
- data/spec/models/past_value_spec.rb +42 -42
- data/spec/models/performance_custom_spec.rb +138 -138
- data/spec/models/portfolio_group_info_spec.rb +90 -90
- data/spec/models/portfolio_group_position_spec.rb +42 -42
- data/spec/models/portfolio_group_settings_spec.rb +54 -54
- data/spec/models/portfolio_group_spec.rb +36 -36
- data/spec/models/position_spec.rb +60 -66
- data/spec/models/position_symbol_spec.rb +60 -60
- data/spec/models/redirect_tokenand_pin_spec.rb +36 -36
- data/spec/models/security_type_spec.rb +48 -48
- data/spec/models/session_event_spec.rb +66 -66
- data/spec/models/session_event_type_spec.rb +24 -24
- data/spec/models/snap_trade_api_disclaimer_accept_status_spec.rb +36 -36
- data/spec/models/snap_trade_holdings_account_account_id_spec.rb +78 -78
- data/spec/models/snap_trade_holdings_account_spec.rb +72 -72
- data/spec/models/snap_trade_holdings_total_value_spec.rb +36 -36
- data/spec/models/snap_trade_login_user_request_body_spec.rb +54 -54
- data/spec/models/snap_trade_register_user_request_body_spec.rb +36 -36
- data/spec/models/state_spec.rb +24 -24
- data/spec/models/status_spec.rb +42 -42
- data/spec/models/strategy_impact_legs_inner_spec.rb +66 -66
- data/spec/models/strategy_impact_spec.rb +90 -90
- data/spec/models/strategy_order_place_orders_inner_legs_inner_spec.rb +66 -66
- data/spec/models/strategy_order_place_orders_inner_spec.rb +282 -282
- data/spec/models/strategy_order_place_spec.rb +36 -36
- data/spec/models/strategy_order_record_order_type_spec.rb +24 -24
- data/spec/models/strategy_order_record_spec.rb +90 -90
- data/spec/models/strategy_order_record_status_spec.rb +24 -24
- data/spec/models/strategy_order_record_time_in_force_spec.rb +24 -24
- data/spec/models/strategy_quotes_greek_spec.rb +54 -54
- data/spec/models/strategy_quotes_spec.rb +60 -60
- data/spec/models/strategy_type_spec.rb +24 -24
- data/spec/models/sub_period_return_rate_spec.rb +42 -42
- data/spec/models/symbol_query_spec.rb +30 -30
- data/spec/models/symbol_spec.rb +66 -66
- data/spec/models/symbols_quotes_inner_spec.rb +60 -60
- data/spec/models/target_asset_spec.rb +60 -60
- data/spec/models/time_in_force_spec.rb +24 -24
- data/spec/models/trade_action_spec.rb +24 -24
- data/spec/models/trade_execution_status_action_spec.rb +24 -24
- data/spec/models/trade_execution_status_spec.rb +78 -78
- data/spec/models/trade_impact_spec.rb +54 -54
- data/spec/models/trade_spec.rb +72 -72
- data/spec/models/trading_cancel_user_account_order_request_spec.rb +30 -30
- data/spec/models/trading_place_oco_order_request_spec.rb +36 -36
- data/spec/models/transactions_status_spec.rb +36 -36
- data/spec/models/type_spec.rb +24 -24
- data/spec/models/underlying_symbol_spec.rb +66 -66
- data/spec/models/universal_activity_spec.rb +120 -120
- data/spec/models/universal_symbol_spec.rb +72 -72
- data/spec/models/universal_symbol_ticker_spec.rb +72 -72
- data/spec/models/us_exchange_spec.rb +78 -78
- data/spec/models/user_error_log_spec.rb +60 -60
- data/spec/models/user_i_dand_secret_spec.rb +36 -36
- data/spec/models/user_settings_spec.rb +84 -84
- data/spec/spec_helper.rb +6 -6
- metadata +116 -116
@@ -1,741 +1,741 @@
|
|
1
|
-
=begin
|
2
|
-
#SnapTrade
|
3
|
-
|
4
|
-
#Connect brokerage accounts to your app for live positions and trading
|
5
|
-
|
6
|
-
The version of the OpenAPI document: 1.0.0
|
7
|
-
Contact: api@snaptrade.com
|
8
|
-
|
9
|
-
=end
|
10
|
-
|
11
|
-
require 'cgi'
|
12
|
-
|
13
|
-
module SnapTrade
|
14
|
-
class TradingApi
|
15
|
-
attr_accessor :api_client
|
16
|
-
|
17
|
-
def initialize(api_client = ApiClient.default)
|
18
|
-
@api_client = api_client
|
19
|
-
end
|
20
|
-
|
21
|
-
# Cancel open order in account
|
22
|
-
# @param user_id [String]
|
23
|
-
# @param user_secret [String]
|
24
|
-
# @param account_id [String] The ID of the account get positions.
|
25
|
-
# @param brokerage_order_id [String]
|
26
|
-
# @param body [TradingCancelUserAccountOrderRequest] The Order ID to be canceled
|
27
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
28
|
-
def cancel_user_account_order(user_id:, user_secret:, account_id:, brokerage_order_id: SENTINEL, extra: {})
|
29
|
-
_body = {}
|
30
|
-
_body[:brokerage_order_id] = brokerage_order_id if brokerage_order_id != SENTINEL
|
31
|
-
trading_cancel_user_account_order_request = _body
|
32
|
-
|
33
|
-
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)
|
34
|
-
data
|
35
|
-
end
|
36
|
-
|
37
|
-
# Cancel open order in account
|
38
|
-
# @param user_id [String]
|
39
|
-
# @param user_secret [String]
|
40
|
-
# @param account_id [String] The ID of the account get positions.
|
41
|
-
# @param brokerage_order_id [String]
|
42
|
-
# @param body [TradingCancelUserAccountOrderRequest] The Order ID to be canceled
|
43
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
44
|
-
def cancel_user_account_order_with_http_info(user_id:, user_secret:, account_id:, brokerage_order_id: SENTINEL, extra: {})
|
45
|
-
_body = {}
|
46
|
-
_body[:brokerage_order_id] = brokerage_order_id if brokerage_order_id != SENTINEL
|
47
|
-
trading_cancel_user_account_order_request = _body
|
48
|
-
|
49
|
-
cancel_user_account_order_with_http_info_impl(user_id, user_secret, account_id, trading_cancel_user_account_order_request, extra)
|
50
|
-
end
|
51
|
-
|
52
|
-
# Cancel open order in account
|
53
|
-
# @param user_id [String]
|
54
|
-
# @param user_secret [String]
|
55
|
-
# @param account_id [String] The ID of the account get positions.
|
56
|
-
# @param trading_cancel_user_account_order_request [TradingCancelUserAccountOrderRequest] The Order ID to be canceled
|
57
|
-
# @param [Hash] opts the optional parameters
|
58
|
-
# @return [AccountOrderRecord]
|
59
|
-
def cancel_user_account_order_impl(user_id, user_secret, account_id, trading_cancel_user_account_order_request, opts = {})
|
60
|
-
data, _status_code, _headers = cancel_user_account_order_with_http_info(user_id, user_secret, account_id, trading_cancel_user_account_order_request, opts)
|
61
|
-
data
|
62
|
-
end
|
63
|
-
|
64
|
-
# Cancel open order in account
|
65
|
-
# @param user_id [String]
|
66
|
-
# @param user_secret [String]
|
67
|
-
# @param account_id [String] The ID of the account get positions.
|
68
|
-
# @param trading_cancel_user_account_order_request [TradingCancelUserAccountOrderRequest] The Order ID to be canceled
|
69
|
-
# @param [Hash] opts the optional parameters
|
70
|
-
# @return [Array<(AccountOrderRecord, Integer, Hash)>] AccountOrderRecord data, response status code and response headers
|
71
|
-
def cancel_user_account_order_with_http_info_impl(user_id, user_secret, account_id, trading_cancel_user_account_order_request, opts = {})
|
72
|
-
if @api_client.config.debugging
|
73
|
-
@api_client.config.logger.debug 'Calling API: TradingApi.cancel_user_account_order ...'
|
74
|
-
end
|
75
|
-
# verify the required parameter 'user_id' is set
|
76
|
-
if @api_client.config.client_side_validation && user_id.nil?
|
77
|
-
fail ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.cancel_user_account_order"
|
78
|
-
end
|
79
|
-
# verify the required parameter 'user_secret' is set
|
80
|
-
if @api_client.config.client_side_validation && user_secret.nil?
|
81
|
-
fail ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.cancel_user_account_order"
|
82
|
-
end
|
83
|
-
# verify the required parameter 'account_id' is set
|
84
|
-
if @api_client.config.client_side_validation && account_id.nil?
|
85
|
-
fail ArgumentError, "Missing the required parameter 'account_id' when calling TradingApi.cancel_user_account_order"
|
86
|
-
end
|
87
|
-
# verify the required parameter 'trading_cancel_user_account_order_request' is set
|
88
|
-
if @api_client.config.client_side_validation && trading_cancel_user_account_order_request.nil?
|
89
|
-
fail ArgumentError, "Missing the required parameter 'trading_cancel_user_account_order_request' when calling TradingApi.cancel_user_account_order"
|
90
|
-
end
|
91
|
-
# resource path
|
92
|
-
local_var_path = '/accounts/{accountId}/orders/cancel'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
|
93
|
-
|
94
|
-
# query parameters
|
95
|
-
query_params = opts[:query_params] || {}
|
96
|
-
query_params[:'userId'] = user_id
|
97
|
-
query_params[:'userSecret'] = user_secret
|
98
|
-
|
99
|
-
# header parameters
|
100
|
-
header_params = opts[:header_params] || {}
|
101
|
-
# HTTP header 'Accept' (if needed)
|
102
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
103
|
-
# HTTP header 'Content-Type'
|
104
|
-
content_type = @api_client.select_header_content_type(['application/json'])
|
105
|
-
if !content_type.nil?
|
106
|
-
header_params['Content-Type'] = content_type
|
107
|
-
end
|
108
|
-
|
109
|
-
# form parameters
|
110
|
-
form_params = opts[:form_params] || {}
|
111
|
-
|
112
|
-
# http body (model)
|
113
|
-
post_body = opts[:debug_body] || @api_client.object_to_http_body(trading_cancel_user_account_order_request)
|
114
|
-
|
115
|
-
# return_type
|
116
|
-
return_type = opts[:debug_return_type] || 'AccountOrderRecord'
|
117
|
-
|
118
|
-
# auth_names
|
119
|
-
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
120
|
-
|
121
|
-
new_options = opts.merge(
|
122
|
-
:operation => :"TradingApi.cancel_user_account_order",
|
123
|
-
:header_params => header_params,
|
124
|
-
:query_params => query_params,
|
125
|
-
:form_params => form_params,
|
126
|
-
:body => post_body,
|
127
|
-
:auth_names => auth_names,
|
128
|
-
:return_type => return_type
|
129
|
-
)
|
130
|
-
|
131
|
-
data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
|
132
|
-
if @api_client.config.debugging
|
133
|
-
@api_client.config.logger.debug "API called: TradingApi#cancel_user_account_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
134
|
-
end
|
135
|
-
return data, status_code, headers, response
|
136
|
-
end
|
137
|
-
|
138
|
-
|
139
|
-
# Check impact of trades on account.
|
140
|
-
# @param user_id [String]
|
141
|
-
# @param user_secret [String]
|
142
|
-
# @param account_id [String]
|
143
|
-
# @param action [Action]
|
144
|
-
# @param order_type [OrderType]
|
145
|
-
# @param price [Float] Trade Price if limit or stop limit order
|
146
|
-
# @param stop [Float] Stop Price. If stop loss or stop limit order, the price to trigger the stop
|
147
|
-
# @param time_in_force [TimeInForce]
|
148
|
-
# @param units [Float] Trade Units
|
149
|
-
# @param universal_symbol_id [String]
|
150
|
-
# @param body [ManualTradeForm]
|
151
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
152
|
-
def get_order_impact(user_id:, user_secret:, account_id: SENTINEL, action: SENTINEL, order_type: SENTINEL, price: SENTINEL, stop: SENTINEL, time_in_force: SENTINEL, units: SENTINEL, universal_symbol_id: SENTINEL, extra: {})
|
153
|
-
_body = {}
|
154
|
-
_body[:account_id] = account_id if account_id != SENTINEL
|
155
|
-
_body[:action] = action if action != SENTINEL
|
156
|
-
_body[:order_type] = order_type if order_type != SENTINEL
|
157
|
-
_body[:price] = price if price != SENTINEL
|
158
|
-
_body[:stop] = stop if stop != SENTINEL
|
159
|
-
_body[:time_in_force] = time_in_force if time_in_force != SENTINEL
|
160
|
-
_body[:units] = units if units != SENTINEL
|
161
|
-
_body[:universal_symbol_id] = universal_symbol_id if universal_symbol_id != SENTINEL
|
162
|
-
manual_trade_form = _body
|
163
|
-
|
164
|
-
data, _status_code, _headers = get_order_impact_with_http_info_impl(user_id, user_secret, manual_trade_form, extra)
|
165
|
-
data
|
166
|
-
end
|
167
|
-
|
168
|
-
# Check impact of trades on account.
|
169
|
-
# @param user_id [String]
|
170
|
-
# @param user_secret [String]
|
171
|
-
# @param account_id [String]
|
172
|
-
# @param action [Action]
|
173
|
-
# @param order_type [OrderType]
|
174
|
-
# @param price [Float] Trade Price if limit or stop limit order
|
175
|
-
# @param stop [Float] Stop Price. If stop loss or stop limit order, the price to trigger the stop
|
176
|
-
# @param time_in_force [TimeInForce]
|
177
|
-
# @param units [Float] Trade Units
|
178
|
-
# @param universal_symbol_id [String]
|
179
|
-
# @param body [ManualTradeForm]
|
180
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
181
|
-
def get_order_impact_with_http_info(user_id:, user_secret:, account_id: SENTINEL, action: SENTINEL, order_type: SENTINEL, price: SENTINEL, stop: SENTINEL, time_in_force: SENTINEL, units: SENTINEL, universal_symbol_id: SENTINEL, extra: {})
|
182
|
-
_body = {}
|
183
|
-
_body[:account_id] = account_id if account_id != SENTINEL
|
184
|
-
_body[:action] = action if action != SENTINEL
|
185
|
-
_body[:order_type] = order_type if order_type != SENTINEL
|
186
|
-
_body[:price] = price if price != SENTINEL
|
187
|
-
_body[:stop] = stop if stop != SENTINEL
|
188
|
-
_body[:time_in_force] = time_in_force if time_in_force != SENTINEL
|
189
|
-
_body[:units] = units if units != SENTINEL
|
190
|
-
_body[:universal_symbol_id] = universal_symbol_id if universal_symbol_id != SENTINEL
|
191
|
-
manual_trade_form = _body
|
192
|
-
|
193
|
-
get_order_impact_with_http_info_impl(user_id, user_secret, manual_trade_form, extra)
|
194
|
-
end
|
195
|
-
|
196
|
-
# Check impact of trades on account.
|
197
|
-
# @param user_id [String]
|
198
|
-
# @param user_secret [String]
|
199
|
-
# @param manual_trade_form [ManualTradeForm]
|
200
|
-
# @param [Hash] opts the optional parameters
|
201
|
-
# @return [ManualTradeAndImpact]
|
202
|
-
def get_order_impact_impl(user_id, user_secret, manual_trade_form, opts = {})
|
203
|
-
data, _status_code, _headers = get_order_impact_with_http_info(user_id, user_secret, manual_trade_form, opts)
|
204
|
-
data
|
205
|
-
end
|
206
|
-
|
207
|
-
# Check impact of trades on account.
|
208
|
-
# @param user_id [String]
|
209
|
-
# @param user_secret [String]
|
210
|
-
# @param manual_trade_form [ManualTradeForm]
|
211
|
-
# @param [Hash] opts the optional parameters
|
212
|
-
# @return [Array<(ManualTradeAndImpact, Integer, Hash)>] ManualTradeAndImpact data, response status code and response headers
|
213
|
-
def get_order_impact_with_http_info_impl(user_id, user_secret, manual_trade_form, opts = {})
|
214
|
-
if @api_client.config.debugging
|
215
|
-
@api_client.config.logger.debug 'Calling API: TradingApi.get_order_impact ...'
|
216
|
-
end
|
217
|
-
# verify the required parameter 'user_id' is set
|
218
|
-
if @api_client.config.client_side_validation && user_id.nil?
|
219
|
-
fail ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.get_order_impact"
|
220
|
-
end
|
221
|
-
# verify the required parameter 'user_secret' is set
|
222
|
-
if @api_client.config.client_side_validation && user_secret.nil?
|
223
|
-
fail ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.get_order_impact"
|
224
|
-
end
|
225
|
-
# verify the required parameter 'manual_trade_form' is set
|
226
|
-
if @api_client.config.client_side_validation && manual_trade_form.nil?
|
227
|
-
fail ArgumentError, "Missing the required parameter 'manual_trade_form' when calling TradingApi.get_order_impact"
|
228
|
-
end
|
229
|
-
# resource path
|
230
|
-
local_var_path = '/trade/impact'
|
231
|
-
|
232
|
-
# query parameters
|
233
|
-
query_params = opts[:query_params] || {}
|
234
|
-
query_params[:'userId'] = user_id
|
235
|
-
query_params[:'userSecret'] = user_secret
|
236
|
-
|
237
|
-
# header parameters
|
238
|
-
header_params = opts[:header_params] || {}
|
239
|
-
# HTTP header 'Accept' (if needed)
|
240
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
241
|
-
# HTTP header 'Content-Type'
|
242
|
-
content_type = @api_client.select_header_content_type(['application/json'])
|
243
|
-
if !content_type.nil?
|
244
|
-
header_params['Content-Type'] = content_type
|
245
|
-
end
|
246
|
-
|
247
|
-
# form parameters
|
248
|
-
form_params = opts[:form_params] || {}
|
249
|
-
|
250
|
-
# http body (model)
|
251
|
-
post_body = opts[:debug_body] || @api_client.object_to_http_body(manual_trade_form)
|
252
|
-
|
253
|
-
# return_type
|
254
|
-
return_type = opts[:debug_return_type] || 'ManualTradeAndImpact'
|
255
|
-
|
256
|
-
# auth_names
|
257
|
-
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
258
|
-
|
259
|
-
new_options = opts.merge(
|
260
|
-
:operation => :"TradingApi.get_order_impact",
|
261
|
-
:header_params => header_params,
|
262
|
-
:query_params => query_params,
|
263
|
-
:form_params => form_params,
|
264
|
-
:body => post_body,
|
265
|
-
:auth_names => auth_names,
|
266
|
-
:return_type => return_type
|
267
|
-
)
|
268
|
-
|
269
|
-
data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
|
270
|
-
if @api_client.config.debugging
|
271
|
-
@api_client.config.logger.debug "API called: TradingApi#get_order_impact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
272
|
-
end
|
273
|
-
return data, status_code, headers, response
|
274
|
-
end
|
275
|
-
|
276
|
-
|
277
|
-
# Get symbol quotes
|
278
|
-
# @param user_id [String]
|
279
|
-
# @param user_secret [String]
|
280
|
-
# @param symbols [String] List of universal_symbol_id or tickers to get quotes for.
|
281
|
-
# @param account_id [String] The ID of the account to get quotes.
|
282
|
-
# @param use_ticker [Boolean] Should be set to True if providing tickers.
|
283
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
284
|
-
def get_user_account_quotes(user_id:, user_secret:, symbols:, account_id:, use_ticker: SENTINEL, extra: {})
|
285
|
-
extra[:use_ticker] = use_ticker if use_ticker != SENTINEL
|
286
|
-
|
287
|
-
data, _status_code, _headers = get_user_account_quotes_with_http_info_impl(user_id, user_secret, symbols, account_id, extra)
|
288
|
-
data
|
289
|
-
end
|
290
|
-
|
291
|
-
# Get symbol quotes
|
292
|
-
# @param user_id [String]
|
293
|
-
# @param user_secret [String]
|
294
|
-
# @param symbols [String] List of universal_symbol_id or tickers to get quotes for.
|
295
|
-
# @param account_id [String] The ID of the account to get quotes.
|
296
|
-
# @param use_ticker [Boolean] Should be set to True if providing tickers.
|
297
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
298
|
-
def get_user_account_quotes_with_http_info(user_id:, user_secret:, symbols:, account_id:, use_ticker: SENTINEL, extra: {})
|
299
|
-
extra[:use_ticker] = use_ticker if use_ticker != SENTINEL
|
300
|
-
|
301
|
-
get_user_account_quotes_with_http_info_impl(user_id, user_secret, symbols, account_id, extra)
|
302
|
-
end
|
303
|
-
|
304
|
-
# Get symbol quotes
|
305
|
-
# @param user_id [String]
|
306
|
-
# @param user_secret [String]
|
307
|
-
# @param symbols [String] List of universal_symbol_id or tickers to get quotes for.
|
308
|
-
# @param account_id [String] The ID of the account to get quotes.
|
309
|
-
# @param [Hash] opts the optional parameters
|
310
|
-
# @option opts [Boolean] :use_ticker Should be set to True if providing tickers.
|
311
|
-
# @return [Array<SymbolsQuotesInner>]
|
312
|
-
def get_user_account_quotes_impl(user_id, user_secret, symbols, account_id, opts = {})
|
313
|
-
data, _status_code, _headers = get_user_account_quotes_with_http_info(user_id, user_secret, symbols, account_id, opts)
|
314
|
-
data
|
315
|
-
end
|
316
|
-
|
317
|
-
# Get symbol quotes
|
318
|
-
# @param user_id [String]
|
319
|
-
# @param user_secret [String]
|
320
|
-
# @param symbols [String] List of universal_symbol_id or tickers to get quotes for.
|
321
|
-
# @param account_id [String] The ID of the account to get quotes.
|
322
|
-
# @param [Hash] opts the optional parameters
|
323
|
-
# @option opts [Boolean] :use_ticker Should be set to True if providing tickers.
|
324
|
-
# @return [Array<(Array<SymbolsQuotesInner>, Integer, Hash)>] Array<SymbolsQuotesInner> data, response status code and response headers
|
325
|
-
def get_user_account_quotes_with_http_info_impl(user_id, user_secret, symbols, account_id, opts = {})
|
326
|
-
if @api_client.config.debugging
|
327
|
-
@api_client.config.logger.debug 'Calling API: TradingApi.get_user_account_quotes ...'
|
328
|
-
end
|
329
|
-
# verify the required parameter 'user_id' is set
|
330
|
-
if @api_client.config.client_side_validation && user_id.nil?
|
331
|
-
fail ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.get_user_account_quotes"
|
332
|
-
end
|
333
|
-
# verify the required parameter 'user_secret' is set
|
334
|
-
if @api_client.config.client_side_validation && user_secret.nil?
|
335
|
-
fail ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.get_user_account_quotes"
|
336
|
-
end
|
337
|
-
# verify the required parameter 'symbols' is set
|
338
|
-
if @api_client.config.client_side_validation && symbols.nil?
|
339
|
-
fail ArgumentError, "Missing the required parameter 'symbols' when calling TradingApi.get_user_account_quotes"
|
340
|
-
end
|
341
|
-
# verify the required parameter 'account_id' is set
|
342
|
-
if @api_client.config.client_side_validation && account_id.nil?
|
343
|
-
fail ArgumentError, "Missing the required parameter 'account_id' when calling TradingApi.get_user_account_quotes"
|
344
|
-
end
|
345
|
-
# resource path
|
346
|
-
local_var_path = '/accounts/{accountId}/quotes'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
|
347
|
-
|
348
|
-
# query parameters
|
349
|
-
query_params = opts[:query_params] || {}
|
350
|
-
query_params[:'userId'] = user_id
|
351
|
-
query_params[:'userSecret'] = user_secret
|
352
|
-
query_params[:'symbols'] = symbols
|
353
|
-
query_params[:'use_ticker'] = opts[:'use_ticker'] if !opts[:'use_ticker'].nil?
|
354
|
-
|
355
|
-
# header parameters
|
356
|
-
header_params = opts[:header_params] || {}
|
357
|
-
# HTTP header 'Accept' (if needed)
|
358
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
359
|
-
|
360
|
-
# form parameters
|
361
|
-
form_params = opts[:form_params] || {}
|
362
|
-
|
363
|
-
# http body (model)
|
364
|
-
post_body = opts[:debug_body]
|
365
|
-
|
366
|
-
# return_type
|
367
|
-
return_type = opts[:debug_return_type] || 'Array<SymbolsQuotesInner>'
|
368
|
-
|
369
|
-
# auth_names
|
370
|
-
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
371
|
-
|
372
|
-
new_options = opts.merge(
|
373
|
-
:operation => :"TradingApi.get_user_account_quotes",
|
374
|
-
:header_params => header_params,
|
375
|
-
:query_params => query_params,
|
376
|
-
:form_params => form_params,
|
377
|
-
:body => post_body,
|
378
|
-
:auth_names => auth_names,
|
379
|
-
:return_type => return_type
|
380
|
-
)
|
381
|
-
|
382
|
-
data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
|
383
|
-
if @api_client.config.debugging
|
384
|
-
@api_client.config.logger.debug "API called: TradingApi#get_user_account_quotes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
385
|
-
end
|
386
|
-
return data, status_code, headers, response
|
387
|
-
end
|
388
|
-
|
389
|
-
|
390
|
-
# Place a trade with NO validation.
|
391
|
-
# @param user_id [String]
|
392
|
-
# @param user_secret [String]
|
393
|
-
# @param account_id [String]
|
394
|
-
# @param action [Action]
|
395
|
-
# @param order_type [OrderType]
|
396
|
-
# @param price [Float] Trade Price if limit or stop limit order
|
397
|
-
# @param stop [Float] Stop Price. If stop loss or stop limit order, the price to trigger the stop
|
398
|
-
# @param time_in_force [TimeInForce]
|
399
|
-
# @param units [Float] Trade Units
|
400
|
-
# @param universal_symbol_id [String]
|
401
|
-
# @param body [ManualTradeForm]
|
402
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
403
|
-
def place_force_order(user_id:, user_secret:, account_id: SENTINEL, action: SENTINEL, order_type: SENTINEL, price: SENTINEL, stop: SENTINEL, time_in_force: SENTINEL, units: SENTINEL, universal_symbol_id: SENTINEL, extra: {})
|
404
|
-
_body = {}
|
405
|
-
_body[:account_id] = account_id if account_id != SENTINEL
|
406
|
-
_body[:action] = action if action != SENTINEL
|
407
|
-
_body[:order_type] = order_type if order_type != SENTINEL
|
408
|
-
_body[:price] = price if price != SENTINEL
|
409
|
-
_body[:stop] = stop if stop != SENTINEL
|
410
|
-
_body[:time_in_force] = time_in_force if time_in_force != SENTINEL
|
411
|
-
_body[:units] = units if units != SENTINEL
|
412
|
-
_body[:universal_symbol_id] = universal_symbol_id if universal_symbol_id != SENTINEL
|
413
|
-
manual_trade_form = _body
|
414
|
-
|
415
|
-
data, _status_code, _headers = place_force_order_with_http_info_impl(user_id, user_secret, manual_trade_form, extra)
|
416
|
-
data
|
417
|
-
end
|
418
|
-
|
419
|
-
# Place a trade with NO validation.
|
420
|
-
# @param user_id [String]
|
421
|
-
# @param user_secret [String]
|
422
|
-
# @param account_id [String]
|
423
|
-
# @param action [Action]
|
424
|
-
# @param order_type [OrderType]
|
425
|
-
# @param price [Float] Trade Price if limit or stop limit order
|
426
|
-
# @param stop [Float] Stop Price. If stop loss or stop limit order, the price to trigger the stop
|
427
|
-
# @param time_in_force [TimeInForce]
|
428
|
-
# @param units [Float] Trade Units
|
429
|
-
# @param universal_symbol_id [String]
|
430
|
-
# @param body [ManualTradeForm]
|
431
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
432
|
-
def place_force_order_with_http_info(user_id:, user_secret:, account_id: SENTINEL, action: SENTINEL, order_type: SENTINEL, price: SENTINEL, stop: SENTINEL, time_in_force: SENTINEL, units: SENTINEL, universal_symbol_id: SENTINEL, extra: {})
|
433
|
-
_body = {}
|
434
|
-
_body[:account_id] = account_id if account_id != SENTINEL
|
435
|
-
_body[:action] = action if action != SENTINEL
|
436
|
-
_body[:order_type] = order_type if order_type != SENTINEL
|
437
|
-
_body[:price] = price if price != SENTINEL
|
438
|
-
_body[:stop] = stop if stop != SENTINEL
|
439
|
-
_body[:time_in_force] = time_in_force if time_in_force != SENTINEL
|
440
|
-
_body[:units] = units if units != SENTINEL
|
441
|
-
_body[:universal_symbol_id] = universal_symbol_id if universal_symbol_id != SENTINEL
|
442
|
-
manual_trade_form = _body
|
443
|
-
|
444
|
-
place_force_order_with_http_info_impl(user_id, user_secret, manual_trade_form, extra)
|
445
|
-
end
|
446
|
-
|
447
|
-
# Place a trade with NO validation.
|
448
|
-
# @param user_id [String]
|
449
|
-
# @param user_secret [String]
|
450
|
-
# @param manual_trade_form [ManualTradeForm]
|
451
|
-
# @param [Hash] opts the optional parameters
|
452
|
-
# @return [AccountOrderRecord]
|
453
|
-
def place_force_order_impl(user_id, user_secret, manual_trade_form, opts = {})
|
454
|
-
data, _status_code, _headers = place_force_order_with_http_info(user_id, user_secret, manual_trade_form, opts)
|
455
|
-
data
|
456
|
-
end
|
457
|
-
|
458
|
-
# Place a trade with NO validation.
|
459
|
-
# @param user_id [String]
|
460
|
-
# @param user_secret [String]
|
461
|
-
# @param manual_trade_form [ManualTradeForm]
|
462
|
-
# @param [Hash] opts the optional parameters
|
463
|
-
# @return [Array<(AccountOrderRecord, Integer, Hash)>] AccountOrderRecord data, response status code and response headers
|
464
|
-
def place_force_order_with_http_info_impl(user_id, user_secret, manual_trade_form, opts = {})
|
465
|
-
if @api_client.config.debugging
|
466
|
-
@api_client.config.logger.debug 'Calling API: TradingApi.place_force_order ...'
|
467
|
-
end
|
468
|
-
# verify the required parameter 'user_id' is set
|
469
|
-
if @api_client.config.client_side_validation && user_id.nil?
|
470
|
-
fail ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.place_force_order"
|
471
|
-
end
|
472
|
-
# verify the required parameter 'user_secret' is set
|
473
|
-
if @api_client.config.client_side_validation && user_secret.nil?
|
474
|
-
fail ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.place_force_order"
|
475
|
-
end
|
476
|
-
# verify the required parameter 'manual_trade_form' is set
|
477
|
-
if @api_client.config.client_side_validation && manual_trade_form.nil?
|
478
|
-
fail ArgumentError, "Missing the required parameter 'manual_trade_form' when calling TradingApi.place_force_order"
|
479
|
-
end
|
480
|
-
# resource path
|
481
|
-
local_var_path = '/trade/place'
|
482
|
-
|
483
|
-
# query parameters
|
484
|
-
query_params = opts[:query_params] || {}
|
485
|
-
query_params[:'userId'] = user_id
|
486
|
-
query_params[:'userSecret'] = user_secret
|
487
|
-
|
488
|
-
# header parameters
|
489
|
-
header_params = opts[:header_params] || {}
|
490
|
-
# HTTP header 'Accept' (if needed)
|
491
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
492
|
-
# HTTP header 'Content-Type'
|
493
|
-
content_type = @api_client.select_header_content_type(['application/json'])
|
494
|
-
if !content_type.nil?
|
495
|
-
header_params['Content-Type'] = content_type
|
496
|
-
end
|
497
|
-
|
498
|
-
# form parameters
|
499
|
-
form_params = opts[:form_params] || {}
|
500
|
-
|
501
|
-
# http body (model)
|
502
|
-
post_body = opts[:debug_body] || @api_client.object_to_http_body(manual_trade_form)
|
503
|
-
|
504
|
-
# return_type
|
505
|
-
return_type = opts[:debug_return_type] || 'AccountOrderRecord'
|
506
|
-
|
507
|
-
# auth_names
|
508
|
-
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
509
|
-
|
510
|
-
new_options = opts.merge(
|
511
|
-
:operation => :"TradingApi.place_force_order",
|
512
|
-
:header_params => header_params,
|
513
|
-
:query_params => query_params,
|
514
|
-
:form_params => form_params,
|
515
|
-
:body => post_body,
|
516
|
-
:auth_names => auth_names,
|
517
|
-
:return_type => return_type
|
518
|
-
)
|
519
|
-
|
520
|
-
data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
|
521
|
-
if @api_client.config.debugging
|
522
|
-
@api_client.config.logger.debug "API called: TradingApi#place_force_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
523
|
-
end
|
524
|
-
return data, status_code, headers, response
|
525
|
-
end
|
526
|
-
|
527
|
-
|
528
|
-
# Place a OCO (One Cancels Other) order
|
529
|
-
# @param user_id [String]
|
530
|
-
# @param user_secret [String]
|
531
|
-
# @param first_trade_id [Object] The ID of first trade object obtained from trade/impact endpoint
|
532
|
-
# @param second_trade_id [Object] The ID of second trade object obtained from trade/impact endpoint
|
533
|
-
# @param body [TradingPlaceOCOOrderRequest]
|
534
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
535
|
-
def place_oco_order(user_id:, user_secret:, first_trade_id: SENTINEL, second_trade_id: SENTINEL, extra: {})
|
536
|
-
_body = {}
|
537
|
-
_body[:first_trade_id] = first_trade_id if first_trade_id != SENTINEL
|
538
|
-
_body[:second_trade_id] = second_trade_id if second_trade_id != SENTINEL
|
539
|
-
trading_place_oco_order_request = _body
|
540
|
-
|
541
|
-
data, _status_code, _headers = place_oco_order_with_http_info_impl(user_id, user_secret, trading_place_oco_order_request, extra)
|
542
|
-
data
|
543
|
-
end
|
544
|
-
|
545
|
-
# Place a OCO (One Cancels Other) order
|
546
|
-
# @param user_id [String]
|
547
|
-
# @param user_secret [String]
|
548
|
-
# @param first_trade_id [Object] The ID of first trade object obtained from trade/impact endpoint
|
549
|
-
# @param second_trade_id [Object] The ID of second trade object obtained from trade/impact endpoint
|
550
|
-
# @param body [TradingPlaceOCOOrderRequest]
|
551
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
552
|
-
def place_oco_order_with_http_info(user_id:, user_secret:, first_trade_id: SENTINEL, second_trade_id: SENTINEL, extra: {})
|
553
|
-
_body = {}
|
554
|
-
_body[:first_trade_id] = first_trade_id if first_trade_id != SENTINEL
|
555
|
-
_body[:second_trade_id] = second_trade_id if second_trade_id != SENTINEL
|
556
|
-
trading_place_oco_order_request = _body
|
557
|
-
|
558
|
-
place_oco_order_with_http_info_impl(user_id, user_secret, trading_place_oco_order_request, extra)
|
559
|
-
end
|
560
|
-
|
561
|
-
# Place a OCO (One Cancels Other) order
|
562
|
-
# @param user_id [String]
|
563
|
-
# @param user_secret [String]
|
564
|
-
# @param trading_place_oco_order_request [TradingPlaceOCOOrderRequest]
|
565
|
-
# @param [Hash] opts the optional parameters
|
566
|
-
# @return [AccountOrderRecord]
|
567
|
-
def place_oco_order_impl(user_id, user_secret, trading_place_oco_order_request, opts = {})
|
568
|
-
data, _status_code, _headers = place_oco_order_with_http_info(user_id, user_secret, trading_place_oco_order_request, opts)
|
569
|
-
data
|
570
|
-
end
|
571
|
-
|
572
|
-
# Place a OCO (One Cancels Other) order
|
573
|
-
# @param user_id [String]
|
574
|
-
# @param user_secret [String]
|
575
|
-
# @param trading_place_oco_order_request [TradingPlaceOCOOrderRequest]
|
576
|
-
# @param [Hash] opts the optional parameters
|
577
|
-
# @return [Array<(AccountOrderRecord, Integer, Hash)>] AccountOrderRecord data, response status code and response headers
|
578
|
-
def place_oco_order_with_http_info_impl(user_id, user_secret, trading_place_oco_order_request, opts = {})
|
579
|
-
if @api_client.config.debugging
|
580
|
-
@api_client.config.logger.debug 'Calling API: TradingApi.place_oco_order ...'
|
581
|
-
end
|
582
|
-
# verify the required parameter 'user_id' is set
|
583
|
-
if @api_client.config.client_side_validation && user_id.nil?
|
584
|
-
fail ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.place_oco_order"
|
585
|
-
end
|
586
|
-
# verify the required parameter 'user_secret' is set
|
587
|
-
if @api_client.config.client_side_validation && user_secret.nil?
|
588
|
-
fail ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.place_oco_order"
|
589
|
-
end
|
590
|
-
# verify the required parameter 'trading_place_oco_order_request' is set
|
591
|
-
if @api_client.config.client_side_validation && trading_place_oco_order_request.nil?
|
592
|
-
fail ArgumentError, "Missing the required parameter 'trading_place_oco_order_request' when calling TradingApi.place_oco_order"
|
593
|
-
end
|
594
|
-
# resource path
|
595
|
-
local_var_path = '/trade/oco'
|
596
|
-
|
597
|
-
# query parameters
|
598
|
-
query_params = opts[:query_params] || {}
|
599
|
-
query_params[:'userId'] = user_id
|
600
|
-
query_params[:'userSecret'] = user_secret
|
601
|
-
|
602
|
-
# header parameters
|
603
|
-
header_params = opts[:header_params] || {}
|
604
|
-
# HTTP header 'Accept' (if needed)
|
605
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
606
|
-
# HTTP header 'Content-Type'
|
607
|
-
content_type = @api_client.select_header_content_type(['application/json'])
|
608
|
-
if !content_type.nil?
|
609
|
-
header_params['Content-Type'] = content_type
|
610
|
-
end
|
611
|
-
|
612
|
-
# form parameters
|
613
|
-
form_params = opts[:form_params] || {}
|
614
|
-
|
615
|
-
# http body (model)
|
616
|
-
post_body = opts[:debug_body] || @api_client.object_to_http_body(trading_place_oco_order_request)
|
617
|
-
|
618
|
-
# return_type
|
619
|
-
return_type = opts[:debug_return_type] || 'AccountOrderRecord'
|
620
|
-
|
621
|
-
# auth_names
|
622
|
-
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
623
|
-
|
624
|
-
new_options = opts.merge(
|
625
|
-
:operation => :"TradingApi.place_oco_order",
|
626
|
-
:header_params => header_params,
|
627
|
-
:query_params => query_params,
|
628
|
-
:form_params => form_params,
|
629
|
-
:body => post_body,
|
630
|
-
:auth_names => auth_names,
|
631
|
-
:return_type => return_type
|
632
|
-
)
|
633
|
-
|
634
|
-
data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
|
635
|
-
if @api_client.config.debugging
|
636
|
-
@api_client.config.logger.debug "API called: TradingApi#place_oco_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
637
|
-
end
|
638
|
-
return data, status_code, headers, response
|
639
|
-
end
|
640
|
-
|
641
|
-
|
642
|
-
# Place order
|
643
|
-
# @param trade_id [String] The ID of trade object obtained from trade/impact endpoint
|
644
|
-
# @param user_id [String]
|
645
|
-
# @param user_secret [String]
|
646
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
647
|
-
def place_order(trade_id:, user_id:, user_secret:, extra: {})
|
648
|
-
|
649
|
-
data, _status_code, _headers = place_order_with_http_info_impl(trade_id, user_id, user_secret, extra)
|
650
|
-
data
|
651
|
-
end
|
652
|
-
|
653
|
-
# Place order
|
654
|
-
# @param trade_id [String] The ID of trade object obtained from trade/impact endpoint
|
655
|
-
# @param user_id [String]
|
656
|
-
# @param user_secret [String]
|
657
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
658
|
-
def place_order_with_http_info(trade_id:, user_id:, user_secret:, extra: {})
|
659
|
-
|
660
|
-
place_order_with_http_info_impl(trade_id, user_id, user_secret, extra)
|
661
|
-
end
|
662
|
-
|
663
|
-
# Place order
|
664
|
-
# @param trade_id [String] The ID of trade object obtained from trade/impact endpoint
|
665
|
-
# @param user_id [String]
|
666
|
-
# @param user_secret [String]
|
667
|
-
# @param [Hash] opts the optional parameters
|
668
|
-
# @return [AccountOrderRecord]
|
669
|
-
def place_order_impl(trade_id, user_id, user_secret, opts = {})
|
670
|
-
data, _status_code, _headers = place_order_with_http_info(trade_id, user_id, user_secret, opts)
|
671
|
-
data
|
672
|
-
end
|
673
|
-
|
674
|
-
# Place order
|
675
|
-
# @param trade_id [String] The ID of trade object obtained from trade/impact endpoint
|
676
|
-
# @param user_id [String]
|
677
|
-
# @param user_secret [String]
|
678
|
-
# @param [Hash] opts the optional parameters
|
679
|
-
# @return [Array<(AccountOrderRecord, Integer, Hash)>] AccountOrderRecord data, response status code and response headers
|
680
|
-
def place_order_with_http_info_impl(trade_id, user_id, user_secret, opts = {})
|
681
|
-
if @api_client.config.debugging
|
682
|
-
@api_client.config.logger.debug 'Calling API: TradingApi.place_order ...'
|
683
|
-
end
|
684
|
-
# verify the required parameter 'trade_id' is set
|
685
|
-
if @api_client.config.client_side_validation && trade_id.nil?
|
686
|
-
fail ArgumentError, "Missing the required parameter 'trade_id' when calling TradingApi.place_order"
|
687
|
-
end
|
688
|
-
# verify the required parameter 'user_id' is set
|
689
|
-
if @api_client.config.client_side_validation && user_id.nil?
|
690
|
-
fail ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.place_order"
|
691
|
-
end
|
692
|
-
# verify the required parameter 'user_secret' is set
|
693
|
-
if @api_client.config.client_side_validation && user_secret.nil?
|
694
|
-
fail ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.place_order"
|
695
|
-
end
|
696
|
-
# resource path
|
697
|
-
local_var_path = '/trade/{tradeId}'.sub('{' + 'tradeId' + '}', CGI.escape(trade_id.to_s))
|
698
|
-
|
699
|
-
# query parameters
|
700
|
-
query_params = opts[:query_params] || {}
|
701
|
-
query_params[:'userId'] = user_id
|
702
|
-
query_params[:'userSecret'] = user_secret
|
703
|
-
|
704
|
-
# header parameters
|
705
|
-
header_params = opts[:header_params] || {}
|
706
|
-
# HTTP header 'Accept' (if needed)
|
707
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
708
|
-
|
709
|
-
# form parameters
|
710
|
-
form_params = opts[:form_params] || {}
|
711
|
-
|
712
|
-
# http body (model)
|
713
|
-
post_body = opts[:debug_body]
|
714
|
-
|
715
|
-
# return_type
|
716
|
-
return_type = opts[:debug_return_type] || 'AccountOrderRecord'
|
717
|
-
|
718
|
-
# auth_names
|
719
|
-
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
720
|
-
|
721
|
-
new_options = opts.merge(
|
722
|
-
:operation => :"TradingApi.place_order",
|
723
|
-
:header_params => header_params,
|
724
|
-
:query_params => query_params,
|
725
|
-
:form_params => form_params,
|
726
|
-
:body => post_body,
|
727
|
-
:auth_names => auth_names,
|
728
|
-
:return_type => return_type
|
729
|
-
)
|
730
|
-
|
731
|
-
data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
|
732
|
-
if @api_client.config.debugging
|
733
|
-
@api_client.config.logger.debug "API called: TradingApi#place_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
734
|
-
end
|
735
|
-
return data, status_code, headers, response
|
736
|
-
end
|
737
|
-
end
|
738
|
-
|
739
|
-
# top-level client access to avoid having the user to insantiate their own API instances
|
740
|
-
Trading = TradingApi::new
|
741
|
-
end
|
1
|
+
=begin
|
2
|
+
#SnapTrade
|
3
|
+
|
4
|
+
#Connect brokerage accounts to your app for live positions and trading
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
Contact: api@snaptrade.com
|
8
|
+
|
9
|
+
=end
|
10
|
+
|
11
|
+
require 'cgi'
|
12
|
+
|
13
|
+
module SnapTrade
|
14
|
+
class TradingApi
|
15
|
+
attr_accessor :api_client
|
16
|
+
|
17
|
+
def initialize(api_client = ApiClient.default)
|
18
|
+
@api_client = api_client
|
19
|
+
end
|
20
|
+
|
21
|
+
# Cancel open order in account
|
22
|
+
# @param user_id [String]
|
23
|
+
# @param user_secret [String]
|
24
|
+
# @param account_id [String] The ID of the account get positions.
|
25
|
+
# @param brokerage_order_id [String]
|
26
|
+
# @param body [TradingCancelUserAccountOrderRequest] The Order ID to be canceled
|
27
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
28
|
+
def cancel_user_account_order(user_id:, user_secret:, account_id:, brokerage_order_id: SENTINEL, extra: {})
|
29
|
+
_body = {}
|
30
|
+
_body[:brokerage_order_id] = brokerage_order_id if brokerage_order_id != SENTINEL
|
31
|
+
trading_cancel_user_account_order_request = _body
|
32
|
+
|
33
|
+
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)
|
34
|
+
data
|
35
|
+
end
|
36
|
+
|
37
|
+
# Cancel open order in account
|
38
|
+
# @param user_id [String]
|
39
|
+
# @param user_secret [String]
|
40
|
+
# @param account_id [String] The ID of the account get positions.
|
41
|
+
# @param brokerage_order_id [String]
|
42
|
+
# @param body [TradingCancelUserAccountOrderRequest] The Order ID to be canceled
|
43
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
44
|
+
def cancel_user_account_order_with_http_info(user_id:, user_secret:, account_id:, brokerage_order_id: SENTINEL, extra: {})
|
45
|
+
_body = {}
|
46
|
+
_body[:brokerage_order_id] = brokerage_order_id if brokerage_order_id != SENTINEL
|
47
|
+
trading_cancel_user_account_order_request = _body
|
48
|
+
|
49
|
+
cancel_user_account_order_with_http_info_impl(user_id, user_secret, account_id, trading_cancel_user_account_order_request, extra)
|
50
|
+
end
|
51
|
+
|
52
|
+
# Cancel open order in account
|
53
|
+
# @param user_id [String]
|
54
|
+
# @param user_secret [String]
|
55
|
+
# @param account_id [String] The ID of the account get positions.
|
56
|
+
# @param trading_cancel_user_account_order_request [TradingCancelUserAccountOrderRequest] The Order ID to be canceled
|
57
|
+
# @param [Hash] opts the optional parameters
|
58
|
+
# @return [AccountOrderRecord]
|
59
|
+
def cancel_user_account_order_impl(user_id, user_secret, account_id, trading_cancel_user_account_order_request, opts = {})
|
60
|
+
data, _status_code, _headers = cancel_user_account_order_with_http_info(user_id, user_secret, account_id, trading_cancel_user_account_order_request, opts)
|
61
|
+
data
|
62
|
+
end
|
63
|
+
|
64
|
+
# Cancel open order in account
|
65
|
+
# @param user_id [String]
|
66
|
+
# @param user_secret [String]
|
67
|
+
# @param account_id [String] The ID of the account get positions.
|
68
|
+
# @param trading_cancel_user_account_order_request [TradingCancelUserAccountOrderRequest] The Order ID to be canceled
|
69
|
+
# @param [Hash] opts the optional parameters
|
70
|
+
# @return [Array<(AccountOrderRecord, Integer, Hash)>] AccountOrderRecord data, response status code and response headers
|
71
|
+
def cancel_user_account_order_with_http_info_impl(user_id, user_secret, account_id, trading_cancel_user_account_order_request, opts = {})
|
72
|
+
if @api_client.config.debugging
|
73
|
+
@api_client.config.logger.debug 'Calling API: TradingApi.cancel_user_account_order ...'
|
74
|
+
end
|
75
|
+
# verify the required parameter 'user_id' is set
|
76
|
+
if @api_client.config.client_side_validation && user_id.nil?
|
77
|
+
fail ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.cancel_user_account_order"
|
78
|
+
end
|
79
|
+
# verify the required parameter 'user_secret' is set
|
80
|
+
if @api_client.config.client_side_validation && user_secret.nil?
|
81
|
+
fail ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.cancel_user_account_order"
|
82
|
+
end
|
83
|
+
# verify the required parameter 'account_id' is set
|
84
|
+
if @api_client.config.client_side_validation && account_id.nil?
|
85
|
+
fail ArgumentError, "Missing the required parameter 'account_id' when calling TradingApi.cancel_user_account_order"
|
86
|
+
end
|
87
|
+
# verify the required parameter 'trading_cancel_user_account_order_request' is set
|
88
|
+
if @api_client.config.client_side_validation && trading_cancel_user_account_order_request.nil?
|
89
|
+
fail ArgumentError, "Missing the required parameter 'trading_cancel_user_account_order_request' when calling TradingApi.cancel_user_account_order"
|
90
|
+
end
|
91
|
+
# resource path
|
92
|
+
local_var_path = '/accounts/{accountId}/orders/cancel'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
|
93
|
+
|
94
|
+
# query parameters
|
95
|
+
query_params = opts[:query_params] || {}
|
96
|
+
query_params[:'userId'] = user_id
|
97
|
+
query_params[:'userSecret'] = user_secret
|
98
|
+
|
99
|
+
# header parameters
|
100
|
+
header_params = opts[:header_params] || {}
|
101
|
+
# HTTP header 'Accept' (if needed)
|
102
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
103
|
+
# HTTP header 'Content-Type'
|
104
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
105
|
+
if !content_type.nil?
|
106
|
+
header_params['Content-Type'] = content_type
|
107
|
+
end
|
108
|
+
|
109
|
+
# form parameters
|
110
|
+
form_params = opts[:form_params] || {}
|
111
|
+
|
112
|
+
# http body (model)
|
113
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(trading_cancel_user_account_order_request)
|
114
|
+
|
115
|
+
# return_type
|
116
|
+
return_type = opts[:debug_return_type] || 'AccountOrderRecord'
|
117
|
+
|
118
|
+
# auth_names
|
119
|
+
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
120
|
+
|
121
|
+
new_options = opts.merge(
|
122
|
+
:operation => :"TradingApi.cancel_user_account_order",
|
123
|
+
:header_params => header_params,
|
124
|
+
:query_params => query_params,
|
125
|
+
:form_params => form_params,
|
126
|
+
:body => post_body,
|
127
|
+
:auth_names => auth_names,
|
128
|
+
:return_type => return_type
|
129
|
+
)
|
130
|
+
|
131
|
+
data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
|
132
|
+
if @api_client.config.debugging
|
133
|
+
@api_client.config.logger.debug "API called: TradingApi#cancel_user_account_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
134
|
+
end
|
135
|
+
return data, status_code, headers, response
|
136
|
+
end
|
137
|
+
|
138
|
+
|
139
|
+
# Check impact of trades on account.
|
140
|
+
# @param user_id [String]
|
141
|
+
# @param user_secret [String]
|
142
|
+
# @param account_id [String]
|
143
|
+
# @param action [Action]
|
144
|
+
# @param order_type [OrderType]
|
145
|
+
# @param price [Float] Trade Price if limit or stop limit order
|
146
|
+
# @param stop [Float] Stop Price. If stop loss or stop limit order, the price to trigger the stop
|
147
|
+
# @param time_in_force [TimeInForce]
|
148
|
+
# @param units [Float] Trade Units
|
149
|
+
# @param universal_symbol_id [String]
|
150
|
+
# @param body [ManualTradeForm]
|
151
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
152
|
+
def get_order_impact(user_id:, user_secret:, account_id: SENTINEL, action: SENTINEL, order_type: SENTINEL, price: SENTINEL, stop: SENTINEL, time_in_force: SENTINEL, units: SENTINEL, universal_symbol_id: SENTINEL, extra: {})
|
153
|
+
_body = {}
|
154
|
+
_body[:account_id] = account_id if account_id != SENTINEL
|
155
|
+
_body[:action] = action if action != SENTINEL
|
156
|
+
_body[:order_type] = order_type if order_type != SENTINEL
|
157
|
+
_body[:price] = price if price != SENTINEL
|
158
|
+
_body[:stop] = stop if stop != SENTINEL
|
159
|
+
_body[:time_in_force] = time_in_force if time_in_force != SENTINEL
|
160
|
+
_body[:units] = units if units != SENTINEL
|
161
|
+
_body[:universal_symbol_id] = universal_symbol_id if universal_symbol_id != SENTINEL
|
162
|
+
manual_trade_form = _body
|
163
|
+
|
164
|
+
data, _status_code, _headers = get_order_impact_with_http_info_impl(user_id, user_secret, manual_trade_form, extra)
|
165
|
+
data
|
166
|
+
end
|
167
|
+
|
168
|
+
# Check impact of trades on account.
|
169
|
+
# @param user_id [String]
|
170
|
+
# @param user_secret [String]
|
171
|
+
# @param account_id [String]
|
172
|
+
# @param action [Action]
|
173
|
+
# @param order_type [OrderType]
|
174
|
+
# @param price [Float] Trade Price if limit or stop limit order
|
175
|
+
# @param stop [Float] Stop Price. If stop loss or stop limit order, the price to trigger the stop
|
176
|
+
# @param time_in_force [TimeInForce]
|
177
|
+
# @param units [Float] Trade Units
|
178
|
+
# @param universal_symbol_id [String]
|
179
|
+
# @param body [ManualTradeForm]
|
180
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
181
|
+
def get_order_impact_with_http_info(user_id:, user_secret:, account_id: SENTINEL, action: SENTINEL, order_type: SENTINEL, price: SENTINEL, stop: SENTINEL, time_in_force: SENTINEL, units: SENTINEL, universal_symbol_id: SENTINEL, extra: {})
|
182
|
+
_body = {}
|
183
|
+
_body[:account_id] = account_id if account_id != SENTINEL
|
184
|
+
_body[:action] = action if action != SENTINEL
|
185
|
+
_body[:order_type] = order_type if order_type != SENTINEL
|
186
|
+
_body[:price] = price if price != SENTINEL
|
187
|
+
_body[:stop] = stop if stop != SENTINEL
|
188
|
+
_body[:time_in_force] = time_in_force if time_in_force != SENTINEL
|
189
|
+
_body[:units] = units if units != SENTINEL
|
190
|
+
_body[:universal_symbol_id] = universal_symbol_id if universal_symbol_id != SENTINEL
|
191
|
+
manual_trade_form = _body
|
192
|
+
|
193
|
+
get_order_impact_with_http_info_impl(user_id, user_secret, manual_trade_form, extra)
|
194
|
+
end
|
195
|
+
|
196
|
+
# Check impact of trades on account.
|
197
|
+
# @param user_id [String]
|
198
|
+
# @param user_secret [String]
|
199
|
+
# @param manual_trade_form [ManualTradeForm]
|
200
|
+
# @param [Hash] opts the optional parameters
|
201
|
+
# @return [ManualTradeAndImpact]
|
202
|
+
def get_order_impact_impl(user_id, user_secret, manual_trade_form, opts = {})
|
203
|
+
data, _status_code, _headers = get_order_impact_with_http_info(user_id, user_secret, manual_trade_form, opts)
|
204
|
+
data
|
205
|
+
end
|
206
|
+
|
207
|
+
# Check impact of trades on account.
|
208
|
+
# @param user_id [String]
|
209
|
+
# @param user_secret [String]
|
210
|
+
# @param manual_trade_form [ManualTradeForm]
|
211
|
+
# @param [Hash] opts the optional parameters
|
212
|
+
# @return [Array<(ManualTradeAndImpact, Integer, Hash)>] ManualTradeAndImpact data, response status code and response headers
|
213
|
+
def get_order_impact_with_http_info_impl(user_id, user_secret, manual_trade_form, opts = {})
|
214
|
+
if @api_client.config.debugging
|
215
|
+
@api_client.config.logger.debug 'Calling API: TradingApi.get_order_impact ...'
|
216
|
+
end
|
217
|
+
# verify the required parameter 'user_id' is set
|
218
|
+
if @api_client.config.client_side_validation && user_id.nil?
|
219
|
+
fail ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.get_order_impact"
|
220
|
+
end
|
221
|
+
# verify the required parameter 'user_secret' is set
|
222
|
+
if @api_client.config.client_side_validation && user_secret.nil?
|
223
|
+
fail ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.get_order_impact"
|
224
|
+
end
|
225
|
+
# verify the required parameter 'manual_trade_form' is set
|
226
|
+
if @api_client.config.client_side_validation && manual_trade_form.nil?
|
227
|
+
fail ArgumentError, "Missing the required parameter 'manual_trade_form' when calling TradingApi.get_order_impact"
|
228
|
+
end
|
229
|
+
# resource path
|
230
|
+
local_var_path = '/trade/impact'
|
231
|
+
|
232
|
+
# query parameters
|
233
|
+
query_params = opts[:query_params] || {}
|
234
|
+
query_params[:'userId'] = user_id
|
235
|
+
query_params[:'userSecret'] = user_secret
|
236
|
+
|
237
|
+
# header parameters
|
238
|
+
header_params = opts[:header_params] || {}
|
239
|
+
# HTTP header 'Accept' (if needed)
|
240
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
241
|
+
# HTTP header 'Content-Type'
|
242
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
243
|
+
if !content_type.nil?
|
244
|
+
header_params['Content-Type'] = content_type
|
245
|
+
end
|
246
|
+
|
247
|
+
# form parameters
|
248
|
+
form_params = opts[:form_params] || {}
|
249
|
+
|
250
|
+
# http body (model)
|
251
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(manual_trade_form)
|
252
|
+
|
253
|
+
# return_type
|
254
|
+
return_type = opts[:debug_return_type] || 'ManualTradeAndImpact'
|
255
|
+
|
256
|
+
# auth_names
|
257
|
+
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
258
|
+
|
259
|
+
new_options = opts.merge(
|
260
|
+
:operation => :"TradingApi.get_order_impact",
|
261
|
+
:header_params => header_params,
|
262
|
+
:query_params => query_params,
|
263
|
+
:form_params => form_params,
|
264
|
+
:body => post_body,
|
265
|
+
:auth_names => auth_names,
|
266
|
+
:return_type => return_type
|
267
|
+
)
|
268
|
+
|
269
|
+
data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
|
270
|
+
if @api_client.config.debugging
|
271
|
+
@api_client.config.logger.debug "API called: TradingApi#get_order_impact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
272
|
+
end
|
273
|
+
return data, status_code, headers, response
|
274
|
+
end
|
275
|
+
|
276
|
+
|
277
|
+
# Get symbol quotes
|
278
|
+
# @param user_id [String]
|
279
|
+
# @param user_secret [String]
|
280
|
+
# @param symbols [String] List of universal_symbol_id or tickers to get quotes for.
|
281
|
+
# @param account_id [String] The ID of the account to get quotes.
|
282
|
+
# @param use_ticker [Boolean] Should be set to True if providing tickers.
|
283
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
284
|
+
def get_user_account_quotes(user_id:, user_secret:, symbols:, account_id:, use_ticker: SENTINEL, extra: {})
|
285
|
+
extra[:use_ticker] = use_ticker if use_ticker != SENTINEL
|
286
|
+
|
287
|
+
data, _status_code, _headers = get_user_account_quotes_with_http_info_impl(user_id, user_secret, symbols, account_id, extra)
|
288
|
+
data
|
289
|
+
end
|
290
|
+
|
291
|
+
# Get symbol quotes
|
292
|
+
# @param user_id [String]
|
293
|
+
# @param user_secret [String]
|
294
|
+
# @param symbols [String] List of universal_symbol_id or tickers to get quotes for.
|
295
|
+
# @param account_id [String] The ID of the account to get quotes.
|
296
|
+
# @param use_ticker [Boolean] Should be set to True if providing tickers.
|
297
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
298
|
+
def get_user_account_quotes_with_http_info(user_id:, user_secret:, symbols:, account_id:, use_ticker: SENTINEL, extra: {})
|
299
|
+
extra[:use_ticker] = use_ticker if use_ticker != SENTINEL
|
300
|
+
|
301
|
+
get_user_account_quotes_with_http_info_impl(user_id, user_secret, symbols, account_id, extra)
|
302
|
+
end
|
303
|
+
|
304
|
+
# Get symbol quotes
|
305
|
+
# @param user_id [String]
|
306
|
+
# @param user_secret [String]
|
307
|
+
# @param symbols [String] List of universal_symbol_id or tickers to get quotes for.
|
308
|
+
# @param account_id [String] The ID of the account to get quotes.
|
309
|
+
# @param [Hash] opts the optional parameters
|
310
|
+
# @option opts [Boolean] :use_ticker Should be set to True if providing tickers.
|
311
|
+
# @return [Array<SymbolsQuotesInner>]
|
312
|
+
def get_user_account_quotes_impl(user_id, user_secret, symbols, account_id, opts = {})
|
313
|
+
data, _status_code, _headers = get_user_account_quotes_with_http_info(user_id, user_secret, symbols, account_id, opts)
|
314
|
+
data
|
315
|
+
end
|
316
|
+
|
317
|
+
# Get symbol quotes
|
318
|
+
# @param user_id [String]
|
319
|
+
# @param user_secret [String]
|
320
|
+
# @param symbols [String] List of universal_symbol_id or tickers to get quotes for.
|
321
|
+
# @param account_id [String] The ID of the account to get quotes.
|
322
|
+
# @param [Hash] opts the optional parameters
|
323
|
+
# @option opts [Boolean] :use_ticker Should be set to True if providing tickers.
|
324
|
+
# @return [Array<(Array<SymbolsQuotesInner>, Integer, Hash)>] Array<SymbolsQuotesInner> data, response status code and response headers
|
325
|
+
def get_user_account_quotes_with_http_info_impl(user_id, user_secret, symbols, account_id, opts = {})
|
326
|
+
if @api_client.config.debugging
|
327
|
+
@api_client.config.logger.debug 'Calling API: TradingApi.get_user_account_quotes ...'
|
328
|
+
end
|
329
|
+
# verify the required parameter 'user_id' is set
|
330
|
+
if @api_client.config.client_side_validation && user_id.nil?
|
331
|
+
fail ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.get_user_account_quotes"
|
332
|
+
end
|
333
|
+
# verify the required parameter 'user_secret' is set
|
334
|
+
if @api_client.config.client_side_validation && user_secret.nil?
|
335
|
+
fail ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.get_user_account_quotes"
|
336
|
+
end
|
337
|
+
# verify the required parameter 'symbols' is set
|
338
|
+
if @api_client.config.client_side_validation && symbols.nil?
|
339
|
+
fail ArgumentError, "Missing the required parameter 'symbols' when calling TradingApi.get_user_account_quotes"
|
340
|
+
end
|
341
|
+
# verify the required parameter 'account_id' is set
|
342
|
+
if @api_client.config.client_side_validation && account_id.nil?
|
343
|
+
fail ArgumentError, "Missing the required parameter 'account_id' when calling TradingApi.get_user_account_quotes"
|
344
|
+
end
|
345
|
+
# resource path
|
346
|
+
local_var_path = '/accounts/{accountId}/quotes'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
|
347
|
+
|
348
|
+
# query parameters
|
349
|
+
query_params = opts[:query_params] || {}
|
350
|
+
query_params[:'userId'] = user_id
|
351
|
+
query_params[:'userSecret'] = user_secret
|
352
|
+
query_params[:'symbols'] = symbols
|
353
|
+
query_params[:'use_ticker'] = opts[:'use_ticker'] if !opts[:'use_ticker'].nil?
|
354
|
+
|
355
|
+
# header parameters
|
356
|
+
header_params = opts[:header_params] || {}
|
357
|
+
# HTTP header 'Accept' (if needed)
|
358
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
359
|
+
|
360
|
+
# form parameters
|
361
|
+
form_params = opts[:form_params] || {}
|
362
|
+
|
363
|
+
# http body (model)
|
364
|
+
post_body = opts[:debug_body]
|
365
|
+
|
366
|
+
# return_type
|
367
|
+
return_type = opts[:debug_return_type] || 'Array<SymbolsQuotesInner>'
|
368
|
+
|
369
|
+
# auth_names
|
370
|
+
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
371
|
+
|
372
|
+
new_options = opts.merge(
|
373
|
+
:operation => :"TradingApi.get_user_account_quotes",
|
374
|
+
:header_params => header_params,
|
375
|
+
:query_params => query_params,
|
376
|
+
:form_params => form_params,
|
377
|
+
:body => post_body,
|
378
|
+
:auth_names => auth_names,
|
379
|
+
:return_type => return_type
|
380
|
+
)
|
381
|
+
|
382
|
+
data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
|
383
|
+
if @api_client.config.debugging
|
384
|
+
@api_client.config.logger.debug "API called: TradingApi#get_user_account_quotes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
385
|
+
end
|
386
|
+
return data, status_code, headers, response
|
387
|
+
end
|
388
|
+
|
389
|
+
|
390
|
+
# Place a trade with NO validation.
|
391
|
+
# @param user_id [String]
|
392
|
+
# @param user_secret [String]
|
393
|
+
# @param account_id [String]
|
394
|
+
# @param action [Action]
|
395
|
+
# @param order_type [OrderType]
|
396
|
+
# @param price [Float] Trade Price if limit or stop limit order
|
397
|
+
# @param stop [Float] Stop Price. If stop loss or stop limit order, the price to trigger the stop
|
398
|
+
# @param time_in_force [TimeInForce]
|
399
|
+
# @param units [Float] Trade Units
|
400
|
+
# @param universal_symbol_id [String]
|
401
|
+
# @param body [ManualTradeForm]
|
402
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
403
|
+
def place_force_order(user_id:, user_secret:, account_id: SENTINEL, action: SENTINEL, order_type: SENTINEL, price: SENTINEL, stop: SENTINEL, time_in_force: SENTINEL, units: SENTINEL, universal_symbol_id: SENTINEL, extra: {})
|
404
|
+
_body = {}
|
405
|
+
_body[:account_id] = account_id if account_id != SENTINEL
|
406
|
+
_body[:action] = action if action != SENTINEL
|
407
|
+
_body[:order_type] = order_type if order_type != SENTINEL
|
408
|
+
_body[:price] = price if price != SENTINEL
|
409
|
+
_body[:stop] = stop if stop != SENTINEL
|
410
|
+
_body[:time_in_force] = time_in_force if time_in_force != SENTINEL
|
411
|
+
_body[:units] = units if units != SENTINEL
|
412
|
+
_body[:universal_symbol_id] = universal_symbol_id if universal_symbol_id != SENTINEL
|
413
|
+
manual_trade_form = _body
|
414
|
+
|
415
|
+
data, _status_code, _headers = place_force_order_with_http_info_impl(user_id, user_secret, manual_trade_form, extra)
|
416
|
+
data
|
417
|
+
end
|
418
|
+
|
419
|
+
# Place a trade with NO validation.
|
420
|
+
# @param user_id [String]
|
421
|
+
# @param user_secret [String]
|
422
|
+
# @param account_id [String]
|
423
|
+
# @param action [Action]
|
424
|
+
# @param order_type [OrderType]
|
425
|
+
# @param price [Float] Trade Price if limit or stop limit order
|
426
|
+
# @param stop [Float] Stop Price. If stop loss or stop limit order, the price to trigger the stop
|
427
|
+
# @param time_in_force [TimeInForce]
|
428
|
+
# @param units [Float] Trade Units
|
429
|
+
# @param universal_symbol_id [String]
|
430
|
+
# @param body [ManualTradeForm]
|
431
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
432
|
+
def place_force_order_with_http_info(user_id:, user_secret:, account_id: SENTINEL, action: SENTINEL, order_type: SENTINEL, price: SENTINEL, stop: SENTINEL, time_in_force: SENTINEL, units: SENTINEL, universal_symbol_id: SENTINEL, extra: {})
|
433
|
+
_body = {}
|
434
|
+
_body[:account_id] = account_id if account_id != SENTINEL
|
435
|
+
_body[:action] = action if action != SENTINEL
|
436
|
+
_body[:order_type] = order_type if order_type != SENTINEL
|
437
|
+
_body[:price] = price if price != SENTINEL
|
438
|
+
_body[:stop] = stop if stop != SENTINEL
|
439
|
+
_body[:time_in_force] = time_in_force if time_in_force != SENTINEL
|
440
|
+
_body[:units] = units if units != SENTINEL
|
441
|
+
_body[:universal_symbol_id] = universal_symbol_id if universal_symbol_id != SENTINEL
|
442
|
+
manual_trade_form = _body
|
443
|
+
|
444
|
+
place_force_order_with_http_info_impl(user_id, user_secret, manual_trade_form, extra)
|
445
|
+
end
|
446
|
+
|
447
|
+
# Place a trade with NO validation.
|
448
|
+
# @param user_id [String]
|
449
|
+
# @param user_secret [String]
|
450
|
+
# @param manual_trade_form [ManualTradeForm]
|
451
|
+
# @param [Hash] opts the optional parameters
|
452
|
+
# @return [AccountOrderRecord]
|
453
|
+
def place_force_order_impl(user_id, user_secret, manual_trade_form, opts = {})
|
454
|
+
data, _status_code, _headers = place_force_order_with_http_info(user_id, user_secret, manual_trade_form, opts)
|
455
|
+
data
|
456
|
+
end
|
457
|
+
|
458
|
+
# Place a trade with NO validation.
|
459
|
+
# @param user_id [String]
|
460
|
+
# @param user_secret [String]
|
461
|
+
# @param manual_trade_form [ManualTradeForm]
|
462
|
+
# @param [Hash] opts the optional parameters
|
463
|
+
# @return [Array<(AccountOrderRecord, Integer, Hash)>] AccountOrderRecord data, response status code and response headers
|
464
|
+
def place_force_order_with_http_info_impl(user_id, user_secret, manual_trade_form, opts = {})
|
465
|
+
if @api_client.config.debugging
|
466
|
+
@api_client.config.logger.debug 'Calling API: TradingApi.place_force_order ...'
|
467
|
+
end
|
468
|
+
# verify the required parameter 'user_id' is set
|
469
|
+
if @api_client.config.client_side_validation && user_id.nil?
|
470
|
+
fail ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.place_force_order"
|
471
|
+
end
|
472
|
+
# verify the required parameter 'user_secret' is set
|
473
|
+
if @api_client.config.client_side_validation && user_secret.nil?
|
474
|
+
fail ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.place_force_order"
|
475
|
+
end
|
476
|
+
# verify the required parameter 'manual_trade_form' is set
|
477
|
+
if @api_client.config.client_side_validation && manual_trade_form.nil?
|
478
|
+
fail ArgumentError, "Missing the required parameter 'manual_trade_form' when calling TradingApi.place_force_order"
|
479
|
+
end
|
480
|
+
# resource path
|
481
|
+
local_var_path = '/trade/place'
|
482
|
+
|
483
|
+
# query parameters
|
484
|
+
query_params = opts[:query_params] || {}
|
485
|
+
query_params[:'userId'] = user_id
|
486
|
+
query_params[:'userSecret'] = user_secret
|
487
|
+
|
488
|
+
# header parameters
|
489
|
+
header_params = opts[:header_params] || {}
|
490
|
+
# HTTP header 'Accept' (if needed)
|
491
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
492
|
+
# HTTP header 'Content-Type'
|
493
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
494
|
+
if !content_type.nil?
|
495
|
+
header_params['Content-Type'] = content_type
|
496
|
+
end
|
497
|
+
|
498
|
+
# form parameters
|
499
|
+
form_params = opts[:form_params] || {}
|
500
|
+
|
501
|
+
# http body (model)
|
502
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(manual_trade_form)
|
503
|
+
|
504
|
+
# return_type
|
505
|
+
return_type = opts[:debug_return_type] || 'AccountOrderRecord'
|
506
|
+
|
507
|
+
# auth_names
|
508
|
+
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
509
|
+
|
510
|
+
new_options = opts.merge(
|
511
|
+
:operation => :"TradingApi.place_force_order",
|
512
|
+
:header_params => header_params,
|
513
|
+
:query_params => query_params,
|
514
|
+
:form_params => form_params,
|
515
|
+
:body => post_body,
|
516
|
+
:auth_names => auth_names,
|
517
|
+
:return_type => return_type
|
518
|
+
)
|
519
|
+
|
520
|
+
data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
|
521
|
+
if @api_client.config.debugging
|
522
|
+
@api_client.config.logger.debug "API called: TradingApi#place_force_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
523
|
+
end
|
524
|
+
return data, status_code, headers, response
|
525
|
+
end
|
526
|
+
|
527
|
+
|
528
|
+
# Place a OCO (One Cancels Other) order
|
529
|
+
# @param user_id [String]
|
530
|
+
# @param user_secret [String]
|
531
|
+
# @param first_trade_id [Object] The ID of first trade object obtained from trade/impact endpoint
|
532
|
+
# @param second_trade_id [Object] The ID of second trade object obtained from trade/impact endpoint
|
533
|
+
# @param body [TradingPlaceOCOOrderRequest]
|
534
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
535
|
+
def place_oco_order(user_id:, user_secret:, first_trade_id: SENTINEL, second_trade_id: SENTINEL, extra: {})
|
536
|
+
_body = {}
|
537
|
+
_body[:first_trade_id] = first_trade_id if first_trade_id != SENTINEL
|
538
|
+
_body[:second_trade_id] = second_trade_id if second_trade_id != SENTINEL
|
539
|
+
trading_place_oco_order_request = _body
|
540
|
+
|
541
|
+
data, _status_code, _headers = place_oco_order_with_http_info_impl(user_id, user_secret, trading_place_oco_order_request, extra)
|
542
|
+
data
|
543
|
+
end
|
544
|
+
|
545
|
+
# Place a OCO (One Cancels Other) order
|
546
|
+
# @param user_id [String]
|
547
|
+
# @param user_secret [String]
|
548
|
+
# @param first_trade_id [Object] The ID of first trade object obtained from trade/impact endpoint
|
549
|
+
# @param second_trade_id [Object] The ID of second trade object obtained from trade/impact endpoint
|
550
|
+
# @param body [TradingPlaceOCOOrderRequest]
|
551
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
552
|
+
def place_oco_order_with_http_info(user_id:, user_secret:, first_trade_id: SENTINEL, second_trade_id: SENTINEL, extra: {})
|
553
|
+
_body = {}
|
554
|
+
_body[:first_trade_id] = first_trade_id if first_trade_id != SENTINEL
|
555
|
+
_body[:second_trade_id] = second_trade_id if second_trade_id != SENTINEL
|
556
|
+
trading_place_oco_order_request = _body
|
557
|
+
|
558
|
+
place_oco_order_with_http_info_impl(user_id, user_secret, trading_place_oco_order_request, extra)
|
559
|
+
end
|
560
|
+
|
561
|
+
# Place a OCO (One Cancels Other) order
|
562
|
+
# @param user_id [String]
|
563
|
+
# @param user_secret [String]
|
564
|
+
# @param trading_place_oco_order_request [TradingPlaceOCOOrderRequest]
|
565
|
+
# @param [Hash] opts the optional parameters
|
566
|
+
# @return [AccountOrderRecord]
|
567
|
+
def place_oco_order_impl(user_id, user_secret, trading_place_oco_order_request, opts = {})
|
568
|
+
data, _status_code, _headers = place_oco_order_with_http_info(user_id, user_secret, trading_place_oco_order_request, opts)
|
569
|
+
data
|
570
|
+
end
|
571
|
+
|
572
|
+
# Place a OCO (One Cancels Other) order
|
573
|
+
# @param user_id [String]
|
574
|
+
# @param user_secret [String]
|
575
|
+
# @param trading_place_oco_order_request [TradingPlaceOCOOrderRequest]
|
576
|
+
# @param [Hash] opts the optional parameters
|
577
|
+
# @return [Array<(AccountOrderRecord, Integer, Hash)>] AccountOrderRecord data, response status code and response headers
|
578
|
+
def place_oco_order_with_http_info_impl(user_id, user_secret, trading_place_oco_order_request, opts = {})
|
579
|
+
if @api_client.config.debugging
|
580
|
+
@api_client.config.logger.debug 'Calling API: TradingApi.place_oco_order ...'
|
581
|
+
end
|
582
|
+
# verify the required parameter 'user_id' is set
|
583
|
+
if @api_client.config.client_side_validation && user_id.nil?
|
584
|
+
fail ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.place_oco_order"
|
585
|
+
end
|
586
|
+
# verify the required parameter 'user_secret' is set
|
587
|
+
if @api_client.config.client_side_validation && user_secret.nil?
|
588
|
+
fail ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.place_oco_order"
|
589
|
+
end
|
590
|
+
# verify the required parameter 'trading_place_oco_order_request' is set
|
591
|
+
if @api_client.config.client_side_validation && trading_place_oco_order_request.nil?
|
592
|
+
fail ArgumentError, "Missing the required parameter 'trading_place_oco_order_request' when calling TradingApi.place_oco_order"
|
593
|
+
end
|
594
|
+
# resource path
|
595
|
+
local_var_path = '/trade/oco'
|
596
|
+
|
597
|
+
# query parameters
|
598
|
+
query_params = opts[:query_params] || {}
|
599
|
+
query_params[:'userId'] = user_id
|
600
|
+
query_params[:'userSecret'] = user_secret
|
601
|
+
|
602
|
+
# header parameters
|
603
|
+
header_params = opts[:header_params] || {}
|
604
|
+
# HTTP header 'Accept' (if needed)
|
605
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
606
|
+
# HTTP header 'Content-Type'
|
607
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
608
|
+
if !content_type.nil?
|
609
|
+
header_params['Content-Type'] = content_type
|
610
|
+
end
|
611
|
+
|
612
|
+
# form parameters
|
613
|
+
form_params = opts[:form_params] || {}
|
614
|
+
|
615
|
+
# http body (model)
|
616
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(trading_place_oco_order_request)
|
617
|
+
|
618
|
+
# return_type
|
619
|
+
return_type = opts[:debug_return_type] || 'AccountOrderRecord'
|
620
|
+
|
621
|
+
# auth_names
|
622
|
+
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
623
|
+
|
624
|
+
new_options = opts.merge(
|
625
|
+
:operation => :"TradingApi.place_oco_order",
|
626
|
+
:header_params => header_params,
|
627
|
+
:query_params => query_params,
|
628
|
+
:form_params => form_params,
|
629
|
+
:body => post_body,
|
630
|
+
:auth_names => auth_names,
|
631
|
+
:return_type => return_type
|
632
|
+
)
|
633
|
+
|
634
|
+
data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
|
635
|
+
if @api_client.config.debugging
|
636
|
+
@api_client.config.logger.debug "API called: TradingApi#place_oco_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
637
|
+
end
|
638
|
+
return data, status_code, headers, response
|
639
|
+
end
|
640
|
+
|
641
|
+
|
642
|
+
# Place order
|
643
|
+
# @param trade_id [String] The ID of trade object obtained from trade/impact endpoint
|
644
|
+
# @param user_id [String]
|
645
|
+
# @param user_secret [String]
|
646
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
647
|
+
def place_order(trade_id:, user_id:, user_secret:, extra: {})
|
648
|
+
|
649
|
+
data, _status_code, _headers = place_order_with_http_info_impl(trade_id, user_id, user_secret, extra)
|
650
|
+
data
|
651
|
+
end
|
652
|
+
|
653
|
+
# Place order
|
654
|
+
# @param trade_id [String] The ID of trade object obtained from trade/impact endpoint
|
655
|
+
# @param user_id [String]
|
656
|
+
# @param user_secret [String]
|
657
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
658
|
+
def place_order_with_http_info(trade_id:, user_id:, user_secret:, extra: {})
|
659
|
+
|
660
|
+
place_order_with_http_info_impl(trade_id, user_id, user_secret, extra)
|
661
|
+
end
|
662
|
+
|
663
|
+
# Place order
|
664
|
+
# @param trade_id [String] The ID of trade object obtained from trade/impact endpoint
|
665
|
+
# @param user_id [String]
|
666
|
+
# @param user_secret [String]
|
667
|
+
# @param [Hash] opts the optional parameters
|
668
|
+
# @return [AccountOrderRecord]
|
669
|
+
def place_order_impl(trade_id, user_id, user_secret, opts = {})
|
670
|
+
data, _status_code, _headers = place_order_with_http_info(trade_id, user_id, user_secret, opts)
|
671
|
+
data
|
672
|
+
end
|
673
|
+
|
674
|
+
# Place order
|
675
|
+
# @param trade_id [String] The ID of trade object obtained from trade/impact endpoint
|
676
|
+
# @param user_id [String]
|
677
|
+
# @param user_secret [String]
|
678
|
+
# @param [Hash] opts the optional parameters
|
679
|
+
# @return [Array<(AccountOrderRecord, Integer, Hash)>] AccountOrderRecord data, response status code and response headers
|
680
|
+
def place_order_with_http_info_impl(trade_id, user_id, user_secret, opts = {})
|
681
|
+
if @api_client.config.debugging
|
682
|
+
@api_client.config.logger.debug 'Calling API: TradingApi.place_order ...'
|
683
|
+
end
|
684
|
+
# verify the required parameter 'trade_id' is set
|
685
|
+
if @api_client.config.client_side_validation && trade_id.nil?
|
686
|
+
fail ArgumentError, "Missing the required parameter 'trade_id' when calling TradingApi.place_order"
|
687
|
+
end
|
688
|
+
# verify the required parameter 'user_id' is set
|
689
|
+
if @api_client.config.client_side_validation && user_id.nil?
|
690
|
+
fail ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.place_order"
|
691
|
+
end
|
692
|
+
# verify the required parameter 'user_secret' is set
|
693
|
+
if @api_client.config.client_side_validation && user_secret.nil?
|
694
|
+
fail ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.place_order"
|
695
|
+
end
|
696
|
+
# resource path
|
697
|
+
local_var_path = '/trade/{tradeId}'.sub('{' + 'tradeId' + '}', CGI.escape(trade_id.to_s))
|
698
|
+
|
699
|
+
# query parameters
|
700
|
+
query_params = opts[:query_params] || {}
|
701
|
+
query_params[:'userId'] = user_id
|
702
|
+
query_params[:'userSecret'] = user_secret
|
703
|
+
|
704
|
+
# header parameters
|
705
|
+
header_params = opts[:header_params] || {}
|
706
|
+
# HTTP header 'Accept' (if needed)
|
707
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
708
|
+
|
709
|
+
# form parameters
|
710
|
+
form_params = opts[:form_params] || {}
|
711
|
+
|
712
|
+
# http body (model)
|
713
|
+
post_body = opts[:debug_body]
|
714
|
+
|
715
|
+
# return_type
|
716
|
+
return_type = opts[:debug_return_type] || 'AccountOrderRecord'
|
717
|
+
|
718
|
+
# auth_names
|
719
|
+
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
720
|
+
|
721
|
+
new_options = opts.merge(
|
722
|
+
:operation => :"TradingApi.place_order",
|
723
|
+
:header_params => header_params,
|
724
|
+
:query_params => query_params,
|
725
|
+
:form_params => form_params,
|
726
|
+
:body => post_body,
|
727
|
+
:auth_names => auth_names,
|
728
|
+
:return_type => return_type
|
729
|
+
)
|
730
|
+
|
731
|
+
data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
|
732
|
+
if @api_client.config.debugging
|
733
|
+
@api_client.config.logger.debug "API called: TradingApi#place_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
734
|
+
end
|
735
|
+
return data, status_code, headers, response
|
736
|
+
end
|
737
|
+
end
|
738
|
+
|
739
|
+
# top-level client access to avoid having the user to insantiate their own API instances
|
740
|
+
Trading = TradingApi::new
|
741
|
+
end
|