snaptrade 2.0.124 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c52a939d269906ab92631ba9806d1d7a9f6fc2b06badd2260018ca5046b9e6f5
4
- data.tar.gz: 1d7b5eee9b5ae12d88c244aa086c0c2a7d5e428b3defec7e64a433ded17ffb22
3
+ metadata.gz: 11b241c94a730790636f70715fa1d45ac5d7df7557c49bcc901de21599d320e3
4
+ data.tar.gz: 38cf98011e50e074187dd245424da594e8258f21f133ecc3f9fd1878d16a20a4
5
5
  SHA512:
6
- metadata.gz: 406fe1174adad1ec1ad3962dae8c0c2098c9fc31ad30adbd6cbd8346a271ebf42f06285b129bd8d4f9283cdc16278125e5317aa245e9c4d36205c0b1ab5e8d3e
7
- data.tar.gz: 710d59a5c10de48f22b51b9a36dd2077cdeb5a498c70e2553ae7cd8b012b6a62e2cf27854865479c289001f2dd70c780e182e45d2b5ab834f7ac261bb45e12fc
6
+ metadata.gz: 4020c52948f0d1d9e2840dc0426863a2dfb303ff2480e826389b6d6ff4e53a0a067da4497b861fc2960ee59c3dab1e68b9e976623bd238640e58ce2ecff7c8d8
7
+ data.tar.gz: aa02784c328165731ee75bd5c626441ba2903a5b31cbeb472ed55a070bd47f83645e52d1518311c6b2847e8359f2fc9d30713129877b868c8ff92b1903052bbc
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- snaptrade (2.0.124)
4
+ snaptrade (2.0.125)
5
5
  faraday (>= 1.0.1, < 3.0)
6
6
  faraday-multipart (~> 1.0, >= 1.0.4)
7
7
 
data/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  Connect brokerage accounts to your app for live positions and trading
8
8
 
