snaptrade 1.16.2 → 1.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (350) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +10 -10
  3. data/Gemfile.lock +14 -14
  4. data/README.md +222 -221
  5. data/docs/APIStatusApi.md +57 -57
  6. data/docs/AccountHoldings.md +2 -2
  7. data/docs/AccountHoldingsAccount.md +2 -2
  8. data/docs/AccountInformationApi.md +535 -535
  9. data/docs/AccountOrderRecord.md +2 -2
  10. data/docs/AuthenticationApi.md +314 -314
  11. data/docs/Balance.md +1 -1
  12. data/docs/Brokerage.md +1 -1
  13. data/docs/BrokerageAuthorization.md +1 -1
  14. data/docs/BrokerageAuthorizationTypeReadOnly.md +1 -1
  15. data/docs/BrokerageSymbol.md +1 -1
  16. data/docs/BrokerageSymbolOptionSymbol.md +7 -5
  17. data/docs/BrokerageSymbolSymbol.md +7 -7
  18. data/docs/ConnectionsApi.md +265 -265
  19. data/docs/EncryptedResponse.md +1 -1
  20. data/docs/ErrorLogsApi.md +68 -68
  21. data/docs/ExchangeRatePairs.md +2 -2
  22. data/docs/ExcludedAsset.md +1 -1
  23. data/docs/ManualTrade.md +1 -1
  24. data/docs/ManualTradeAndImpact.md +2 -2
  25. data/docs/ManualTradeBalance.md +2 -2
  26. data/docs/ManualTradeSymbol.md +1 -1
  27. data/docs/ModelAssetClassDetails.md +1 -1
  28. data/docs/ModelAssetClassTarget.md +1 -1
  29. data/docs/ModelPortfolioAssetClass.md +1 -1
  30. data/docs/ModelPortfolioDetails.md +1 -1
  31. data/docs/ModelPortfolioSecurity.md +1 -1
  32. data/docs/NetDividend.md +1 -1
  33. data/docs/OptionStrategy.md +1 -1
  34. data/docs/OptionType.md +15 -0
  35. data/docs/OptionsApi.md +378 -378
  36. data/docs/OptionsHoldings.md +2 -2
  37. data/docs/OptionsPosition.md +1 -1
  38. data/docs/OptionsSymbol.md +7 -5
  39. data/docs/PerformanceCustom.md +1 -1
  40. data/docs/PortfolioGroupInfo.md +1 -1
  41. data/docs/PortfolioGroupPosition.md +1 -1
  42. data/docs/PortfolioGroupSettings.md +1 -1
  43. data/docs/Position.md +1 -1
  44. data/docs/PositionSymbol.md +1 -1
  45. data/docs/ReferenceDataApi.md +595 -595
  46. data/docs/SnapTradeHoldingsAccount.md +1 -1
  47. data/docs/StrategyOrderRecord.md +1 -1
  48. data/docs/StrategyQuotes.md +2 -2
  49. data/docs/Symbol.md +3 -3
  50. data/docs/SymbolsQuotesInner.md +1 -1
  51. data/docs/TargetAsset.md +1 -1
  52. data/docs/Trade.md +3 -3
  53. data/docs/TradeExecutionStatus.md +3 -3
  54. data/docs/TradeImpact.md +2 -2
  55. data/docs/TradingApi.md +478 -478
  56. data/docs/TransactionsAndReportingApi.md +183 -183
  57. data/docs/UnderlyingSymbol.md +3 -3
  58. data/docs/UniversalActivity.md +5 -5
  59. data/docs/UniversalSymbol.md +7 -7
  60. data/docs/UniversalSymbolTicker.md +3 -3
  61. data/docs/UserSettings.md +1 -1
  62. data/header.png +0 -0
  63. data/lib/snaptrade/api/account_information_api.rb +785 -801
  64. data/lib/snaptrade/api/api_status_api.rb +96 -98
  65. data/lib/snaptrade/api/authentication_api.rb +471 -481
  66. data/lib/snaptrade/api/connections_api.rb +390 -398
  67. data/lib/snaptrade/api/error_logs_api.rb +110 -112
  68. data/lib/snaptrade/api/options_api.rb +581 -591
  69. data/lib/snaptrade/api/reference_data_api.rb +872 -894
  70. data/lib/snaptrade/api/trading_api.rb +729 -741
  71. data/lib/snaptrade/api/transactions_and_reporting_api.rb +279 -283
  72. data/lib/snaptrade/api_client.rb +427 -427
  73. data/lib/snaptrade/api_client_custom.rb +32 -32
  74. data/lib/snaptrade/api_error.rb +6 -6
  75. data/lib/snaptrade/configuration.rb +341 -341
  76. data/lib/snaptrade/models/account.rb +6 -6
  77. data/lib/snaptrade/models/account_holdings.rb +6 -6
  78. data/lib/snaptrade/models/account_holdings_account.rb +6 -6
  79. data/lib/snaptrade/models/account_order_record.rb +6 -6
  80. data/lib/snaptrade/models/account_order_record_status.rb +6 -6
  81. data/lib/snaptrade/models/account_simple.rb +6 -6
  82. data/lib/snaptrade/models/account_sync_status.rb +6 -6
  83. data/lib/snaptrade/models/action.rb +6 -6
  84. data/lib/snaptrade/models/auth_type.rb +6 -6
  85. data/lib/snaptrade/models/authentication_login_snap_trade_user200_response.rb +6 -6
  86. data/lib/snaptrade/models/balance.rb +6 -6
  87. data/lib/snaptrade/models/brokerage.rb +6 -6
  88. data/lib/snaptrade/models/brokerage_authorization.rb +6 -6
  89. data/lib/snaptrade/models/brokerage_authorization_type.rb +6 -6
  90. data/lib/snaptrade/models/brokerage_authorization_type_read_only.rb +6 -6
  91. data/lib/snaptrade/models/brokerage_authorization_type_read_only_brokerage.rb +6 -6
  92. data/lib/snaptrade/models/brokerage_authorization_type_read_only_type.rb +6 -6
  93. data/lib/snaptrade/models/brokerage_authorization_type_type.rb +6 -6
  94. data/lib/snaptrade/models/brokerage_symbol.rb +6 -6
  95. data/lib/snaptrade/models/brokerage_symbol_option_symbol.rb +46 -7
  96. data/lib/snaptrade/models/brokerage_symbol_symbol.rb +36 -6
  97. data/lib/snaptrade/models/brokerage_type.rb +6 -6
  98. data/lib/snaptrade/models/calculated_trade.rb +6 -6
  99. data/lib/snaptrade/models/cash_restriction.rb +6 -6
  100. data/lib/snaptrade/models/connection_type.rb +6 -6
  101. data/lib/snaptrade/models/connections_session_events200_response_inner.rb +6 -6
  102. data/lib/snaptrade/models/currency.rb +6 -6
  103. data/lib/snaptrade/models/delete_user_response.rb +6 -6
  104. data/lib/snaptrade/models/dividend_at_date.rb +6 -6
  105. data/lib/snaptrade/models/encrypted_response.rb +6 -6
  106. data/lib/snaptrade/models/encrypted_response_encrypted_message_data.rb +6 -6
  107. data/lib/snaptrade/models/exchange.rb +6 -6
  108. data/lib/snaptrade/models/exchange_rate_pairs.rb +6 -6
  109. data/lib/snaptrade/models/excluded_asset.rb +6 -6
  110. data/lib/snaptrade/models/jwt.rb +6 -6
  111. data/lib/snaptrade/models/login_redirect_uri.rb +6 -6
  112. data/lib/snaptrade/models/manual_trade.rb +6 -6
  113. data/lib/snaptrade/models/manual_trade_and_impact.rb +6 -6
  114. data/lib/snaptrade/models/manual_trade_balance.rb +6 -6
  115. data/lib/snaptrade/models/manual_trade_form.rb +6 -6
  116. data/lib/snaptrade/models/manual_trade_symbol.rb +6 -6
  117. data/lib/snaptrade/models/model400_failed_request_response.rb +6 -6
  118. data/lib/snaptrade/models/model401_failed_request_response.rb +6 -6
  119. data/lib/snaptrade/models/model403_failed_request_response.rb +6 -6
  120. data/lib/snaptrade/models/model404_failed_request_response.rb +6 -6
  121. data/lib/snaptrade/models/model_asset_class.rb +6 -6
  122. data/lib/snaptrade/models/model_asset_class_details.rb +6 -6
  123. data/lib/snaptrade/models/model_asset_class_target.rb +6 -6
  124. data/lib/snaptrade/models/model_portfolio.rb +6 -6
  125. data/lib/snaptrade/models/model_portfolio_asset_class.rb +6 -6
  126. data/lib/snaptrade/models/model_portfolio_details.rb +6 -6
  127. data/lib/snaptrade/models/model_portfolio_security.rb +6 -6
  128. data/lib/snaptrade/models/model_type.rb +6 -6
  129. data/lib/snaptrade/models/monthly_dividends.rb +6 -6
  130. data/lib/snaptrade/models/net_contributions.rb +6 -6
  131. data/lib/snaptrade/models/net_dividend.rb +6 -6
  132. data/lib/snaptrade/models/option_chain_inner.rb +6 -6
  133. data/lib/snaptrade/models/option_chain_inner_chain_per_root_inner.rb +6 -6
  134. data/lib/snaptrade/models/option_chain_inner_chain_per_root_inner_chain_per_strike_price_inner.rb +6 -6
  135. data/lib/snaptrade/models/option_leg.rb +6 -6
  136. data/lib/snaptrade/models/option_leg_action.rb +6 -6
  137. data/lib/snaptrade/models/option_strategy.rb +6 -6
  138. data/lib/snaptrade/models/option_strategy_legs_inner.rb +6 -6
  139. data/lib/snaptrade/models/option_type.rb +38 -0
  140. data/lib/snaptrade/models/options_get_option_strategy_request.rb +6 -6
  141. data/lib/snaptrade/models/options_holdings.rb +6 -6
  142. data/lib/snaptrade/models/options_place_option_strategy_request.rb +6 -6
  143. data/lib/snaptrade/models/options_position.rb +6 -6
  144. data/lib/snaptrade/models/options_position_currency.rb +6 -6
  145. data/lib/snaptrade/models/options_symbol.rb +46 -7
  146. data/lib/snaptrade/models/order_strategy_execute_body_order_type.rb +6 -6
  147. data/lib/snaptrade/models/order_strategy_execute_body_time_in_force.rb +6 -6
  148. data/lib/snaptrade/models/order_type.rb +6 -6
  149. data/lib/snaptrade/models/partner_data.rb +6 -6
  150. data/lib/snaptrade/models/past_value.rb +6 -6
  151. data/lib/snaptrade/models/performance_custom.rb +6 -6
  152. data/lib/snaptrade/models/portfolio_group.rb +6 -6
  153. data/lib/snaptrade/models/portfolio_group_info.rb +6 -6
  154. data/lib/snaptrade/models/portfolio_group_position.rb +6 -6
  155. data/lib/snaptrade/models/portfolio_group_settings.rb +6 -6
  156. data/lib/snaptrade/models/position.rb +6 -6
  157. data/lib/snaptrade/models/position_symbol.rb +6 -6
  158. data/lib/snaptrade/models/redirect_tokenand_pin.rb +6 -6
  159. data/lib/snaptrade/models/security_type.rb +6 -6
  160. data/lib/snaptrade/models/session_event.rb +6 -6
  161. data/lib/snaptrade/models/session_event_type.rb +6 -6
  162. data/lib/snaptrade/models/snap_trade_api_disclaimer_accept_status.rb +6 -6
  163. data/lib/snaptrade/models/snap_trade_holdings_account.rb +6 -6
  164. data/lib/snaptrade/models/snap_trade_holdings_account_account_id.rb +6 -6
  165. data/lib/snaptrade/models/snap_trade_holdings_total_value.rb +6 -6
  166. data/lib/snaptrade/models/snap_trade_login_user_request_body.rb +6 -6
  167. data/lib/snaptrade/models/snap_trade_register_user_request_body.rb +6 -6
  168. data/lib/snaptrade/models/state.rb +6 -6
  169. data/lib/snaptrade/models/status.rb +6 -6
  170. data/lib/snaptrade/models/strategy_impact.rb +6 -6
  171. data/lib/snaptrade/models/strategy_impact_legs_inner.rb +6 -6
  172. data/lib/snaptrade/models/strategy_order_place.rb +6 -6
  173. data/lib/snaptrade/models/strategy_order_place_orders_inner.rb +6 -6
  174. data/lib/snaptrade/models/strategy_order_place_orders_inner_legs_inner.rb +6 -6
  175. data/lib/snaptrade/models/strategy_order_record.rb +6 -6
  176. data/lib/snaptrade/models/strategy_order_record_order_type.rb +6 -6
  177. data/lib/snaptrade/models/strategy_order_record_status.rb +6 -6
  178. data/lib/snaptrade/models/strategy_order_record_time_in_force.rb +6 -6
  179. data/lib/snaptrade/models/strategy_quotes.rb +6 -6
  180. data/lib/snaptrade/models/strategy_quotes_greek.rb +6 -6
  181. data/lib/snaptrade/models/strategy_type.rb +6 -6
  182. data/lib/snaptrade/models/sub_period_return_rate.rb +6 -6
  183. data/lib/snaptrade/models/symbol.rb +6 -6
  184. data/lib/snaptrade/models/symbol_query.rb +6 -6
  185. data/lib/snaptrade/models/symbols_quotes_inner.rb +6 -6
  186. data/lib/snaptrade/models/target_asset.rb +6 -6
  187. data/lib/snaptrade/models/time_in_force.rb +6 -6
  188. data/lib/snaptrade/models/trade.rb +6 -6
  189. data/lib/snaptrade/models/trade_action.rb +6 -6
  190. data/lib/snaptrade/models/trade_execution_status.rb +6 -6
  191. data/lib/snaptrade/models/trade_execution_status_action.rb +6 -6
  192. data/lib/snaptrade/models/trade_impact.rb +6 -6
  193. data/lib/snaptrade/models/trading_cancel_user_account_order_request.rb +6 -6
  194. data/lib/snaptrade/models/trading_place_oco_order_request.rb +6 -6
  195. data/lib/snaptrade/models/transactions_status.rb +6 -6
  196. data/lib/snaptrade/models/type.rb +6 -6
  197. data/lib/snaptrade/models/underlying_symbol.rb +6 -6
  198. data/lib/snaptrade/models/universal_activity.rb +7 -7
  199. data/lib/snaptrade/models/universal_symbol.rb +36 -6
  200. data/lib/snaptrade/models/universal_symbol_ticker.rb +6 -6
  201. data/lib/snaptrade/models/us_exchange.rb +6 -6
  202. data/lib/snaptrade/models/user_error_log.rb +6 -6
  203. data/lib/snaptrade/models/user_i_dand_secret.rb +6 -6
  204. data/lib/snaptrade/models/user_settings.rb +6 -6
  205. data/lib/snaptrade/version.rb +7 -7
  206. data/lib/snaptrade.rb +215 -214
  207. data/snaptrade.gemspec +41 -41
  208. data/spec/api/account_information_api_spec.rb +135 -135
  209. data/spec/api/api_status_api_spec.rb +42 -42
  210. data/spec/api/authentication_api_spec.rb +88 -88
  211. data/spec/api/connections_api_spec.rb +82 -82
  212. data/spec/api/error_logs_api_spec.rb +43 -43
  213. data/spec/api/options_api_spec.rb +101 -101
  214. data/spec/api/reference_data_api_spec.rb +150 -150
  215. data/spec/api/trading_api_spec.rb +112 -112
  216. data/spec/api/transactions_and_reporting_api_spec.rb +67 -67
  217. data/spec/api_client_spec.rb +193 -193
  218. data/spec/configuration_spec.rb +6 -6
  219. data/spec/getting_started_spec.rb +114 -114
  220. data/spec/models/account_holdings_account_spec.rb +54 -54
  221. data/spec/models/account_holdings_spec.rb +48 -48
  222. data/spec/models/account_order_record_spec.rb +132 -132
  223. data/spec/models/account_order_record_status_spec.rb +24 -24
  224. data/spec/models/account_simple_spec.rb +48 -48
  225. data/spec/models/account_spec.rb +84 -84
  226. data/spec/models/account_sync_status_spec.rb +30 -30
  227. data/spec/models/action_spec.rb +24 -24
  228. data/spec/models/auth_type_spec.rb +24 -24
  229. data/spec/models/authentication_login_snap_trade_user200_response_spec.rb +27 -27
  230. data/spec/models/balance_spec.rb +36 -36
  231. data/spec/models/brokerage_authorization_spec.rb +78 -78
  232. data/spec/models/brokerage_authorization_type_read_only_brokerage_spec.rb +42 -42
  233. data/spec/models/brokerage_authorization_type_read_only_spec.rb +48 -48
  234. data/spec/models/brokerage_authorization_type_read_only_type_spec.rb +24 -24
  235. data/spec/models/brokerage_authorization_type_spec.rb +30 -30
  236. data/spec/models/brokerage_authorization_type_type_spec.rb +24 -24
  237. data/spec/models/brokerage_spec.rb +132 -132
  238. data/spec/models/brokerage_symbol_option_symbol_spec.rb +78 -72
  239. data/spec/models/brokerage_symbol_spec.rb +60 -60
  240. data/spec/models/brokerage_symbol_symbol_spec.rb +72 -72
  241. data/spec/models/brokerage_type_spec.rb +36 -36
  242. data/spec/models/calculated_trade_spec.rb +36 -36
  243. data/spec/models/cash_restriction_spec.rb +54 -54
  244. data/spec/models/connection_type_spec.rb +24 -24
  245. data/spec/models/connections_session_events200_response_inner_spec.rb +66 -66
  246. data/spec/models/currency_spec.rb +42 -42
  247. data/spec/models/delete_user_response_spec.rb +36 -36
  248. data/spec/models/dividend_at_date_spec.rb +42 -42
  249. data/spec/models/encrypted_response_encrypted_message_data_spec.rb +42 -42
  250. data/spec/models/encrypted_response_spec.rb +36 -36
  251. data/spec/models/exchange_rate_pairs_spec.rb +42 -42
  252. data/spec/models/exchange_spec.rb +72 -72
  253. data/spec/models/excluded_asset_spec.rb +30 -30
  254. data/spec/models/jwt_spec.rb +30 -30
  255. data/spec/models/login_redirect_uri_spec.rb +36 -36
  256. data/spec/models/manual_trade_and_impact_spec.rb +42 -42
  257. data/spec/models/manual_trade_balance_spec.rb +42 -42
  258. data/spec/models/manual_trade_form_spec.rb +72 -72
  259. data/spec/models/manual_trade_spec.rb +72 -72
  260. data/spec/models/manual_trade_symbol_spec.rb +60 -60
  261. data/spec/models/model400_failed_request_response_spec.rb +36 -36
  262. data/spec/models/model401_failed_request_response_spec.rb +36 -36
  263. data/spec/models/model403_failed_request_response_spec.rb +36 -36
  264. data/spec/models/model404_failed_request_response_spec.rb +36 -36
  265. data/spec/models/model_asset_class_details_spec.rb +36 -36
  266. data/spec/models/model_asset_class_spec.rb +36 -36
  267. data/spec/models/model_asset_class_target_spec.rb +30 -30
  268. data/spec/models/model_portfolio_asset_class_spec.rb +36 -36
  269. data/spec/models/model_portfolio_details_spec.rb +42 -42
  270. data/spec/models/model_portfolio_security_spec.rb +36 -36
  271. data/spec/models/model_portfolio_spec.rb +42 -42
  272. data/spec/models/model_type_spec.rb +24 -24
  273. data/spec/models/monthly_dividends_spec.rb +36 -36
  274. data/spec/models/net_contributions_spec.rb +42 -42
  275. data/spec/models/net_dividend_spec.rb +42 -42
  276. data/spec/models/option_chain_inner_chain_per_root_inner_chain_per_strike_price_inner_spec.rb +42 -42
  277. data/spec/models/option_chain_inner_chain_per_root_inner_spec.rb +42 -42
  278. data/spec/models/option_chain_inner_spec.rb +54 -54
  279. data/spec/models/option_leg_action_spec.rb +24 -24
  280. data/spec/models/option_leg_spec.rb +42 -42
  281. data/spec/models/option_strategy_legs_inner_spec.rb +48 -48
  282. data/spec/models/option_strategy_spec.rb +54 -54
  283. data/spec/models/option_type_spec.rb +24 -0
  284. data/spec/models/options_get_option_strategy_request_spec.rb +42 -42
  285. data/spec/models/options_holdings_spec.rb +60 -60
  286. data/spec/models/options_place_option_strategy_request_spec.rb +42 -42
  287. data/spec/models/options_position_currency_spec.rb +42 -42
  288. data/spec/models/options_position_spec.rb +66 -66
  289. data/spec/models/options_symbol_spec.rb +78 -72
  290. data/spec/models/order_strategy_execute_body_order_type_spec.rb +24 -24
  291. data/spec/models/order_strategy_execute_body_time_in_force_spec.rb +24 -24
  292. data/spec/models/order_type_spec.rb +24 -24
  293. data/spec/models/partner_data_spec.rb +96 -96
  294. data/spec/models/past_value_spec.rb +42 -42
  295. data/spec/models/performance_custom_spec.rb +138 -138
  296. data/spec/models/portfolio_group_info_spec.rb +90 -90
  297. data/spec/models/portfolio_group_position_spec.rb +42 -42
  298. data/spec/models/portfolio_group_settings_spec.rb +54 -54
  299. data/spec/models/portfolio_group_spec.rb +36 -36
  300. data/spec/models/position_spec.rb +60 -60
  301. data/spec/models/position_symbol_spec.rb +60 -60
  302. data/spec/models/redirect_tokenand_pin_spec.rb +36 -36
  303. data/spec/models/security_type_spec.rb +48 -48
  304. data/spec/models/session_event_spec.rb +66 -66
  305. data/spec/models/session_event_type_spec.rb +24 -24
  306. data/spec/models/snap_trade_api_disclaimer_accept_status_spec.rb +36 -36
  307. data/spec/models/snap_trade_holdings_account_account_id_spec.rb +78 -78
  308. data/spec/models/snap_trade_holdings_account_spec.rb +72 -72
  309. data/spec/models/snap_trade_holdings_total_value_spec.rb +36 -36
  310. data/spec/models/snap_trade_login_user_request_body_spec.rb +54 -54
  311. data/spec/models/snap_trade_register_user_request_body_spec.rb +36 -36
  312. data/spec/models/state_spec.rb +24 -24
  313. data/spec/models/status_spec.rb +42 -42
  314. data/spec/models/strategy_impact_legs_inner_spec.rb +66 -66
  315. data/spec/models/strategy_impact_spec.rb +90 -90
  316. data/spec/models/strategy_order_place_orders_inner_legs_inner_spec.rb +66 -66
  317. data/spec/models/strategy_order_place_orders_inner_spec.rb +282 -282
  318. data/spec/models/strategy_order_place_spec.rb +36 -36
  319. data/spec/models/strategy_order_record_order_type_spec.rb +24 -24
  320. data/spec/models/strategy_order_record_spec.rb +90 -90
  321. data/spec/models/strategy_order_record_status_spec.rb +24 -24
  322. data/spec/models/strategy_order_record_time_in_force_spec.rb +24 -24
  323. data/spec/models/strategy_quotes_greek_spec.rb +54 -54
  324. data/spec/models/strategy_quotes_spec.rb +60 -60
  325. data/spec/models/strategy_type_spec.rb +24 -24
  326. data/spec/models/sub_period_return_rate_spec.rb +42 -42
  327. data/spec/models/symbol_query_spec.rb +30 -30
  328. data/spec/models/symbol_spec.rb +66 -66
  329. data/spec/models/symbols_quotes_inner_spec.rb +60 -60
  330. data/spec/models/target_asset_spec.rb +60 -60
  331. data/spec/models/time_in_force_spec.rb +24 -24
  332. data/spec/models/trade_action_spec.rb +24 -24
  333. data/spec/models/trade_execution_status_action_spec.rb +24 -24
  334. data/spec/models/trade_execution_status_spec.rb +78 -78
  335. data/spec/models/trade_impact_spec.rb +54 -54
  336. data/spec/models/trade_spec.rb +72 -72
  337. data/spec/models/trading_cancel_user_account_order_request_spec.rb +30 -30
  338. data/spec/models/trading_place_oco_order_request_spec.rb +36 -36
  339. data/spec/models/transactions_status_spec.rb +36 -36
  340. data/spec/models/type_spec.rb +24 -24
  341. data/spec/models/underlying_symbol_spec.rb +66 -66
  342. data/spec/models/universal_activity_spec.rb +126 -126
  343. data/spec/models/universal_symbol_spec.rb +72 -72
  344. data/spec/models/universal_symbol_ticker_spec.rb +72 -72
  345. data/spec/models/us_exchange_spec.rb +78 -78
  346. data/spec/models/user_error_log_spec.rb +60 -60
  347. data/spec/models/user_i_dand_secret_spec.rb +36 -36
  348. data/spec/models/user_settings_spec.rb +84 -84
  349. data/spec/spec_helper.rb +6 -6
  350. metadata +121 -116
