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,591 +1,591 @@
|
|
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 OptionsApi
|
15
|
-
attr_accessor :api_client
|
16
|
-
|
17
|
-
def initialize(api_client = ApiClient.default)
|
18
|
-
@api_client = api_client
|
19
|
-
end
|
20
|
-
|
21
|
-
# Creates an option strategy object that will be used to place an option strategy order
|
22
|
-
# @param underlying_symbol_id [String]
|
23
|
-
# @param legs [Array<OptionLeg>]
|
24
|
-
# @param strategy_type [StrategyType]
|
25
|
-
# @param user_id [String]
|
26
|
-
# @param user_secret [String]
|
27
|
-
# @param account_id [String] The ID of the account get positions.
|
28
|
-
# @param body [OptionsGetOptionStrategyRequest]
|
29
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
30
|
-
def get_option_strategy(underlying_symbol_id:, legs:, strategy_type:, user_id:, user_secret:, account_id:, extra: {})
|
31
|
-
_body = {}
|
32
|
-
_body[:underlying_symbol_id] = underlying_symbol_id if underlying_symbol_id != SENTINEL
|
33
|
-
_body[:legs] = legs if legs != SENTINEL
|
34
|
-
_body[:strategy_type] = strategy_type if strategy_type != SENTINEL
|
35
|
-
options_get_option_strategy_request = _body
|
36
|
-
|
37
|
-
data, _status_code, _headers = get_option_strategy_with_http_info_impl(user_id, user_secret, account_id, options_get_option_strategy_request, extra)
|
38
|
-
data
|
39
|
-
end
|
40
|
-
|
41
|
-
# Creates an option strategy object that will be used to place an option strategy order
|
42
|
-
# @param underlying_symbol_id [String]
|
43
|
-
# @param legs [Array<OptionLeg>]
|
44
|
-
# @param strategy_type [StrategyType]
|
45
|
-
# @param user_id [String]
|
46
|
-
# @param user_secret [String]
|
47
|
-
# @param account_id [String] The ID of the account get positions.
|
48
|
-
# @param body [OptionsGetOptionStrategyRequest]
|
49
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
50
|
-
def get_option_strategy_with_http_info(underlying_symbol_id:, legs:, strategy_type:, user_id:, user_secret:, account_id:, extra: {})
|
51
|
-
_body = {}
|
52
|
-
_body[:underlying_symbol_id] = underlying_symbol_id if underlying_symbol_id != SENTINEL
|
53
|
-
_body[:legs] = legs if legs != SENTINEL
|
54
|
-
_body[:strategy_type] = strategy_type if strategy_type != SENTINEL
|
55
|
-
options_get_option_strategy_request = _body
|
56
|
-
|
57
|
-
get_option_strategy_with_http_info_impl(user_id, user_secret, account_id, options_get_option_strategy_request, extra)
|
58
|
-
end
|
59
|
-
|
60
|
-
# Creates an option strategy object that will be used to place an option strategy order
|
61
|
-
# @param user_id [String]
|
62
|
-
# @param user_secret [String]
|
63
|
-
# @param account_id [String] The ID of the account get positions.
|
64
|
-
# @param options_get_option_strategy_request [OptionsGetOptionStrategyRequest]
|
65
|
-
# @param [Hash] opts the optional parameters
|
66
|
-
# @return [StrategyQuotes]
|
67
|
-
def get_option_strategy_impl(user_id, user_secret, account_id, options_get_option_strategy_request, opts = {})
|
68
|
-
data, _status_code, _headers = get_option_strategy_with_http_info(user_id, user_secret, account_id, options_get_option_strategy_request, opts)
|
69
|
-
data
|
70
|
-
end
|
71
|
-
|
72
|
-
# Creates an option strategy object that will be used to place an option strategy order
|
73
|
-
# @param user_id [String]
|
74
|
-
# @param user_secret [String]
|
75
|
-
# @param account_id [String] The ID of the account get positions.
|
76
|
-
# @param options_get_option_strategy_request [OptionsGetOptionStrategyRequest]
|
77
|
-
# @param [Hash] opts the optional parameters
|
78
|
-
# @return [Array<(StrategyQuotes, Integer, Hash)>] StrategyQuotes data, response status code and response headers
|
79
|
-
def get_option_strategy_with_http_info_impl(user_id, user_secret, account_id, options_get_option_strategy_request, opts = {})
|
80
|
-
if @api_client.config.debugging
|
81
|
-
@api_client.config.logger.debug 'Calling API: OptionsApi.get_option_strategy ...'
|
82
|
-
end
|
83
|
-
# verify the required parameter 'user_id' is set
|
84
|
-
if @api_client.config.client_side_validation && user_id.nil?
|
85
|
-
fail ArgumentError, "Missing the required parameter 'user_id' when calling OptionsApi.get_option_strategy"
|
86
|
-
end
|
87
|
-
# verify the required parameter 'user_secret' is set
|
88
|
-
if @api_client.config.client_side_validation && user_secret.nil?
|
89
|
-
fail ArgumentError, "Missing the required parameter 'user_secret' when calling OptionsApi.get_option_strategy"
|
90
|
-
end
|
91
|
-
# verify the required parameter 'account_id' is set
|
92
|
-
if @api_client.config.client_side_validation && account_id.nil?
|
93
|
-
fail ArgumentError, "Missing the required parameter 'account_id' when calling OptionsApi.get_option_strategy"
|
94
|
-
end
|
95
|
-
# verify the required parameter 'options_get_option_strategy_request' is set
|
96
|
-
if @api_client.config.client_side_validation && options_get_option_strategy_request.nil?
|
97
|
-
fail ArgumentError, "Missing the required parameter 'options_get_option_strategy_request' when calling OptionsApi.get_option_strategy"
|
98
|
-
end
|
99
|
-
# resource path
|
100
|
-
local_var_path = '/accounts/{accountId}/optionStrategy'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
|
101
|
-
|
102
|
-
# query parameters
|
103
|
-
query_params = opts[:query_params] || {}
|
104
|
-
query_params[:'userId'] = user_id
|
105
|
-
query_params[:'userSecret'] = user_secret
|
106
|
-
|
107
|
-
# header parameters
|
108
|
-
header_params = opts[:header_params] || {}
|
109
|
-
# HTTP header 'Accept' (if needed)
|
110
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
111
|
-
# HTTP header 'Content-Type'
|
112
|
-
content_type = @api_client.select_header_content_type(['application/json'])
|
113
|
-
if !content_type.nil?
|
114
|
-
header_params['Content-Type'] = content_type
|
115
|
-
end
|
116
|
-
|
117
|
-
# form parameters
|
118
|
-
form_params = opts[:form_params] || {}
|
119
|
-
|
120
|
-
# http body (model)
|
121
|
-
post_body = opts[:debug_body] || @api_client.object_to_http_body(options_get_option_strategy_request)
|
122
|
-
|
123
|
-
# return_type
|
124
|
-
return_type = opts[:debug_return_type] || 'StrategyQuotes'
|
125
|
-
|
126
|
-
# auth_names
|
127
|
-
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
128
|
-
|
129
|
-
new_options = opts.merge(
|
130
|
-
:operation => :"OptionsApi.get_option_strategy",
|
131
|
-
:header_params => header_params,
|
132
|
-
:query_params => query_params,
|
133
|
-
:form_params => form_params,
|
134
|
-
:body => post_body,
|
135
|
-
:auth_names => auth_names,
|
136
|
-
:return_type => return_type
|
137
|
-
)
|
138
|
-
|
139
|
-
data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
|
140
|
-
if @api_client.config.debugging
|
141
|
-
@api_client.config.logger.debug "API called: OptionsApi#get_option_strategy\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
142
|
-
end
|
143
|
-
return data, status_code, headers, response
|
144
|
-
end
|
145
|
-
|
146
|
-
|
147
|
-
# Get the options chain
|
148
|
-
# @param user_id [String]
|
149
|
-
# @param user_secret [String]
|
150
|
-
# @param account_id [String] The ID of the account get positions.
|
151
|
-
# @param symbol [String] Universal symbol ID if symbol
|
152
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
153
|
-
def get_options_chain(user_id:, user_secret:, account_id:, symbol:, extra: {})
|
154
|
-
|
155
|
-
data, _status_code, _headers = get_options_chain_with_http_info_impl(user_id, user_secret, account_id, symbol, extra)
|
156
|
-
data
|
157
|
-
end
|
158
|
-
|
159
|
-
# Get the options chain
|
160
|
-
# @param user_id [String]
|
161
|
-
# @param user_secret [String]
|
162
|
-
# @param account_id [String] The ID of the account get positions.
|
163
|
-
# @param symbol [String] Universal symbol ID if symbol
|
164
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
165
|
-
def get_options_chain_with_http_info(user_id:, user_secret:, account_id:, symbol:, extra: {})
|
166
|
-
|
167
|
-
get_options_chain_with_http_info_impl(user_id, user_secret, account_id, symbol, extra)
|
168
|
-
end
|
169
|
-
|
170
|
-
# Get the options chain
|
171
|
-
# @param user_id [String]
|
172
|
-
# @param user_secret [String]
|
173
|
-
# @param account_id [String] The ID of the account get positions.
|
174
|
-
# @param symbol [String] Universal symbol ID if symbol
|
175
|
-
# @param [Hash] opts the optional parameters
|
176
|
-
# @return [Array<OptionChainInner>]
|
177
|
-
def get_options_chain_impl(user_id, user_secret, account_id, symbol, opts = {})
|
178
|
-
data, _status_code, _headers = get_options_chain_with_http_info(user_id, user_secret, account_id, symbol, opts)
|
179
|
-
data
|
180
|
-
end
|
181
|
-
|
182
|
-
# Get the options chain
|
183
|
-
# @param user_id [String]
|
184
|
-
# @param user_secret [String]
|
185
|
-
# @param account_id [String] The ID of the account get positions.
|
186
|
-
# @param symbol [String] Universal symbol ID if symbol
|
187
|
-
# @param [Hash] opts the optional parameters
|
188
|
-
# @return [Array<(Array<OptionChainInner>, Integer, Hash)>] Array<OptionChainInner> data, response status code and response headers
|
189
|
-
def get_options_chain_with_http_info_impl(user_id, user_secret, account_id, symbol, opts = {})
|
190
|
-
if @api_client.config.debugging
|
191
|
-
@api_client.config.logger.debug 'Calling API: OptionsApi.get_options_chain ...'
|
192
|
-
end
|
193
|
-
# verify the required parameter 'user_id' is set
|
194
|
-
if @api_client.config.client_side_validation && user_id.nil?
|
195
|
-
fail ArgumentError, "Missing the required parameter 'user_id' when calling OptionsApi.get_options_chain"
|
196
|
-
end
|
197
|
-
# verify the required parameter 'user_secret' is set
|
198
|
-
if @api_client.config.client_side_validation && user_secret.nil?
|
199
|
-
fail ArgumentError, "Missing the required parameter 'user_secret' when calling OptionsApi.get_options_chain"
|
200
|
-
end
|
201
|
-
# verify the required parameter 'account_id' is set
|
202
|
-
if @api_client.config.client_side_validation && account_id.nil?
|
203
|
-
fail ArgumentError, "Missing the required parameter 'account_id' when calling OptionsApi.get_options_chain"
|
204
|
-
end
|
205
|
-
# verify the required parameter 'symbol' is set
|
206
|
-
if @api_client.config.client_side_validation && symbol.nil?
|
207
|
-
fail ArgumentError, "Missing the required parameter 'symbol' when calling OptionsApi.get_options_chain"
|
208
|
-
end
|
209
|
-
# resource path
|
210
|
-
local_var_path = '/accounts/{accountId}/optionsChain'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
|
211
|
-
|
212
|
-
# query parameters
|
213
|
-
query_params = opts[:query_params] || {}
|
214
|
-
query_params[:'userId'] = user_id
|
215
|
-
query_params[:'userSecret'] = user_secret
|
216
|
-
query_params[:'symbol'] = symbol
|
217
|
-
|
218
|
-
# header parameters
|
219
|
-
header_params = opts[:header_params] || {}
|
220
|
-
# HTTP header 'Accept' (if needed)
|
221
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
222
|
-
|
223
|
-
# form parameters
|
224
|
-
form_params = opts[:form_params] || {}
|
225
|
-
|
226
|
-
# http body (model)
|
227
|
-
post_body = opts[:debug_body]
|
228
|
-
|
229
|
-
# return_type
|
230
|
-
return_type = opts[:debug_return_type] || 'Array<OptionChainInner>'
|
231
|
-
|
232
|
-
# auth_names
|
233
|
-
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
234
|
-
|
235
|
-
new_options = opts.merge(
|
236
|
-
:operation => :"OptionsApi.get_options_chain",
|
237
|
-
:header_params => header_params,
|
238
|
-
:query_params => query_params,
|
239
|
-
:form_params => form_params,
|
240
|
-
:body => post_body,
|
241
|
-
:auth_names => auth_names,
|
242
|
-
:return_type => return_type
|
243
|
-
)
|
244
|
-
|
245
|
-
data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
|
246
|
-
if @api_client.config.debugging
|
247
|
-
@api_client.config.logger.debug "API called: OptionsApi#get_options_chain\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
248
|
-
end
|
249
|
-
return data, status_code, headers, response
|
250
|
-
end
|
251
|
-
|
252
|
-
|
253
|
-
# Get latest market data of option strategy
|
254
|
-
# @param user_id [String]
|
255
|
-
# @param user_secret [String]
|
256
|
-
# @param account_id [String] The ID of the account get positions.
|
257
|
-
# @param option_strategy_id [String] Option strategy id obtained from response when creating option strategy object
|
258
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
259
|
-
def get_options_strategy_quote(user_id:, user_secret:, account_id:, option_strategy_id:, extra: {})
|
260
|
-
|
261
|
-
data, _status_code, _headers = get_options_strategy_quote_with_http_info_impl(user_id, user_secret, account_id, option_strategy_id, extra)
|
262
|
-
data
|
263
|
-
end
|
264
|
-
|
265
|
-
# Get latest market data of option strategy
|
266
|
-
# @param user_id [String]
|
267
|
-
# @param user_secret [String]
|
268
|
-
# @param account_id [String] The ID of the account get positions.
|
269
|
-
# @param option_strategy_id [String] Option strategy id obtained from response when creating option strategy object
|
270
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
271
|
-
def get_options_strategy_quote_with_http_info(user_id:, user_secret:, account_id:, option_strategy_id:, extra: {})
|
272
|
-
|
273
|
-
get_options_strategy_quote_with_http_info_impl(user_id, user_secret, account_id, option_strategy_id, extra)
|
274
|
-
end
|
275
|
-
|
276
|
-
# Get latest market data of option strategy
|
277
|
-
# @param user_id [String]
|
278
|
-
# @param user_secret [String]
|
279
|
-
# @param account_id [String] The ID of the account get positions.
|
280
|
-
# @param option_strategy_id [String] Option strategy id obtained from response when creating option strategy object
|
281
|
-
# @param [Hash] opts the optional parameters
|
282
|
-
# @return [StrategyQuotes]
|
283
|
-
def get_options_strategy_quote_impl(user_id, user_secret, account_id, option_strategy_id, opts = {})
|
284
|
-
data, _status_code, _headers = get_options_strategy_quote_with_http_info(user_id, user_secret, account_id, option_strategy_id, opts)
|
285
|
-
data
|
286
|
-
end
|
287
|
-
|
288
|
-
# Get latest market data of option strategy
|
289
|
-
# @param user_id [String]
|
290
|
-
# @param user_secret [String]
|
291
|
-
# @param account_id [String] The ID of the account get positions.
|
292
|
-
# @param option_strategy_id [String] Option strategy id obtained from response when creating option strategy object
|
293
|
-
# @param [Hash] opts the optional parameters
|
294
|
-
# @return [Array<(StrategyQuotes, Integer, Hash)>] StrategyQuotes data, response status code and response headers
|
295
|
-
def get_options_strategy_quote_with_http_info_impl(user_id, user_secret, account_id, option_strategy_id, opts = {})
|
296
|
-
if @api_client.config.debugging
|
297
|
-
@api_client.config.logger.debug 'Calling API: OptionsApi.get_options_strategy_quote ...'
|
298
|
-
end
|
299
|
-
# verify the required parameter 'user_id' is set
|
300
|
-
if @api_client.config.client_side_validation && user_id.nil?
|
301
|
-
fail ArgumentError, "Missing the required parameter 'user_id' when calling OptionsApi.get_options_strategy_quote"
|
302
|
-
end
|
303
|
-
# verify the required parameter 'user_secret' is set
|
304
|
-
if @api_client.config.client_side_validation && user_secret.nil?
|
305
|
-
fail ArgumentError, "Missing the required parameter 'user_secret' when calling OptionsApi.get_options_strategy_quote"
|
306
|
-
end
|
307
|
-
# verify the required parameter 'account_id' is set
|
308
|
-
if @api_client.config.client_side_validation && account_id.nil?
|
309
|
-
fail ArgumentError, "Missing the required parameter 'account_id' when calling OptionsApi.get_options_strategy_quote"
|
310
|
-
end
|
311
|
-
# verify the required parameter 'option_strategy_id' is set
|
312
|
-
if @api_client.config.client_side_validation && option_strategy_id.nil?
|
313
|
-
fail ArgumentError, "Missing the required parameter 'option_strategy_id' when calling OptionsApi.get_options_strategy_quote"
|
314
|
-
end
|
315
|
-
# resource path
|
316
|
-
local_var_path = '/accounts/{accountId}/optionStrategy/{optionStrategyId}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'optionStrategyId' + '}', CGI.escape(option_strategy_id.to_s))
|
317
|
-
|
318
|
-
# query parameters
|
319
|
-
query_params = opts[:query_params] || {}
|
320
|
-
query_params[:'userId'] = user_id
|
321
|
-
query_params[:'userSecret'] = user_secret
|
322
|
-
|
323
|
-
# header parameters
|
324
|
-
header_params = opts[:header_params] || {}
|
325
|
-
# HTTP header 'Accept' (if needed)
|
326
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
327
|
-
|
328
|
-
# form parameters
|
329
|
-
form_params = opts[:form_params] || {}
|
330
|
-
|
331
|
-
# http body (model)
|
332
|
-
post_body = opts[:debug_body]
|
333
|
-
|
334
|
-
# return_type
|
335
|
-
return_type = opts[:debug_return_type] || 'StrategyQuotes'
|
336
|
-
|
337
|
-
# auth_names
|
338
|
-
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
339
|
-
|
340
|
-
new_options = opts.merge(
|
341
|
-
:operation => :"OptionsApi.get_options_strategy_quote",
|
342
|
-
:header_params => header_params,
|
343
|
-
:query_params => query_params,
|
344
|
-
:form_params => form_params,
|
345
|
-
:body => post_body,
|
346
|
-
:auth_names => auth_names,
|
347
|
-
:return_type => return_type
|
348
|
-
)
|
349
|
-
|
350
|
-
data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
|
351
|
-
if @api_client.config.debugging
|
352
|
-
@api_client.config.logger.debug "API called: OptionsApi#get_options_strategy_quote\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
353
|
-
end
|
354
|
-
return data, status_code, headers, response
|
355
|
-
end
|
356
|
-
|
357
|
-
|
358
|
-
# Get the options holdings in the account
|
359
|
-
# @param user_id [String]
|
360
|
-
# @param user_secret [String]
|
361
|
-
# @param account_id [String] The ID of the account get positions.
|
362
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
363
|
-
def list_option_holdings(user_id:, user_secret:, account_id:, extra: {})
|
364
|
-
|
365
|
-
data, _status_code, _headers = list_option_holdings_with_http_info_impl(user_id, user_secret, account_id, extra)
|
366
|
-
data
|
367
|
-
end
|
368
|
-
|
369
|
-
# Get the options holdings in the account
|
370
|
-
# @param user_id [String]
|
371
|
-
# @param user_secret [String]
|
372
|
-
# @param account_id [String] The ID of the account get positions.
|
373
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
374
|
-
def list_option_holdings_with_http_info(user_id:, user_secret:, account_id:, extra: {})
|
375
|
-
|
376
|
-
list_option_holdings_with_http_info_impl(user_id, user_secret, account_id, extra)
|
377
|
-
end
|
378
|
-
|
379
|
-
# Get the options holdings in the account
|
380
|
-
# @param user_id [String]
|
381
|
-
# @param user_secret [String]
|
382
|
-
# @param account_id [String] The ID of the account get positions.
|
383
|
-
# @param [Hash] opts the optional parameters
|
384
|
-
# @return [Array<OptionsPosition>]
|
385
|
-
def list_option_holdings_impl(user_id, user_secret, account_id, opts = {})
|
386
|
-
data, _status_code, _headers = list_option_holdings_with_http_info(user_id, user_secret, account_id, opts)
|
387
|
-
data
|
388
|
-
end
|
389
|
-
|
390
|
-
# Get the options holdings in the account
|
391
|
-
# @param user_id [String]
|
392
|
-
# @param user_secret [String]
|
393
|
-
# @param account_id [String] The ID of the account get positions.
|
394
|
-
# @param [Hash] opts the optional parameters
|
395
|
-
# @return [Array<(Array<OptionsPosition>, Integer, Hash)>] Array<OptionsPosition> data, response status code and response headers
|
396
|
-
def list_option_holdings_with_http_info_impl(user_id, user_secret, account_id, opts = {})
|
397
|
-
if @api_client.config.debugging
|
398
|
-
@api_client.config.logger.debug 'Calling API: OptionsApi.list_option_holdings ...'
|
399
|
-
end
|
400
|
-
# verify the required parameter 'user_id' is set
|
401
|
-
if @api_client.config.client_side_validation && user_id.nil?
|
402
|
-
fail ArgumentError, "Missing the required parameter 'user_id' when calling OptionsApi.list_option_holdings"
|
403
|
-
end
|
404
|
-
# verify the required parameter 'user_secret' is set
|
405
|
-
if @api_client.config.client_side_validation && user_secret.nil?
|
406
|
-
fail ArgumentError, "Missing the required parameter 'user_secret' when calling OptionsApi.list_option_holdings"
|
407
|
-
end
|
408
|
-
# verify the required parameter 'account_id' is set
|
409
|
-
if @api_client.config.client_side_validation && account_id.nil?
|
410
|
-
fail ArgumentError, "Missing the required parameter 'account_id' when calling OptionsApi.list_option_holdings"
|
411
|
-
end
|
412
|
-
# resource path
|
413
|
-
local_var_path = '/accounts/{accountId}/options'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
|
414
|
-
|
415
|
-
# query parameters
|
416
|
-
query_params = opts[:query_params] || {}
|
417
|
-
query_params[:'userId'] = user_id
|
418
|
-
query_params[:'userSecret'] = user_secret
|
419
|
-
|
420
|
-
# header parameters
|
421
|
-
header_params = opts[:header_params] || {}
|
422
|
-
# HTTP header 'Accept' (if needed)
|
423
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
424
|
-
|
425
|
-
# form parameters
|
426
|
-
form_params = opts[:form_params] || {}
|
427
|
-
|
428
|
-
# http body (model)
|
429
|
-
post_body = opts[:debug_body]
|
430
|
-
|
431
|
-
# return_type
|
432
|
-
return_type = opts[:debug_return_type] || 'Array<OptionsPosition>'
|
433
|
-
|
434
|
-
# auth_names
|
435
|
-
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
436
|
-
|
437
|
-
new_options = opts.merge(
|
438
|
-
:operation => :"OptionsApi.list_option_holdings",
|
439
|
-
:header_params => header_params,
|
440
|
-
:query_params => query_params,
|
441
|
-
:form_params => form_params,
|
442
|
-
:body => post_body,
|
443
|
-
:auth_names => auth_names,
|
444
|
-
:return_type => return_type
|
445
|
-
)
|
446
|
-
|
447
|
-
data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
|
448
|
-
if @api_client.config.debugging
|
449
|
-
@api_client.config.logger.debug "API called: OptionsApi#list_option_holdings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
450
|
-
end
|
451
|
-
return data, status_code, headers, response
|
452
|
-
end
|
453
|
-
|
454
|
-
|
455
|
-
# Place an option strategy order on the brokerage
|
456
|
-
# @param order_type [OrderStrategyExecuteBodyOrderType]
|
457
|
-
# @param time_in_force [OrderStrategyExecuteBodyTimeInForce]
|
458
|
-
# @param price [Float] Trade Price if limit or stop limit order
|
459
|
-
# @param user_id [String]
|
460
|
-
# @param user_secret [String]
|
461
|
-
# @param account_id [String] The ID of the account get positions.
|
462
|
-
# @param option_strategy_id [String] Option strategy id obtained from response when creating option strategy object
|
463
|
-
# @param body [OptionsPlaceOptionStrategyRequest]
|
464
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
465
|
-
def place_option_strategy(order_type:, time_in_force:, price:, user_id:, user_secret:, account_id:, option_strategy_id:, extra: {})
|
466
|
-
_body = {}
|
467
|
-
_body[:order_type] = order_type if order_type != SENTINEL
|
468
|
-
_body[:time_in_force] = time_in_force if time_in_force != SENTINEL
|
469
|
-
_body[:price] = price if price != SENTINEL
|
470
|
-
options_place_option_strategy_request = _body
|
471
|
-
|
472
|
-
data, _status_code, _headers = place_option_strategy_with_http_info_impl(user_id, user_secret, account_id, option_strategy_id, options_place_option_strategy_request, extra)
|
473
|
-
data
|
474
|
-
end
|
475
|
-
|
476
|
-
# Place an option strategy order on the brokerage
|
477
|
-
# @param order_type [OrderStrategyExecuteBodyOrderType]
|
478
|
-
# @param time_in_force [OrderStrategyExecuteBodyTimeInForce]
|
479
|
-
# @param price [Float] Trade Price if limit or stop limit order
|
480
|
-
# @param user_id [String]
|
481
|
-
# @param user_secret [String]
|
482
|
-
# @param account_id [String] The ID of the account get positions.
|
483
|
-
# @param option_strategy_id [String] Option strategy id obtained from response when creating option strategy object
|
484
|
-
# @param body [OptionsPlaceOptionStrategyRequest]
|
485
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
486
|
-
def place_option_strategy_with_http_info(order_type:, time_in_force:, price:, user_id:, user_secret:, account_id:, option_strategy_id:, extra: {})
|
487
|
-
_body = {}
|
488
|
-
_body[:order_type] = order_type if order_type != SENTINEL
|
489
|
-
_body[:time_in_force] = time_in_force if time_in_force != SENTINEL
|
490
|
-
_body[:price] = price if price != SENTINEL
|
491
|
-
options_place_option_strategy_request = _body
|
492
|
-
|
493
|
-
place_option_strategy_with_http_info_impl(user_id, user_secret, account_id, option_strategy_id, options_place_option_strategy_request, extra)
|
494
|
-
end
|
495
|
-
|
496
|
-
# Place an option strategy order on the brokerage
|
497
|
-
# @param user_id [String]
|
498
|
-
# @param user_secret [String]
|
499
|
-
# @param account_id [String] The ID of the account get positions.
|
500
|
-
# @param option_strategy_id [String] Option strategy id obtained from response when creating option strategy object
|
501
|
-
# @param options_place_option_strategy_request [OptionsPlaceOptionStrategyRequest]
|
502
|
-
# @param [Hash] opts the optional parameters
|
503
|
-
# @return [StrategyOrderRecord]
|
504
|
-
def place_option_strategy_impl(user_id, user_secret, account_id, option_strategy_id, options_place_option_strategy_request, opts = {})
|
505
|
-
data, _status_code, _headers = place_option_strategy_with_http_info(user_id, user_secret, account_id, option_strategy_id, options_place_option_strategy_request, opts)
|
506
|
-
data
|
507
|
-
end
|
508
|
-
|
509
|
-
# Place an option strategy order on the brokerage
|
510
|
-
# @param user_id [String]
|
511
|
-
# @param user_secret [String]
|
512
|
-
# @param account_id [String] The ID of the account get positions.
|
513
|
-
# @param option_strategy_id [String] Option strategy id obtained from response when creating option strategy object
|
514
|
-
# @param options_place_option_strategy_request [OptionsPlaceOptionStrategyRequest]
|
515
|
-
# @param [Hash] opts the optional parameters
|
516
|
-
# @return [Array<(StrategyOrderRecord, Integer, Hash)>] StrategyOrderRecord data, response status code and response headers
|
517
|
-
def place_option_strategy_with_http_info_impl(user_id, user_secret, account_id, option_strategy_id, options_place_option_strategy_request, opts = {})
|
518
|
-
if @api_client.config.debugging
|
519
|
-
@api_client.config.logger.debug 'Calling API: OptionsApi.place_option_strategy ...'
|
520
|
-
end
|
521
|
-
# verify the required parameter 'user_id' is set
|
522
|
-
if @api_client.config.client_side_validation && user_id.nil?
|
523
|
-
fail ArgumentError, "Missing the required parameter 'user_id' when calling OptionsApi.place_option_strategy"
|
524
|
-
end
|
525
|
-
# verify the required parameter 'user_secret' is set
|
526
|
-
if @api_client.config.client_side_validation && user_secret.nil?
|
527
|
-
fail ArgumentError, "Missing the required parameter 'user_secret' when calling OptionsApi.place_option_strategy"
|
528
|
-
end
|
529
|
-
# verify the required parameter 'account_id' is set
|
530
|
-
if @api_client.config.client_side_validation && account_id.nil?
|
531
|
-
fail ArgumentError, "Missing the required parameter 'account_id' when calling OptionsApi.place_option_strategy"
|
532
|
-
end
|
533
|
-
# verify the required parameter 'option_strategy_id' is set
|
534
|
-
if @api_client.config.client_side_validation && option_strategy_id.nil?
|
535
|
-
fail ArgumentError, "Missing the required parameter 'option_strategy_id' when calling OptionsApi.place_option_strategy"
|
536
|
-
end
|
537
|
-
# verify the required parameter 'options_place_option_strategy_request' is set
|
538
|
-
if @api_client.config.client_side_validation && options_place_option_strategy_request.nil?
|
539
|
-
fail ArgumentError, "Missing the required parameter 'options_place_option_strategy_request' when calling OptionsApi.place_option_strategy"
|
540
|
-
end
|
541
|
-
# resource path
|
542
|
-
local_var_path = '/accounts/{accountId}/optionStrategy/{optionStrategyId}/execute'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'optionStrategyId' + '}', CGI.escape(option_strategy_id.to_s))
|
543
|
-
|
544
|
-
# query parameters
|
545
|
-
query_params = opts[:query_params] || {}
|
546
|
-
query_params[:'userId'] = user_id
|
547
|
-
query_params[:'userSecret'] = user_secret
|
548
|
-
|
549
|
-
# header parameters
|
550
|
-
header_params = opts[:header_params] || {}
|
551
|
-
# HTTP header 'Accept' (if needed)
|
552
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
553
|
-
# HTTP header 'Content-Type'
|
554
|
-
content_type = @api_client.select_header_content_type(['application/json'])
|
555
|
-
if !content_type.nil?
|
556
|
-
header_params['Content-Type'] = content_type
|
557
|
-
end
|
558
|
-
|
559
|
-
# form parameters
|
560
|
-
form_params = opts[:form_params] || {}
|
561
|
-
|
562
|
-
# http body (model)
|
563
|
-
post_body = opts[:debug_body] || @api_client.object_to_http_body(options_place_option_strategy_request)
|
564
|
-
|
565
|
-
# return_type
|
566
|
-
return_type = opts[:debug_return_type] || 'StrategyOrderRecord'
|
567
|
-
|
568
|
-
# auth_names
|
569
|
-
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
570
|
-
|
571
|
-
new_options = opts.merge(
|
572
|
-
:operation => :"OptionsApi.place_option_strategy",
|
573
|
-
:header_params => header_params,
|
574
|
-
:query_params => query_params,
|
575
|
-
:form_params => form_params,
|
576
|
-
:body => post_body,
|
577
|
-
:auth_names => auth_names,
|
578
|
-
:return_type => return_type
|
579
|
-
)
|
580
|
-
|
581
|
-
data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
|
582
|
-
if @api_client.config.debugging
|
583
|
-
@api_client.config.logger.debug "API called: OptionsApi#place_option_strategy\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
584
|
-
end
|
585
|
-
return data, status_code, headers, response
|
586
|
-
end
|
587
|
-
end
|
588
|
-
|
589
|
-
# top-level client access to avoid having the user to insantiate their own API instances
|
590
|
-
Options = OptionsApi::new
|
591
|
-
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 OptionsApi
|
15
|
+
attr_accessor :api_client
|
16
|
+
|
17
|
+
def initialize(api_client = ApiClient.default)
|
18
|
+
@api_client = api_client
|
19
|
+
end
|
20
|
+
|
21
|
+
# Creates an option strategy object that will be used to place an option strategy order
|
22
|
+
# @param underlying_symbol_id [String]
|
23
|
+
# @param legs [Array<OptionLeg>]
|
24
|
+
# @param strategy_type [StrategyType]
|
25
|
+
# @param user_id [String]
|
26
|
+
# @param user_secret [String]
|
27
|
+
# @param account_id [String] The ID of the account get positions.
|
28
|
+
# @param body [OptionsGetOptionStrategyRequest]
|
29
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
30
|
+
def get_option_strategy(underlying_symbol_id:, legs:, strategy_type:, user_id:, user_secret:, account_id:, extra: {})
|
31
|
+
_body = {}
|
32
|
+
_body[:underlying_symbol_id] = underlying_symbol_id if underlying_symbol_id != SENTINEL
|
33
|
+
_body[:legs] = legs if legs != SENTINEL
|
34
|
+
_body[:strategy_type] = strategy_type if strategy_type != SENTINEL
|
35
|
+
options_get_option_strategy_request = _body
|
36
|
+
|
37
|
+
data, _status_code, _headers = get_option_strategy_with_http_info_impl(user_id, user_secret, account_id, options_get_option_strategy_request, extra)
|
38
|
+
data
|
39
|
+
end
|
40
|
+
|
41
|
+
# Creates an option strategy object that will be used to place an option strategy order
|
42
|
+
# @param underlying_symbol_id [String]
|
43
|
+
# @param legs [Array<OptionLeg>]
|
44
|
+
# @param strategy_type [StrategyType]
|
45
|
+
# @param user_id [String]
|
46
|
+
# @param user_secret [String]
|
47
|
+
# @param account_id [String] The ID of the account get positions.
|
48
|
+
# @param body [OptionsGetOptionStrategyRequest]
|
49
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
50
|
+
def get_option_strategy_with_http_info(underlying_symbol_id:, legs:, strategy_type:, user_id:, user_secret:, account_id:, extra: {})
|
51
|
+
_body = {}
|
52
|
+
_body[:underlying_symbol_id] = underlying_symbol_id if underlying_symbol_id != SENTINEL
|
53
|
+
_body[:legs] = legs if legs != SENTINEL
|
54
|
+
_body[:strategy_type] = strategy_type if strategy_type != SENTINEL
|
55
|
+
options_get_option_strategy_request = _body
|
56
|
+
|
57
|
+
get_option_strategy_with_http_info_impl(user_id, user_secret, account_id, options_get_option_strategy_request, extra)
|
58
|
+
end
|
59
|
+
|
60
|
+
# Creates an option strategy object that will be used to place an option strategy order
|
61
|
+
# @param user_id [String]
|
62
|
+
# @param user_secret [String]
|
63
|
+
# @param account_id [String] The ID of the account get positions.
|
64
|
+
# @param options_get_option_strategy_request [OptionsGetOptionStrategyRequest]
|
65
|
+
# @param [Hash] opts the optional parameters
|
66
|
+
# @return [StrategyQuotes]
|
67
|
+
def get_option_strategy_impl(user_id, user_secret, account_id, options_get_option_strategy_request, opts = {})
|
68
|
+
data, _status_code, _headers = get_option_strategy_with_http_info(user_id, user_secret, account_id, options_get_option_strategy_request, opts)
|
69
|
+
data
|
70
|
+
end
|
71
|
+
|
72
|
+
# Creates an option strategy object that will be used to place an option strategy order
|
73
|
+
# @param user_id [String]
|
74
|
+
# @param user_secret [String]
|
75
|
+
# @param account_id [String] The ID of the account get positions.
|
76
|
+
# @param options_get_option_strategy_request [OptionsGetOptionStrategyRequest]
|
77
|
+
# @param [Hash] opts the optional parameters
|
78
|
+
# @return [Array<(StrategyQuotes, Integer, Hash)>] StrategyQuotes data, response status code and response headers
|
79
|
+
def get_option_strategy_with_http_info_impl(user_id, user_secret, account_id, options_get_option_strategy_request, opts = {})
|
80
|
+
if @api_client.config.debugging
|
81
|
+
@api_client.config.logger.debug 'Calling API: OptionsApi.get_option_strategy ...'
|
82
|
+
end
|
83
|
+
# verify the required parameter 'user_id' is set
|
84
|
+
if @api_client.config.client_side_validation && user_id.nil?
|
85
|
+
fail ArgumentError, "Missing the required parameter 'user_id' when calling OptionsApi.get_option_strategy"
|
86
|
+
end
|
87
|
+
# verify the required parameter 'user_secret' is set
|
88
|
+
if @api_client.config.client_side_validation && user_secret.nil?
|
89
|
+
fail ArgumentError, "Missing the required parameter 'user_secret' when calling OptionsApi.get_option_strategy"
|
90
|
+
end
|
91
|
+
# verify the required parameter 'account_id' is set
|
92
|
+
if @api_client.config.client_side_validation && account_id.nil?
|
93
|
+
fail ArgumentError, "Missing the required parameter 'account_id' when calling OptionsApi.get_option_strategy"
|
94
|
+
end
|
95
|
+
# verify the required parameter 'options_get_option_strategy_request' is set
|
96
|
+
if @api_client.config.client_side_validation && options_get_option_strategy_request.nil?
|
97
|
+
fail ArgumentError, "Missing the required parameter 'options_get_option_strategy_request' when calling OptionsApi.get_option_strategy"
|
98
|
+
end
|
99
|
+
# resource path
|
100
|
+
local_var_path = '/accounts/{accountId}/optionStrategy'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
|
101
|
+
|
102
|
+
# query parameters
|
103
|
+
query_params = opts[:query_params] || {}
|
104
|
+
query_params[:'userId'] = user_id
|
105
|
+
query_params[:'userSecret'] = user_secret
|
106
|
+
|
107
|
+
# header parameters
|
108
|
+
header_params = opts[:header_params] || {}
|
109
|
+
# HTTP header 'Accept' (if needed)
|
110
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
111
|
+
# HTTP header 'Content-Type'
|
112
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
113
|
+
if !content_type.nil?
|
114
|
+
header_params['Content-Type'] = content_type
|
115
|
+
end
|
116
|
+
|
117
|
+
# form parameters
|
118
|
+
form_params = opts[:form_params] || {}
|
119
|
+
|
120
|
+
# http body (model)
|
121
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(options_get_option_strategy_request)
|
122
|
+
|
123
|
+
# return_type
|
124
|
+
return_type = opts[:debug_return_type] || 'StrategyQuotes'
|
125
|
+
|
126
|
+
# auth_names
|
127
|
+
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
128
|
+
|
129
|
+
new_options = opts.merge(
|
130
|
+
:operation => :"OptionsApi.get_option_strategy",
|
131
|
+
:header_params => header_params,
|
132
|
+
:query_params => query_params,
|
133
|
+
:form_params => form_params,
|
134
|
+
:body => post_body,
|
135
|
+
:auth_names => auth_names,
|
136
|
+
:return_type => return_type
|
137
|
+
)
|
138
|
+
|
139
|
+
data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
|
140
|
+
if @api_client.config.debugging
|
141
|
+
@api_client.config.logger.debug "API called: OptionsApi#get_option_strategy\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
142
|
+
end
|
143
|
+
return data, status_code, headers, response
|
144
|
+
end
|
145
|
+
|
146
|
+
|
147
|
+
# Get the options chain
|
148
|
+
# @param user_id [String]
|
149
|
+
# @param user_secret [String]
|
150
|
+
# @param account_id [String] The ID of the account get positions.
|
151
|
+
# @param symbol [String] Universal symbol ID if symbol
|
152
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
153
|
+
def get_options_chain(user_id:, user_secret:, account_id:, symbol:, extra: {})
|
154
|
+
|
155
|
+
data, _status_code, _headers = get_options_chain_with_http_info_impl(user_id, user_secret, account_id, symbol, extra)
|
156
|
+
data
|
157
|
+
end
|
158
|
+
|
159
|
+
# Get the options chain
|
160
|
+
# @param user_id [String]
|
161
|
+
# @param user_secret [String]
|
162
|
+
# @param account_id [String] The ID of the account get positions.
|
163
|
+
# @param symbol [String] Universal symbol ID if symbol
|
164
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
165
|
+
def get_options_chain_with_http_info(user_id:, user_secret:, account_id:, symbol:, extra: {})
|
166
|
+
|
167
|
+
get_options_chain_with_http_info_impl(user_id, user_secret, account_id, symbol, extra)
|
168
|
+
end
|
169
|
+
|
170
|
+
# Get the options chain
|
171
|
+
# @param user_id [String]
|
172
|
+
# @param user_secret [String]
|
173
|
+
# @param account_id [String] The ID of the account get positions.
|
174
|
+
# @param symbol [String] Universal symbol ID if symbol
|
175
|
+
# @param [Hash] opts the optional parameters
|
176
|
+
# @return [Array<OptionChainInner>]
|
177
|
+
def get_options_chain_impl(user_id, user_secret, account_id, symbol, opts = {})
|
178
|
+
data, _status_code, _headers = get_options_chain_with_http_info(user_id, user_secret, account_id, symbol, opts)
|
179
|
+
data
|
180
|
+
end
|
181
|
+
|
182
|
+
# Get the options chain
|
183
|
+
# @param user_id [String]
|
184
|
+
# @param user_secret [String]
|
185
|
+
# @param account_id [String] The ID of the account get positions.
|
186
|
+
# @param symbol [String] Universal symbol ID if symbol
|
187
|
+
# @param [Hash] opts the optional parameters
|
188
|
+
# @return [Array<(Array<OptionChainInner>, Integer, Hash)>] Array<OptionChainInner> data, response status code and response headers
|
189
|
+
def get_options_chain_with_http_info_impl(user_id, user_secret, account_id, symbol, opts = {})
|
190
|
+
if @api_client.config.debugging
|
191
|
+
@api_client.config.logger.debug 'Calling API: OptionsApi.get_options_chain ...'
|
192
|
+
end
|
193
|
+
# verify the required parameter 'user_id' is set
|
194
|
+
if @api_client.config.client_side_validation && user_id.nil?
|
195
|
+
fail ArgumentError, "Missing the required parameter 'user_id' when calling OptionsApi.get_options_chain"
|
196
|
+
end
|
197
|
+
# verify the required parameter 'user_secret' is set
|
198
|
+
if @api_client.config.client_side_validation && user_secret.nil?
|
199
|
+
fail ArgumentError, "Missing the required parameter 'user_secret' when calling OptionsApi.get_options_chain"
|
200
|
+
end
|
201
|
+
# verify the required parameter 'account_id' is set
|
202
|
+
if @api_client.config.client_side_validation && account_id.nil?
|
203
|
+
fail ArgumentError, "Missing the required parameter 'account_id' when calling OptionsApi.get_options_chain"
|
204
|
+
end
|
205
|
+
# verify the required parameter 'symbol' is set
|
206
|
+
if @api_client.config.client_side_validation && symbol.nil?
|
207
|
+
fail ArgumentError, "Missing the required parameter 'symbol' when calling OptionsApi.get_options_chain"
|
208
|
+
end
|
209
|
+
# resource path
|
210
|
+
local_var_path = '/accounts/{accountId}/optionsChain'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
|
211
|
+
|
212
|
+
# query parameters
|
213
|
+
query_params = opts[:query_params] || {}
|
214
|
+
query_params[:'userId'] = user_id
|
215
|
+
query_params[:'userSecret'] = user_secret
|
216
|
+
query_params[:'symbol'] = symbol
|
217
|
+
|
218
|
+
# header parameters
|
219
|
+
header_params = opts[:header_params] || {}
|
220
|
+
# HTTP header 'Accept' (if needed)
|
221
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
222
|
+
|
223
|
+
# form parameters
|
224
|
+
form_params = opts[:form_params] || {}
|
225
|
+
|
226
|
+
# http body (model)
|
227
|
+
post_body = opts[:debug_body]
|
228
|
+
|
229
|
+
# return_type
|
230
|
+
return_type = opts[:debug_return_type] || 'Array<OptionChainInner>'
|
231
|
+
|
232
|
+
# auth_names
|
233
|
+
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
234
|
+
|
235
|
+
new_options = opts.merge(
|
236
|
+
:operation => :"OptionsApi.get_options_chain",
|
237
|
+
:header_params => header_params,
|
238
|
+
:query_params => query_params,
|
239
|
+
:form_params => form_params,
|
240
|
+
:body => post_body,
|
241
|
+
:auth_names => auth_names,
|
242
|
+
:return_type => return_type
|
243
|
+
)
|
244
|
+
|
245
|
+
data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
|
246
|
+
if @api_client.config.debugging
|
247
|
+
@api_client.config.logger.debug "API called: OptionsApi#get_options_chain\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
248
|
+
end
|
249
|
+
return data, status_code, headers, response
|
250
|
+
end
|
251
|
+
|
252
|
+
|
253
|
+
# Get latest market data of option strategy
|
254
|
+
# @param user_id [String]
|
255
|
+
# @param user_secret [String]
|
256
|
+
# @param account_id [String] The ID of the account get positions.
|
257
|
+
# @param option_strategy_id [String] Option strategy id obtained from response when creating option strategy object
|
258
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
259
|
+
def get_options_strategy_quote(user_id:, user_secret:, account_id:, option_strategy_id:, extra: {})
|
260
|
+
|
261
|
+
data, _status_code, _headers = get_options_strategy_quote_with_http_info_impl(user_id, user_secret, account_id, option_strategy_id, extra)
|
262
|
+
data
|
263
|
+
end
|
264
|
+
|
265
|
+
# Get latest market data of option strategy
|
266
|
+
# @param user_id [String]
|
267
|
+
# @param user_secret [String]
|
268
|
+
# @param account_id [String] The ID of the account get positions.
|
269
|
+
# @param option_strategy_id [String] Option strategy id obtained from response when creating option strategy object
|
270
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
271
|
+
def get_options_strategy_quote_with_http_info(user_id:, user_secret:, account_id:, option_strategy_id:, extra: {})
|
272
|
+
|
273
|
+
get_options_strategy_quote_with_http_info_impl(user_id, user_secret, account_id, option_strategy_id, extra)
|
274
|
+
end
|
275
|
+
|
276
|
+
# Get latest market data of option strategy
|
277
|
+
# @param user_id [String]
|
278
|
+
# @param user_secret [String]
|
279
|
+
# @param account_id [String] The ID of the account get positions.
|
280
|
+
# @param option_strategy_id [String] Option strategy id obtained from response when creating option strategy object
|
281
|
+
# @param [Hash] opts the optional parameters
|
282
|
+
# @return [StrategyQuotes]
|
283
|
+
def get_options_strategy_quote_impl(user_id, user_secret, account_id, option_strategy_id, opts = {})
|
284
|
+
data, _status_code, _headers = get_options_strategy_quote_with_http_info(user_id, user_secret, account_id, option_strategy_id, opts)
|
285
|
+
data
|
286
|
+
end
|
287
|
+
|
288
|
+
# Get latest market data of option strategy
|
289
|
+
# @param user_id [String]
|
290
|
+
# @param user_secret [String]
|
291
|
+
# @param account_id [String] The ID of the account get positions.
|
292
|
+
# @param option_strategy_id [String] Option strategy id obtained from response when creating option strategy object
|
293
|
+
# @param [Hash] opts the optional parameters
|
294
|
+
# @return [Array<(StrategyQuotes, Integer, Hash)>] StrategyQuotes data, response status code and response headers
|
295
|
+
def get_options_strategy_quote_with_http_info_impl(user_id, user_secret, account_id, option_strategy_id, opts = {})
|
296
|
+
if @api_client.config.debugging
|
297
|
+
@api_client.config.logger.debug 'Calling API: OptionsApi.get_options_strategy_quote ...'
|
298
|
+
end
|
299
|
+
# verify the required parameter 'user_id' is set
|
300
|
+
if @api_client.config.client_side_validation && user_id.nil?
|
301
|
+
fail ArgumentError, "Missing the required parameter 'user_id' when calling OptionsApi.get_options_strategy_quote"
|
302
|
+
end
|
303
|
+
# verify the required parameter 'user_secret' is set
|
304
|
+
if @api_client.config.client_side_validation && user_secret.nil?
|
305
|
+
fail ArgumentError, "Missing the required parameter 'user_secret' when calling OptionsApi.get_options_strategy_quote"
|
306
|
+
end
|
307
|
+
# verify the required parameter 'account_id' is set
|
308
|
+
if @api_client.config.client_side_validation && account_id.nil?
|
309
|
+
fail ArgumentError, "Missing the required parameter 'account_id' when calling OptionsApi.get_options_strategy_quote"
|
310
|
+
end
|
311
|
+
# verify the required parameter 'option_strategy_id' is set
|
312
|
+
if @api_client.config.client_side_validation && option_strategy_id.nil?
|
313
|
+
fail ArgumentError, "Missing the required parameter 'option_strategy_id' when calling OptionsApi.get_options_strategy_quote"
|
314
|
+
end
|
315
|
+
# resource path
|
316
|
+
local_var_path = '/accounts/{accountId}/optionStrategy/{optionStrategyId}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'optionStrategyId' + '}', CGI.escape(option_strategy_id.to_s))
|
317
|
+
|
318
|
+
# query parameters
|
319
|
+
query_params = opts[:query_params] || {}
|
320
|
+
query_params[:'userId'] = user_id
|
321
|
+
query_params[:'userSecret'] = user_secret
|
322
|
+
|
323
|
+
# header parameters
|
324
|
+
header_params = opts[:header_params] || {}
|
325
|
+
# HTTP header 'Accept' (if needed)
|
326
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
327
|
+
|
328
|
+
# form parameters
|
329
|
+
form_params = opts[:form_params] || {}
|
330
|
+
|
331
|
+
# http body (model)
|
332
|
+
post_body = opts[:debug_body]
|
333
|
+
|
334
|
+
# return_type
|
335
|
+
return_type = opts[:debug_return_type] || 'StrategyQuotes'
|
336
|
+
|
337
|
+
# auth_names
|
338
|
+
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
339
|
+
|
340
|
+
new_options = opts.merge(
|
341
|
+
:operation => :"OptionsApi.get_options_strategy_quote",
|
342
|
+
:header_params => header_params,
|
343
|
+
:query_params => query_params,
|
344
|
+
:form_params => form_params,
|
345
|
+
:body => post_body,
|
346
|
+
:auth_names => auth_names,
|
347
|
+
:return_type => return_type
|
348
|
+
)
|
349
|
+
|
350
|
+
data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
|
351
|
+
if @api_client.config.debugging
|
352
|
+
@api_client.config.logger.debug "API called: OptionsApi#get_options_strategy_quote\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
353
|
+
end
|
354
|
+
return data, status_code, headers, response
|
355
|
+
end
|
356
|
+
|
357
|
+
|
358
|
+
# Get the options holdings in the account
|
359
|
+
# @param user_id [String]
|
360
|
+
# @param user_secret [String]
|
361
|
+
# @param account_id [String] The ID of the account get positions.
|
362
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
363
|
+
def list_option_holdings(user_id:, user_secret:, account_id:, extra: {})
|
364
|
+
|
365
|
+
data, _status_code, _headers = list_option_holdings_with_http_info_impl(user_id, user_secret, account_id, extra)
|
366
|
+
data
|
367
|
+
end
|
368
|
+
|
369
|
+
# Get the options holdings in the account
|
370
|
+
# @param user_id [String]
|
371
|
+
# @param user_secret [String]
|
372
|
+
# @param account_id [String] The ID of the account get positions.
|
373
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
374
|
+
def list_option_holdings_with_http_info(user_id:, user_secret:, account_id:, extra: {})
|
375
|
+
|
376
|
+
list_option_holdings_with_http_info_impl(user_id, user_secret, account_id, extra)
|
377
|
+
end
|
378
|
+
|
379
|
+
# Get the options holdings in the account
|
380
|
+
# @param user_id [String]
|
381
|
+
# @param user_secret [String]
|
382
|
+
# @param account_id [String] The ID of the account get positions.
|
383
|
+
# @param [Hash] opts the optional parameters
|
384
|
+
# @return [Array<OptionsPosition>]
|
385
|
+
def list_option_holdings_impl(user_id, user_secret, account_id, opts = {})
|
386
|
+
data, _status_code, _headers = list_option_holdings_with_http_info(user_id, user_secret, account_id, opts)
|
387
|
+
data
|
388
|
+
end
|
389
|
+
|
390
|
+
# Get the options holdings in the account
|
391
|
+
# @param user_id [String]
|
392
|
+
# @param user_secret [String]
|
393
|
+
# @param account_id [String] The ID of the account get positions.
|
394
|
+
# @param [Hash] opts the optional parameters
|
395
|
+
# @return [Array<(Array<OptionsPosition>, Integer, Hash)>] Array<OptionsPosition> data, response status code and response headers
|
396
|
+
def list_option_holdings_with_http_info_impl(user_id, user_secret, account_id, opts = {})
|
397
|
+
if @api_client.config.debugging
|
398
|
+
@api_client.config.logger.debug 'Calling API: OptionsApi.list_option_holdings ...'
|
399
|
+
end
|
400
|
+
# verify the required parameter 'user_id' is set
|
401
|
+
if @api_client.config.client_side_validation && user_id.nil?
|
402
|
+
fail ArgumentError, "Missing the required parameter 'user_id' when calling OptionsApi.list_option_holdings"
|
403
|
+
end
|
404
|
+
# verify the required parameter 'user_secret' is set
|
405
|
+
if @api_client.config.client_side_validation && user_secret.nil?
|
406
|
+
fail ArgumentError, "Missing the required parameter 'user_secret' when calling OptionsApi.list_option_holdings"
|
407
|
+
end
|
408
|
+
# verify the required parameter 'account_id' is set
|
409
|
+
if @api_client.config.client_side_validation && account_id.nil?
|
410
|
+
fail ArgumentError, "Missing the required parameter 'account_id' when calling OptionsApi.list_option_holdings"
|
411
|
+
end
|
412
|
+
# resource path
|
413
|
+
local_var_path = '/accounts/{accountId}/options'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
|
414
|
+
|
415
|
+
# query parameters
|
416
|
+
query_params = opts[:query_params] || {}
|
417
|
+
query_params[:'userId'] = user_id
|
418
|
+
query_params[:'userSecret'] = user_secret
|
419
|
+
|
420
|
+
# header parameters
|
421
|
+
header_params = opts[:header_params] || {}
|
422
|
+
# HTTP header 'Accept' (if needed)
|
423
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
424
|
+
|
425
|
+
# form parameters
|
426
|
+
form_params = opts[:form_params] || {}
|
427
|
+
|
428
|
+
# http body (model)
|
429
|
+
post_body = opts[:debug_body]
|
430
|
+
|
431
|
+
# return_type
|
432
|
+
return_type = opts[:debug_return_type] || 'Array<OptionsPosition>'
|
433
|
+
|
434
|
+
# auth_names
|
435
|
+
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
436
|
+
|
437
|
+
new_options = opts.merge(
|
438
|
+
:operation => :"OptionsApi.list_option_holdings",
|
439
|
+
:header_params => header_params,
|
440
|
+
:query_params => query_params,
|
441
|
+
:form_params => form_params,
|
442
|
+
:body => post_body,
|
443
|
+
:auth_names => auth_names,
|
444
|
+
:return_type => return_type
|
445
|
+
)
|
446
|
+
|
447
|
+
data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
|
448
|
+
if @api_client.config.debugging
|
449
|
+
@api_client.config.logger.debug "API called: OptionsApi#list_option_holdings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
450
|
+
end
|
451
|
+
return data, status_code, headers, response
|
452
|
+
end
|
453
|
+
|
454
|
+
|
455
|
+
# Place an option strategy order on the brokerage
|
456
|
+
# @param order_type [OrderStrategyExecuteBodyOrderType]
|
457
|
+
# @param time_in_force [OrderStrategyExecuteBodyTimeInForce]
|
458
|
+
# @param price [Float] Trade Price if limit or stop limit order
|
459
|
+
# @param user_id [String]
|
460
|
+
# @param user_secret [String]
|
461
|
+
# @param account_id [String] The ID of the account get positions.
|
462
|
+
# @param option_strategy_id [String] Option strategy id obtained from response when creating option strategy object
|
463
|
+
# @param body [OptionsPlaceOptionStrategyRequest]
|
464
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
465
|
+
def place_option_strategy(order_type:, time_in_force:, price:, user_id:, user_secret:, account_id:, option_strategy_id:, extra: {})
|
466
|
+
_body = {}
|
467
|
+
_body[:order_type] = order_type if order_type != SENTINEL
|
468
|
+
_body[:time_in_force] = time_in_force if time_in_force != SENTINEL
|
469
|
+
_body[:price] = price if price != SENTINEL
|
470
|
+
options_place_option_strategy_request = _body
|
471
|
+
|
472
|
+
data, _status_code, _headers = place_option_strategy_with_http_info_impl(user_id, user_secret, account_id, option_strategy_id, options_place_option_strategy_request, extra)
|
473
|
+
data
|
474
|
+
end
|
475
|
+
|
476
|
+
# Place an option strategy order on the brokerage
|
477
|
+
# @param order_type [OrderStrategyExecuteBodyOrderType]
|
478
|
+
# @param time_in_force [OrderStrategyExecuteBodyTimeInForce]
|
479
|
+
# @param price [Float] Trade Price if limit or stop limit order
|
480
|
+
# @param user_id [String]
|
481
|
+
# @param user_secret [String]
|
482
|
+
# @param account_id [String] The ID of the account get positions.
|
483
|
+
# @param option_strategy_id [String] Option strategy id obtained from response when creating option strategy object
|
484
|
+
# @param body [OptionsPlaceOptionStrategyRequest]
|
485
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
486
|
+
def place_option_strategy_with_http_info(order_type:, time_in_force:, price:, user_id:, user_secret:, account_id:, option_strategy_id:, extra: {})
|
487
|
+
_body = {}
|
488
|
+
_body[:order_type] = order_type if order_type != SENTINEL
|
489
|
+
_body[:time_in_force] = time_in_force if time_in_force != SENTINEL
|
490
|
+
_body[:price] = price if price != SENTINEL
|
491
|
+
options_place_option_strategy_request = _body
|
492
|
+
|
493
|
+
place_option_strategy_with_http_info_impl(user_id, user_secret, account_id, option_strategy_id, options_place_option_strategy_request, extra)
|
494
|
+
end
|
495
|
+
|
496
|
+
# Place an option strategy order on the brokerage
|
497
|
+
# @param user_id [String]
|
498
|
+
# @param user_secret [String]
|
499
|
+
# @param account_id [String] The ID of the account get positions.
|
500
|
+
# @param option_strategy_id [String] Option strategy id obtained from response when creating option strategy object
|
501
|
+
# @param options_place_option_strategy_request [OptionsPlaceOptionStrategyRequest]
|
502
|
+
# @param [Hash] opts the optional parameters
|
503
|
+
# @return [StrategyOrderRecord]
|
504
|
+
def place_option_strategy_impl(user_id, user_secret, account_id, option_strategy_id, options_place_option_strategy_request, opts = {})
|
505
|
+
data, _status_code, _headers = place_option_strategy_with_http_info(user_id, user_secret, account_id, option_strategy_id, options_place_option_strategy_request, opts)
|
506
|
+
data
|
507
|
+
end
|
508
|
+
|
509
|
+
# Place an option strategy order on the brokerage
|
510
|
+
# @param user_id [String]
|
511
|
+
# @param user_secret [String]
|
512
|
+
# @param account_id [String] The ID of the account get positions.
|
513
|
+
# @param option_strategy_id [String] Option strategy id obtained from response when creating option strategy object
|
514
|
+
# @param options_place_option_strategy_request [OptionsPlaceOptionStrategyRequest]
|
515
|
+
# @param [Hash] opts the optional parameters
|
516
|
+
# @return [Array<(StrategyOrderRecord, Integer, Hash)>] StrategyOrderRecord data, response status code and response headers
|
517
|
+
def place_option_strategy_with_http_info_impl(user_id, user_secret, account_id, option_strategy_id, options_place_option_strategy_request, opts = {})
|
518
|
+
if @api_client.config.debugging
|
519
|
+
@api_client.config.logger.debug 'Calling API: OptionsApi.place_option_strategy ...'
|
520
|
+
end
|
521
|
+
# verify the required parameter 'user_id' is set
|
522
|
+
if @api_client.config.client_side_validation && user_id.nil?
|
523
|
+
fail ArgumentError, "Missing the required parameter 'user_id' when calling OptionsApi.place_option_strategy"
|
524
|
+
end
|
525
|
+
# verify the required parameter 'user_secret' is set
|
526
|
+
if @api_client.config.client_side_validation && user_secret.nil?
|
527
|
+
fail ArgumentError, "Missing the required parameter 'user_secret' when calling OptionsApi.place_option_strategy"
|
528
|
+
end
|
529
|
+
# verify the required parameter 'account_id' is set
|
530
|
+
if @api_client.config.client_side_validation && account_id.nil?
|
531
|
+
fail ArgumentError, "Missing the required parameter 'account_id' when calling OptionsApi.place_option_strategy"
|
532
|
+
end
|
533
|
+
# verify the required parameter 'option_strategy_id' is set
|
534
|
+
if @api_client.config.client_side_validation && option_strategy_id.nil?
|
535
|
+
fail ArgumentError, "Missing the required parameter 'option_strategy_id' when calling OptionsApi.place_option_strategy"
|
536
|
+
end
|
537
|
+
# verify the required parameter 'options_place_option_strategy_request' is set
|
538
|
+
if @api_client.config.client_side_validation && options_place_option_strategy_request.nil?
|
539
|
+
fail ArgumentError, "Missing the required parameter 'options_place_option_strategy_request' when calling OptionsApi.place_option_strategy"
|
540
|
+
end
|
541
|
+
# resource path
|
542
|
+
local_var_path = '/accounts/{accountId}/optionStrategy/{optionStrategyId}/execute'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'optionStrategyId' + '}', CGI.escape(option_strategy_id.to_s))
|
543
|
+
|
544
|
+
# query parameters
|
545
|
+
query_params = opts[:query_params] || {}
|
546
|
+
query_params[:'userId'] = user_id
|
547
|
+
query_params[:'userSecret'] = user_secret
|
548
|
+
|
549
|
+
# header parameters
|
550
|
+
header_params = opts[:header_params] || {}
|
551
|
+
# HTTP header 'Accept' (if needed)
|
552
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
553
|
+
# HTTP header 'Content-Type'
|
554
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
555
|
+
if !content_type.nil?
|
556
|
+
header_params['Content-Type'] = content_type
|
557
|
+
end
|
558
|
+
|
559
|
+
# form parameters
|
560
|
+
form_params = opts[:form_params] || {}
|
561
|
+
|
562
|
+
# http body (model)
|
563
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(options_place_option_strategy_request)
|
564
|
+
|
565
|
+
# return_type
|
566
|
+
return_type = opts[:debug_return_type] || 'StrategyOrderRecord'
|
567
|
+
|
568
|
+
# auth_names
|
569
|
+
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
570
|
+
|
571
|
+
new_options = opts.merge(
|
572
|
+
:operation => :"OptionsApi.place_option_strategy",
|
573
|
+
:header_params => header_params,
|
574
|
+
:query_params => query_params,
|
575
|
+
:form_params => form_params,
|
576
|
+
:body => post_body,
|
577
|
+
:auth_names => auth_names,
|
578
|
+
:return_type => return_type
|
579
|
+
)
|
580
|
+
|
581
|
+
data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
|
582
|
+
if @api_client.config.debugging
|
583
|
+
@api_client.config.logger.debug "API called: OptionsApi#place_option_strategy\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
584
|
+
end
|
585
|
+
return data, status_code, headers, response
|
586
|
+
end
|
587
|
+
end
|
588
|
+
|
589
|
+
# top-level client access to avoid having the user to insantiate their own API instances
|
590
|
+
Options = OptionsApi::new
|
591
|
+
end
|