9
- [![npm](https://img.shields.io/badge/gem-v2.0.124-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.124)
9
+ [![npm](https://img.shields.io/badge/gem-v2.0.125-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.125)
10
10
  [![More Info](https://img.shields.io/badge/More%20Info-Click%20Here-orange)](https://snaptrade.com/)
11
11
 
12
12
  </div>
@@ -44,11 +44,8 @@ Connect brokerage accounts to your app for live positions and trading
44
44
  * [`snaptrade.connections.remove_brokerage_authorization`](#snaptradeconnectionsremove_brokerage_authorization)
45
45
  * [`snaptrade.connections.return_rates`](#snaptradeconnectionsreturn_rates)
46
46
  * [`snaptrade.connections.session_events`](#snaptradeconnectionssession_events)
47
- * [`snaptrade.options.get_option_strategy`](#snaptradeoptionsget_option_strategy)
48
47
  * [`snaptrade.options.get_options_chain`](#snaptradeoptionsget_options_chain)
49
- * [`snaptrade.options.get_options_strategy_quote`](#snaptradeoptionsget_options_strategy_quote)
50
48
  * [`snaptrade.options.list_option_holdings`](#snaptradeoptionslist_option_holdings)
51
- * [`snaptrade.options.place_option_strategy`](#snaptradeoptionsplace_option_strategy)
52
49
  * [`snaptrade.reference_data.get_currency_exchange_rate_pair`](#snaptradereference_dataget_currency_exchange_rate_pair)
53
50
  * [`snaptrade.reference_data.get_partner_info`](#snaptradereference_dataget_partner_info)
54
51
  * [`snaptrade.reference_data.get_security_types`](#snaptradereference_dataget_security_types)
@@ -84,7 +81,7 @@ Connect brokerage accounts to your app for live positions and trading
84
81
  Add to Gemfile:
85
82
 
86
83
  ```ruby
87
- gem 'snaptrade', '~> 2.0.124'
84
+ gem 'snaptrade', '~> 2.0.125'
88
85
  ```
89
86
 
90
87
  ## Getting Started<a id="getting-started"></a>
@@ -1085,54 +1082,6 @@ specific users
1085
1082
  ---
1086
1083
 
1087
1084
 
1088
- ### `snaptrade.options.get_option_strategy`<a id="snaptradeoptionsget_option_strategy"></a>
1089
-
1090
- Creates an option strategy object that will be used to place an option strategy order.
1091
-
1092
-
1093
- #### 🛠️ Usage<a id="🛠️-usage"></a>
1094
-
1095
- ```ruby
1096
- result = snaptrade.options.get_option_strategy(
1097
- underlying_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
1098
- legs: [
1099
- {
1100
- "action" => "BUY_TO_OPEN",
1101
- "option_symbol_id" => "SPY220819P00200000",
1102
- "quantity" => 1,
1103
- }
1104
- ],
1105
- strategy_type: "CUSTOM",
1106
- user_id: "snaptrade-user-123",
1107
- user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
1108
- account_id: "accountId_example",
1109
- )
1110
- p result
1111
- ```
1112
-
1113
- #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1114
-
1115
- ##### underlying_symbol_id: `String`<a id="underlying_symbol_id-string"></a>
1116
- ##### legs: Array<[`OptionLeg`](./lib/snaptrade/models/option_leg.rb)><a id="legs-array"></a>
1117
- ##### strategy_type: [`StrategyType`](./lib/snaptrade/models/strategy_type.rb)<a id="strategy_type-strategytypelibsnaptrademodelsstrategy_typerb"></a>
1118
- ##### user_id: `String`<a id="user_id-string"></a>
1119
- ##### user_secret: `String`<a id="user_secret-string"></a>
1120
- ##### account_id: `String`<a id="account_id-string"></a>
1121
- The ID of the account to create the option strategy object in.
1122
-
1123
- #### 🔄 Return<a id="🔄-return"></a>
1124
-
1125
- [StrategyQuotes](./lib/snaptrade/models/strategy_quotes.rb)
1126
-
1127
- #### 🌐 Endpoint<a id="🌐-endpoint"></a>
1128
-
1129
- `/accounts/{accountId}/optionStrategy` `POST`
1130
-
1131
- [🔙 **Back to Table of Contents**](#table-of-contents)
1132
-
1133
- ---
1134
-
1135
-
1136
1085
  ### `snaptrade.options.get_options_chain`<a id="snaptradeoptionsget_options_chain"></a>
1137
1086
 
1138
1087
  Returns the option chain for the specified symbol in the specified account.
@@ -1172,46 +1121,6 @@ Universal symbol ID if symbol
1172
1121
  ---
1173
1122
 
1174
1123
 
1175
- ### `snaptrade.options.get_options_strategy_quote`<a id="snaptradeoptionsget_options_strategy_quote"></a>
1176
-
1177
- Returns a Strategy Quotes object which has latest market data of the specified option strategy.
1178
-
1179
-
1180
- #### 🛠️ Usage<a id="🛠️-usage"></a>
1181
-
1182
- ```ruby
1183
- result = snaptrade.options.get_options_strategy_quote(
1184
- user_id: "snaptrade-user-123",
1185
- user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
1186
- account_id: "accountId_example",
1187
- option_strategy_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
1188
- )
1189
- p result
1190
- ```
1191
-
1192
- #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1193
-
1194
- ##### user_id: `String`<a id="user_id-string"></a>
1195
- ##### user_secret: `String`<a id="user_secret-string"></a>
1196
- ##### account_id: `String`<a id="account_id-string"></a>
1197
- The ID of the account the strategy will be placed in.
1198
-
1199
- ##### option_strategy_id: `String`<a id="option_strategy_id-string"></a>
1200
- Option strategy id obtained from response when creating option strategy object
1201
-
1202
- #### 🔄 Return<a id="🔄-return"></a>
1203
-
1204
- [StrategyQuotes](./lib/snaptrade/models/strategy_quotes.rb)
1205
-
1206
- #### 🌐 Endpoint<a id="🌐-endpoint"></a>
1207
-
1208
- `/accounts/{accountId}/optionStrategy/{optionStrategyId}` `GET`
1209
-
1210
- [🔙 **Back to Table of Contents**](#table-of-contents)
1211
-
1212
- ---
1213
-
1214
-
1215
1124
  ### `snaptrade.options.list_option_holdings`<a id="snaptradeoptionslist_option_holdings"></a>
1216
1125
 
1217
1126
  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).
@@ -1248,66 +1157,6 @@ p result
1248
1157
  ---
1249
1158
 
1250
1159
 
1251
- ### `snaptrade.options.place_option_strategy`<a id="snaptradeoptionsplace_option_strategy"></a>
1252
-
1253
- Places the option strategy order and returns the order record received from the brokerage.
1254
-
1255
- #### 🛠️ Usage<a id="🛠️-usage"></a>
1256
-
1257
- ```ruby
1258
- result = snaptrade.options.place_option_strategy(
1259
- order_type: "Market",
1260
- time_in_force: "Day",
1261
- user_id: "snaptrade-user-123",
1262
- user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
1263
- account_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
1264
- option_strategy_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
1265
- price: 31.33,
1266
- )
1267
- p result
1268
- ```
1269
-
1270
- #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1271
-
1272
- ##### order_type: [`OrderTypeStrict`](./lib/snaptrade/models/order_type_strict.rb)<a id="order_type-ordertypestrictlibsnaptrademodelsorder_type_strictrb"></a>
1273
- The type of order to place. - For `Limit` and `StopLimit` orders, the `price`
1274
- field is required. - For `Stop` and `StopLimit` orders, the `stop` field is
1275
- required.
1276
-
1277
- ##### time_in_force: [`TimeInForceStrict`](./lib/snaptrade/models/time_in_force_strict.rb)<a id="time_in_force-timeinforcestrictlibsnaptrademodelstime_in_force_strictrb"></a>
1278
- The Time in Force type for the order. This field indicates how long the order
1279
- will remain active before it is executed or expires. Here are the supported
1280
- values: - `Day` - Day. The order is valid only for the trading day on which it
1281
- is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed
1282
- or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety
1283
- immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order
1284
- must be executed immediately. Any portion of the order that cannot be filled
1285
- immediately will be canceled.
1286
-
1287
- ##### user_id: `String`<a id="user_id-string"></a>
1288
- ##### user_secret: `String`<a id="user_secret-string"></a>
1289
- ##### account_id: `String`<a id="account_id-string"></a>
1290
- The ID of the account to execute the strategy in.
1291
-
1292
- ##### option_strategy_id: `String`<a id="option_strategy_id-string"></a>
1293
- Option strategy id obtained from response when creating option strategy object
1294
-
1295
- ##### price: `Float`<a id="price-float"></a>
1296
- Trade Price if limit or stop limit order
1297
-
1298
- #### 🔄 Return<a id="🔄-return"></a>
1299
-
1300
- [StrategyOrderRecord](./lib/snaptrade/models/strategy_order_record.rb)
1301
-
1302
- #### 🌐 Endpoint<a id="🌐-endpoint"></a>
1303
-
1304
- `/accounts/{accountId}/optionStrategy/{optionStrategyId}/execute` `POST`
1305
-
1306
- [🔙 **Back to Table of Contents**](#table-of-contents)
1307
-
1308
- ---
1309
-
1310
-
1311
1160
  ### `snaptrade.reference_data.get_currency_exchange_rate_pair`<a id="snaptradereference_dataget_currency_exchange_rate_pair"></a>
1312
1161
 
1313
1162
  Returns an Exchange Rate Pair object for the specified Currency Pair.
@@ -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
@@ -8,5 +8,5 @@ Contact: api@snaptrade.com
8
8
  =end
9
9
 
10
10
  module SnapTrade
11
- VERSION = '2.0.124'
11
+ VERSION = '2.0.125'
12
12
  end
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'
@@ -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&#x3D;d16c4c97b8d5438bbb2d8581ac53b11e) and look for \&quot;Cache Expiry Time\&quot; 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.124
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-20 00:00:00.000000000 Z
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
@@ -1,251 +0,0 @@
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
- =end
9
-
10
- require 'date'
11
- require 'time'
12
-
13
- module SnapTrade
14
- class OptionsGetOptionStrategyRequest
15
- attr_accessor :underlying_symbol_id
16
-
17
- attr_accessor :legs
18
-
19
- attr_accessor :strategy_type
20
-
21
- # Attribute mapping from ruby-style variable name to JSON key.
22
- def self.attribute_map
23
- {
24
- :'underlying_symbol_id' => :'underlying_symbol_id',
25
- :'legs' => :'legs',
26
- :'strategy_type' => :'strategy_type'
27
- }
28
- end
29
-
30
- # Returns all the JSON keys this model knows about
31
- def self.acceptable_attributes
32
- attribute_map.values
33
- end
34
-
35
- # Attribute type mapping.
36
- def self.openapi_types
37
- {
38
- :'underlying_symbol_id' => :'String',
39
- :'legs' => :'Array<OptionLeg>',
40
- :'strategy_type' => :'StrategyType'
41
- }
42
- end
43
-
44
- # List of attributes with nullable: true
45
- def self.openapi_nullable
46
- Set.new([
47
- ])
48
- end
49
-
50
- # Initializes the object
51
- # @param [Hash] attributes Model attributes in the form of hash
52
- def initialize(attributes = {})
53
- if (!attributes.is_a?(Hash))
54
- fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::OptionsGetOptionStrategyRequest` initialize method"
55
- end
56
-
57
- # check to see if the attribute exists and convert string to symbol for hash key
58
- attributes = attributes.each_with_object({}) { |(k, v), h|
59
- if (!self.class.attribute_map.key?(k.to_sym))
60
- fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::OptionsGetOptionStrategyRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
61
- end
62
- h[k.to_sym] = v
63
- }
64
-
65
- if attributes.key?(:'underlying_symbol_id')
66
- self.underlying_symbol_id = attributes[:'underlying_symbol_id']
67
- end
68
-
69
- if attributes.key?(:'legs')
70
- if (value = attributes[:'legs']).is_a?(Array)
71
- self.legs = value
72
- end
73
- end
74
-
75
- if attributes.key?(:'strategy_type')
76
- self.strategy_type = attributes[:'strategy_type']
77
- end
78
- end
79
-
80
- # Show invalid properties with the reasons. Usually used together with valid?
81
- # @return Array for valid properties with the reasons
82
- def list_invalid_properties
83
- invalid_properties = Array.new
84
- if @underlying_symbol_id.nil?
85
- invalid_properties.push('invalid value for "underlying_symbol_id", underlying_symbol_id cannot be nil.')
86
- end
87
-
88
- if @legs.nil?
89
- invalid_properties.push('invalid value for "legs", legs cannot be nil.')
90
- end
91
-
92
- if @strategy_type.nil?
93
- invalid_properties.push('invalid value for "strategy_type", strategy_type cannot be nil.')
94
- end
95
-
96
- invalid_properties
97
- end
98
-
99
- # Check to see if the all the properties in the model are valid
100
- # @return true if the model is valid
101
- def valid?
102
- return false if @underlying_symbol_id.nil?
103
- return false if @legs.nil?
104
- return false if @strategy_type.nil?
105
- true
106
- end
107
-
108
- # Checks equality by comparing each attribute.
109
- # @param [Object] Object to be compared
110
- def ==(o)
111
- return true if self.equal?(o)
112
- self.class == o.class &&
113
- underlying_symbol_id == o.underlying_symbol_id &&
114
- legs == o.legs &&
115
- strategy_type == o.strategy_type
116
- end
117
-
118
- # @see the `==` method
119
- # @param [Object] Object to be compared
120
- def eql?(o)
121
- self == o
122
- end
123
-
124
- # Calculates hash code according to all attributes.
125
- # @return [Integer] Hash code
126
- def hash
127
- [underlying_symbol_id, legs, strategy_type].hash
128
- end
129
-
130
- # Builds the object from hash
131
- # @param [Hash] attributes Model attributes in the form of hash
132
- # @return [Object] Returns the model itself
133
- def self.build_from_hash(attributes)
134
- new.build_from_hash(attributes)
135
- end
136
-
137
- # Builds the object from hash
138
- # @param [Hash] attributes Model attributes in the form of hash
139
- # @return [Object] Returns the model itself
140
- def build_from_hash(attributes)
141
- return nil unless attributes.is_a?(Hash)
142
- attributes = attributes.transform_keys(&:to_sym)
143
- self.class.openapi_types.each_pair do |key, type|
144
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
145
- self.send("#{key}=", nil)
146
- elsif type =~ /\AArray<(.*)>/i
147
- # check to ensure the input is an array given that the attribute
148
- # is documented as an array but the input is not
149
- if attributes[self.class.attribute_map[key]].is_a?(Array)
150
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
151
- end
152
- elsif !attributes[self.class.attribute_map[key]].nil?
153
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
154
- end
155
- end
156
-
157
- self
158
- end
159
-
160
- # Deserializes the data based on type
161
- # @param string type Data type
162
- # @param string value Value to be deserialized
163
- # @return [Object] Deserialized data
164
- def _deserialize(type, value)
165
- case type.to_sym
166
- when :Time
167
- Time.parse(value)
168
- when :Date
169
- Date.parse(value)
170
- when :String
171
- value.to_s
172
- when :Integer
173
- value.to_i
174
- when :Float
175
- value.to_f
176
- when :Boolean
177
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
178
- true
179
- else
180
- false
181
- end
182
- when :Object
183
- # generic object (usually a Hash), return directly
184
- value
185
- when /\AArray<(?<inner_type>.+)>\z/
186
- inner_type = Regexp.last_match[:inner_type]
187
- value.map { |v| _deserialize(inner_type, v) }
188
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
189
- k_type = Regexp.last_match[:k_type]
190
- v_type = Regexp.last_match[:v_type]
191
- {}.tap do |hash|
192
- value.each do |k, v|
193
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
194
- end
195
- end
196
- else # model
197
- # models (e.g. Pet) or oneOf
198
- klass = SnapTrade.const_get(type)
199
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
200
- end
201
- end
202
-
203
- # Returns the string representation of the object
204
- # @return [String] String presentation of the object
205
- def to_s
206
- to_hash.to_s
207
- end
208
-
209
- # to_body is an alias to to_hash (backward compatibility)
210
- # @return [Hash] Returns the object in the form of hash
211
- def to_body
212
- to_hash
213
- end
214
-
215
- # Returns the object in the form of hash
216
- # @return [Hash] Returns the object in the form of hash
217
- def to_hash
218
- hash = {}
219
- self.class.attribute_map.each_pair do |attr, param|
220
- value = self.send(attr)
221
- if value.nil?
222
- is_nullable = self.class.openapi_nullable.include?(attr)
223
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
224
- end
225
-
226
- hash[param] = _to_hash(value)
227
- end
228
- hash
229
- end
230
-
231
- # Outputs non-array value in the form of hash
232
- # For object, use to_hash. Otherwise, just return the value
233
- # @param [Object] value Any valid value
234
- # @return [Hash] Returns the value in the form of hash
235
- def _to_hash(value)
236
- if value.is_a?(Array)
237
- value.compact.map { |v| _to_hash(v) }
238
- elsif value.is_a?(Hash)
239
- {}.tap do |hash|
240
- value.each { |k, v| hash[k] = _to_hash(v) }
241
- end
242
- elsif value.respond_to? :to_hash
243
- value.to_hash
244
- else
245
- value
246
- end
247
- end
248
-
249
- end
250
-
251
- end
@@ -1,248 +0,0 @@
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
- =end
9
-
10
- require 'date'
11
- require 'time'
12
-
13
- module SnapTrade
14
- class OptionsPlaceOptionStrategyRequest
15
- # 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.
16
- attr_accessor :order_type
17
-
18
- # 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.
19
- attr_accessor :time_in_force
20
-
21
- # Trade Price if limit or stop limit order
22
- attr_accessor :price
23
-
24
- # Attribute mapping from ruby-style variable name to JSON key.
25
- def self.attribute_map
26
- {
27
- :'order_type' => :'order_type',
28
- :'time_in_force' => :'time_in_force',
29
- :'price' => :'price'
30
- }
31
- end
32
-
33
- # Returns all the JSON keys this model knows about
34
- def self.acceptable_attributes
35
- attribute_map.values
36
- end
37
-
38
- # Attribute type mapping.
39
- def self.openapi_types
40
- {
41
- :'order_type' => :'OrderTypeStrict',
42
- :'time_in_force' => :'TimeInForceStrict',
43
- :'price' => :'Float'
44
- }
45
- end
46
-
47
- # List of attributes with nullable: true
48
- def self.openapi_nullable
49
- Set.new([
50
- :'price'
51
- ])
52
- end
53
-
54
- # Initializes the object
55
- # @param [Hash] attributes Model attributes in the form of hash
56
- def initialize(attributes = {})
57
- if (!attributes.is_a?(Hash))
58
- fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::OptionsPlaceOptionStrategyRequest` initialize method"
59
- end
60
-
61
- # check to see if the attribute exists and convert string to symbol for hash key
62
- attributes = attributes.each_with_object({}) { |(k, v), h|
63
- if (!self.class.attribute_map.key?(k.to_sym))
64
- fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::OptionsPlaceOptionStrategyRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
65
- end
66
- h[k.to_sym] = v
67
- }
68
-
69
- if attributes.key?(:'order_type')
70
- self.order_type = attributes[:'order_type']
71
- end
72
-
73
- if attributes.key?(:'time_in_force')
74
- self.time_in_force = attributes[:'time_in_force']
75
- end
76
-
77
- if attributes.key?(:'price')
78
- self.price = attributes[:'price']
79
- end
80
- end
81
-
82
- # Show invalid properties with the reasons. Usually used together with valid?
83
- # @return Array for valid properties with the reasons
84
- def list_invalid_properties
85
- invalid_properties = Array.new
86
- if @order_type.nil?
87
- invalid_properties.push('invalid value for "order_type", order_type cannot be nil.')
88
- end
89
-
90
- if @time_in_force.nil?
91
- invalid_properties.push('invalid value for "time_in_force", time_in_force cannot be nil.')
92
- end
93
-
94
- invalid_properties
95
- end
96
-
97
- # Check to see if the all the properties in the model are valid
98
- # @return true if the model is valid
99
- def valid?
100
- return false if @order_type.nil?
101
- return false if @time_in_force.nil?
102
- true
103
- end
104
-
105
- # Checks equality by comparing each attribute.
106
- # @param [Object] Object to be compared
107
- def ==(o)
108
- return true if self.equal?(o)
109
- self.class == o.class &&
110
- order_type == o.order_type &&
111
- time_in_force == o.time_in_force &&
112
- price == o.price
113
- end
114
-
115
- # @see the `==` method
116
- # @param [Object] Object to be compared
117
- def eql?(o)
118
- self == o
119
- end
120
-
121
- # Calculates hash code according to all attributes.
122
- # @return [Integer] Hash code
123
- def hash
124
- [order_type, time_in_force, price].hash
125
- end
126
-
127
- # Builds the object from hash
128
- # @param [Hash] attributes Model attributes in the form of hash
129
- # @return [Object] Returns the model itself
130
- def self.build_from_hash(attributes)
131
- new.build_from_hash(attributes)
132
- end
133
-
134
- # Builds the object from hash
135
- # @param [Hash] attributes Model attributes in the form of hash
136
- # @return [Object] Returns the model itself
137
- def build_from_hash(attributes)
138
- return nil unless attributes.is_a?(Hash)
139
- attributes = attributes.transform_keys(&:to_sym)
140
- self.class.openapi_types.each_pair do |key, type|
141
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
142
- self.send("#{key}=", nil)
143
- elsif type =~ /\AArray<(.*)>/i
144
- # check to ensure the input is an array given that the attribute
145
- # is documented as an array but the input is not
146
- if attributes[self.class.attribute_map[key]].is_a?(Array)
147
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
148
- end
149
- elsif !attributes[self.class.attribute_map[key]].nil?
150
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
151
- end
152
- end
153
-
154
- self
155
- end
156
-
157
- # Deserializes the data based on type
158
- # @param string type Data type
159
- # @param string value Value to be deserialized
160
- # @return [Object] Deserialized data
161
- def _deserialize(type, value)
162
- case type.to_sym
163
- when :Time
164
- Time.parse(value)
165
- when :Date
166
- Date.parse(value)
167
- when :String
168
- value.to_s
169
- when :Integer
170
- value.to_i
171
- when :Float
172
- value.to_f
173
- when :Boolean
174
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
175
- true
176
- else
177
- false
178
- end
179
- when :Object
180
- # generic object (usually a Hash), return directly
181
- value
182
- when /\AArray<(?<inner_type>.+)>\z/
183
- inner_type = Regexp.last_match[:inner_type]
184
- value.map { |v| _deserialize(inner_type, v) }
185
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
186
- k_type = Regexp.last_match[:k_type]
187
- v_type = Regexp.last_match[:v_type]
188
- {}.tap do |hash|
189
- value.each do |k, v|
190
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
191
- end
192
- end
193
- else # model
194
- # models (e.g. Pet) or oneOf
195
- klass = SnapTrade.const_get(type)
196
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
197
- end
198
- end
199
-
200
- # Returns the string representation of the object
201
- # @return [String] String presentation of the object
202
- def to_s
203
- to_hash.to_s
204
- end
205
-
206
- # to_body is an alias to to_hash (backward compatibility)
207
- # @return [Hash] Returns the object in the form of hash
208
- def to_body
209
- to_hash
210
- end
211
-
212
- # Returns the object in the form of hash
213
- # @return [Hash] Returns the object in the form of hash
214
- def to_hash
215
- hash = {}
216
- self.class.attribute_map.each_pair do |attr, param|
217
- value = self.send(attr)
218
- if value.nil?
219
- is_nullable = self.class.openapi_nullable.include?(attr)
220
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
221
- end
222
-
223
- hash[param] = _to_hash(value)
224
- end
225
- hash
226
- end
227
-
228
- # Outputs non-array value in the form of hash
229
- # For object, use to_hash. Otherwise, just return the value
230
- # @param [Object] value Any valid value
231
- # @return [Hash] Returns the value in the form of hash
232
- def _to_hash(value)
233
- if value.is_a?(Array)
234
- value.compact.map { |v| _to_hash(v) }
235
- elsif value.is_a?(Hash)
236
- {}.tap do |hash|
237
- value.each { |k, v| hash[k] = _to_hash(v) }
238
- end
239
- elsif value.respond_to? :to_hash
240
- value.to_hash
241
- else
242
- value
243
- end
244
- end
245
-
246
- end
247
-
248
- end
@@ -1,41 +0,0 @@
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
- =end
9
-
10
- require 'spec_helper'
11
- require 'json'
12
- require 'date'
13
-
14
- # Unit tests for SnapTrade::OptionsGetOptionStrategyRequest
15
- describe SnapTrade::OptionsGetOptionStrategyRequest do
16
- let(:instance) { SnapTrade::OptionsGetOptionStrategyRequest.new }
17
-
18
- describe 'test an instance of OptionsGetOptionStrategyRequest' do
19
- it 'should create an instance of OptionsGetOptionStrategyRequest' do
20
- expect(instance).to be_instance_of(SnapTrade::OptionsGetOptionStrategyRequest)
21
- end
22
- end
23
- describe 'test attribute "underlying_symbol_id"' do
24
- it 'should work' do
25
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
26
- end
27
- end
28
-
29
- describe 'test attribute "legs"' do
30
- it 'should work' do
31
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
32
- end
33
- end
34
-
35
- describe 'test attribute "strategy_type"' do
36
- it 'should work' do
37
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
38
- end
39
- end
40
-
41
- end
@@ -1,41 +0,0 @@
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
- =end
9
-
10
- require 'spec_helper'
11
- require 'json'
12
- require 'date'
13
-
14
- # Unit tests for SnapTrade::OptionsPlaceOptionStrategyRequest
15
- describe SnapTrade::OptionsPlaceOptionStrategyRequest do
16
- let(:instance) { SnapTrade::OptionsPlaceOptionStrategyRequest.new }
17
-
18
- describe 'test an instance of OptionsPlaceOptionStrategyRequest' do
19
- it 'should create an instance of OptionsPlaceOptionStrategyRequest' do
20
- expect(instance).to be_instance_of(SnapTrade::OptionsPlaceOptionStrategyRequest)
21
- end
22
- end
23
- describe 'test attribute "order_type"' do
24
- it 'should work' do
25
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
26
- end
27
- end
28
-
29
- describe 'test attribute "time_in_force"' do
30
- it 'should work' do
31
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
32
- end
33
- end
34
-
35
- describe 'test attribute "price"' do
36
- it 'should work' do
37
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
38
- end
39
- end
40
-
41
- end