@@ -1,591 +1,581 @@
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
+ data, _status_code, _headers = get_option_strategy_with_http_info_impl(user_id, user_secret, account_id, options_get_option_strategy_request, extra)
37
+ data
38
+ end
39
+
40
+ # Creates an option strategy object that will be used to place an option strategy order
41
+ # @param underlying_symbol_id [String]
42
+ # @param legs [Array<OptionLeg>]
43
+ # @param strategy_type [StrategyType]
44
+ # @param user_id [String]
45
+ # @param user_secret [String]
46
+ # @param account_id [String] The ID of the account get positions.
47
+ # @param body [OptionsGetOptionStrategyRequest]
48
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
49
+ def get_option_strategy_with_http_info(underlying_symbol_id:, legs:, strategy_type:, user_id:, user_secret:, account_id:, extra: {})
50
+ _body = {}
51
+ _body[:underlying_symbol_id] = underlying_symbol_id if underlying_symbol_id != SENTINEL
52
+ _body[:legs] = legs if legs != SENTINEL
53
+ _body[:strategy_type] = strategy_type if strategy_type != SENTINEL
54
+ options_get_option_strategy_request = _body
55
+ get_option_strategy_with_http_info_impl(user_id, user_secret, account_id, options_get_option_strategy_request, extra)
56
+ end
57
+
58
+ # Creates an option strategy object that will be used to place an option strategy order
59
+ # @param user_id [String]
60
+ # @param user_secret [String]
61
+ # @param account_id [String] The ID of the account get positions.
62
+ # @param options_get_option_strategy_request [OptionsGetOptionStrategyRequest]
63
+ # @param [Hash] opts the optional parameters
64
+ # @return [StrategyQuotes]
65
+ def get_option_strategy_impl(user_id, user_secret, account_id, options_get_option_strategy_request, opts = {})
66
+ data, _status_code, _headers = get_option_strategy_with_http_info(user_id, user_secret, account_id, options_get_option_strategy_request, opts)
67
+ data
68
+ end
69
+
70
+ # Creates an option strategy object that will be used to place an option strategy order
71
+ # @param user_id [String]
72
+ # @param user_secret [String]
73
+ # @param account_id [String] The ID of the account get positions.
74
+ # @param options_get_option_strategy_request [OptionsGetOptionStrategyRequest]
75
+ # @param [Hash] opts the optional parameters
76
+ # @return [Array<(StrategyQuotes, Integer, Hash)>] StrategyQuotes data, response status code and response headers
77
+ def get_option_strategy_with_http_info_impl(user_id, user_secret, account_id, options_get_option_strategy_request, opts = {})
78
+ if @api_client.config.debugging
79
+ @api_client.config.logger.debug 'Calling API: OptionsApi.get_option_strategy ...'
80
+ end
81
+ # verify the required parameter 'user_id' is set
82
+ if @api_client.config.client_side_validation && user_id.nil?
83
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling OptionsApi.get_option_strategy"
84
+ end
85
+ # verify the required parameter 'user_secret' is set
86
+ if @api_client.config.client_side_validation && user_secret.nil?
87
+ fail ArgumentError, "Missing the required parameter 'user_secret' when calling OptionsApi.get_option_strategy"
88
+ end
89
+ # verify the required parameter 'account_id' is set
90
+ if @api_client.config.client_side_validation && account_id.nil?
91
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling OptionsApi.get_option_strategy"
92
+ end
93
+ # verify the required parameter 'options_get_option_strategy_request' is set
94
+ if @api_client.config.client_side_validation && options_get_option_strategy_request.nil?
95
+ fail ArgumentError, "Missing the required parameter 'options_get_option_strategy_request' when calling OptionsApi.get_option_strategy"
96
+ end
97
+ # resource path
98
+ local_var_path = '/accounts/{accountId}/optionStrategy'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
99
+
100
+ # query parameters
101
+ query_params = opts[:query_params] || {}
102
+ query_params[:'userId'] = user_id
103
+ query_params[:'userSecret'] = user_secret
104
+
105
+ # header parameters
106
+ header_params = opts[:header_params] || {}
107
+ # HTTP header 'Accept' (if needed)
108
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
109
+ # HTTP header 'Content-Type'
110
+ content_type = @api_client.select_header_content_type(['application/json'])
111
+ if !content_type.nil?
112
+ header_params['Content-Type'] = content_type
113
+ end
114
+
115
+ # form parameters
116
+ form_params = opts[:form_params] || {}
117
+
118
+ # http body (model)
119
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(options_get_option_strategy_request)
120
+
121
+ # return_type
122
+ return_type = opts[:debug_return_type] || 'StrategyQuotes'
123
+
124
+ # auth_names
125
+ auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
126
+
127
+ new_options = opts.merge(
128
+ :operation => :"OptionsApi.get_option_strategy",
129
+ :header_params => header_params,
130
+ :query_params => query_params,
131
+ :form_params => form_params,
132
+ :body => post_body,
133
+ :auth_names => auth_names,
134
+ :return_type => return_type
135
+ )
136
+
137
+ data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
138
+ if @api_client.config.debugging
139
+ @api_client.config.logger.debug "API called: OptionsApi#get_option_strategy\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
140
+ end
141
+ return data, status_code, headers, response
142
+ end
143
+
144
+
145
+ # Get the options chain
146
+ # @param user_id [String]
147
+ # @param user_secret [String]
148
+ # @param account_id [String] The ID of the account get positions.
149
+ # @param symbol [String] Universal symbol ID if symbol
150
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
151
+ def get_options_chain(user_id:, user_secret:, account_id:, symbol:, extra: {})
152
+ data, _status_code, _headers = get_options_chain_with_http_info_impl(user_id, user_secret, account_id, symbol, extra)
153
+ data
154
+ end
155
+
156
+ # Get the options chain
157
+ # @param user_id [String]
158
+ # @param user_secret [String]
159
+ # @param account_id [String] The ID of the account get positions.
160
+ # @param symbol [String] Universal symbol ID if symbol
161
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
162
+ def get_options_chain_with_http_info(user_id:, user_secret:, account_id:, symbol:, extra: {})
163
+ get_options_chain_with_http_info_impl(user_id, user_secret, account_id, symbol, extra)
164
+ end
165
+
166
+ # Get the options chain
167
+ # @param user_id [String]
168
+ # @param user_secret [String]
169
+ # @param account_id [String] The ID of the account get positions.
170
+ # @param symbol [String] Universal symbol ID if symbol
171
+ # @param [Hash] opts the optional parameters
172
+ # @return [Array<OptionChainInner>]
173
+ def get_options_chain_impl(user_id, user_secret, account_id, symbol, opts = {})
174
+ data, _status_code, _headers = get_options_chain_with_http_info(user_id, user_secret, account_id, symbol, opts)
175
+ data
176
+ end
177
+
178
+ # Get the options chain
179
+ # @param user_id [String]
180
+ # @param user_secret [String]
181
+ # @param account_id [String] The ID of the account get positions.
182
+ # @param symbol [String] Universal symbol ID if symbol
183
+ # @param [Hash] opts the optional parameters
184
+ # @return [Array<(Array<OptionChainInner>, Integer, Hash)>] Array<OptionChainInner> data, response status code and response headers
185
+ def get_options_chain_with_http_info_impl(user_id, user_secret, account_id, symbol, opts = {})
186
+ if @api_client.config.debugging
187
+ @api_client.config.logger.debug 'Calling API: OptionsApi.get_options_chain ...'
188
+ end
189
+ # verify the required parameter 'user_id' is set
190
+ if @api_client.config.client_side_validation && user_id.nil?
191
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling OptionsApi.get_options_chain"
192
+ end
193
+ # verify the required parameter 'user_secret' is set
194
+ if @api_client.config.client_side_validation && user_secret.nil?
195
+ fail ArgumentError, "Missing the required parameter 'user_secret' when calling OptionsApi.get_options_chain"
196
+ end
197
+ # verify the required parameter 'account_id' is set
198
+ if @api_client.config.client_side_validation && account_id.nil?
199
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling OptionsApi.get_options_chain"
200
+ end
201
+ # verify the required parameter 'symbol' is set
202
+ if @api_client.config.client_side_validation && symbol.nil?
203
+ fail ArgumentError, "Missing the required parameter 'symbol' when calling OptionsApi.get_options_chain"
204
+ end
205
+ # resource path
206
+ local_var_path = '/accounts/{accountId}/optionsChain'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
207
+
208
+ # query parameters
209
+ query_params = opts[:query_params] || {}
210
+ query_params[:'userId'] = user_id
211
+ query_params[:'userSecret'] = user_secret
212
+ query_params[:'symbol'] = symbol
213
+
214
+ # header parameters
215
+ header_params = opts[:header_params] || {}
216
+ # HTTP header 'Accept' (if needed)
217
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
218
+
219
+ # form parameters
220
+ form_params = opts[:form_params] || {}
221
+
222
+ # http body (model)
223
+ post_body = opts[:debug_body]
224
+
225
+ # return_type
226
+ return_type = opts[:debug_return_type] || 'Array<OptionChainInner>'
227
+
228
+ # auth_names
229
+ auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
230
+
231
+ new_options = opts.merge(
232
+ :operation => :"OptionsApi.get_options_chain",
233
+ :header_params => header_params,
234
+ :query_params => query_params,
235
+ :form_params => form_params,
236
+ :body => post_body,
237
+ :auth_names => auth_names,
238
+ :return_type => return_type
239
+ )
240
+
241
+ data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
242
+ if @api_client.config.debugging
243
+ @api_client.config.logger.debug "API called: OptionsApi#get_options_chain\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
244
+ end
245
+ return data, status_code, headers, response
246
+ end
247
+
248
+
249
+ # Get latest market data of option strategy
250
+ # @param user_id [String]
251
+ # @param user_secret [String]
252
+ # @param account_id [String] The ID of the account get positions.
253
+ # @param option_strategy_id [String] Option strategy id obtained from response when creating option strategy object
254
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
255
+ def get_options_strategy_quote(user_id:, user_secret:, account_id:, option_strategy_id:, extra: {})
256
+ data, _status_code, _headers = get_options_strategy_quote_with_http_info_impl(user_id, user_secret, account_id, option_strategy_id, extra)
257
+ data
258
+ end
259
+
260
+ # Get latest market data of option strategy
261
+ # @param user_id [String]
262
+ # @param user_secret [String]
263
+ # @param account_id [String] The ID of the account get positions.
264
+ # @param option_strategy_id [String] Option strategy id obtained from response when creating option strategy object
265
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
266
+ def get_options_strategy_quote_with_http_info(user_id:, user_secret:, account_id:, option_strategy_id:, extra: {})
267
+ get_options_strategy_quote_with_http_info_impl(user_id, user_secret, account_id, option_strategy_id, extra)
268
+ end
269
+
270
+ # Get latest market data of option strategy
271
+ # @param user_id [String]
272
+ # @param user_secret [String]
273
+ # @param account_id [String] The ID of the account get positions.
274
+ # @param option_strategy_id [String] Option strategy id obtained from response when creating option strategy object
275
+ # @param [Hash] opts the optional parameters
276
+ # @return [StrategyQuotes]
277
+ def get_options_strategy_quote_impl(user_id, user_secret, account_id, option_strategy_id, opts = {})
278
+ data, _status_code, _headers = get_options_strategy_quote_with_http_info(user_id, user_secret, account_id, option_strategy_id, opts)
279
+ data
280
+ end
281
+
282
+ # Get latest market data of option strategy
283
+ # @param user_id [String]
284
+ # @param user_secret [String]
285
+ # @param account_id [String] The ID of the account get positions.
286
+ # @param option_strategy_id [String] Option strategy id obtained from response when creating option strategy object
287
+ # @param [Hash] opts the optional parameters
288
+ # @return [Array<(StrategyQuotes, Integer, Hash)>] StrategyQuotes data, response status code and response headers
289
+ def get_options_strategy_quote_with_http_info_impl(user_id, user_secret, account_id, option_strategy_id, opts = {})
290
+ if @api_client.config.debugging
291
+ @api_client.config.logger.debug 'Calling API: OptionsApi.get_options_strategy_quote ...'
292
+ end
293
+ # verify the required parameter 'user_id' is set
294
+ if @api_client.config.client_side_validation && user_id.nil?
295
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling OptionsApi.get_options_strategy_quote"
296
+ end
297
+ # verify the required parameter 'user_secret' is set
298
+ if @api_client.config.client_side_validation && user_secret.nil?
299
+ fail ArgumentError, "Missing the required parameter 'user_secret' when calling OptionsApi.get_options_strategy_quote"
300
+ end
301
+ # verify the required parameter 'account_id' is set
302
+ if @api_client.config.client_side_validation && account_id.nil?
303
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling OptionsApi.get_options_strategy_quote"
304
+ end
305
+ # verify the required parameter 'option_strategy_id' is set
306
+ if @api_client.config.client_side_validation && option_strategy_id.nil?
307
+ fail ArgumentError, "Missing the required parameter 'option_strategy_id' when calling OptionsApi.get_options_strategy_quote"
308
+ end
309
+ # resource path
310
+ local_var_path = '/accounts/{accountId}/optionStrategy/{optionStrategyId}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'optionStrategyId' + '}', CGI.escape(option_strategy_id.to_s))
311
+
312
+ # query parameters
313
+ query_params = opts[:query_params] || {}
314
+ query_params[:'userId'] = user_id
315
+ query_params[:'userSecret'] = user_secret
316
+
317
+ # header parameters
318
+ header_params = opts[:header_params] || {}
319
+ # HTTP header 'Accept' (if needed)
320
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
321
+
322
+ # form parameters
323
+ form_params = opts[:form_params] || {}
324
+
325
+ # http body (model)
326
+ post_body = opts[:debug_body]
327
+
328
+ # return_type
329
+ return_type = opts[:debug_return_type] || 'StrategyQuotes'
330
+
331
+ # auth_names
332
+ auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
333
+
334
+ new_options = opts.merge(
335
+ :operation => :"OptionsApi.get_options_strategy_quote",
336
+ :header_params => header_params,
337
+ :query_params => query_params,
338
+ :form_params => form_params,
339
+ :body => post_body,
340
+ :auth_names => auth_names,
341
+ :return_type => return_type
342
+ )
343
+
344
+ data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
345
+ if @api_client.config.debugging
346
+ @api_client.config.logger.debug "API called: OptionsApi#get_options_strategy_quote\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
347
+ end
348
+ return data, status_code, headers, response
349
+ end
350
+
351
+
352
+ # Get the options holdings in the account
353
+ # @param user_id [String]
354
+ # @param user_secret [String]
355
+ # @param account_id [String] The ID of the account get positions.
356
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
357
+ def list_option_holdings(user_id:, user_secret:, account_id:, extra: {})
358
+ data, _status_code, _headers = list_option_holdings_with_http_info_impl(user_id, user_secret, account_id, extra)
359
+ data
360
+ end
361
+
362
+ # Get the options holdings in the account
363
+ # @param user_id [String]
364
+ # @param user_secret [String]
365
+ # @param account_id [String] The ID of the account get positions.
366
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
367
+ def list_option_holdings_with_http_info(user_id:, user_secret:, account_id:, extra: {})
368
+ list_option_holdings_with_http_info_impl(user_id, user_secret, account_id, extra)
369
+ end
370
+
371
+ # Get the options holdings in the account
372
+ # @param user_id [String]
373
+ # @param user_secret [String]
374
+ # @param account_id [String] The ID of the account get positions.
375
+ # @param [Hash] opts the optional parameters
376
+ # @return [Array<OptionsPosition>]
377
+ def list_option_holdings_impl(user_id, user_secret, account_id, opts = {})
378
+ data, _status_code, _headers = list_option_holdings_with_http_info(user_id, user_secret, account_id, opts)
379
+ data
380
+ end
381
+
382
+ # Get the options holdings in the account
383
+ # @param user_id [String]
384
+ # @param user_secret [String]
385
+ # @param account_id [String] The ID of the account get positions.
386
+ # @param [Hash] opts the optional parameters
387
+ # @return [Array<(Array<OptionsPosition>, Integer, Hash)>] Array<OptionsPosition> data, response status code and response headers
388
+ def list_option_holdings_with_http_info_impl(user_id, user_secret, account_id, opts = {})
389
+ if @api_client.config.debugging
390
+ @api_client.config.logger.debug 'Calling API: OptionsApi.list_option_holdings ...'
391
+ end
392
+ # verify the required parameter 'user_id' is set
393
+ if @api_client.config.client_side_validation && user_id.nil?
394
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling OptionsApi.list_option_holdings"
395
+ end
396
+ # verify the required parameter 'user_secret' is set
397
+ if @api_client.config.client_side_validation && user_secret.nil?
398
+ fail ArgumentError, "Missing the required parameter 'user_secret' when calling OptionsApi.list_option_holdings"
399
+ end
400
+ # verify the required parameter 'account_id' is set
401
+ if @api_client.config.client_side_validation && account_id.nil?
402
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling OptionsApi.list_option_holdings"
403
+ end
404
+ # resource path
405
+ local_var_path = '/accounts/{accountId}/options'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
406
+
407
+ # query parameters
408
+ query_params = opts[:query_params] || {}
409
+ query_params[:'userId'] = user_id
410
+ query_params[:'userSecret'] = user_secret
411
+
412
+ # header parameters
413
+ header_params = opts[:header_params] || {}
414
+ # HTTP header 'Accept' (if needed)
415
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
416
+
417
+ # form parameters
418
+ form_params = opts[:form_params] || {}
419
+
420
+ # http body (model)
421
+ post_body = opts[:debug_body]
422
+
423
+ # return_type
424
+ return_type = opts[:debug_return_type] || 'Array<OptionsPosition>'
425
+
426
+ # auth_names
427
+ auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
428
+
429
+ new_options = opts.merge(
430
+ :operation => :"OptionsApi.list_option_holdings",
431
+ :header_params => header_params,
432
+ :query_params => query_params,
433
+ :form_params => form_params,
434
+ :body => post_body,
435
+ :auth_names => auth_names,
436
+ :return_type => return_type
437
+ )
438
+
439
+ data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
440
+ if @api_client.config.debugging
441
+ @api_client.config.logger.debug "API called: OptionsApi#list_option_holdings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
442
+ end
443
+ return data, status_code, headers, response
444
+ end
445
+
446
+
447
+ # Place an option strategy order on the brokerage
448
+ # @param order_type [OrderStrategyExecuteBodyOrderType]
449
+ # @param time_in_force [OrderStrategyExecuteBodyTimeInForce]
450
+ # @param price [Float] Trade Price if limit or stop limit order
451
+ # @param user_id [String]
452
+ # @param user_secret [String]
453
+ # @param account_id [String] The ID of the account get positions.
454
+ # @param option_strategy_id [String] Option strategy id obtained from response when creating option strategy object
455
+ # @param body [OptionsPlaceOptionStrategyRequest]
456
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
457
+ def place_option_strategy(order_type:, time_in_force:, price:, user_id:, user_secret:, account_id:, option_strategy_id:, extra: {})
458
+ _body = {}
459
+ _body[:order_type] = order_type if order_type != SENTINEL
460
+ _body[:time_in_force] = time_in_force if time_in_force != SENTINEL
461
+ _body[:price] = price if price != SENTINEL
462
+ options_place_option_strategy_request = _body
463
+ 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)
464
+ data
465
+ end
466
+
467
+ # Place an option strategy order on the brokerage
468
+ # @param order_type [OrderStrategyExecuteBodyOrderType]
469
+ # @param time_in_force [OrderStrategyExecuteBodyTimeInForce]
470
+ # @param price [Float] Trade Price if limit or stop limit order
471
+ # @param user_id [String]
472
+ # @param user_secret [String]
473
+ # @param account_id [String] The ID of the account get positions.
474
+ # @param option_strategy_id [String] Option strategy id obtained from response when creating option strategy object
475
+ # @param body [OptionsPlaceOptionStrategyRequest]
476
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
477
+ def place_option_strategy_with_http_info(order_type:, time_in_force:, price:, user_id:, user_secret:, account_id:, option_strategy_id:, extra: {})
478
+ _body = {}
479
+ _body[:order_type] = order_type if order_type != SENTINEL
480
+ _body[:time_in_force] = time_in_force if time_in_force != SENTINEL
481
+ _body[:price] = price if price != SENTINEL
482
+ options_place_option_strategy_request = _body
483
+ place_option_strategy_with_http_info_impl(user_id, user_secret, account_id, option_strategy_id, options_place_option_strategy_request, extra)
484
+ end
485
+
486
+ # Place an option strategy order on the brokerage
487
+ # @param user_id [String]
488
+ # @param user_secret [String]
489
+ # @param account_id [String] The ID of the account get positions.
490
+ # @param option_strategy_id [String] Option strategy id obtained from response when creating option strategy object
491
+ # @param options_place_option_strategy_request [OptionsPlaceOptionStrategyRequest]
492
+ # @param [Hash] opts the optional parameters
493
+ # @return [StrategyOrderRecord]
494
+ def place_option_strategy_impl(user_id, user_secret, account_id, option_strategy_id, options_place_option_strategy_request, opts = {})
495
+ 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)
496
+ data
497
+ end
498
+
499
+ # Place an option strategy order on the brokerage
500
+ # @param user_id [String]
501
+ # @param user_secret [String]
502
+ # @param account_id [String] The ID of the account get positions.
503
+ # @param option_strategy_id [String] Option strategy id obtained from response when creating option strategy object
504
+ # @param options_place_option_strategy_request [OptionsPlaceOptionStrategyRequest]
505
+ # @param [Hash] opts the optional parameters
506
+ # @return [Array<(StrategyOrderRecord, Integer, Hash)>] StrategyOrderRecord data, response status code and response headers
507
+ def place_option_strategy_with_http_info_impl(user_id, user_secret, account_id, option_strategy_id, options_place_option_strategy_request, opts = {})
508
+ if @api_client.config.debugging
509
+ @api_client.config.logger.debug 'Calling API: OptionsApi.place_option_strategy ...'
510
+ end
511
+ # verify the required parameter 'user_id' is set
512
+ if @api_client.config.client_side_validation && user_id.nil?
513
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling OptionsApi.place_option_strategy"
514
+ end
515
+ # verify the required parameter 'user_secret' is set
516
+ if @api_client.config.client_side_validation && user_secret.nil?
517
+ fail ArgumentError, "Missing the required parameter 'user_secret' when calling OptionsApi.place_option_strategy"
518
+ end
519
+ # verify the required parameter 'account_id' is set
520
+ if @api_client.config.client_side_validation && account_id.nil?
521
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling OptionsApi.place_option_strategy"
522
+ end
523
+ # verify the required parameter 'option_strategy_id' is set
524
+ if @api_client.config.client_side_validation && option_strategy_id.nil?
525
+ fail ArgumentError, "Missing the required parameter 'option_strategy_id' when calling OptionsApi.place_option_strategy"
526
+ end
527
+ # verify the required parameter 'options_place_option_strategy_request' is set
528
+ if @api_client.config.client_side_validation && options_place_option_strategy_request.nil?
529
+ fail ArgumentError, "Missing the required parameter 'options_place_option_strategy_request' when calling OptionsApi.place_option_strategy"
530
+ end
531
+ # resource path
532
+ 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))
533
+
534
+ # query parameters
535
+ query_params = opts[:query_params] || {}
536
+ query_params[:'userId'] = user_id
537
+ query_params[:'userSecret'] = user_secret
538
+
539
+ # header parameters
540
+ header_params = opts[:header_params] || {}
541
+ # HTTP header 'Accept' (if needed)
542
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
543
+ # HTTP header 'Content-Type'
544
+ content_type = @api_client.select_header_content_type(['application/json'])
545
+ if !content_type.nil?
546
+ header_params['Content-Type'] = content_type
547
+ end
548
+
549
+ # form parameters
550
+ form_params = opts[:form_params] || {}
551
+
552
+ # http body (model)
553
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(options_place_option_strategy_request)
554
+
555
+ # return_type
556
+ return_type = opts[:debug_return_type] || 'StrategyOrderRecord'
557
+
558
+ # auth_names
559
+ auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
560
+
561
+ new_options = opts.merge(
562
+ :operation => :"OptionsApi.place_option_strategy",
563
+ :header_params => header_params,
564
+ :query_params => query_params,
565
+ :form_params => form_params,
566
+ :body => post_body,
567
+ :auth_names => auth_names,
568
+ :return_type => return_type
569
+ )
570
+
571
+ data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
572
+ if @api_client.config.debugging
573
+ @api_client.config.logger.debug "API called: OptionsApi#place_option_strategy\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
574
+ end
575
+ return data, status_code, headers, response
576
+ end
577
+ end
578
+
579
+ # top-level client access to avoid having the user to insantiate their own API instances
580
+ Options = OptionsApi::new
581
+ end