snaptrade 2.0.195 → 2.0.196

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.
@@ -1,505 +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 '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
- # Get account order detail (V2)
21
- #
22
- # Returns the detail of a single order using the brokerage order ID provided as a path parameter.
23
- #
24
- # The V2 order response format includes all legs of the order in the `legs` list field.
25
- # If the order is single legged, `legs` will be a list of one leg.
26
- #
27
- # This endpoint is always realtime and does not rely on cached data.
28
- #
29
- # This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint.
30
- #
31
- # @param account_id [String]
32
- # @param brokerage_order_id [String]
33
- # @param user_id [String]
34
- # @param user_secret [String]
35
- # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
36
- def get_user_account_order_detail_v2(account_id:, brokerage_order_id:, user_id:, user_secret:, extra: {})
37
- data, _status_code, _headers = get_user_account_order_detail_v2_with_http_info_impl(account_id, brokerage_order_id, user_id, user_secret, extra)
38
- data
39
- end
40
-
41
- # Get account order detail (V2)
42
- #
43
- # Returns the detail of a single order using the brokerage order ID provided as a path parameter.
44
- #
45
- # The V2 order response format includes all legs of the order in the `legs` list field.
46
- # If the order is single legged, `legs` will be a list of one leg.
47
- #
48
- # This endpoint is always realtime and does not rely on cached data.
49
- #
50
- # This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint.
51
- #
52
- # @param account_id [String]
53
- # @param brokerage_order_id [String]
54
- # @param user_id [String]
55
- # @param user_secret [String]
56
- # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
57
- def get_user_account_order_detail_v2_with_http_info(account_id:, brokerage_order_id:, user_id:, user_secret:, extra: {})
58
- get_user_account_order_detail_v2_with_http_info_impl(account_id, brokerage_order_id, user_id, user_secret, extra)
59
- end
60
-
61
- # Get account order detail (V2)
62
- # 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.
63
- # @param account_id [String]
64
- # @param brokerage_order_id [String]
65
- # @param user_id [String]
66
- # @param user_secret [String]
67
- # @param [Hash] opts the optional parameters
68
- # @return [AccountOrderRecordV2]
69
- private def get_user_account_order_detail_v2_impl(account_id, brokerage_order_id, user_id, user_secret, opts = {})
70
- data, _status_code, _headers = get_user_account_order_detail_v2_with_http_info(account_id, brokerage_order_id, user_id, user_secret, opts)
71
- data
72
- end
73
-
74
- # Get account order detail (V2)
75
- # 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.
76
- # @param account_id [String]
77
- # @param brokerage_order_id [String]
78
- # @param user_id [String]
79
- # @param user_secret [String]
80
- # @param [Hash] opts the optional parameters
81
- # @return [Array<(AccountOrderRecordV2, Integer, Hash)>] AccountOrderRecordV2 data, response status code and response headers
82
- private def get_user_account_order_detail_v2_with_http_info_impl(account_id, brokerage_order_id, user_id, user_secret, opts = {})
83
- if @api_client.config.debugging
84
- @api_client.config.logger.debug 'Calling API: ExperimentalEndpointsApi.get_user_account_order_detail_v2 ...'
85
- end
86
- # verify the required parameter 'account_id' is set
87
- if @api_client.config.client_side_validation && account_id.nil?
88
- fail ArgumentError, "Missing the required parameter 'account_id' when calling ExperimentalEndpointsApi.get_user_account_order_detail_v2"
89
- end
90
- # verify the required parameter 'brokerage_order_id' is set
91
- if @api_client.config.client_side_validation && brokerage_order_id.nil?
92
- fail ArgumentError, "Missing the required parameter 'brokerage_order_id' when calling ExperimentalEndpointsApi.get_user_account_order_detail_v2"
93
- end
94
- # verify the required parameter 'user_id' is set
95
- if @api_client.config.client_side_validation && user_id.nil?
96
- fail ArgumentError, "Missing the required parameter 'user_id' when calling ExperimentalEndpointsApi.get_user_account_order_detail_v2"
97
- end
98
- # verify the required parameter 'user_secret' is set
99
- if @api_client.config.client_side_validation && user_secret.nil?
100
- fail ArgumentError, "Missing the required parameter 'user_secret' when calling ExperimentalEndpointsApi.get_user_account_order_detail_v2"
101
- end
102
- # resource path
103
- 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))
104
-
105
- # query parameters
106
- query_params = opts[:query_params] || {}
107
- query_params[:'userId'] = user_id
108
- query_params[:'userSecret'] = user_secret
109
-
110
- # header parameters
111
- header_params = opts[:header_params] || {}
112
- # HTTP header 'Accept' (if needed)
113
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
114
-
115
- # form parameters
116
- form_params = opts[:form_params] || {}
117
-
118
- # http body (model)
119
- post_body = opts[:debug_body]
120
-
121
- # return_type
122
- return_type = opts[:debug_return_type] || 'AccountOrderRecordV2'
123
-
124
- # auth_names
125
- auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
126
-
127
- new_options = opts.merge(
128
- :operation => :"ExperimentalEndpointsApi.get_user_account_order_detail_v2",
129
- :header_params => header_params,
130
- :query_params => query_params,
131
- :form_params => form_params,
132
- :body => post_body,
133
- :auth_names => auth_names,
134
- :return_type => return_type
135
- )
136
-
137
- data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
138
- if @api_client.config.debugging
139
- @api_client.config.logger.debug "API called: ExperimentalEndpointsApi#get_user_account_order_detail_v2\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
140
- end
141
- return data, status_code, headers, response
142
- end
143
-
144
-
145
- # List account orders v2
146
- #
147
- # Returns a list of recent orders in the specified account.
148
- #
149
- # 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.
150
- #
151
- # 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.
152
- #
153
- # @param user_id [String]
154
- # @param user_secret [String]
155
- # @param account_id [String]
156
- # @param state [String] defaults value is set to \"all\"
157
- # @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.
158
- # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
159
- def get_user_account_orders_v2(user_id:, user_secret:, account_id:, state: SENTINEL, days: SENTINEL, extra: {})
160
- extra[:state] = state if state != SENTINEL
161
- extra[:days] = days if days != SENTINEL
162
- data, _status_code, _headers = get_user_account_orders_v2_with_http_info_impl(user_id, user_secret, account_id, extra)
163
- data
164
- end
165
-
166
- # List account orders v2
167
- #
168
- # Returns a list of recent orders in the specified account.
169
- #
170
- # 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.
171
- #
172
- # 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.
173
- #
174
- # @param user_id [String]
175
- # @param user_secret [String]
176
- # @param account_id [String]
177
- # @param state [String] defaults value is set to \"all\"
178
- # @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.
179
- # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
180
- def get_user_account_orders_v2_with_http_info(user_id:, user_secret:, account_id:, state: SENTINEL, days: SENTINEL, extra: {})
181
- extra[:state] = state if state != SENTINEL
182
- extra[:days] = days if days != SENTINEL
183
- get_user_account_orders_v2_with_http_info_impl(user_id, user_secret, account_id, extra)
184
- end
185
-
186
- # List account orders v2
187
- # 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.
188
- # @param user_id [String]
189
- # @param user_secret [String]
190
- # @param account_id [String]
191
- # @param [Hash] opts the optional parameters
192
- # @option opts [String] :state defaults value is set to \"all\"
193
- # @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.
194
- # @return [AccountOrdersV2Response]
195
- private def get_user_account_orders_v2_impl(user_id, user_secret, account_id, opts = {})
196
- data, _status_code, _headers = get_user_account_orders_v2_with_http_info(user_id, user_secret, account_id, opts)
197
- data
198
- end
199
-
200
- # List account orders v2
201
- # 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.
202
- # @param user_id [String]
203
- # @param user_secret [String]
204
- # @param account_id [String]
205
- # @param [Hash] opts the optional parameters
206
- # @option opts [String] :state defaults value is set to \"all\"
207
- # @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.
208
- # @return [Array<(AccountOrdersV2Response, Integer, Hash)>] AccountOrdersV2Response data, response status code and response headers
209
- private def get_user_account_orders_v2_with_http_info_impl(user_id, user_secret, account_id, opts = {})
210
- if @api_client.config.debugging
211
- @api_client.config.logger.debug 'Calling API: ExperimentalEndpointsApi.get_user_account_orders_v2 ...'
212
- end
213
- # verify the required parameter 'user_id' is set
214
- if @api_client.config.client_side_validation && user_id.nil?
215
- fail ArgumentError, "Missing the required parameter 'user_id' when calling ExperimentalEndpointsApi.get_user_account_orders_v2"
216
- end
217
- # verify the required parameter 'user_secret' is set
218
- if @api_client.config.client_side_validation && user_secret.nil?
219
- fail ArgumentError, "Missing the required parameter 'user_secret' when calling ExperimentalEndpointsApi.get_user_account_orders_v2"
220
- end
221
- # verify the required parameter 'account_id' is set
222
- if @api_client.config.client_side_validation && account_id.nil?
223
- fail ArgumentError, "Missing the required parameter 'account_id' when calling ExperimentalEndpointsApi.get_user_account_orders_v2"
224
- end
225
- allowable_values = ["all", "open", "executed"]
226
- if @api_client.config.client_side_validation && opts[:'state'] && !allowable_values.include?(opts[:'state'])
227
- fail ArgumentError, "invalid value for \"state\", must be one of #{allowable_values}"
228
- end
229
- if @api_client.config.client_side_validation && !opts[:'days'].nil? && opts[:'days'] > 90
230
- fail ArgumentError, 'invalid value for "opts[:"days"]" when calling ExperimentalEndpointsApi.get_user_account_orders_v2, must be smaller than or equal to 90.'
231
- end
232
-
233
- if @api_client.config.client_side_validation && !opts[:'days'].nil? && opts[:'days'] < 1
234
- fail ArgumentError, 'invalid value for "opts[:"days"]" when calling ExperimentalEndpointsApi.get_user_account_orders_v2, must be greater than or equal to 1.'
235
- end
236
-
237
- # resource path
238
- local_var_path = '/accounts/{accountId}/orders/v2'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
239
-
240
- # query parameters
241
- query_params = opts[:query_params] || {}
242
- query_params[:'userId'] = user_id
243
- query_params[:'userSecret'] = user_secret
244
- query_params[:'state'] = opts[:'state'] if !opts[:'state'].nil?
245
- query_params[:'days'] = opts[:'days'] if !opts[:'days'].nil?
246
-
247
- # header parameters
248
- header_params = opts[:header_params] || {}
249
- # HTTP header 'Accept' (if needed)
250
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
251
-
252
- # form parameters
253
- form_params = opts[:form_params] || {}
254
-
255
- # http body (model)
256
- post_body = opts[:debug_body]
257
-
258
- # return_type
259
- return_type = opts[:debug_return_type] || 'AccountOrdersV2Response'
260
-
261
- # auth_names
262
- auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
263
-
264
- new_options = opts.merge(
265
- :operation => :"ExperimentalEndpointsApi.get_user_account_orders_v2",
266
- :header_params => header_params,
267
- :query_params => query_params,
268
- :form_params => form_params,
269
- :body => post_body,
270
- :auth_names => auth_names,
271
- :return_type => return_type
272
- )
273
-
274
- data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
275
- if @api_client.config.debugging
276
- @api_client.config.logger.debug "API called: ExperimentalEndpointsApi#get_user_account_orders_v2\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
277
- end
278
- return data, status_code, headers, response
279
- end
280
-
281
-
282
- # List account recent orders (V2, last 24 hours only)
283
- #
284
- # A lightweight endpoint that returns a list of orders executed in the last 24 hours in the specified account using the V2 order format.
285
- # 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.
286
- # Differs from /orders in that it is realtime, and only checks the last 24 hours as opposed to the last 30 days.
287
- # By default only returns executed orders, but that can be changed by setting *only_executed* to false.
288
- # **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)**
289
- #
290
- # @param user_id [String]
291
- # @param user_secret [String]
292
- # @param account_id [String]
293
- # @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
294
- # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
295
- def get_user_account_recent_orders_v2(user_id:, user_secret:, account_id:, only_executed: SENTINEL, extra: {})
296
- extra[:only_executed] = only_executed if only_executed != SENTINEL
297
- data, _status_code, _headers = get_user_account_recent_orders_v2_with_http_info_impl(user_id, user_secret, account_id, extra)
298
- data
299
- end
300
-
301
- # List account recent orders (V2, last 24 hours only)
302
- #
303
- # A lightweight endpoint that returns a list of orders executed in the last 24 hours in the specified account using the V2 order format.
304
- # 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.
305
- # Differs from /orders in that it is realtime, and only checks the last 24 hours as opposed to the last 30 days.
306
- # By default only returns executed orders, but that can be changed by setting *only_executed* to false.
307
- # **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)**
308
- #
309
- # @param user_id [String]
310
- # @param user_secret [String]
311
- # @param account_id [String]
312
- # @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
313
- # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
314
- def get_user_account_recent_orders_v2_with_http_info(user_id:, user_secret:, account_id:, only_executed: SENTINEL, extra: {})
315
- extra[:only_executed] = only_executed if only_executed != SENTINEL
316
- get_user_account_recent_orders_v2_with_http_info_impl(user_id, user_secret, account_id, extra)
317
- end
318
-
319
- # List account recent orders (V2, last 24 hours only)
320
- # 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)**
321
- # @param user_id [String]
322
- # @param user_secret [String]
323
- # @param account_id [String]
324
- # @param [Hash] opts the optional parameters
325
- # @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
326
- # @return [AccountOrdersV2Response]
327
- private def get_user_account_recent_orders_v2_impl(user_id, user_secret, account_id, opts = {})
328
- data, _status_code, _headers = get_user_account_recent_orders_v2_with_http_info(user_id, user_secret, account_id, opts)
329
- data
330
- end
331
-
332
- # List account recent orders (V2, last 24 hours only)
333
- # 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)**
334
- # @param user_id [String]
335
- # @param user_secret [String]
336
- # @param account_id [String]
337
- # @param [Hash] opts the optional parameters
338
- # @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
339
- # @return [Array<(AccountOrdersV2Response, Integer, Hash)>] AccountOrdersV2Response data, response status code and response headers
340
- private def get_user_account_recent_orders_v2_with_http_info_impl(user_id, user_secret, account_id, opts = {})
341
- if @api_client.config.debugging
342
- @api_client.config.logger.debug 'Calling API: ExperimentalEndpointsApi.get_user_account_recent_orders_v2 ...'
343
- end
344
- # verify the required parameter 'user_id' is set
345
- if @api_client.config.client_side_validation && user_id.nil?
346
- fail ArgumentError, "Missing the required parameter 'user_id' when calling ExperimentalEndpointsApi.get_user_account_recent_orders_v2"
347
- end
348
- # verify the required parameter 'user_secret' is set
349
- if @api_client.config.client_side_validation && user_secret.nil?
350
- fail ArgumentError, "Missing the required parameter 'user_secret' when calling ExperimentalEndpointsApi.get_user_account_recent_orders_v2"
351
- end
352
- # verify the required parameter 'account_id' is set
353
- if @api_client.config.client_side_validation && account_id.nil?
354
- fail ArgumentError, "Missing the required parameter 'account_id' when calling ExperimentalEndpointsApi.get_user_account_recent_orders_v2"
355
- end
356
- # resource path
357
- local_var_path = '/accounts/{accountId}/recentOrders/v2'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
358
-
359
- # query parameters
360
- query_params = opts[:query_params] || {}
361
- query_params[:'userId'] = user_id
362
- query_params[:'userSecret'] = user_secret
363
- query_params[:'only_executed'] = opts[:'only_executed'] if !opts[:'only_executed'].nil?
364
-
365
- # header parameters
366
- header_params = opts[:header_params] || {}
367
- # HTTP header 'Accept' (if needed)
368
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
369
-
370
- # form parameters
371
- form_params = opts[:form_params] || {}
372
-
373
- # http body (model)
374
- post_body = opts[:debug_body]
375
-
376
- # return_type
377
- return_type = opts[:debug_return_type] || 'AccountOrdersV2Response'
378
-
379
- # auth_names
380
- auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
381
-
382
- new_options = opts.merge(
383
- :operation => :"ExperimentalEndpointsApi.get_user_account_recent_orders_v2",
384
- :header_params => header_params,
385
- :query_params => query_params,
386
- :form_params => form_params,
387
- :body => post_body,
388
- :auth_names => auth_names,
389
- :return_type => return_type
390
- )
391
-
392
- data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
393
- if @api_client.config.debugging
394
- @api_client.config.logger.debug "API called: ExperimentalEndpointsApi#get_user_account_recent_orders_v2\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
395
- end
396
- return data, status_code, headers, response
397
- end
398
-
399
-
400
- # Sync transactions for a connection
401
- #
402
- # Trigger a transactions sync for all accounts under this connection. Updates will be queued asynchronously. Transactions are not updated intra-day, but calling this endpoint can ensure that the previous day's transactions have been synced. For more information on sync behaviour, see: https://docs.snaptrade.com/docs/syncing
403
- #
404
- # @param authorization_id [String]
405
- # @param user_id [String]
406
- # @param user_secret [String]
407
- # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
408
- def sync_brokerage_authorization_transactions(authorization_id:, user_id:, user_secret:, extra: {})
409
- data, _status_code, _headers = sync_brokerage_authorization_transactions_with_http_info_impl(authorization_id, user_id, user_secret, extra)
410
- data
411
- end
412
-
413
- # Sync transactions for a connection
414
- #
415
- # Trigger a transactions sync for all accounts under this connection. Updates will be queued asynchronously. Transactions are not updated intra-day, but calling this endpoint can ensure that the previous day's transactions have been synced. For more information on sync behaviour, see: https://docs.snaptrade.com/docs/syncing
416
- #
417
- # @param authorization_id [String]
418
- # @param user_id [String]
419
- # @param user_secret [String]
420
- # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
421
- def sync_brokerage_authorization_transactions_with_http_info(authorization_id:, user_id:, user_secret:, extra: {})
422
- sync_brokerage_authorization_transactions_with_http_info_impl(authorization_id, user_id, user_secret, extra)
423
- end
424
-
425
- # Sync transactions for a connection
426
- # Trigger a transactions sync for all accounts under this connection. Updates will be queued asynchronously. Transactions are not updated intra-day, but calling this endpoint can ensure that the previous day's transactions have been synced. For more information on sync behaviour, see: https://docs.snaptrade.com/docs/syncing
427
- # @param authorization_id [String]
428
- # @param user_id [String]
429
- # @param user_secret [String]
430
- # @param [Hash] opts the optional parameters
431
- # @return [BrokerageAuthorizationTransactionsSyncConfirmation]
432
- private def sync_brokerage_authorization_transactions_impl(authorization_id, user_id, user_secret, opts = {})
433
- data, _status_code, _headers = sync_brokerage_authorization_transactions_with_http_info(authorization_id, user_id, user_secret, opts)
434
- data
435
- end
436
-
437
- # Sync transactions for a connection
438
- # Trigger a transactions sync for all accounts under this connection. Updates will be queued asynchronously. Transactions are not updated intra-day, but calling this endpoint can ensure that the previous day&#39;s transactions have been synced. For more information on sync behaviour, see: https://docs.snaptrade.com/docs/syncing
439
- # @param authorization_id [String]
440
- # @param user_id [String]
441
- # @param user_secret [String]
442
- # @param [Hash] opts the optional parameters
443
- # @return [Array<(BrokerageAuthorizationTransactionsSyncConfirmation, Integer, Hash)>] BrokerageAuthorizationTransactionsSyncConfirmation data, response status code and response headers
444
- private def sync_brokerage_authorization_transactions_with_http_info_impl(authorization_id, user_id, user_secret, opts = {})
445
- if @api_client.config.debugging
446
- @api_client.config.logger.debug 'Calling API: ExperimentalEndpointsApi.sync_brokerage_authorization_transactions ...'
447
- end
448
- # verify the required parameter 'authorization_id' is set
449
- if @api_client.config.client_side_validation && authorization_id.nil?
450
- fail ArgumentError, "Missing the required parameter 'authorization_id' when calling ExperimentalEndpointsApi.sync_brokerage_authorization_transactions"
451
- end
452
- # verify the required parameter 'user_id' is set
453
- if @api_client.config.client_side_validation && user_id.nil?
454
- fail ArgumentError, "Missing the required parameter 'user_id' when calling ExperimentalEndpointsApi.sync_brokerage_authorization_transactions"
455
- end
456
- # verify the required parameter 'user_secret' is set
457
- if @api_client.config.client_side_validation && user_secret.nil?
458
- fail ArgumentError, "Missing the required parameter 'user_secret' when calling ExperimentalEndpointsApi.sync_brokerage_authorization_transactions"
459
- end
460
- # resource path
461
- local_var_path = '/authorizations/{authorizationId}/transactions/sync'.sub('{' + 'authorizationId' + '}', CGI.escape(authorization_id.to_s))
462
-
463
- # query parameters
464
- query_params = opts[:query_params] || {}
465
- query_params[:'userId'] = user_id
466
- query_params[:'userSecret'] = user_secret
467
-
468
- # header parameters
469
- header_params = opts[:header_params] || {}
470
- # HTTP header 'Accept' (if needed)
471
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
472
-
473
- # form parameters
474
- form_params = opts[:form_params] || {}
475
-
476
- # http body (model)
477
- post_body = opts[:debug_body]
478
-
479
- # return_type
480
- return_type = opts[:debug_return_type] || 'BrokerageAuthorizationTransactionsSyncConfirmation'
481
-
482
- # auth_names
483
- auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
484
-
485
- new_options = opts.merge(
486
- :operation => :"ExperimentalEndpointsApi.sync_brokerage_authorization_transactions",
487
- :header_params => header_params,
488
- :query_params => query_params,
489
- :form_params => form_params,
490
- :body => post_body,
491
- :auth_names => auth_names,
492
- :return_type => return_type
493
- )
494
-
495
- data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
496
- if @api_client.config.debugging
497
- @api_client.config.logger.debug "API called: ExperimentalEndpointsApi#sync_brokerage_authorization_transactions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
498
- end
499
- return data, status_code, headers, response
500
- end
501
- end
502
-
503
- # top-level client access to avoid having the user to insantiate their own API instances
504
- ExperimentalEndpoints = ExperimentalEndpointsApi::new
505
- end
@@ -1,90 +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
-
13
- # Unit tests for SnapTrade::ExperimentalEndpointsApi
14
- describe 'ExperimentalEndpointsApi' do
15
- before do
16
- # run before each test
17
- @api_instance = SnapTrade::ExperimentalEndpointsApi.new
18
- end
19
-
20
- after do
21
- # run after each test
22
- end
23
-
24
- describe 'test an instance of ExperimentalEndpointsApi' do
25
- it 'should create an instance of ExperimentalEndpointsApi' do
26
- expect(@api_instance).to be_instance_of(SnapTrade::ExperimentalEndpointsApi)
27
- end
28
- end
29
-
30
- # unit tests for get_user_account_order_detail_v2
31
- # Get account order detail (V2)
32
- # 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.
33
- # @param account_id
34
- # @param brokerage_order_id
35
- # @param user_id
36
- # @param user_secret
37
- # @param [Hash] opts the optional parameters
38
- # @return [AccountOrderRecordV2]
39
- describe 'get_user_account_order_detail_v2 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
- # unit tests for get_user_account_orders_v2
46
- # List account orders v2
47
- # 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.
48
- # @param user_id
49
- # @param user_secret
50
- # @param account_id
51
- # @param [Hash] opts the optional parameters
52
- # @option opts [String] :state defaults value is set to \&quot;all\&quot;
53
- # @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.
54
- # @return [AccountOrdersV2Response]
55
- describe 'get_user_account_orders_v2 test' do
56
- it 'should work' do
57
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
58
- end
59
- end
60
-
61
- # unit tests for get_user_account_recent_orders_v2
62
- # List account recent orders (V2, last 24 hours only)
63
- # 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)**
64
- # @param user_id
65
- # @param user_secret
66
- # @param account_id
67
- # @param [Hash] opts the optional parameters
68
- # @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
69
- # @return [AccountOrdersV2Response]
70
- describe 'get_user_account_recent_orders_v2 test' do
71
- it 'should work' do
72
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
73
- end
74
- end
75
-
76
- # unit tests for sync_brokerage_authorization_transactions
77
- # Sync transactions for a connection
78
- # Trigger a transactions sync for all accounts under this connection. Updates will be queued asynchronously. Transactions are not updated intra-day, but calling this endpoint can ensure that the previous day&#39;s transactions have been synced. For more information on sync behaviour, see: https://docs.snaptrade.com/docs/syncing
79
- # @param authorization_id
80
- # @param user_id
81
- # @param user_secret
82
- # @param [Hash] opts the optional parameters
83
- # @return [BrokerageAuthorizationTransactionsSyncConfirmation]
84
- describe 'sync_brokerage_authorization_transactions test' do
85
- it 'should work' do
86
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
87
- end
88
- end
89
-
90
- end