snaptrade 2.0.123 → 2.0.125
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +39 -153
- data/lib/snaptrade/api/account_information_api.rb +111 -0
- data/lib/snaptrade/api/options_api.rb +0 -383
- data/lib/snaptrade/models/account_status.rb +2 -1
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +0 -2
- data/spec/api/account_information_api_spec.rb +15 -0
- data/spec/api/options_api_spec.rb +0 -46
- metadata +2 -8
- data/lib/snaptrade/models/options_get_option_strategy_request.rb +0 -251
- data/lib/snaptrade/models/options_place_option_strategy_request.rb +0 -248
- data/spec/models/options_get_option_strategy_request_spec.rb +0 -41
- data/spec/models/options_place_option_strategy_request_spec.rb +0 -41
@@ -17,138 +17,6 @@ module SnapTrade
|
|
17
17
|
@api_client = api_client
|
18
18
|
end
|
19
19
|
|
20
|
-
# Create options strategy
|
21
|
-
#
|
22
|
-
# Creates an option strategy object that will be used to place an option strategy order.
|
23
|
-
#
|
24
|
-
# @param underlying_symbol_id [String]
|
25
|
-
# @param legs [Array<OptionLeg>]
|
26
|
-
# @param strategy_type [StrategyType]
|
27
|
-
# @param user_id [String]
|
28
|
-
# @param user_secret [String]
|
29
|
-
# @param account_id [String] The ID of the account to create the option strategy object in.
|
30
|
-
# @param body [OptionsGetOptionStrategyRequest]
|
31
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
32
|
-
def get_option_strategy(underlying_symbol_id:, legs:, strategy_type:, user_id:, user_secret:, account_id:, extra: {})
|
33
|
-
_body = {}
|
34
|
-
_body[:underlying_symbol_id] = underlying_symbol_id if underlying_symbol_id != SENTINEL
|
35
|
-
_body[:legs] = legs if legs != SENTINEL
|
36
|
-
_body[:strategy_type] = strategy_type if strategy_type != SENTINEL
|
37
|
-
options_get_option_strategy_request = _body
|
38
|
-
data, _status_code, _headers = get_option_strategy_with_http_info_impl(user_id, user_secret, account_id, options_get_option_strategy_request, extra)
|
39
|
-
data
|
40
|
-
end
|
41
|
-
|
42
|
-
# Create options strategy
|
43
|
-
#
|
44
|
-
# Creates an option strategy object that will be used to place an option strategy order.
|
45
|
-
#
|
46
|
-
# @param underlying_symbol_id [String]
|
47
|
-
# @param legs [Array<OptionLeg>]
|
48
|
-
# @param strategy_type [StrategyType]
|
49
|
-
# @param user_id [String]
|
50
|
-
# @param user_secret [String]
|
51
|
-
# @param account_id [String] The ID of the account to create the option strategy object in.
|
52
|
-
# @param body [OptionsGetOptionStrategyRequest]
|
53
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
54
|
-
def get_option_strategy_with_http_info(underlying_symbol_id:, legs:, strategy_type:, user_id:, user_secret:, account_id:, extra: {})
|
55
|
-
_body = {}
|
56
|
-
_body[:underlying_symbol_id] = underlying_symbol_id if underlying_symbol_id != SENTINEL
|
57
|
-
_body[:legs] = legs if legs != SENTINEL
|
58
|
-
_body[:strategy_type] = strategy_type if strategy_type != SENTINEL
|
59
|
-
options_get_option_strategy_request = _body
|
60
|
-
get_option_strategy_with_http_info_impl(user_id, user_secret, account_id, options_get_option_strategy_request, extra)
|
61
|
-
end
|
62
|
-
|
63
|
-
# Create options strategy
|
64
|
-
# Creates an option strategy object that will be used to place an option strategy order.
|
65
|
-
# @param user_id [String]
|
66
|
-
# @param user_secret [String]
|
67
|
-
# @param account_id [String] The ID of the account to create the option strategy object in.
|
68
|
-
# @param options_get_option_strategy_request [OptionsGetOptionStrategyRequest]
|
69
|
-
# @param [Hash] opts the optional parameters
|
70
|
-
# @return [StrategyQuotes]
|
71
|
-
private def get_option_strategy_impl(user_id, user_secret, account_id, options_get_option_strategy_request, opts = {})
|
72
|
-
data, _status_code, _headers = get_option_strategy_with_http_info(user_id, user_secret, account_id, options_get_option_strategy_request, opts)
|
73
|
-
data
|
74
|
-
end
|
75
|
-
|
76
|
-
# Create options strategy
|
77
|
-
# Creates an option strategy object that will be used to place an option strategy order.
|
78
|
-
# @param user_id [String]
|
79
|
-
# @param user_secret [String]
|
80
|
-
# @param account_id [String] The ID of the account to create the option strategy object in.
|
81
|
-
# @param options_get_option_strategy_request [OptionsGetOptionStrategyRequest]
|
82
|
-
# @param [Hash] opts the optional parameters
|
83
|
-
# @return [Array<(StrategyQuotes, Integer, Hash)>] StrategyQuotes data, response status code and response headers
|
84
|
-
private def get_option_strategy_with_http_info_impl(user_id, user_secret, account_id, options_get_option_strategy_request, opts = {})
|
85
|
-
if @api_client.config.debugging
|
86
|
-
@api_client.config.logger.debug 'Calling API: OptionsApi.get_option_strategy ...'
|
87
|
-
end
|
88
|
-
# verify the required parameter 'user_id' is set
|
89
|
-
if @api_client.config.client_side_validation && user_id.nil?
|
90
|
-
fail ArgumentError, "Missing the required parameter 'user_id' when calling OptionsApi.get_option_strategy"
|
91
|
-
end
|
92
|
-
# verify the required parameter 'user_secret' is set
|
93
|
-
if @api_client.config.client_side_validation && user_secret.nil?
|
94
|
-
fail ArgumentError, "Missing the required parameter 'user_secret' when calling OptionsApi.get_option_strategy"
|
95
|
-
end
|
96
|
-
# verify the required parameter 'account_id' is set
|
97
|
-
if @api_client.config.client_side_validation && account_id.nil?
|
98
|
-
fail ArgumentError, "Missing the required parameter 'account_id' when calling OptionsApi.get_option_strategy"
|
99
|
-
end
|
100
|
-
# verify the required parameter 'options_get_option_strategy_request' is set
|
101
|
-
if @api_client.config.client_side_validation && options_get_option_strategy_request.nil?
|
102
|
-
fail ArgumentError, "Missing the required parameter 'options_get_option_strategy_request' when calling OptionsApi.get_option_strategy"
|
103
|
-
end
|
104
|
-
# resource path
|
105
|
-
local_var_path = '/accounts/{accountId}/optionStrategy'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
|
106
|
-
|
107
|
-
# query parameters
|
108
|
-
query_params = opts[:query_params] || {}
|
109
|
-
query_params[:'userId'] = user_id
|
110
|
-
query_params[:'userSecret'] = user_secret
|
111
|
-
|
112
|
-
# header parameters
|
113
|
-
header_params = opts[:header_params] || {}
|
114
|
-
# HTTP header 'Accept' (if needed)
|
115
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
116
|
-
# HTTP header 'Content-Type'
|
117
|
-
content_type = @api_client.select_header_content_type(['application/json'])
|
118
|
-
if !content_type.nil?
|
119
|
-
header_params['Content-Type'] = content_type
|
120
|
-
end
|
121
|
-
|
122
|
-
# form parameters
|
123
|
-
form_params = opts[:form_params] || {}
|
124
|
-
|
125
|
-
# http body (model)
|
126
|
-
post_body = opts[:debug_body] || @api_client.object_to_http_body(options_get_option_strategy_request)
|
127
|
-
|
128
|
-
# return_type
|
129
|
-
return_type = opts[:debug_return_type] || 'StrategyQuotes'
|
130
|
-
|
131
|
-
# auth_names
|
132
|
-
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
133
|
-
|
134
|
-
new_options = opts.merge(
|
135
|
-
:operation => :"OptionsApi.get_option_strategy",
|
136
|
-
:header_params => header_params,
|
137
|
-
:query_params => query_params,
|
138
|
-
:form_params => form_params,
|
139
|
-
:body => post_body,
|
140
|
-
:auth_names => auth_names,
|
141
|
-
:return_type => return_type
|
142
|
-
)
|
143
|
-
|
144
|
-
data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
|
145
|
-
if @api_client.config.debugging
|
146
|
-
@api_client.config.logger.debug "API called: OptionsApi#get_option_strategy\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
147
|
-
end
|
148
|
-
return data, status_code, headers, response
|
149
|
-
end
|
150
|
-
|
151
|
-
|
152
20
|
# Get the options chain for a symbol
|
153
21
|
#
|
154
22
|
# Returns the option chain for the specified symbol in the specified account.
|
@@ -261,117 +129,6 @@ module SnapTrade
|
|
261
129
|
end
|
262
130
|
|
263
131
|
|
264
|
-
# Get options strategy quotes
|
265
|
-
#
|
266
|
-
# Returns a Strategy Quotes object which has latest market data of the specified option strategy.
|
267
|
-
#
|
268
|
-
# @param user_id [String]
|
269
|
-
# @param user_secret [String]
|
270
|
-
# @param account_id [String] The ID of the account the strategy will be placed in.
|
271
|
-
# @param option_strategy_id [String] Option strategy id obtained from response when creating option strategy object
|
272
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
273
|
-
def get_options_strategy_quote(user_id:, user_secret:, account_id:, option_strategy_id:, extra: {})
|
274
|
-
data, _status_code, _headers = get_options_strategy_quote_with_http_info_impl(user_id, user_secret, account_id, option_strategy_id, extra)
|
275
|
-
data
|
276
|
-
end
|
277
|
-
|
278
|
-
# Get options strategy quotes
|
279
|
-
#
|
280
|
-
# Returns a Strategy Quotes object which has latest market data of the specified option strategy.
|
281
|
-
#
|
282
|
-
# @param user_id [String]
|
283
|
-
# @param user_secret [String]
|
284
|
-
# @param account_id [String] The ID of the account the strategy will be placed in.
|
285
|
-
# @param option_strategy_id [String] Option strategy id obtained from response when creating option strategy object
|
286
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
287
|
-
def get_options_strategy_quote_with_http_info(user_id:, user_secret:, account_id:, option_strategy_id:, extra: {})
|
288
|
-
get_options_strategy_quote_with_http_info_impl(user_id, user_secret, account_id, option_strategy_id, extra)
|
289
|
-
end
|
290
|
-
|
291
|
-
# Get options strategy quotes
|
292
|
-
# Returns a Strategy Quotes object which has latest market data of the specified option strategy.
|
293
|
-
# @param user_id [String]
|
294
|
-
# @param user_secret [String]
|
295
|
-
# @param account_id [String] The ID of the account the strategy will be placed in.
|
296
|
-
# @param option_strategy_id [String] Option strategy id obtained from response when creating option strategy object
|
297
|
-
# @param [Hash] opts the optional parameters
|
298
|
-
# @return [StrategyQuotes]
|
299
|
-
private def get_options_strategy_quote_impl(user_id, user_secret, account_id, option_strategy_id, opts = {})
|
300
|
-
data, _status_code, _headers = get_options_strategy_quote_with_http_info(user_id, user_secret, account_id, option_strategy_id, opts)
|
301
|
-
data
|
302
|
-
end
|
303
|
-
|
304
|
-
# Get options strategy quotes
|
305
|
-
# Returns a Strategy Quotes object which has latest market data of the specified option strategy.
|
306
|
-
# @param user_id [String]
|
307
|
-
# @param user_secret [String]
|
308
|
-
# @param account_id [String] The ID of the account the strategy will be placed in.
|
309
|
-
# @param option_strategy_id [String] Option strategy id obtained from response when creating option strategy object
|
310
|
-
# @param [Hash] opts the optional parameters
|
311
|
-
# @return [Array<(StrategyQuotes, Integer, Hash)>] StrategyQuotes data, response status code and response headers
|
312
|
-
private def get_options_strategy_quote_with_http_info_impl(user_id, user_secret, account_id, option_strategy_id, opts = {})
|
313
|
-
if @api_client.config.debugging
|
314
|
-
@api_client.config.logger.debug 'Calling API: OptionsApi.get_options_strategy_quote ...'
|
315
|
-
end
|
316
|
-
# verify the required parameter 'user_id' is set
|
317
|
-
if @api_client.config.client_side_validation && user_id.nil?
|
318
|
-
fail ArgumentError, "Missing the required parameter 'user_id' when calling OptionsApi.get_options_strategy_quote"
|
319
|
-
end
|
320
|
-
# verify the required parameter 'user_secret' is set
|
321
|
-
if @api_client.config.client_side_validation && user_secret.nil?
|
322
|
-
fail ArgumentError, "Missing the required parameter 'user_secret' when calling OptionsApi.get_options_strategy_quote"
|
323
|
-
end
|
324
|
-
# verify the required parameter 'account_id' is set
|
325
|
-
if @api_client.config.client_side_validation && account_id.nil?
|
326
|
-
fail ArgumentError, "Missing the required parameter 'account_id' when calling OptionsApi.get_options_strategy_quote"
|
327
|
-
end
|
328
|
-
# verify the required parameter 'option_strategy_id' is set
|
329
|
-
if @api_client.config.client_side_validation && option_strategy_id.nil?
|
330
|
-
fail ArgumentError, "Missing the required parameter 'option_strategy_id' when calling OptionsApi.get_options_strategy_quote"
|
331
|
-
end
|
332
|
-
# resource path
|
333
|
-
local_var_path = '/accounts/{accountId}/optionStrategy/{optionStrategyId}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'optionStrategyId' + '}', CGI.escape(option_strategy_id.to_s))
|
334
|
-
|
335
|
-
# query parameters
|
336
|
-
query_params = opts[:query_params] || {}
|
337
|
-
query_params[:'userId'] = user_id
|
338
|
-
query_params[:'userSecret'] = user_secret
|
339
|
-
|
340
|
-
# header parameters
|
341
|
-
header_params = opts[:header_params] || {}
|
342
|
-
# HTTP header 'Accept' (if needed)
|
343
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
344
|
-
|
345
|
-
# form parameters
|
346
|
-
form_params = opts[:form_params] || {}
|
347
|
-
|
348
|
-
# http body (model)
|
349
|
-
post_body = opts[:debug_body]
|
350
|
-
|
351
|
-
# return_type
|
352
|
-
return_type = opts[:debug_return_type] || 'StrategyQuotes'
|
353
|
-
|
354
|
-
# auth_names
|
355
|
-
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
356
|
-
|
357
|
-
new_options = opts.merge(
|
358
|
-
:operation => :"OptionsApi.get_options_strategy_quote",
|
359
|
-
:header_params => header_params,
|
360
|
-
:query_params => query_params,
|
361
|
-
:form_params => form_params,
|
362
|
-
:body => post_body,
|
363
|
-
:auth_names => auth_names,
|
364
|
-
:return_type => return_type
|
365
|
-
)
|
366
|
-
|
367
|
-
data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
|
368
|
-
if @api_client.config.debugging
|
369
|
-
@api_client.config.logger.debug "API called: OptionsApi#get_options_strategy_quote\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
370
|
-
end
|
371
|
-
return data, status_code, headers, response
|
372
|
-
end
|
373
|
-
|
374
|
-
|
375
132
|
# List account option positions
|
376
133
|
#
|
377
134
|
# Returns a list of option positions in the specified account. For stock/ETF/crypto/mutual fund positions, please use the [positions endpoint](/reference/Account%20Information/AccountInformation_getUserAccountPositions).
|
@@ -477,146 +234,6 @@ module SnapTrade
|
|
477
234
|
end
|
478
235
|
return data, status_code, headers, response
|
479
236
|
end
|
480
|
-
|
481
|
-
|
482
|
-
# Place an option strategy order
|
483
|
-
#
|
484
|
-
# Places the option strategy order and returns the order record received from the brokerage.
|
485
|
-
#
|
486
|
-
# @param order_type [OrderTypeStrict] The type of order to place. - For `Limit` and `StopLimit` orders, the `price` field is required. - For `Stop` and `StopLimit` orders, the `stop` field is required.
|
487
|
-
# @param time_in_force [TimeInForceStrict] The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled.
|
488
|
-
# @param user_id [String]
|
489
|
-
# @param user_secret [String]
|
490
|
-
# @param account_id [String] The ID of the account to execute the strategy in.
|
491
|
-
# @param option_strategy_id [String] Option strategy id obtained from response when creating option strategy object
|
492
|
-
# @param price [Float] Trade Price if limit or stop limit order
|
493
|
-
# @param body [OptionsPlaceOptionStrategyRequest]
|
494
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
495
|
-
def place_option_strategy(order_type:, time_in_force:, user_id:, user_secret:, account_id:, option_strategy_id:, price: SENTINEL, extra: {})
|
496
|
-
_body = {}
|
497
|
-
_body[:order_type] = order_type if order_type != SENTINEL
|
498
|
-
_body[:time_in_force] = time_in_force if time_in_force != SENTINEL
|
499
|
-
_body[:price] = price if price != SENTINEL
|
500
|
-
options_place_option_strategy_request = _body
|
501
|
-
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)
|
502
|
-
data
|
503
|
-
end
|
504
|
-
|
505
|
-
# Place an option strategy order
|
506
|
-
#
|
507
|
-
# Places the option strategy order and returns the order record received from the brokerage.
|
508
|
-
#
|
509
|
-
# @param order_type [OrderTypeStrict] The type of order to place. - For `Limit` and `StopLimit` orders, the `price` field is required. - For `Stop` and `StopLimit` orders, the `stop` field is required.
|
510
|
-
# @param time_in_force [TimeInForceStrict] The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled.
|
511
|
-
# @param user_id [String]
|
512
|
-
# @param user_secret [String]
|
513
|
-
# @param account_id [String] The ID of the account to execute the strategy in.
|
514
|
-
# @param option_strategy_id [String] Option strategy id obtained from response when creating option strategy object
|
515
|
-
# @param price [Float] Trade Price if limit or stop limit order
|
516
|
-
# @param body [OptionsPlaceOptionStrategyRequest]
|
517
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
518
|
-
def place_option_strategy_with_http_info(order_type:, time_in_force:, user_id:, user_secret:, account_id:, option_strategy_id:, price: SENTINEL, extra: {})
|
519
|
-
_body = {}
|
520
|
-
_body[:order_type] = order_type if order_type != SENTINEL
|
521
|
-
_body[:time_in_force] = time_in_force if time_in_force != SENTINEL
|
522
|
-
_body[:price] = price if price != SENTINEL
|
523
|
-
options_place_option_strategy_request = _body
|
524
|
-
place_option_strategy_with_http_info_impl(user_id, user_secret, account_id, option_strategy_id, options_place_option_strategy_request, extra)
|
525
|
-
end
|
526
|
-
|
527
|
-
# Place an option strategy order
|
528
|
-
# Places the option strategy order and returns the order record received from the brokerage.
|
529
|
-
# @param user_id [String]
|
530
|
-
# @param user_secret [String]
|
531
|
-
# @param account_id [String] The ID of the account to execute the strategy in.
|
532
|
-
# @param option_strategy_id [String] Option strategy id obtained from response when creating option strategy object
|
533
|
-
# @param options_place_option_strategy_request [OptionsPlaceOptionStrategyRequest]
|
534
|
-
# @param [Hash] opts the optional parameters
|
535
|
-
# @return [StrategyOrderRecord]
|
536
|
-
private def place_option_strategy_impl(user_id, user_secret, account_id, option_strategy_id, options_place_option_strategy_request, opts = {})
|
537
|
-
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)
|
538
|
-
data
|
539
|
-
end
|
540
|
-
|
541
|
-
# Place an option strategy order
|
542
|
-
# Places the option strategy order and returns the order record received from the brokerage.
|
543
|
-
# @param user_id [String]
|
544
|
-
# @param user_secret [String]
|
545
|
-
# @param account_id [String] The ID of the account to execute the strategy in.
|
546
|
-
# @param option_strategy_id [String] Option strategy id obtained from response when creating option strategy object
|
547
|
-
# @param options_place_option_strategy_request [OptionsPlaceOptionStrategyRequest]
|
548
|
-
# @param [Hash] opts the optional parameters
|
549
|
-
# @return [Array<(StrategyOrderRecord, Integer, Hash)>] StrategyOrderRecord data, response status code and response headers
|
550
|
-
private def place_option_strategy_with_http_info_impl(user_id, user_secret, account_id, option_strategy_id, options_place_option_strategy_request, opts = {})
|
551
|
-
if @api_client.config.debugging
|
552
|
-
@api_client.config.logger.debug 'Calling API: OptionsApi.place_option_strategy ...'
|
553
|
-
end
|
554
|
-
# verify the required parameter 'user_id' is set
|
555
|
-
if @api_client.config.client_side_validation && user_id.nil?
|
556
|
-
fail ArgumentError, "Missing the required parameter 'user_id' when calling OptionsApi.place_option_strategy"
|
557
|
-
end
|
558
|
-
# verify the required parameter 'user_secret' is set
|
559
|
-
if @api_client.config.client_side_validation && user_secret.nil?
|
560
|
-
fail ArgumentError, "Missing the required parameter 'user_secret' when calling OptionsApi.place_option_strategy"
|
561
|
-
end
|
562
|
-
# verify the required parameter 'account_id' is set
|
563
|
-
if @api_client.config.client_side_validation && account_id.nil?
|
564
|
-
fail ArgumentError, "Missing the required parameter 'account_id' when calling OptionsApi.place_option_strategy"
|
565
|
-
end
|
566
|
-
# verify the required parameter 'option_strategy_id' is set
|
567
|
-
if @api_client.config.client_side_validation && option_strategy_id.nil?
|
568
|
-
fail ArgumentError, "Missing the required parameter 'option_strategy_id' when calling OptionsApi.place_option_strategy"
|
569
|
-
end
|
570
|
-
# verify the required parameter 'options_place_option_strategy_request' is set
|
571
|
-
if @api_client.config.client_side_validation && options_place_option_strategy_request.nil?
|
572
|
-
fail ArgumentError, "Missing the required parameter 'options_place_option_strategy_request' when calling OptionsApi.place_option_strategy"
|
573
|
-
end
|
574
|
-
# resource path
|
575
|
-
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))
|
576
|
-
|
577
|
-
# query parameters
|
578
|
-
query_params = opts[:query_params] || {}
|
579
|
-
query_params[:'userId'] = user_id
|
580
|
-
query_params[:'userSecret'] = user_secret
|
581
|
-
|
582
|
-
# header parameters
|
583
|
-
header_params = opts[:header_params] || {}
|
584
|
-
# HTTP header 'Accept' (if needed)
|
585
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
586
|
-
# HTTP header 'Content-Type'
|
587
|
-
content_type = @api_client.select_header_content_type(['application/json'])
|
588
|
-
if !content_type.nil?
|
589
|
-
header_params['Content-Type'] = content_type
|
590
|
-
end
|
591
|
-
|
592
|
-
# form parameters
|
593
|
-
form_params = opts[:form_params] || {}
|
594
|
-
|
595
|
-
# http body (model)
|
596
|
-
post_body = opts[:debug_body] || @api_client.object_to_http_body(options_place_option_strategy_request)
|
597
|
-
|
598
|
-
# return_type
|
599
|
-
return_type = opts[:debug_return_type] || 'StrategyOrderRecord'
|
600
|
-
|
601
|
-
# auth_names
|
602
|
-
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
603
|
-
|
604
|
-
new_options = opts.merge(
|
605
|
-
:operation => :"OptionsApi.place_option_strategy",
|
606
|
-
:header_params => header_params,
|
607
|
-
:query_params => query_params,
|
608
|
-
:form_params => form_params,
|
609
|
-
:body => post_body,
|
610
|
-
:auth_names => auth_names,
|
611
|
-
:return_type => return_type
|
612
|
-
)
|
613
|
-
|
614
|
-
data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
|
615
|
-
if @api_client.config.debugging
|
616
|
-
@api_client.config.logger.debug "API called: OptionsApi#place_option_strategy\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
617
|
-
end
|
618
|
-
return data, status_code, headers, response
|
619
|
-
end
|
620
237
|
end
|
621
238
|
|
622
239
|
# top-level client access to avoid having the user to insantiate their own API instances
|
@@ -15,9 +15,10 @@ module SnapTrade
|
|
15
15
|
OPEN = "open".freeze
|
16
16
|
CLOSED = "closed".freeze
|
17
17
|
ARCHIVED = "archived".freeze
|
18
|
+
UNAVAILABLE = "unavailable".freeze
|
18
19
|
|
19
20
|
def self.all_vars
|
20
|
-
@all_vars ||= [OPEN, CLOSED, ARCHIVED].freeze
|
21
|
+
@all_vars ||= [OPEN, CLOSED, ARCHIVED, UNAVAILABLE].freeze
|
21
22
|
end
|
22
23
|
|
23
24
|
# Builds the enum from string
|
data/lib/snaptrade/version.rb
CHANGED
data/lib/snaptrade.rb
CHANGED
@@ -114,8 +114,6 @@ require 'snaptrade/models/option_leg_action'
|
|
114
114
|
require 'snaptrade/models/option_strategy'
|
115
115
|
require 'snaptrade/models/option_strategy_legs_inner'
|
116
116
|
require 'snaptrade/models/option_type'
|
117
|
-
require 'snaptrade/models/options_get_option_strategy_request'
|
118
|
-
require 'snaptrade/models/options_place_option_strategy_request'
|
119
117
|
require 'snaptrade/models/options_position'
|
120
118
|
require 'snaptrade/models/options_position_currency'
|
121
119
|
require 'snaptrade/models/options_symbol'
|
@@ -88,6 +88,21 @@ describe 'AccountInformationApi' do
|
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
91
|
+
# unit tests for get_user_account_order_detail
|
92
|
+
# Get account order detail
|
93
|
+
# Returns the detail of a single order in the specified account. This endpoint is always realtime and does not rely on cached data.
|
94
|
+
# @param user_id
|
95
|
+
# @param user_secret
|
96
|
+
# @param account_id
|
97
|
+
# @param brokerage_order_id
|
98
|
+
# @param [Hash] opts the optional parameters
|
99
|
+
# @return [AccountOrderRecord]
|
100
|
+
describe 'get_user_account_order_detail test' do
|
101
|
+
it 'should work' do
|
102
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
91
106
|
# unit tests for get_user_account_orders
|
92
107
|
# List account orders
|
93
108
|
# Returns a list of recent orders in the specified account. The data returned here is cached. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for \"Cache Expiry Time\" to see the exact value for a specific brokerage. **If you need real-time data, please use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint**.
|
@@ -27,21 +27,6 @@ describe 'OptionsApi' do
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
-
# unit tests for get_option_strategy
|
31
|
-
# Create options strategy
|
32
|
-
# Creates an option strategy object that will be used to place an option strategy order.
|
33
|
-
# @param user_id
|
34
|
-
# @param user_secret
|
35
|
-
# @param account_id The ID of the account to create the option strategy object in.
|
36
|
-
# @param options_get_option_strategy_request
|
37
|
-
# @param [Hash] opts the optional parameters
|
38
|
-
# @return [StrategyQuotes]
|
39
|
-
describe 'get_option_strategy test' do
|
40
|
-
it 'should work' do
|
41
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
30
|
# unit tests for get_options_chain
|
46
31
|
# Get the options chain for a symbol
|
47
32
|
# Returns the option chain for the specified symbol in the specified account.
|
@@ -57,21 +42,6 @@ describe 'OptionsApi' do
|
|
57
42
|
end
|
58
43
|
end
|
59
44
|
|
60
|
-
# unit tests for get_options_strategy_quote
|
61
|
-
# Get options strategy quotes
|
62
|
-
# Returns a Strategy Quotes object which has latest market data of the specified option strategy.
|
63
|
-
# @param user_id
|
64
|
-
# @param user_secret
|
65
|
-
# @param account_id The ID of the account the strategy will be placed in.
|
66
|
-
# @param option_strategy_id Option strategy id obtained from response when creating option strategy object
|
67
|
-
# @param [Hash] opts the optional parameters
|
68
|
-
# @return [StrategyQuotes]
|
69
|
-
describe 'get_options_strategy_quote test' do
|
70
|
-
it 'should work' do
|
71
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
45
|
# unit tests for list_option_holdings
|
76
46
|
# List account option positions
|
77
47
|
# Returns a list of option positions in the specified account. For stock/ETF/crypto/mutual fund positions, please use the [positions endpoint](/reference/Account%20Information/AccountInformation_getUserAccountPositions). The data returned here is cached. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for \"Cache Expiry Time\" to see the exact value for a specific brokerage. **If you need real-time data, please use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint**.
|
@@ -86,20 +56,4 @@ describe 'OptionsApi' do
|
|
86
56
|
end
|
87
57
|
end
|
88
58
|
|
89
|
-
# unit tests for place_option_strategy
|
90
|
-
# Place an option strategy order
|
91
|
-
# Places the option strategy order and returns the order record received from the brokerage.
|
92
|
-
# @param user_id
|
93
|
-
# @param user_secret
|
94
|
-
# @param account_id The ID of the account to execute the strategy in.
|
95
|
-
# @param option_strategy_id Option strategy id obtained from response when creating option strategy object
|
96
|
-
# @param options_place_option_strategy_request
|
97
|
-
# @param [Hash] opts the optional parameters
|
98
|
-
# @return [StrategyOrderRecord]
|
99
|
-
describe 'place_option_strategy test' do
|
100
|
-
it 'should work' do
|
101
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
59
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: snaptrade
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.125
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SnapTrade
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-08-
|
11
|
+
date: 2025-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -193,8 +193,6 @@ files:
|
|
193
193
|
- lib/snaptrade/models/option_strategy.rb
|
194
194
|
- lib/snaptrade/models/option_strategy_legs_inner.rb
|
195
195
|
- lib/snaptrade/models/option_type.rb
|
196
|
-
- lib/snaptrade/models/options_get_option_strategy_request.rb
|
197
|
-
- lib/snaptrade/models/options_place_option_strategy_request.rb
|
198
196
|
- lib/snaptrade/models/options_position.rb
|
199
197
|
- lib/snaptrade/models/options_position_currency.rb
|
200
198
|
- lib/snaptrade/models/options_symbol.rb
|
@@ -363,8 +361,6 @@ files:
|
|
363
361
|
- spec/models/option_strategy_legs_inner_spec.rb
|
364
362
|
- spec/models/option_strategy_spec.rb
|
365
363
|
- spec/models/option_type_spec.rb
|
366
|
-
- spec/models/options_get_option_strategy_request_spec.rb
|
367
|
-
- spec/models/options_place_option_strategy_request_spec.rb
|
368
364
|
- spec/models/options_position_currency_spec.rb
|
369
365
|
- spec/models/options_position_spec.rb
|
370
366
|
- spec/models/options_symbol_spec.rb
|
@@ -464,7 +460,6 @@ test_files:
|
|
464
460
|
- spec/models/trading_instrument_spec.rb
|
465
461
|
- spec/models/session_event_type_spec.rb
|
466
462
|
- spec/models/account_order_record_status_spec.rb
|
467
|
-
- spec/models/options_place_option_strategy_request_spec.rb
|
468
463
|
- spec/models/time_in_force_strict_spec.rb
|
469
464
|
- spec/models/account_universal_activity_spec.rb
|
470
465
|
- spec/models/mleg_order_type_strict_spec.rb
|
@@ -553,7 +548,6 @@ test_files:
|
|
553
548
|
- spec/models/option_chain_inner_chain_per_root_inner_chain_per_strike_price_inner_spec.rb
|
554
549
|
- spec/models/account_status_spec.rb
|
555
550
|
- spec/models/connections_session_events200_response_inner_spec.rb
|
556
|
-
- spec/models/options_get_option_strategy_request_spec.rb
|
557
551
|
- spec/models/trading_instrument_type_spec.rb
|
558
552
|
- spec/models/manual_trade_form_spec.rb
|
559
553
|
- spec/models/rate_of_return_object_spec.rb
|