snaptrade 2.0.198 → 2.0.199

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.
@@ -0,0 +1,697 @@
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 'cgi'
11
+
12
+ module SnapTrade
13
+ class ExperimentalEndpointsApi
14
+ attr_accessor :api_client
15
+
16
+ def initialize(api_client = ApiClient.default)
17
+ @api_client = api_client
18
+ end
19
+
20
+ # Add a Trade Detection subscription
21
+ #
22
+ # Adds or restores a Trade Detection subscription for a connected brokerage account.
23
+ # This endpoint requires `userId` and `userSecret` in addition to the partner signature.
24
+ #
25
+ # @param account_id [String] Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
26
+ # @param user_id [String]
27
+ # @param user_secret [String]
28
+ # @param body [TradeDetectionAddSubscriptionRequest]
29
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
30
+ def add_subscription(account_id:, user_id:, user_secret:, extra: {})
31
+ _body = {}
32
+ _body[:account_id] = account_id if account_id != SENTINEL
33
+ trade_detection_add_subscription_request = _body
34
+ data, _status_code, _headers = add_subscription_with_http_info_impl(user_id, user_secret, trade_detection_add_subscription_request, extra)
35
+ data
36
+ end
37
+
38
+ # Add a Trade Detection subscription
39
+ #
40
+ # Adds or restores a Trade Detection subscription for a connected brokerage account.
41
+ # This endpoint requires `userId` and `userSecret` in addition to the partner signature.
42
+ #
43
+ # @param account_id [String] Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
44
+ # @param user_id [String]
45
+ # @param user_secret [String]
46
+ # @param body [TradeDetectionAddSubscriptionRequest]
47
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
48
+ def add_subscription_with_http_info(account_id:, user_id:, user_secret:, extra: {})
49
+ _body = {}
50
+ _body[:account_id] = account_id if account_id != SENTINEL
51
+ trade_detection_add_subscription_request = _body
52
+ add_subscription_with_http_info_impl(user_id, user_secret, trade_detection_add_subscription_request, extra)
53
+ end
54
+
55
+ # Add a Trade Detection subscription
56
+ # Adds or restores a Trade Detection subscription for a connected brokerage account. This endpoint requires `userId` and `userSecret` in addition to the partner signature.
57
+ # @param user_id [String]
58
+ # @param user_secret [String]
59
+ # @param trade_detection_add_subscription_request [TradeDetectionAddSubscriptionRequest]
60
+ # @param [Hash] opts the optional parameters
61
+ # @return [TradeDetectionSubscription]
62
+ private def add_subscription_impl(user_id, user_secret, trade_detection_add_subscription_request, opts = {})
63
+ data, _status_code, _headers = add_subscription_with_http_info(user_id, user_secret, trade_detection_add_subscription_request, opts)
64
+ data
65
+ end
66
+
67
+ # Add a Trade Detection subscription
68
+ # Adds or restores a Trade Detection subscription for a connected brokerage account. This endpoint requires `userId` and `userSecret` in addition to the partner signature.
69
+ # @param user_id [String]
70
+ # @param user_secret [String]
71
+ # @param trade_detection_add_subscription_request [TradeDetectionAddSubscriptionRequest]
72
+ # @param [Hash] opts the optional parameters
73
+ # @return [Array<(TradeDetectionSubscription, Integer, Hash)>] TradeDetectionSubscription data, response status code and response headers
74
+ private def add_subscription_with_http_info_impl(user_id, user_secret, trade_detection_add_subscription_request, opts = {})
75
+ if @api_client.config.debugging
76
+ @api_client.config.logger.debug 'Calling API: ExperimentalEndpointsApi.add_subscription ...'
77
+ end
78
+ # verify the required parameter 'user_id' is set
79
+ if @api_client.config.client_side_validation && user_id.nil?
80
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling ExperimentalEndpointsApi.add_subscription"
81
+ end
82
+ # verify the required parameter 'user_secret' is set
83
+ if @api_client.config.client_side_validation && user_secret.nil?
84
+ fail ArgumentError, "Missing the required parameter 'user_secret' when calling ExperimentalEndpointsApi.add_subscription"
85
+ end
86
+ # verify the required parameter 'trade_detection_add_subscription_request' is set
87
+ if @api_client.config.client_side_validation && trade_detection_add_subscription_request.nil?
88
+ fail ArgumentError, "Missing the required parameter 'trade_detection_add_subscription_request' when calling ExperimentalEndpointsApi.add_subscription"
89
+ end
90
+ # resource path
91
+ local_var_path = '/snapTrade/tradeDetection/subscriptions'
92
+
93
+ # query parameters
94
+ query_params = opts[:query_params] || {}
95
+ query_params[:'userId'] = user_id
96
+ query_params[:'userSecret'] = user_secret
97
+
98
+ # header parameters
99
+ header_params = opts[:header_params] || {}
100
+ # HTTP header 'Accept' (if needed)
101
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
102
+ # HTTP header 'Content-Type'
103
+ content_type = @api_client.select_header_content_type(['application/json'])
104
+ if !content_type.nil?
105
+ header_params['Content-Type'] = content_type
106
+ end
107
+
108
+ # form parameters
109
+ form_params = opts[:form_params] || {}
110
+
111
+ # http body (model)
112
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(trade_detection_add_subscription_request)
113
+
114
+ # return_type
115
+ return_type = opts[:debug_return_type] || 'TradeDetectionSubscription'
116
+
117
+ # auth_names
118
+ auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
119
+
120
+ new_options = opts.merge(
121
+ :operation => :"ExperimentalEndpointsApi.add_subscription",
122
+ :header_params => header_params,
123
+ :query_params => query_params,
124
+ :form_params => form_params,
125
+ :body => post_body,
126
+ :auth_names => auth_names,
127
+ :return_type => return_type
128
+ )
129
+
130
+ data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
131
+ if @api_client.config.debugging
132
+ @api_client.config.logger.debug "API called: ExperimentalEndpointsApi#add_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
133
+ end
134
+ return data, status_code, headers, response
135
+ end
136
+
137
+
138
+ # Cancel a Trade Detection subscription
139
+ #
140
+ # Cancels a Trade Detection subscription for a connected brokerage account.
141
+ # This endpoint requires partner signature authentication only and does not require `userId` or `userSecret`.
142
+ #
143
+ # @param account_id [String] Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
144
+ # @param body [TradeDetectionAddSubscriptionRequest]
145
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
146
+ def cancel_subscription(account_id:, extra: {})
147
+ _body = {}
148
+ _body[:account_id] = account_id if account_id != SENTINEL
149
+ trade_detection_add_subscription_request = _body
150
+ data, _status_code, _headers = cancel_subscription_with_http_info_impl(trade_detection_add_subscription_request, extra)
151
+ data
152
+ end
153
+
154
+ # Cancel a Trade Detection subscription
155
+ #
156
+ # Cancels a Trade Detection subscription for a connected brokerage account.
157
+ # This endpoint requires partner signature authentication only and does not require `userId` or `userSecret`.
158
+ #
159
+ # @param account_id [String] Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
160
+ # @param body [TradeDetectionAddSubscriptionRequest]
161
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
162
+ def cancel_subscription_with_http_info(account_id:, extra: {})
163
+ _body = {}
164
+ _body[:account_id] = account_id if account_id != SENTINEL
165
+ trade_detection_add_subscription_request = _body
166
+ cancel_subscription_with_http_info_impl(trade_detection_add_subscription_request, extra)
167
+ end
168
+
169
+ # Cancel a Trade Detection subscription
170
+ # Cancels a Trade Detection subscription for a connected brokerage account. This endpoint requires partner signature authentication only and does not require `userId` or `userSecret`.
171
+ # @param trade_detection_add_subscription_request [TradeDetectionAddSubscriptionRequest]
172
+ # @param [Hash] opts the optional parameters
173
+ # @return [TradeDetectionCancelSubscriptionResponse]
174
+ private def cancel_subscription_impl(trade_detection_add_subscription_request, opts = {})
175
+ data, _status_code, _headers = cancel_subscription_with_http_info(trade_detection_add_subscription_request, opts)
176
+ data
177
+ end
178
+
179
+ # Cancel a Trade Detection subscription
180
+ # Cancels a Trade Detection subscription for a connected brokerage account. This endpoint requires partner signature authentication only and does not require &#x60;userId&#x60; or &#x60;userSecret&#x60;.
181
+ # @param trade_detection_add_subscription_request [TradeDetectionAddSubscriptionRequest]
182
+ # @param [Hash] opts the optional parameters
183
+ # @return [Array<(TradeDetectionCancelSubscriptionResponse, Integer, Hash)>] TradeDetectionCancelSubscriptionResponse data, response status code and response headers
184
+ private def cancel_subscription_with_http_info_impl(trade_detection_add_subscription_request, opts = {})
185
+ if @api_client.config.debugging
186
+ @api_client.config.logger.debug 'Calling API: ExperimentalEndpointsApi.cancel_subscription ...'
187
+ end
188
+ # verify the required parameter 'trade_detection_add_subscription_request' is set
189
+ if @api_client.config.client_side_validation && trade_detection_add_subscription_request.nil?
190
+ fail ArgumentError, "Missing the required parameter 'trade_detection_add_subscription_request' when calling ExperimentalEndpointsApi.cancel_subscription"
191
+ end
192
+ # resource path
193
+ local_var_path = '/snapTrade/tradeDetection/subscriptions/cancel'
194
+
195
+ # query parameters
196
+ query_params = opts[:query_params] || {}
197
+
198
+ # header parameters
199
+ header_params = opts[:header_params] || {}
200
+ # HTTP header 'Accept' (if needed)
201
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
202
+ # HTTP header 'Content-Type'
203
+ content_type = @api_client.select_header_content_type(['application/json'])
204
+ if !content_type.nil?
205
+ header_params['Content-Type'] = content_type
206
+ end
207
+
208
+ # form parameters
209
+ form_params = opts[:form_params] || {}
210
+
211
+ # http body (model)
212
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(trade_detection_add_subscription_request)
213
+
214
+ # return_type
215
+ return_type = opts[:debug_return_type] || 'TradeDetectionCancelSubscriptionResponse'
216
+
217
+ # auth_names
218
+ auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
219
+
220
+ new_options = opts.merge(
221
+ :operation => :"ExperimentalEndpointsApi.cancel_subscription",
222
+ :header_params => header_params,
223
+ :query_params => query_params,
224
+ :form_params => form_params,
225
+ :body => post_body,
226
+ :auth_names => auth_names,
227
+ :return_type => return_type
228
+ )
229
+
230
+ data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
231
+ if @api_client.config.debugging
232
+ @api_client.config.logger.debug "API called: ExperimentalEndpointsApi#cancel_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
233
+ end
234
+ return data, status_code, headers, response
235
+ end
236
+
237
+
238
+ # Get account order detail (V2)
239
+ #
240
+ # Returns the detail of a single order using the brokerage order ID provided as a path parameter.
241
+ #
242
+ # The V2 order response format includes all legs of the order in the `legs` list field.
243
+ # If the order is single legged, `legs` will be a list of one leg.
244
+ #
245
+ # This endpoint is always realtime and does not rely on cached data.
246
+ #
247
+ # This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint.
248
+ #
249
+ # @param account_id [String]
250
+ # @param brokerage_order_id [String]
251
+ # @param user_id [String]
252
+ # @param user_secret [String]
253
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
254
+ def get_user_account_order_detail_v2(account_id:, brokerage_order_id:, user_id:, user_secret:, extra: {})
255
+ data, _status_code, _headers = get_user_account_order_detail_v2_with_http_info_impl(account_id, brokerage_order_id, user_id, user_secret, extra)
256
+ data
257
+ end
258
+
259
+ # Get account order detail (V2)
260
+ #
261
+ # Returns the detail of a single order using the brokerage order ID provided as a path parameter.
262
+ #
263
+ # The V2 order response format includes all legs of the order in the `legs` list field.
264
+ # If the order is single legged, `legs` will be a list of one leg.
265
+ #
266
+ # This endpoint is always realtime and does not rely on cached data.
267
+ #
268
+ # This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint.
269
+ #
270
+ # @param account_id [String]
271
+ # @param brokerage_order_id [String]
272
+ # @param user_id [String]
273
+ # @param user_secret [String]
274
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
275
+ def get_user_account_order_detail_v2_with_http_info(account_id:, brokerage_order_id:, user_id:, user_secret:, extra: {})
276
+ get_user_account_order_detail_v2_with_http_info_impl(account_id, brokerage_order_id, user_id, user_secret, extra)
277
+ end
278
+
279
+ # Get account order detail (V2)
280
+ # Returns the detail of a single order using the brokerage order ID provided as a path parameter. The V2 order response format includes all legs of the order in the `legs` list field. If the order is single legged, `legs` will be a list of one leg. This endpoint is always realtime and does not rely on cached data. This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint.
281
+ # @param account_id [String]
282
+ # @param brokerage_order_id [String]
283
+ # @param user_id [String]
284
+ # @param user_secret [String]
285
+ # @param [Hash] opts the optional parameters
286
+ # @return [AccountOrderRecordV2]
287
+ private def get_user_account_order_detail_v2_impl(account_id, brokerage_order_id, user_id, user_secret, opts = {})
288
+ data, _status_code, _headers = get_user_account_order_detail_v2_with_http_info(account_id, brokerage_order_id, user_id, user_secret, opts)
289
+ data
290
+ end
291
+
292
+ # Get account order detail (V2)
293
+ # Returns the detail of a single order using the brokerage order ID provided as a path parameter. The V2 order response format includes all legs of the order in the &#x60;legs&#x60; list field. If the order is single legged, &#x60;legs&#x60; will be a list of one leg. This endpoint is always realtime and does not rely on cached data. This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint.
294
+ # @param account_id [String]
295
+ # @param brokerage_order_id [String]
296
+ # @param user_id [String]
297
+ # @param user_secret [String]
298
+ # @param [Hash] opts the optional parameters
299
+ # @return [Array<(AccountOrderRecordV2, Integer, Hash)>] AccountOrderRecordV2 data, response status code and response headers
300
+ private def get_user_account_order_detail_v2_with_http_info_impl(account_id, brokerage_order_id, user_id, user_secret, opts = {})
301
+ if @api_client.config.debugging
302
+ @api_client.config.logger.debug 'Calling API: ExperimentalEndpointsApi.get_user_account_order_detail_v2 ...'
303
+ end
304
+ # verify the required parameter 'account_id' is set
305
+ if @api_client.config.client_side_validation && account_id.nil?
306
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling ExperimentalEndpointsApi.get_user_account_order_detail_v2"
307
+ end
308
+ # verify the required parameter 'brokerage_order_id' is set
309
+ if @api_client.config.client_side_validation && brokerage_order_id.nil?
310
+ fail ArgumentError, "Missing the required parameter 'brokerage_order_id' when calling ExperimentalEndpointsApi.get_user_account_order_detail_v2"
311
+ end
312
+ # verify the required parameter 'user_id' is set
313
+ if @api_client.config.client_side_validation && user_id.nil?
314
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling ExperimentalEndpointsApi.get_user_account_order_detail_v2"
315
+ end
316
+ # verify the required parameter 'user_secret' is set
317
+ if @api_client.config.client_side_validation && user_secret.nil?
318
+ fail ArgumentError, "Missing the required parameter 'user_secret' when calling ExperimentalEndpointsApi.get_user_account_order_detail_v2"
319
+ end
320
+ # resource path
321
+ local_var_path = '/accounts/{accountId}/orders/details/v2/{brokerageOrderId}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'brokerageOrderId' + '}', CGI.escape(brokerage_order_id.to_s))
322
+
323
+ # query parameters
324
+ query_params = opts[:query_params] || {}
325
+ query_params[:'userId'] = user_id
326
+ query_params[:'userSecret'] = user_secret
327
+
328
+ # header parameters
329
+ header_params = opts[:header_params] || {}
330
+ # HTTP header 'Accept' (if needed)
331
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
332
+
333
+ # form parameters
334
+ form_params = opts[:form_params] || {}
335
+
336
+ # http body (model)
337
+ post_body = opts[:debug_body]
338
+
339
+ # return_type
340
+ return_type = opts[:debug_return_type] || 'AccountOrderRecordV2'
341
+
342
+ # auth_names
343
+ auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
344
+
345
+ new_options = opts.merge(
346
+ :operation => :"ExperimentalEndpointsApi.get_user_account_order_detail_v2",
347
+ :header_params => header_params,
348
+ :query_params => query_params,
349
+ :form_params => form_params,
350
+ :body => post_body,
351
+ :auth_names => auth_names,
352
+ :return_type => return_type
353
+ )
354
+
355
+ data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
356
+ if @api_client.config.debugging
357
+ @api_client.config.logger.debug "API called: ExperimentalEndpointsApi#get_user_account_order_detail_v2\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
358
+ end
359
+ return data, status_code, headers, response
360
+ end
361
+
362
+
363
+ # List account orders v2
364
+ #
365
+ # Returns a list of recent orders in the specified account.
366
+ #
367
+ # The V2 order response format will include all legs of each order in the `legs` list field. If the order is single legged, `legs` will be a list of one leg.
368
+ #
369
+ # If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
370
+ #
371
+ # @param user_id [String]
372
+ # @param user_secret [String]
373
+ # @param account_id [String]
374
+ # @param state [String] defaults to \"all\"
375
+ # @param days [Integer] Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in. Values greater than 90 will be capped at 90.
376
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
377
+ def get_user_account_orders_v2(user_id:, user_secret:, account_id:, state: SENTINEL, days: SENTINEL, extra: {})
378
+ extra[:state] = state if state != SENTINEL
379
+ extra[:days] = days if days != SENTINEL
380
+ data, _status_code, _headers = get_user_account_orders_v2_with_http_info_impl(user_id, user_secret, account_id, extra)
381
+ data
382
+ end
383
+
384
+ # List account orders v2
385
+ #
386
+ # Returns a list of recent orders in the specified account.
387
+ #
388
+ # The V2 order response format will include all legs of each order in the `legs` list field. If the order is single legged, `legs` will be a list of one leg.
389
+ #
390
+ # If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
391
+ #
392
+ # @param user_id [String]
393
+ # @param user_secret [String]
394
+ # @param account_id [String]
395
+ # @param state [String] defaults to \"all\"
396
+ # @param days [Integer] Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in. Values greater than 90 will be capped at 90.
397
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
398
+ def get_user_account_orders_v2_with_http_info(user_id:, user_secret:, account_id:, state: SENTINEL, days: SENTINEL, extra: {})
399
+ extra[:state] = state if state != SENTINEL
400
+ extra[:days] = days if days != SENTINEL
401
+ get_user_account_orders_v2_with_http_info_impl(user_id, user_secret, account_id, extra)
402
+ end
403
+
404
+ # List account orders v2
405
+ # Returns a list of recent orders in the specified account. The V2 order response format will include all legs of each order in the `legs` list field. If the order is single legged, `legs` will be a list of one leg. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
406
+ # @param user_id [String]
407
+ # @param user_secret [String]
408
+ # @param account_id [String]
409
+ # @param [Hash] opts the optional parameters
410
+ # @option opts [String] :state defaults to \"all\"
411
+ # @option opts [Integer] :days Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in. Values greater than 90 will be capped at 90.
412
+ # @return [AccountOrdersV2Response]
413
+ private def get_user_account_orders_v2_impl(user_id, user_secret, account_id, opts = {})
414
+ data, _status_code, _headers = get_user_account_orders_v2_with_http_info(user_id, user_secret, account_id, opts)
415
+ data
416
+ end
417
+
418
+ # List account orders v2
419
+ # Returns a list of recent orders in the specified account. The V2 order response format will include all legs of each order in the &#x60;legs&#x60; list field. If the order is single legged, &#x60;legs&#x60; will be a list of one leg. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
420
+ # @param user_id [String]
421
+ # @param user_secret [String]
422
+ # @param account_id [String]
423
+ # @param [Hash] opts the optional parameters
424
+ # @option opts [String] :state defaults to \"all\"
425
+ # @option opts [Integer] :days Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in. Values greater than 90 will be capped at 90.
426
+ # @return [Array<(AccountOrdersV2Response, Integer, Hash)>] AccountOrdersV2Response data, response status code and response headers
427
+ private def get_user_account_orders_v2_with_http_info_impl(user_id, user_secret, account_id, opts = {})
428
+ if @api_client.config.debugging
429
+ @api_client.config.logger.debug 'Calling API: ExperimentalEndpointsApi.get_user_account_orders_v2 ...'
430
+ end
431
+ # verify the required parameter 'user_id' is set
432
+ if @api_client.config.client_side_validation && user_id.nil?
433
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling ExperimentalEndpointsApi.get_user_account_orders_v2"
434
+ end
435
+ # verify the required parameter 'user_secret' is set
436
+ if @api_client.config.client_side_validation && user_secret.nil?
437
+ fail ArgumentError, "Missing the required parameter 'user_secret' when calling ExperimentalEndpointsApi.get_user_account_orders_v2"
438
+ end
439
+ # verify the required parameter 'account_id' is set
440
+ if @api_client.config.client_side_validation && account_id.nil?
441
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling ExperimentalEndpointsApi.get_user_account_orders_v2"
442
+ end
443
+ allowable_values = ["all", "open", "executed"]
444
+ if @api_client.config.client_side_validation && opts[:'state'] && !allowable_values.include?(opts[:'state'])
445
+ fail ArgumentError, "invalid value for \"state\", must be one of #{allowable_values}"
446
+ end
447
+ if @api_client.config.client_side_validation && !opts[:'days'].nil? && opts[:'days'] > 90
448
+ fail ArgumentError, 'invalid value for "opts[:"days"]" when calling ExperimentalEndpointsApi.get_user_account_orders_v2, must be smaller than or equal to 90.'
449
+ end
450
+
451
+ if @api_client.config.client_side_validation && !opts[:'days'].nil? && opts[:'days'] < 1
452
+ fail ArgumentError, 'invalid value for "opts[:"days"]" when calling ExperimentalEndpointsApi.get_user_account_orders_v2, must be greater than or equal to 1.'
453
+ end
454
+
455
+ # resource path
456
+ local_var_path = '/accounts/{accountId}/orders/v2'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
457
+
458
+ # query parameters
459
+ query_params = opts[:query_params] || {}
460
+ query_params[:'userId'] = user_id
461
+ query_params[:'userSecret'] = user_secret
462
+ query_params[:'state'] = opts[:'state'] if !opts[:'state'].nil?
463
+ query_params[:'days'] = opts[:'days'] if !opts[:'days'].nil?
464
+
465
+ # header parameters
466
+ header_params = opts[:header_params] || {}
467
+ # HTTP header 'Accept' (if needed)
468
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
469
+
470
+ # form parameters
471
+ form_params = opts[:form_params] || {}
472
+
473
+ # http body (model)
474
+ post_body = opts[:debug_body]
475
+
476
+ # return_type
477
+ return_type = opts[:debug_return_type] || 'AccountOrdersV2Response'
478
+
479
+ # auth_names
480
+ auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
481
+
482
+ new_options = opts.merge(
483
+ :operation => :"ExperimentalEndpointsApi.get_user_account_orders_v2",
484
+ :header_params => header_params,
485
+ :query_params => query_params,
486
+ :form_params => form_params,
487
+ :body => post_body,
488
+ :auth_names => auth_names,
489
+ :return_type => return_type
490
+ )
491
+
492
+ data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
493
+ if @api_client.config.debugging
494
+ @api_client.config.logger.debug "API called: ExperimentalEndpointsApi#get_user_account_orders_v2\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
495
+ end
496
+ return data, status_code, headers, response
497
+ end
498
+
499
+
500
+ # List account recent orders (V2, last 24 hours only)
501
+ #
502
+ # A lightweight endpoint that returns a list of orders executed in the last 24 hours in the specified account using the V2 order format.
503
+ # This endpoint is realtime and can be used to quickly check if account state has recently changed due to an execution, or check status of recently placed orders.
504
+ # Differs from /orders in that it is realtime, and only checks the last 24 hours as opposed to the last 30 days.
505
+ # By default only returns executed orders, but that can be changed by setting *only_executed* to false.
506
+ # **Because of the cost of realtime requests, each call to this endpoint incurs an additional charge. You can find the exact cost for your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing)**
507
+ #
508
+ # @param user_id [String]
509
+ # @param user_secret [String]
510
+ # @param account_id [String]
511
+ # @param only_executed [Boolean] Defaults to true. Indicates if request should fetch only executed orders. Set to false to retrieve non executed orders as well
512
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
513
+ def get_user_account_recent_orders_v2(user_id:, user_secret:, account_id:, only_executed: SENTINEL, extra: {})
514
+ extra[:only_executed] = only_executed if only_executed != SENTINEL
515
+ data, _status_code, _headers = get_user_account_recent_orders_v2_with_http_info_impl(user_id, user_secret, account_id, extra)
516
+ data
517
+ end
518
+
519
+ # List account recent orders (V2, last 24 hours only)
520
+ #
521
+ # A lightweight endpoint that returns a list of orders executed in the last 24 hours in the specified account using the V2 order format.
522
+ # This endpoint is realtime and can be used to quickly check if account state has recently changed due to an execution, or check status of recently placed orders.
523
+ # Differs from /orders in that it is realtime, and only checks the last 24 hours as opposed to the last 30 days.
524
+ # By default only returns executed orders, but that can be changed by setting *only_executed* to false.
525
+ # **Because of the cost of realtime requests, each call to this endpoint incurs an additional charge. You can find the exact cost for your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing)**
526
+ #
527
+ # @param user_id [String]
528
+ # @param user_secret [String]
529
+ # @param account_id [String]
530
+ # @param only_executed [Boolean] Defaults to true. Indicates if request should fetch only executed orders. Set to false to retrieve non executed orders as well
531
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
532
+ def get_user_account_recent_orders_v2_with_http_info(user_id:, user_secret:, account_id:, only_executed: SENTINEL, extra: {})
533
+ extra[:only_executed] = only_executed if only_executed != SENTINEL
534
+ get_user_account_recent_orders_v2_with_http_info_impl(user_id, user_secret, account_id, extra)
535
+ end
536
+
537
+ # List account recent orders (V2, last 24 hours only)
538
+ # A lightweight endpoint that returns a list of orders executed in the last 24 hours in the specified account using the V2 order format. This endpoint is realtime and can be used to quickly check if account state has recently changed due to an execution, or check status of recently placed orders. Differs from /orders in that it is realtime, and only checks the last 24 hours as opposed to the last 30 days. By default only returns executed orders, but that can be changed by setting *only_executed* to false. **Because of the cost of realtime requests, each call to this endpoint incurs an additional charge. You can find the exact cost for your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing)**
539
+ # @param user_id [String]
540
+ # @param user_secret [String]
541
+ # @param account_id [String]
542
+ # @param [Hash] opts the optional parameters
543
+ # @option opts [Boolean] :only_executed Defaults to true. Indicates if request should fetch only executed orders. Set to false to retrieve non executed orders as well
544
+ # @return [AccountOrdersV2Response]
545
+ private def get_user_account_recent_orders_v2_impl(user_id, user_secret, account_id, opts = {})
546
+ data, _status_code, _headers = get_user_account_recent_orders_v2_with_http_info(user_id, user_secret, account_id, opts)
547
+ data
548
+ end
549
+
550
+ # List account recent orders (V2, last 24 hours only)
551
+ # A lightweight endpoint that returns a list of orders executed in the last 24 hours in the specified account using the V2 order format. This endpoint is realtime and can be used to quickly check if account state has recently changed due to an execution, or check status of recently placed orders. Differs from /orders in that it is realtime, and only checks the last 24 hours as opposed to the last 30 days. By default only returns executed orders, but that can be changed by setting *only_executed* to false. **Because of the cost of realtime requests, each call to this endpoint incurs an additional charge. You can find the exact cost for your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing)**
552
+ # @param user_id [String]
553
+ # @param user_secret [String]
554
+ # @param account_id [String]
555
+ # @param [Hash] opts the optional parameters
556
+ # @option opts [Boolean] :only_executed Defaults to true. Indicates if request should fetch only executed orders. Set to false to retrieve non executed orders as well
557
+ # @return [Array<(AccountOrdersV2Response, Integer, Hash)>] AccountOrdersV2Response data, response status code and response headers
558
+ private def get_user_account_recent_orders_v2_with_http_info_impl(user_id, user_secret, account_id, opts = {})
559
+ if @api_client.config.debugging
560
+ @api_client.config.logger.debug 'Calling API: ExperimentalEndpointsApi.get_user_account_recent_orders_v2 ...'
561
+ end
562
+ # verify the required parameter 'user_id' is set
563
+ if @api_client.config.client_side_validation && user_id.nil?
564
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling ExperimentalEndpointsApi.get_user_account_recent_orders_v2"
565
+ end
566
+ # verify the required parameter 'user_secret' is set
567
+ if @api_client.config.client_side_validation && user_secret.nil?
568
+ fail ArgumentError, "Missing the required parameter 'user_secret' when calling ExperimentalEndpointsApi.get_user_account_recent_orders_v2"
569
+ end
570
+ # verify the required parameter 'account_id' is set
571
+ if @api_client.config.client_side_validation && account_id.nil?
572
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling ExperimentalEndpointsApi.get_user_account_recent_orders_v2"
573
+ end
574
+ # resource path
575
+ local_var_path = '/accounts/{accountId}/recentOrders/v2'.sub('{' + 'accountId' + '}', CGI.escape(account_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
+ query_params[:'only_executed'] = opts[:'only_executed'] if !opts[:'only_executed'].nil?
582
+
583
+ # header parameters
584
+ header_params = opts[:header_params] || {}
585
+ # HTTP header 'Accept' (if needed)
586
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
587
+
588
+ # form parameters
589
+ form_params = opts[:form_params] || {}
590
+
591
+ # http body (model)
592
+ post_body = opts[:debug_body]
593
+
594
+ # return_type
595
+ return_type = opts[:debug_return_type] || 'AccountOrdersV2Response'
596
+
597
+ # auth_names
598
+ auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
599
+
600
+ new_options = opts.merge(
601
+ :operation => :"ExperimentalEndpointsApi.get_user_account_recent_orders_v2",
602
+ :header_params => header_params,
603
+ :query_params => query_params,
604
+ :form_params => form_params,
605
+ :body => post_body,
606
+ :auth_names => auth_names,
607
+ :return_type => return_type
608
+ )
609
+
610
+ data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
611
+ if @api_client.config.debugging
612
+ @api_client.config.logger.debug "API called: ExperimentalEndpointsApi#get_user_account_recent_orders_v2\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
613
+ end
614
+ return data, status_code, headers, response
615
+ end
616
+
617
+
618
+ # List active Trade Detection subscriptions
619
+ #
620
+ # Returns active Trade Detection subscriptions for your Client ID. Cancelled subscriptions are not returned.
621
+ #
622
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
623
+ def list_subscriptions(extra: {})
624
+ data, _status_code, _headers = list_subscriptions_with_http_info_impl(extra)
625
+ data
626
+ end
627
+
628
+ # List active Trade Detection subscriptions
629
+ #
630
+ # Returns active Trade Detection subscriptions for your Client ID. Cancelled subscriptions are not returned.
631
+ #
632
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
633
+ def list_subscriptions_with_http_info(extra: {})
634
+ list_subscriptions_with_http_info_impl(extra)
635
+ end
636
+
637
+ # List active Trade Detection subscriptions
638
+ # Returns active Trade Detection subscriptions for your Client ID. Cancelled subscriptions are not returned.
639
+ # @param [Hash] opts the optional parameters
640
+ # @return [Array<TradeDetectionSubscription>]
641
+ private def list_subscriptions_impl(opts = {})
642
+ data, _status_code, _headers = list_subscriptions_with_http_info(opts)
643
+ data
644
+ end
645
+
646
+ # List active Trade Detection subscriptions
647
+ # Returns active Trade Detection subscriptions for your Client ID. Cancelled subscriptions are not returned.
648
+ # @param [Hash] opts the optional parameters
649
+ # @return [Array<(Array<TradeDetectionSubscription>, Integer, Hash)>] Array<TradeDetectionSubscription> data, response status code and response headers
650
+ private def list_subscriptions_with_http_info_impl(opts = {})
651
+ if @api_client.config.debugging
652
+ @api_client.config.logger.debug 'Calling API: ExperimentalEndpointsApi.list_subscriptions ...'
653
+ end
654
+ # resource path
655
+ local_var_path = '/snapTrade/tradeDetection/subscriptions'
656
+
657
+ # query parameters
658
+ query_params = opts[:query_params] || {}
659
+
660
+ # header parameters
661
+ header_params = opts[:header_params] || {}
662
+ # HTTP header 'Accept' (if needed)
663
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
664
+
665
+ # form parameters
666
+ form_params = opts[:form_params] || {}
667
+
668
+ # http body (model)
669
+ post_body = opts[:debug_body]
670
+
671
+ # return_type
672
+ return_type = opts[:debug_return_type] || 'Array<TradeDetectionSubscription>'
673
+
674
+ # auth_names
675
+ auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
676
+
677
+ new_options = opts.merge(
678
+ :operation => :"ExperimentalEndpointsApi.list_subscriptions",
679
+ :header_params => header_params,
680
+ :query_params => query_params,
681
+ :form_params => form_params,
682
+ :body => post_body,
683
+ :auth_names => auth_names,
684
+ :return_type => return_type
685
+ )
686
+
687
+ data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
688
+ if @api_client.config.debugging
689
+ @api_client.config.logger.debug "API called: ExperimentalEndpointsApi#list_subscriptions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
690
+ end
691
+ return data, status_code, headers, response
692
+ end
693
+ end
694
+
695
+ # top-level client access to avoid having the user to insantiate their own API instances
696
+ ExperimentalEndpoints = ExperimentalEndpointsApi::new
697
+ end