snaptrade 2.0.187 → 2.0.188
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +39 -48
- data/lib/snaptrade/api/account_information_api.rb +103 -0
- data/lib/snaptrade/api/experimental_endpoints_api.rb +8 -137
- data/lib/snaptrade/configuration.rb +1 -1
- data/lib/snaptrade/models/adr_instrument.rb +311 -0
- data/lib/snaptrade/models/adr_instrument_kind.rb +36 -0
- data/lib/snaptrade/models/all_account_positions_response.rb +3 -40
- data/lib/snaptrade/models/cef_instrument.rb +311 -0
- data/lib/snaptrade/models/cef_instrument_kind.rb +36 -0
- data/lib/snaptrade/models/instrument.rb +6 -0
- data/lib/snaptrade/models/mutual_fund_instrument.rb +311 -0
- data/lib/snaptrade/models/mutual_fund_instrument_kind.rb +36 -0
- data/lib/snaptrade/models/underlying_option_instrument.rb +6 -0
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +6 -0
- data/spec/api/account_information_api_spec.rb +14 -0
- data/spec/api/experimental_endpoints_api_spec.rb +1 -17
- data/spec/models/adr_instrument_kind_spec.rb +23 -0
- data/spec/models/adr_instrument_spec.rb +71 -0
- data/spec/models/all_account_positions_response_spec.rb +0 -18
- data/spec/models/cef_instrument_kind_spec.rb +23 -0
- data/spec/models/cef_instrument_spec.rb +71 -0
- data/spec/models/mutual_fund_instrument_kind_spec.rb +23 -0
- data/spec/models/mutual_fund_instrument_spec.rb +71 -0
- metadata +20 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 71fcfdf628fbaf3df2aa5bfebf30c70220ef8100c764c119bdf8b058055ef828
|
|
4
|
+
data.tar.gz: ffdb7d67435e1d0a5abc6e17205b5e31c16e8083f1973112966b3bbdc1f4c31d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 74016e3e1cbb5015412b54fe7cabdc766accd21bbd62c890956c2d1509034686cff1d3abd9adcac6e00129536afcedcea7d4c0f168245d6df71f60716e2e4dc3
|
|
7
|
+
data.tar.gz: d0e84ee4336ec0a1d99bbf5d5e1f9ed897a1a2b3a6ac6b4650468e29df46aeb7fd3c204b4615f07c298edac80bd75bf1ec98fd97ed222f3a7b8b6adebe8f9c58
|
data/Gemfile.lock
CHANGED
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
|
-
[](https://rubygems.org/gems/snaptrade/versions/2.0.188)
|
|
10
10
|
[](https://snaptrade.com/)
|
|
11
11
|
|
|
12
12
|
</div>
|
|
@@ -20,6 +20,7 @@ Connect brokerage accounts to your app for live positions and trading
|
|
|
20
20
|
- [Raw HTTP Response](#raw-http-response)
|
|
21
21
|
- [Reference](#reference)
|
|
22
22
|
* [`snaptrade.account_information.get_account_activities`](#snaptradeaccount_informationget_account_activities)
|
|
23
|
+
* [`snaptrade.account_information.get_account_balance_history`](#snaptradeaccount_informationget_account_balance_history)
|
|
23
24
|
* [`snaptrade.account_information.get_all_user_holdings`](#snaptradeaccount_informationget_all_user_holdings)
|
|
24
25
|
* [`snaptrade.account_information.get_user_account_balance`](#snaptradeaccount_informationget_user_account_balance)
|
|
25
26
|
* [`snaptrade.account_information.get_user_account_details`](#snaptradeaccount_informationget_user_account_details)
|
|
@@ -45,7 +46,6 @@ Connect brokerage accounts to your app for live positions and trading
|
|
|
45
46
|
* [`snaptrade.connections.remove_brokerage_authorization`](#snaptradeconnectionsremove_brokerage_authorization)
|
|
46
47
|
* [`snaptrade.connections.return_rates`](#snaptradeconnectionsreturn_rates)
|
|
47
48
|
* [`snaptrade.connections.session_events`](#snaptradeconnectionssession_events)
|
|
48
|
-
* [`snaptrade.experimental_endpoints.get_account_balance_history`](#snaptradeexperimental_endpointsget_account_balance_history)
|
|
49
49
|
* [`snaptrade.experimental_endpoints.get_all_account_positions`](#snaptradeexperimental_endpointsget_all_account_positions)
|
|
50
50
|
* [`snaptrade.experimental_endpoints.get_user_account_order_detail_v2`](#snaptradeexperimental_endpointsget_user_account_order_detail_v2)
|
|
51
51
|
* [`snaptrade.experimental_endpoints.get_user_account_orders_v2`](#snaptradeexperimental_endpointsget_user_account_orders_v2)
|
|
@@ -90,7 +90,7 @@ Connect brokerage accounts to your app for live positions and trading
|
|
|
90
90
|
Add to Gemfile:
|
|
91
91
|
|
|
92
92
|
```ruby
|
|
93
|
-
gem 'snaptrade', '~> 2.0.
|
|
93
|
+
gem 'snaptrade', '~> 2.0.188'
|
|
94
94
|
```
|
|
95
95
|
|
|
96
96
|
## Getting Started<a id="getting-started"></a>
|
|
@@ -217,6 +217,40 @@ Transfer of assets from one account to another. - `SPLIT` - A stock share split.
|
|
|
217
217
|
---
|
|
218
218
|
|
|
219
219
|
|
|
220
|
+
### `snaptrade.account_information.get_account_balance_history`<a id="snaptradeaccount_informationget_account_balance_history"></a>
|
|
221
|
+
|
|
222
|
+
An experimental endpoint that returns estimated historical total account value for the specified account. Total account value is the sum of the market value of all positions and cash in the account at a given time. This endpoint is experimental, disabled by default, and has a maximum lookback of 1 year.
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
|
226
|
+
|
|
227
|
+
```ruby
|
|
228
|
+
result = snaptrade.account_information.get_account_balance_history(
|
|
229
|
+
user_id: "snaptrade-user-123",
|
|
230
|
+
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
231
|
+
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
232
|
+
)
|
|
233
|
+
p result
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
237
|
+
|
|
238
|
+
##### user_id: `String`<a id="user_id-string"></a>
|
|
239
|
+
##### user_secret: `String`<a id="user_secret-string"></a>
|
|
240
|
+
##### account_id: `String`<a id="account_id-string"></a>
|
|
241
|
+
#### 🔄 Return<a id="🔄-return"></a>
|
|
242
|
+
|
|
243
|
+
[AccountValueHistoryResponse](./lib/snaptrade/models/account_value_history_response.rb)
|
|
244
|
+
|
|
245
|
+
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
|
246
|
+
|
|
247
|
+
`/accounts/{accountId}/balanceHistory` `GET`
|
|
248
|
+
|
|
249
|
+
[🔙 **Back to Table of Contents**](#table-of-contents)
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
|
|
220
254
|
### `snaptrade.account_information.get_all_user_holdings`<a id="snaptradeaccount_informationget_all_user_holdings"></a>
|
|
221
255
|

|
|
222
256
|
|
|
@@ -1185,45 +1219,11 @@ specific users
|
|
|
1185
1219
|
---
|
|
1186
1220
|
|
|
1187
1221
|
|
|
1188
|
-
### `snaptrade.experimental_endpoints.get_account_balance_history`<a id="snaptradeexperimental_endpointsget_account_balance_history"></a>
|
|
1189
|
-
|
|
1190
|
-
An experimental endpoint that returns estimated historical total account value for the specified account. Total account value is the sum of the market value of all positions and cash in the account at a given time. This endpoint is experimental, disabled by default, and only available for certain brokerages with a maximum lookback of 1 year.
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
|
1194
|
-
|
|
1195
|
-
```ruby
|
|
1196
|
-
result = snaptrade.experimental_endpoints.get_account_balance_history(
|
|
1197
|
-
user_id: "snaptrade-user-123",
|
|
1198
|
-
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
1199
|
-
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
1200
|
-
)
|
|
1201
|
-
p result
|
|
1202
|
-
```
|
|
1203
|
-
|
|
1204
|
-
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
1205
|
-
|
|
1206
|
-
##### user_id: `String`<a id="user_id-string"></a>
|
|
1207
|
-
##### user_secret: `String`<a id="user_secret-string"></a>
|
|
1208
|
-
##### account_id: `String`<a id="account_id-string"></a>
|
|
1209
|
-
#### 🔄 Return<a id="🔄-return"></a>
|
|
1210
|
-
|
|
1211
|
-
[AccountValueHistoryResponse](./lib/snaptrade/models/account_value_history_response.rb)
|
|
1212
|
-
|
|
1213
|
-
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
|
1214
|
-
|
|
1215
|
-
`/accounts/{accountId}/balanceHistory` `GET`
|
|
1216
|
-
|
|
1217
|
-
[🔙 **Back to Table of Contents**](#table-of-contents)
|
|
1218
|
-
|
|
1219
|
-
---
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
1222
|
### `snaptrade.experimental_endpoints.get_all_account_positions`<a id="snaptradeexperimental_endpointsget_all_account_positions"></a>
|
|
1223
1223
|
|
|
1224
|
-
Returns a
|
|
1224
|
+
Returns a list of all positions in the specified account.
|
|
1225
1225
|
|
|
1226
|
-
The `results` list can contain multiple instrument types in the same response
|
|
1226
|
+
The `results` list can contain multiple instrument types in the same response, including stocks, ADRs, ETFs, mutual funds, closed-end funds, crypto, futures, and option positions. Use the `instrument.kind` discriminator to determine the schema for each position's `instrument`.
|
|
1227
1227
|
|
|
1228
1228
|
Stock positions may also include `cash_equivalent`, and may include `tax_lots` when tax lot data is enabled for the account.
|
|
1229
1229
|
|
|
@@ -1237,8 +1237,6 @@ result = snaptrade.experimental_endpoints.get_all_account_positions(
|
|
|
1237
1237
|
user_id: "snaptrade-user-123",
|
|
1238
1238
|
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
1239
1239
|
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
1240
|
-
page: 1,
|
|
1241
|
-
page_size: 100,
|
|
1242
1240
|
)
|
|
1243
1241
|
p result
|
|
1244
1242
|
```
|
|
@@ -1248,13 +1246,6 @@ p result
|
|
|
1248
1246
|
##### user_id: `String`<a id="user_id-string"></a>
|
|
1249
1247
|
##### user_secret: `String`<a id="user_secret-string"></a>
|
|
1250
1248
|
##### account_id: `String`<a id="account_id-string"></a>
|
|
1251
|
-
##### page: `Integer`<a id="page-integer"></a>
|
|
1252
|
-
The page number to return. Defaults to 1.
|
|
1253
|
-
|
|
1254
|
-
##### page_size: `Integer`<a id="page_size-integer"></a>
|
|
1255
|
-
The number of positions to return per page. Defaults to 100 with a maximum of
|
|
1256
|
-
1000.
|
|
1257
|
-
|
|
1258
1249
|
#### 🔄 Return<a id="🔄-return"></a>
|
|
1259
1250
|
|
|
1260
1251
|
[AllAccountPositionsResponse](./lib/snaptrade/models/all_account_positions_response.rb)
|
|
@@ -179,6 +179,109 @@ module SnapTrade
|
|
|
179
179
|
end
|
|
180
180
|
|
|
181
181
|
|
|
182
|
+
# List historical account total value
|
|
183
|
+
#
|
|
184
|
+
# An experimental endpoint that returns estimated historical total account value for the specified account. Total account value is the sum of the market value of all positions and cash in the account at a given time. This endpoint is experimental, disabled by default, and has a maximum lookback of 1 year.
|
|
185
|
+
#
|
|
186
|
+
# @param user_id [String]
|
|
187
|
+
# @param user_secret [String]
|
|
188
|
+
# @param account_id [String]
|
|
189
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
190
|
+
def get_account_balance_history(user_id:, user_secret:, account_id:, extra: {})
|
|
191
|
+
data, _status_code, _headers = get_account_balance_history_with_http_info_impl(user_id, user_secret, account_id, extra)
|
|
192
|
+
data
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
# List historical account total value
|
|
196
|
+
#
|
|
197
|
+
# An experimental endpoint that returns estimated historical total account value for the specified account. Total account value is the sum of the market value of all positions and cash in the account at a given time. This endpoint is experimental, disabled by default, and has a maximum lookback of 1 year.
|
|
198
|
+
#
|
|
199
|
+
# @param user_id [String]
|
|
200
|
+
# @param user_secret [String]
|
|
201
|
+
# @param account_id [String]
|
|
202
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
203
|
+
def get_account_balance_history_with_http_info(user_id:, user_secret:, account_id:, extra: {})
|
|
204
|
+
get_account_balance_history_with_http_info_impl(user_id, user_secret, account_id, extra)
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
# List historical account total value
|
|
208
|
+
# An experimental endpoint that returns estimated historical total account value for the specified account. Total account value is the sum of the market value of all positions and cash in the account at a given time. This endpoint is experimental, disabled by default, and has a maximum lookback of 1 year.
|
|
209
|
+
# @param user_id [String]
|
|
210
|
+
# @param user_secret [String]
|
|
211
|
+
# @param account_id [String]
|
|
212
|
+
# @param [Hash] opts the optional parameters
|
|
213
|
+
# @return [AccountValueHistoryResponse]
|
|
214
|
+
private def get_account_balance_history_impl(user_id, user_secret, account_id, opts = {})
|
|
215
|
+
data, _status_code, _headers = get_account_balance_history_with_http_info(user_id, user_secret, account_id, opts)
|
|
216
|
+
data
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
# List historical account total value
|
|
220
|
+
# An experimental endpoint that returns estimated historical total account value for the specified account. Total account value is the sum of the market value of all positions and cash in the account at a given time. This endpoint is experimental, disabled by default, and has a maximum lookback of 1 year.
|
|
221
|
+
# @param user_id [String]
|
|
222
|
+
# @param user_secret [String]
|
|
223
|
+
# @param account_id [String]
|
|
224
|
+
# @param [Hash] opts the optional parameters
|
|
225
|
+
# @return [Array<(AccountValueHistoryResponse, Integer, Hash)>] AccountValueHistoryResponse data, response status code and response headers
|
|
226
|
+
private def get_account_balance_history_with_http_info_impl(user_id, user_secret, account_id, opts = {})
|
|
227
|
+
if @api_client.config.debugging
|
|
228
|
+
@api_client.config.logger.debug 'Calling API: AccountInformationApi.get_account_balance_history ...'
|
|
229
|
+
end
|
|
230
|
+
# verify the required parameter 'user_id' is set
|
|
231
|
+
if @api_client.config.client_side_validation && user_id.nil?
|
|
232
|
+
fail ArgumentError, "Missing the required parameter 'user_id' when calling AccountInformationApi.get_account_balance_history"
|
|
233
|
+
end
|
|
234
|
+
# verify the required parameter 'user_secret' is set
|
|
235
|
+
if @api_client.config.client_side_validation && user_secret.nil?
|
|
236
|
+
fail ArgumentError, "Missing the required parameter 'user_secret' when calling AccountInformationApi.get_account_balance_history"
|
|
237
|
+
end
|
|
238
|
+
# verify the required parameter 'account_id' is set
|
|
239
|
+
if @api_client.config.client_side_validation && account_id.nil?
|
|
240
|
+
fail ArgumentError, "Missing the required parameter 'account_id' when calling AccountInformationApi.get_account_balance_history"
|
|
241
|
+
end
|
|
242
|
+
# resource path
|
|
243
|
+
local_var_path = '/accounts/{accountId}/balanceHistory'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
|
|
244
|
+
|
|
245
|
+
# query parameters
|
|
246
|
+
query_params = opts[:query_params] || {}
|
|
247
|
+
query_params[:'userId'] = user_id
|
|
248
|
+
query_params[:'userSecret'] = user_secret
|
|
249
|
+
|
|
250
|
+
# header parameters
|
|
251
|
+
header_params = opts[:header_params] || {}
|
|
252
|
+
# HTTP header 'Accept' (if needed)
|
|
253
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
254
|
+
|
|
255
|
+
# form parameters
|
|
256
|
+
form_params = opts[:form_params] || {}
|
|
257
|
+
|
|
258
|
+
# http body (model)
|
|
259
|
+
post_body = opts[:debug_body]
|
|
260
|
+
|
|
261
|
+
# return_type
|
|
262
|
+
return_type = opts[:debug_return_type] || 'AccountValueHistoryResponse'
|
|
263
|
+
|
|
264
|
+
# auth_names
|
|
265
|
+
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
|
266
|
+
|
|
267
|
+
new_options = opts.merge(
|
|
268
|
+
:operation => :"AccountInformationApi.get_account_balance_history",
|
|
269
|
+
:header_params => header_params,
|
|
270
|
+
:query_params => query_params,
|
|
271
|
+
:form_params => form_params,
|
|
272
|
+
:body => post_body,
|
|
273
|
+
:auth_names => auth_names,
|
|
274
|
+
:return_type => return_type
|
|
275
|
+
)
|
|
276
|
+
|
|
277
|
+
data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
|
|
278
|
+
if @api_client.config.debugging
|
|
279
|
+
@api_client.config.logger.debug "API called: AccountInformationApi#get_account_balance_history\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
280
|
+
end
|
|
281
|
+
return data, status_code, headers, response
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
|
|
182
285
|
# List all accounts for the user, plus balances, positions, and orders for each account.
|
|
183
286
|
#
|
|
184
287
|
# **Deprecated, please use the account-specific holdings endpoint instead.**
|
|
@@ -17,114 +17,11 @@ module SnapTrade
|
|
|
17
17
|
@api_client = api_client
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
# List historical account total value
|
|
21
|
-
#
|
|
22
|
-
# An experimental endpoint that returns estimated historical total account value for the specified account. Total account value is the sum of the market value of all positions and cash in the account at a given time. This endpoint is experimental, disabled by default, and only available for certain brokerages with a maximum lookback of 1 year.
|
|
23
|
-
#
|
|
24
|
-
# @param user_id [String]
|
|
25
|
-
# @param user_secret [String]
|
|
26
|
-
# @param account_id [String]
|
|
27
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
28
|
-
def get_account_balance_history(user_id:, user_secret:, account_id:, extra: {})
|
|
29
|
-
data, _status_code, _headers = get_account_balance_history_with_http_info_impl(user_id, user_secret, account_id, extra)
|
|
30
|
-
data
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
# List historical account total value
|
|
34
|
-
#
|
|
35
|
-
# An experimental endpoint that returns estimated historical total account value for the specified account. Total account value is the sum of the market value of all positions and cash in the account at a given time. This endpoint is experimental, disabled by default, and only available for certain brokerages with a maximum lookback of 1 year.
|
|
36
|
-
#
|
|
37
|
-
# @param user_id [String]
|
|
38
|
-
# @param user_secret [String]
|
|
39
|
-
# @param account_id [String]
|
|
40
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
41
|
-
def get_account_balance_history_with_http_info(user_id:, user_secret:, account_id:, extra: {})
|
|
42
|
-
get_account_balance_history_with_http_info_impl(user_id, user_secret, account_id, extra)
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
# List historical account total value
|
|
46
|
-
# An experimental endpoint that returns estimated historical total account value for the specified account. Total account value is the sum of the market value of all positions and cash in the account at a given time. This endpoint is experimental, disabled by default, and only available for certain brokerages with a maximum lookback of 1 year.
|
|
47
|
-
# @param user_id [String]
|
|
48
|
-
# @param user_secret [String]
|
|
49
|
-
# @param account_id [String]
|
|
50
|
-
# @param [Hash] opts the optional parameters
|
|
51
|
-
# @return [AccountValueHistoryResponse]
|
|
52
|
-
private def get_account_balance_history_impl(user_id, user_secret, account_id, opts = {})
|
|
53
|
-
data, _status_code, _headers = get_account_balance_history_with_http_info(user_id, user_secret, account_id, opts)
|
|
54
|
-
data
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
# List historical account total value
|
|
58
|
-
# An experimental endpoint that returns estimated historical total account value for the specified account. Total account value is the sum of the market value of all positions and cash in the account at a given time. This endpoint is experimental, disabled by default, and only available for certain brokerages with a maximum lookback of 1 year.
|
|
59
|
-
# @param user_id [String]
|
|
60
|
-
# @param user_secret [String]
|
|
61
|
-
# @param account_id [String]
|
|
62
|
-
# @param [Hash] opts the optional parameters
|
|
63
|
-
# @return [Array<(AccountValueHistoryResponse, Integer, Hash)>] AccountValueHistoryResponse data, response status code and response headers
|
|
64
|
-
private def get_account_balance_history_with_http_info_impl(user_id, user_secret, account_id, opts = {})
|
|
65
|
-
if @api_client.config.debugging
|
|
66
|
-
@api_client.config.logger.debug 'Calling API: ExperimentalEndpointsApi.get_account_balance_history ...'
|
|
67
|
-
end
|
|
68
|
-
# verify the required parameter 'user_id' is set
|
|
69
|
-
if @api_client.config.client_side_validation && user_id.nil?
|
|
70
|
-
fail ArgumentError, "Missing the required parameter 'user_id' when calling ExperimentalEndpointsApi.get_account_balance_history"
|
|
71
|
-
end
|
|
72
|
-
# verify the required parameter 'user_secret' is set
|
|
73
|
-
if @api_client.config.client_side_validation && user_secret.nil?
|
|
74
|
-
fail ArgumentError, "Missing the required parameter 'user_secret' when calling ExperimentalEndpointsApi.get_account_balance_history"
|
|
75
|
-
end
|
|
76
|
-
# verify the required parameter 'account_id' is set
|
|
77
|
-
if @api_client.config.client_side_validation && account_id.nil?
|
|
78
|
-
fail ArgumentError, "Missing the required parameter 'account_id' when calling ExperimentalEndpointsApi.get_account_balance_history"
|
|
79
|
-
end
|
|
80
|
-
# resource path
|
|
81
|
-
local_var_path = '/accounts/{accountId}/balanceHistory'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
|
|
82
|
-
|
|
83
|
-
# query parameters
|
|
84
|
-
query_params = opts[:query_params] || {}
|
|
85
|
-
query_params[:'userId'] = user_id
|
|
86
|
-
query_params[:'userSecret'] = user_secret
|
|
87
|
-
|
|
88
|
-
# header parameters
|
|
89
|
-
header_params = opts[:header_params] || {}
|
|
90
|
-
# HTTP header 'Accept' (if needed)
|
|
91
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
92
|
-
|
|
93
|
-
# form parameters
|
|
94
|
-
form_params = opts[:form_params] || {}
|
|
95
|
-
|
|
96
|
-
# http body (model)
|
|
97
|
-
post_body = opts[:debug_body]
|
|
98
|
-
|
|
99
|
-
# return_type
|
|
100
|
-
return_type = opts[:debug_return_type] || 'AccountValueHistoryResponse'
|
|
101
|
-
|
|
102
|
-
# auth_names
|
|
103
|
-
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
|
104
|
-
|
|
105
|
-
new_options = opts.merge(
|
|
106
|
-
:operation => :"ExperimentalEndpointsApi.get_account_balance_history",
|
|
107
|
-
:header_params => header_params,
|
|
108
|
-
:query_params => query_params,
|
|
109
|
-
:form_params => form_params,
|
|
110
|
-
:body => post_body,
|
|
111
|
-
:auth_names => auth_names,
|
|
112
|
-
:return_type => return_type
|
|
113
|
-
)
|
|
114
|
-
|
|
115
|
-
data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
|
|
116
|
-
if @api_client.config.debugging
|
|
117
|
-
@api_client.config.logger.debug "API called: ExperimentalEndpointsApi#get_account_balance_history\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
118
|
-
end
|
|
119
|
-
return data, status_code, headers, response
|
|
120
|
-
end
|
|
121
|
-
|
|
122
|
-
|
|
123
20
|
# List all account positions
|
|
124
21
|
#
|
|
125
|
-
# Returns a
|
|
22
|
+
# Returns a list of all positions in the specified account.
|
|
126
23
|
#
|
|
127
|
-
# The `results` list can contain multiple instrument types in the same response
|
|
24
|
+
# The `results` list can contain multiple instrument types in the same response, including stocks, ADRs, ETFs, mutual funds, closed-end funds, crypto, futures, and option positions. Use the `instrument.kind` discriminator to determine the schema for each position's `instrument`.
|
|
128
25
|
#
|
|
129
26
|
# Stock positions may also include `cash_equivalent`, and may include `tax_lots` when tax lot data is enabled for the account.
|
|
130
27
|
#
|
|
@@ -133,21 +30,17 @@ module SnapTrade
|
|
|
133
30
|
# @param user_id [String]
|
|
134
31
|
# @param user_secret [String]
|
|
135
32
|
# @param account_id [String]
|
|
136
|
-
# @param page [Integer] The page number to return. Defaults to 1.
|
|
137
|
-
# @param page_size [Integer] The number of positions to return per page. Defaults to 100 with a maximum of 1000.
|
|
138
33
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
139
|
-
def get_all_account_positions(user_id:, user_secret:, account_id:,
|
|
140
|
-
extra[:page] = page if page != SENTINEL
|
|
141
|
-
extra[:page_size] = page_size if page_size != SENTINEL
|
|
34
|
+
def get_all_account_positions(user_id:, user_secret:, account_id:, extra: {})
|
|
142
35
|
data, _status_code, _headers = get_all_account_positions_with_http_info_impl(user_id, user_secret, account_id, extra)
|
|
143
36
|
data
|
|
144
37
|
end
|
|
145
38
|
|
|
146
39
|
# List all account positions
|
|
147
40
|
#
|
|
148
|
-
# Returns a
|
|
41
|
+
# Returns a list of all positions in the specified account.
|
|
149
42
|
#
|
|
150
|
-
# The `results` list can contain multiple instrument types in the same response
|
|
43
|
+
# The `results` list can contain multiple instrument types in the same response, including stocks, ADRs, ETFs, mutual funds, closed-end funds, crypto, futures, and option positions. Use the `instrument.kind` discriminator to determine the schema for each position's `instrument`.
|
|
151
44
|
#
|
|
152
45
|
# Stock positions may also include `cash_equivalent`, and may include `tax_lots` when tax lot data is enabled for the account.
|
|
153
46
|
#
|
|
@@ -156,23 +49,17 @@ module SnapTrade
|
|
|
156
49
|
# @param user_id [String]
|
|
157
50
|
# @param user_secret [String]
|
|
158
51
|
# @param account_id [String]
|
|
159
|
-
# @param page [Integer] The page number to return. Defaults to 1.
|
|
160
|
-
# @param page_size [Integer] The number of positions to return per page. Defaults to 100 with a maximum of 1000.
|
|
161
52
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
162
|
-
def get_all_account_positions_with_http_info(user_id:, user_secret:, account_id:,
|
|
163
|
-
extra[:page] = page if page != SENTINEL
|
|
164
|
-
extra[:page_size] = page_size if page_size != SENTINEL
|
|
53
|
+
def get_all_account_positions_with_http_info(user_id:, user_secret:, account_id:, extra: {})
|
|
165
54
|
get_all_account_positions_with_http_info_impl(user_id, user_secret, account_id, extra)
|
|
166
55
|
end
|
|
167
56
|
|
|
168
57
|
# List all account positions
|
|
169
|
-
# Returns a
|
|
58
|
+
# Returns a list of all positions in the specified account. The `results` list can contain multiple instrument types in the same response, including stocks, ADRs, ETFs, mutual funds, closed-end funds, crypto, futures, and option positions. Use the `instrument.kind` discriminator to determine the schema for each position's `instrument`. Stock positions may also include `cash_equivalent`, and may include `tax_lots` when tax lot data is enabled for the account. 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.
|
|
170
59
|
# @param user_id [String]
|
|
171
60
|
# @param user_secret [String]
|
|
172
61
|
# @param account_id [String]
|
|
173
62
|
# @param [Hash] opts the optional parameters
|
|
174
|
-
# @option opts [Integer] :page The page number to return. Defaults to 1.
|
|
175
|
-
# @option opts [Integer] :page_size The number of positions to return per page. Defaults to 100 with a maximum of 1000.
|
|
176
63
|
# @return [AllAccountPositionsResponse]
|
|
177
64
|
private def get_all_account_positions_impl(user_id, user_secret, account_id, opts = {})
|
|
178
65
|
data, _status_code, _headers = get_all_account_positions_with_http_info(user_id, user_secret, account_id, opts)
|
|
@@ -180,13 +67,11 @@ module SnapTrade
|
|
|
180
67
|
end
|
|
181
68
|
|
|
182
69
|
# List all account positions
|
|
183
|
-
# Returns a
|
|
70
|
+
# Returns a list of all positions in the specified account. The `results` list can contain multiple instrument types in the same response, including stocks, ADRs, ETFs, mutual funds, closed-end funds, crypto, futures, and option positions. Use the `instrument.kind` discriminator to determine the schema for each position's `instrument`. Stock positions may also include `cash_equivalent`, and may include `tax_lots` when tax lot data is enabled for the account. 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.
|
|
184
71
|
# @param user_id [String]
|
|
185
72
|
# @param user_secret [String]
|
|
186
73
|
# @param account_id [String]
|
|
187
74
|
# @param [Hash] opts the optional parameters
|
|
188
|
-
# @option opts [Integer] :page The page number to return. Defaults to 1.
|
|
189
|
-
# @option opts [Integer] :page_size The number of positions to return per page. Defaults to 100 with a maximum of 1000.
|
|
190
75
|
# @return [Array<(AllAccountPositionsResponse, Integer, Hash)>] AllAccountPositionsResponse data, response status code and response headers
|
|
191
76
|
private def get_all_account_positions_with_http_info_impl(user_id, user_secret, account_id, opts = {})
|
|
192
77
|
if @api_client.config.debugging
|
|
@@ -204,18 +89,6 @@ module SnapTrade
|
|
|
204
89
|
if @api_client.config.client_side_validation && account_id.nil?
|
|
205
90
|
fail ArgumentError, "Missing the required parameter 'account_id' when calling ExperimentalEndpointsApi.get_all_account_positions"
|
|
206
91
|
end
|
|
207
|
-
if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1
|
|
208
|
-
fail ArgumentError, 'invalid value for "opts[:"page"]" when calling ExperimentalEndpointsApi.get_all_account_positions, must be greater than or equal to 1.'
|
|
209
|
-
end
|
|
210
|
-
|
|
211
|
-
if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000
|
|
212
|
-
fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ExperimentalEndpointsApi.get_all_account_positions, must be smaller than or equal to 1000.'
|
|
213
|
-
end
|
|
214
|
-
|
|
215
|
-
if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1
|
|
216
|
-
fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ExperimentalEndpointsApi.get_all_account_positions, must be greater than or equal to 1.'
|
|
217
|
-
end
|
|
218
|
-
|
|
219
92
|
# resource path
|
|
220
93
|
local_var_path = '/accounts/{accountId}/positions/all'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
|
|
221
94
|
|
|
@@ -223,8 +96,6 @@ module SnapTrade
|
|
|
223
96
|
query_params = opts[:query_params] || {}
|
|
224
97
|
query_params[:'userId'] = user_id
|
|
225
98
|
query_params[:'userSecret'] = user_secret
|
|
226
|
-
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
|
|
227
|
-
query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?
|
|
228
99
|
|
|
229
100
|
# header parameters
|
|
230
101
|
header_params = opts[:header_params] || {}
|
|
@@ -160,7 +160,7 @@ module SnapTrade
|
|
|
160
160
|
@ssl_client_cert = nil
|
|
161
161
|
@ssl_client_key = nil
|
|
162
162
|
@middlewares = Hash.new { |h, k| h[k] = [] }
|
|
163
|
-
@timeout =
|
|
163
|
+
@timeout = 120
|
|
164
164
|
# return data as binary instead of file
|
|
165
165
|
@return_binary_data = false
|
|
166
166
|
@params_encoder = nil
|