snaptrade 3.0.42 → 3.0.43
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/README.md +43 -3
- data/lib/snaptrade/api/management_api.rb +108 -12
- data/lib/snaptrade/models/account_balances_v2_response.rb +1 -1
- data/lib/snaptrade/models/connected_asset_partner_stats.rb +382 -0
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +1 -0
- data/spec/api/management_api_spec.rb +15 -3
- data/spec/models/connected_asset_partner_stats_spec.rb +107 -0
- metadata +255 -252
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e4f85b9d1b1c3c35297f0b4e937782ddd87ac1fefe8a44d89d1db6fb15e91a6d
|
|
4
|
+
data.tar.gz: b3ebe1a7502cd05431555ca0eece1885d0c6c218e2aa94acce12f922aa5561ee
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9ab272bfcc080dc03433a1577adeb1bc7963c47d13fb8d839c1c9a387e8e37202e72631107951ec339f255be10aa16a6840d4671eda5d54e3fa5a5e1989105cb
|
|
7
|
+
data.tar.gz: d9135555eead25f271e1a2401d22f959e0535f182da7b320e7275963ad0b1a7a409617e6760ede9569fd6bfbe8b7797cc3f8c4971e150e87493c71c9c9f6d27e
|
data/README.md
CHANGED
|
@@ -63,7 +63,7 @@ backoff with jitter rather than from the headers.
|
|
|
63
63
|
See https://docs.snaptrade.com/docs/ratelimiting.
|
|
64
64
|
|
|
65
65
|
|
|
66
|
-
[](https://rubygems.org/gems/snaptrade/versions/3.0.43)
|
|
67
67
|
[](https://snaptrade.com/)
|
|
68
68
|
|
|
69
69
|
</div>
|
|
@@ -114,6 +114,7 @@ See https://docs.snaptrade.com/docs/ratelimiting.
|
|
|
114
114
|
* [`snaptrade.experimental_endpoints.list_subscriptions`](#snaptradeexperimental_endpointslist_subscriptions)
|
|
115
115
|
* [`snaptrade.experimental_endpoints.place_simple_order`](#snaptradeexperimental_endpointsplace_simple_order)
|
|
116
116
|
* [`snaptrade.management.get_stats`](#snaptrademanagementget_stats)
|
|
117
|
+
* [`snaptrade.management.get_stats_legacy`](#snaptrademanagementget_stats_legacy)
|
|
117
118
|
* [`snaptrade.reference_data.get_partner_info`](#snaptradereference_dataget_partner_info)
|
|
118
119
|
* [`snaptrade.reference_data.get_stock_exchanges`](#snaptradereference_dataget_stock_exchanges)
|
|
119
120
|
* [`snaptrade.reference_data.get_symbols`](#snaptradereference_dataget_symbols)
|
|
@@ -145,7 +146,7 @@ See https://docs.snaptrade.com/docs/ratelimiting.
|
|
|
145
146
|
Add to Gemfile:
|
|
146
147
|
|
|
147
148
|
```ruby
|
|
148
|
-
gem 'snaptrade', '~> 3.0.
|
|
149
|
+
gem 'snaptrade', '~> 3.0.43'
|
|
149
150
|
```
|
|
150
151
|
|
|
151
152
|
## Getting Started<a id="getting-started"></a>
|
|
@@ -1778,9 +1779,11 @@ extended-hours enablement. Futures and multi-leg orders only accept regular.
|
|
|
1778
1779
|
|
|
1779
1780
|
### `snaptrade.management.get_stats`<a id="snaptrademanagementget_stats"></a>
|
|
1780
1781
|
|
|
1782
|
+
**Beta.** This endpoint and its response schema may change.
|
|
1783
|
+
|
|
1781
1784
|
Returns user, connection, and connected asset totals for your SnapTrade Client ID. These are the same numbers shown on the Users & Connections page of the SnapTrade Dashboard.
|
|
1782
1785
|
|
|
1783
|
-
User and connection counts are cached for up to 5 minutes. Connected asset values come from a snapshot calculated once a day; `
|
|
1786
|
+
User and connection counts are cached for up to 5 minutes. Connected asset values come from a snapshot calculated once a day; `connected_assets_calculated_at` indicates when it was last calculated.
|
|
1784
1787
|
|
|
1785
1788
|
|
|
1786
1789
|
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
|
@@ -1799,6 +1802,43 @@ ISO 4217 currency code to express connected asset values in. Defaults to `USD`.
|
|
|
1799
1802
|
|
|
1800
1803
|
#### 🔄 Return<a id="🔄-return"></a>
|
|
1801
1804
|
|
|
1805
|
+
[ConnectedAssetPartnerStats](./lib/snaptrade/models/connected_asset_partner_stats.rb)
|
|
1806
|
+
|
|
1807
|
+
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
|
1808
|
+
|
|
1809
|
+
`/management/stats` `GET`
|
|
1810
|
+
|
|
1811
|
+
[🔙 **Back to Table of Contents**](#table-of-contents)
|
|
1812
|
+
|
|
1813
|
+
---
|
|
1814
|
+
|
|
1815
|
+
|
|
1816
|
+
### `snaptrade.management.get_stats_legacy`<a id="snaptrademanagementget_stats_legacy"></a>
|
|
1817
|
+

|
|
1818
|
+
|
|
1819
|
+
**Deprecated.** Use `GET /management/stats` for the beta response with connected asset field names.
|
|
1820
|
+
|
|
1821
|
+
Returns user, connection, and connected asset totals for your SnapTrade Client ID. These are the same numbers shown on the Users & Connections page of the SnapTrade Dashboard.
|
|
1822
|
+
|
|
1823
|
+
User and connection counts are cached for up to 5 minutes. Connected asset values come from a snapshot calculated once a day; `assets_under_management_calculated_at` indicates when it was last calculated.
|
|
1824
|
+
|
|
1825
|
+
|
|
1826
|
+
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
|
1827
|
+
|
|
1828
|
+
```ruby
|
|
1829
|
+
result = snaptrade.management.get_stats_legacy(
|
|
1830
|
+
currency: "USD",
|
|
1831
|
+
)
|
|
1832
|
+
p result
|
|
1833
|
+
```
|
|
1834
|
+
|
|
1835
|
+
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
1836
|
+
|
|
1837
|
+
##### currency: `String`<a id="currency-string"></a>
|
|
1838
|
+
ISO 4217 currency code to express connected asset values in. Defaults to `USD`.
|
|
1839
|
+
|
|
1840
|
+
#### 🔄 Return<a id="🔄-return"></a>
|
|
1841
|
+
|
|
1802
1842
|
[PartnerStats](./lib/snaptrade/models/partner_stats.rb)
|
|
1803
1843
|
|
|
1804
1844
|
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
|
@@ -17,11 +17,13 @@ module SnapTrade
|
|
|
17
17
|
@api_client = api_client
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
# Get usage stats
|
|
20
|
+
# Get usage stats (beta)
|
|
21
21
|
#
|
|
22
|
+
# **Beta.** This endpoint and its response schema may change.
|
|
23
|
+
#
|
|
22
24
|
# Returns user, connection, and connected asset totals for your SnapTrade Client ID. These are the same numbers shown on the Users & Connections page of the SnapTrade Dashboard.
|
|
23
25
|
#
|
|
24
|
-
# User and connection counts are cached for up to 5 minutes. Connected asset values come from a snapshot calculated once a day; `
|
|
26
|
+
# User and connection counts are cached for up to 5 minutes. Connected asset values come from a snapshot calculated once a day; `connected_assets_calculated_at` indicates when it was last calculated.
|
|
25
27
|
#
|
|
26
28
|
# @param currency [String] ISO 4217 currency code to express connected asset values in. Defaults to `USD`.
|
|
27
29
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
@@ -31,11 +33,13 @@ module SnapTrade
|
|
|
31
33
|
data
|
|
32
34
|
end
|
|
33
35
|
|
|
34
|
-
# Get usage stats
|
|
36
|
+
# Get usage stats (beta)
|
|
35
37
|
#
|
|
38
|
+
# **Beta.** This endpoint and its response schema may change.
|
|
39
|
+
#
|
|
36
40
|
# Returns user, connection, and connected asset totals for your SnapTrade Client ID. These are the same numbers shown on the Users & Connections page of the SnapTrade Dashboard.
|
|
37
41
|
#
|
|
38
|
-
# User and connection counts are cached for up to 5 minutes. Connected asset values come from a snapshot calculated once a day; `
|
|
42
|
+
# User and connection counts are cached for up to 5 minutes. Connected asset values come from a snapshot calculated once a day; `connected_assets_calculated_at` indicates when it was last calculated.
|
|
39
43
|
#
|
|
40
44
|
# @param currency [String] ISO 4217 currency code to express connected asset values in. Defaults to `USD`.
|
|
41
45
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
@@ -44,27 +48,27 @@ module SnapTrade
|
|
|
44
48
|
get_stats_with_http_info_impl(extra)
|
|
45
49
|
end
|
|
46
50
|
|
|
47
|
-
# Get usage stats
|
|
48
|
-
# Returns user, connection, and connected asset totals for your SnapTrade Client ID. These are the same numbers shown on the Users & Connections page of the SnapTrade Dashboard. User and connection counts are cached for up to 5 minutes. Connected asset values come from a snapshot calculated once a day; `
|
|
51
|
+
# Get usage stats (beta)
|
|
52
|
+
# **Beta.** This endpoint and its response schema may change. Returns user, connection, and connected asset totals for your SnapTrade Client ID. These are the same numbers shown on the Users & Connections page of the SnapTrade Dashboard. User and connection counts are cached for up to 5 minutes. Connected asset values come from a snapshot calculated once a day; `connected_assets_calculated_at` indicates when it was last calculated.
|
|
49
53
|
# @param [Hash] opts the optional parameters
|
|
50
54
|
# @option opts [String] :currency ISO 4217 currency code to express connected asset values in. Defaults to `USD`.
|
|
51
|
-
# @return [
|
|
55
|
+
# @return [ConnectedAssetPartnerStats]
|
|
52
56
|
private def get_stats_impl(opts = {})
|
|
53
57
|
data, _status_code, _headers = get_stats_with_http_info(opts)
|
|
54
58
|
data
|
|
55
59
|
end
|
|
56
60
|
|
|
57
|
-
# Get usage stats
|
|
58
|
-
# Returns user, connection, and connected asset totals for your SnapTrade Client ID. These are the same numbers shown on the Users & Connections page of the SnapTrade Dashboard. User and connection counts are cached for up to 5 minutes. Connected asset values come from a snapshot calculated once a day; `
|
|
61
|
+
# Get usage stats (beta)
|
|
62
|
+
# **Beta.** This endpoint and its response schema may change. Returns user, connection, and connected asset totals for your SnapTrade Client ID. These are the same numbers shown on the Users & Connections page of the SnapTrade Dashboard. User and connection counts are cached for up to 5 minutes. Connected asset values come from a snapshot calculated once a day; `connected_assets_calculated_at` indicates when it was last calculated.
|
|
59
63
|
# @param [Hash] opts the optional parameters
|
|
60
64
|
# @option opts [String] :currency ISO 4217 currency code to express connected asset values in. Defaults to `USD`.
|
|
61
|
-
# @return [Array<(
|
|
65
|
+
# @return [Array<(ConnectedAssetPartnerStats, Integer, Hash)>] ConnectedAssetPartnerStats data, response status code and response headers
|
|
62
66
|
private def get_stats_with_http_info_impl(opts = {})
|
|
63
67
|
if @api_client.config.debugging
|
|
64
68
|
@api_client.config.logger.debug 'Calling API: ManagementApi.get_stats ...'
|
|
65
69
|
end
|
|
66
70
|
# resource path
|
|
67
|
-
local_var_path = '/
|
|
71
|
+
local_var_path = '/management/stats'
|
|
68
72
|
|
|
69
73
|
# query parameters
|
|
70
74
|
query_params = opts[:query_params] || {}
|
|
@@ -82,7 +86,7 @@ module SnapTrade
|
|
|
82
86
|
post_body = opts[:debug_body]
|
|
83
87
|
|
|
84
88
|
# return_type
|
|
85
|
-
return_type = opts[:debug_return_type] || '
|
|
89
|
+
return_type = opts[:debug_return_type] || 'ConnectedAssetPartnerStats'
|
|
86
90
|
|
|
87
91
|
# auth_names
|
|
88
92
|
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
|
@@ -103,6 +107,98 @@ module SnapTrade
|
|
|
103
107
|
end
|
|
104
108
|
return data, status_code, headers, response
|
|
105
109
|
end
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
# Get usage stats (deprecated)
|
|
113
|
+
#
|
|
114
|
+
# **Deprecated.** Use `GET /management/stats` for the beta response with connected asset field names.
|
|
115
|
+
#
|
|
116
|
+
# Returns user, connection, and connected asset totals for your SnapTrade Client ID. These are the same numbers shown on the Users & Connections page of the SnapTrade Dashboard.
|
|
117
|
+
#
|
|
118
|
+
# User and connection counts are cached for up to 5 minutes. Connected asset values come from a snapshot calculated once a day; `assets_under_management_calculated_at` indicates when it was last calculated.
|
|
119
|
+
#
|
|
120
|
+
# @param currency [String] ISO 4217 currency code to express connected asset values in. Defaults to `USD`.
|
|
121
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
122
|
+
def get_stats_legacy(currency: SENTINEL, extra: {})
|
|
123
|
+
extra[:currency] = currency if currency != SENTINEL
|
|
124
|
+
data, _status_code, _headers = get_stats_legacy_with_http_info_impl(extra)
|
|
125
|
+
data
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# Get usage stats (deprecated)
|
|
129
|
+
#
|
|
130
|
+
# **Deprecated.** Use `GET /management/stats` for the beta response with connected asset field names.
|
|
131
|
+
#
|
|
132
|
+
# Returns user, connection, and connected asset totals for your SnapTrade Client ID. These are the same numbers shown on the Users & Connections page of the SnapTrade Dashboard.
|
|
133
|
+
#
|
|
134
|
+
# User and connection counts are cached for up to 5 minutes. Connected asset values come from a snapshot calculated once a day; `assets_under_management_calculated_at` indicates when it was last calculated.
|
|
135
|
+
#
|
|
136
|
+
# @param currency [String] ISO 4217 currency code to express connected asset values in. Defaults to `USD`.
|
|
137
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
138
|
+
def get_stats_legacy_with_http_info(currency: SENTINEL, extra: {})
|
|
139
|
+
extra[:currency] = currency if currency != SENTINEL
|
|
140
|
+
get_stats_legacy_with_http_info_impl(extra)
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# Get usage stats (deprecated)
|
|
144
|
+
# **Deprecated.** Use `GET /management/stats` for the beta response with connected asset field names. Returns user, connection, and connected asset totals for your SnapTrade Client ID. These are the same numbers shown on the Users & Connections page of the SnapTrade Dashboard. User and connection counts are cached for up to 5 minutes. Connected asset values come from a snapshot calculated once a day; `assets_under_management_calculated_at` indicates when it was last calculated.
|
|
145
|
+
# @param [Hash] opts the optional parameters
|
|
146
|
+
# @option opts [String] :currency ISO 4217 currency code to express connected asset values in. Defaults to `USD`.
|
|
147
|
+
# @return [PartnerStats]
|
|
148
|
+
private def get_stats_legacy_impl(opts = {})
|
|
149
|
+
data, _status_code, _headers = get_stats_legacy_with_http_info(opts)
|
|
150
|
+
data
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
# Get usage stats (deprecated)
|
|
154
|
+
# **Deprecated.** Use `GET /management/stats` for the beta response with connected asset field names. Returns user, connection, and connected asset totals for your SnapTrade Client ID. These are the same numbers shown on the Users & Connections page of the SnapTrade Dashboard. User and connection counts are cached for up to 5 minutes. Connected asset values come from a snapshot calculated once a day; `assets_under_management_calculated_at` indicates when it was last calculated.
|
|
155
|
+
# @param [Hash] opts the optional parameters
|
|
156
|
+
# @option opts [String] :currency ISO 4217 currency code to express connected asset values in. Defaults to `USD`.
|
|
157
|
+
# @return [Array<(PartnerStats, Integer, Hash)>] PartnerStats data, response status code and response headers
|
|
158
|
+
private def get_stats_legacy_with_http_info_impl(opts = {})
|
|
159
|
+
if @api_client.config.debugging
|
|
160
|
+
@api_client.config.logger.debug 'Calling API: ManagementApi.get_stats_legacy ...'
|
|
161
|
+
end
|
|
162
|
+
# resource path
|
|
163
|
+
local_var_path = '/snapTrade/stats'
|
|
164
|
+
|
|
165
|
+
# query parameters
|
|
166
|
+
query_params = opts[:query_params] || {}
|
|
167
|
+
query_params[:'currency'] = opts[:'currency'] if !opts[:'currency'].nil?
|
|
168
|
+
|
|
169
|
+
# header parameters
|
|
170
|
+
header_params = opts[:header_params] || {}
|
|
171
|
+
# HTTP header 'Accept' (if needed)
|
|
172
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
173
|
+
|
|
174
|
+
# form parameters
|
|
175
|
+
form_params = opts[:form_params] || {}
|
|
176
|
+
|
|
177
|
+
# http body (model)
|
|
178
|
+
post_body = opts[:debug_body]
|
|
179
|
+
|
|
180
|
+
# return_type
|
|
181
|
+
return_type = opts[:debug_return_type] || 'PartnerStats'
|
|
182
|
+
|
|
183
|
+
# auth_names
|
|
184
|
+
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
|
185
|
+
|
|
186
|
+
new_options = opts.merge(
|
|
187
|
+
:operation => :"ManagementApi.get_stats_legacy",
|
|
188
|
+
:header_params => header_params,
|
|
189
|
+
:query_params => query_params,
|
|
190
|
+
:form_params => form_params,
|
|
191
|
+
:body => post_body,
|
|
192
|
+
:auth_names => auth_names,
|
|
193
|
+
:return_type => return_type
|
|
194
|
+
)
|
|
195
|
+
|
|
196
|
+
data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
|
|
197
|
+
if @api_client.config.debugging
|
|
198
|
+
@api_client.config.logger.debug "API called: ManagementApi#get_stats_legacy\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
199
|
+
end
|
|
200
|
+
return data, status_code, headers, response
|
|
201
|
+
end
|
|
106
202
|
end
|
|
107
203
|
|
|
108
204
|
# top-level client access to avoid having the user to insantiate their own API instances
|
|
@@ -24,7 +24,7 @@ module SnapTrade
|
|
|
24
24
|
# Cash held in the account, one entry per currency. Some institutions allow holding multiple currencies in the same account.
|
|
25
25
|
attr_accessor :cash
|
|
26
26
|
|
|
27
|
-
# How much the account can spend on new purchases, one entry per currency. Amounts are in different currencies and shouldn't be added together. Null when it can't be determined. - **Cash accounts:** one entry per currency held, never more than the cash in that currency. Each entry is the settled cash available to spend in that currency where the institution reports it; otherwise it's the institution's buying power or cash, which may include proceeds from trades that haven't settled. Check `basis`. - **Margin accounts:**
|
|
27
|
+
# How much the account can spend on new purchases, one entry per currency. Amounts are in different currencies and shouldn't be added together. Null when it can't be determined. - **Cash accounts:** one entry per currency held, never more than the cash in that currency. Each entry is the settled cash available to spend in that currency where the institution reports it; otherwise it's the institution's buying power or cash, which may include proceeds from trades that haven't settled. Check `basis`. - **Margin accounts:** a single entry with the institution's buying power, typically its overnight figure (day-trading buying power isn't included). How it's calculated varies by institution, it can be negative, and it may not cover options or other non-marginable securities.
|
|
28
28
|
attr_accessor :buying_power
|
|
29
29
|
|
|
30
30
|
attr_accessor :margin
|
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#SnapTrade
|
|
3
|
+
|
|
4
|
+
#Connect brokerage accounts to your app for live positions and trading. ## Rate limiting Two limits apply to requests signed with your `clientId`. The stricter one wins, and exceeding either returns `429 Too Many Requests`. - **Customer-level** — 250 requests/minute by default, scoped to your `clientId` and applied across all endpoints. Reported in `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. - **Account-level** — 10 requests/minute per account, scoped to (`clientId`, `accountId`). All covered operations for one account draw on the same bucket — reading balances and reading positions share it — and enforcement does not depend on the HTTP method, so updating an account consumes the same bucket as reading it. Only enforced for Personal users, and only for integrations it has been rolled out to — it is not yet in force for every Personal integration. It also does not apply on every operation that documents a 429 below. Where it applies it is reported in `X-RateLimit-Account-Limit`, `X-RateLimit-Account-Remaining` and `X-RateLimit-Account-Reset`. Do not read the absence of those headers as proof the limit is off — some configurations omit the rate limit headers while still enforcing the limit, so header absence tells you nothing about your allowance. On a 429, `X-RateLimit-Remaining: 0` means you hit the customer-level limit and `X-RateLimit-Account-Remaining: 0` means the account-level one. Wait for the corresponding `*-Reset` value (seconds) before retrying, or fall back to exponential backoff with jitter. Not every 429 is explained by those headers. A separate per-authenticated-user limit, reported in no `X-RateLimit-*` header, covers OAuth-authenticated requests and signed requests in configurations where the customer-level limit is not in effect — on the operations that use the default throttles. A few operations override those and are governed by the customer-level limit alone. The two do not stack: a signed request governed by the customer-level limit above is not additionally subject to the per-user one. If a 429 arrives with no header at zero — or with no `X-RateLimit-*` headers at all — honour `Retry-After` and back off. Treat the remaining counts as a hint, not a guarantee that the next request will succeed. Because the customer-level limit applies everywhere, any signed request can return 429. **OAuth-authenticated requests are an exception.** They are not subject to the customer-level limit and do not receive `X-RateLimit-Limit`, `X-RateLimit-Remaining` or `X-RateLimit-Reset` — do not wait on those headers or design around a customer-level allowance on this path. The account-level limit still applies to them on the account-data endpoints above, reported in the `X-RateLimit-Account-*` headers. On operations using the default throttles the per-user limit above applies to them as well, so an OAuth request can be rejected while the account headers still show capacity; on the few operations that override those throttles, OAuth callers have no per-user ceiling at all. Drive retries from `Retry-After` and exponential backoff with jitter rather than from the headers. See https://docs.snaptrade.com/docs/ratelimiting.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
Contact: api@snaptrade.com
|
|
8
|
+
=end
|
|
9
|
+
|
|
10
|
+
require 'date'
|
|
11
|
+
require 'time'
|
|
12
|
+
|
|
13
|
+
module SnapTrade
|
|
14
|
+
# User, connection, and connected asset totals for your SnapTrade Client ID.
|
|
15
|
+
class ConnectedAssetPartnerStats
|
|
16
|
+
# Number of users registered with your Client ID.
|
|
17
|
+
attr_accessor :total_users
|
|
18
|
+
|
|
19
|
+
# Number of users registered with your Client ID that have at least one connection, active or disabled.
|
|
20
|
+
attr_accessor :total_connected_users
|
|
21
|
+
|
|
22
|
+
# Number of active connections across users registered with your Client ID.
|
|
23
|
+
attr_accessor :total_active_connections
|
|
24
|
+
|
|
25
|
+
# Number of disabled connections across users registered with your Client ID.
|
|
26
|
+
attr_accessor :total_disabled_connections
|
|
27
|
+
|
|
28
|
+
# Number of users who have authorized your OAuth application. `null` if your Client ID has no OAuth application.
|
|
29
|
+
attr_accessor :oauth_total_users
|
|
30
|
+
|
|
31
|
+
# Number of users who have authorized your OAuth application and have at least one connection, active or disabled. `null` if your Client ID has no OAuth application.
|
|
32
|
+
attr_accessor :oauth_total_connected_users
|
|
33
|
+
|
|
34
|
+
# Number of active connections across users who have authorized your OAuth application. `null` if your Client ID has no OAuth application.
|
|
35
|
+
attr_accessor :oauth_total_active_connections
|
|
36
|
+
|
|
37
|
+
# Number of disabled connections across users who have authorized your OAuth application. `null` if your Client ID has no OAuth application.
|
|
38
|
+
attr_accessor :oauth_total_disabled_connections
|
|
39
|
+
|
|
40
|
+
# Total latest account value across active connections of users registered with your Client ID, in `connected_assets_currency`. `null` until the first daily snapshot has been calculated.
|
|
41
|
+
attr_accessor :connected_assets
|
|
42
|
+
|
|
43
|
+
# Total account value across disabled connections of users registered with your Client ID, as of each connection's last sync, in `connected_assets_currency`. `null` until the first daily snapshot has been calculated.
|
|
44
|
+
attr_accessor :disabled_connected_assets
|
|
45
|
+
|
|
46
|
+
# Total latest account value across active connections of users who have authorized your OAuth application, in `connected_assets_currency`. `null` if your Client ID has no OAuth application, or until the first daily snapshot after it was added.
|
|
47
|
+
attr_accessor :oauth_connected_assets
|
|
48
|
+
|
|
49
|
+
# Total account value across disabled connections of users who have authorized your OAuth application, as of each connection's last sync, in `connected_assets_currency`. `null` if your Client ID has no OAuth application, or until the first daily snapshot after it was added.
|
|
50
|
+
attr_accessor :oauth_disabled_connected_assets
|
|
51
|
+
|
|
52
|
+
# ISO 4217 currency code the asset values are expressed in.
|
|
53
|
+
attr_accessor :connected_assets_currency
|
|
54
|
+
|
|
55
|
+
# Timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format indicating when the connected asset values were last calculated. `null` until the first daily snapshot has been calculated.
|
|
56
|
+
attr_accessor :connected_assets_calculated_at
|
|
57
|
+
|
|
58
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
59
|
+
def self.attribute_map
|
|
60
|
+
{
|
|
61
|
+
:'total_users' => :'total_users',
|
|
62
|
+
:'total_connected_users' => :'total_connected_users',
|
|
63
|
+
:'total_active_connections' => :'total_active_connections',
|
|
64
|
+
:'total_disabled_connections' => :'total_disabled_connections',
|
|
65
|
+
:'oauth_total_users' => :'oauth_total_users',
|
|
66
|
+
:'oauth_total_connected_users' => :'oauth_total_connected_users',
|
|
67
|
+
:'oauth_total_active_connections' => :'oauth_total_active_connections',
|
|
68
|
+
:'oauth_total_disabled_connections' => :'oauth_total_disabled_connections',
|
|
69
|
+
:'connected_assets' => :'connected_assets',
|
|
70
|
+
:'disabled_connected_assets' => :'disabled_connected_assets',
|
|
71
|
+
:'oauth_connected_assets' => :'oauth_connected_assets',
|
|
72
|
+
:'oauth_disabled_connected_assets' => :'oauth_disabled_connected_assets',
|
|
73
|
+
:'connected_assets_currency' => :'connected_assets_currency',
|
|
74
|
+
:'connected_assets_calculated_at' => :'connected_assets_calculated_at'
|
|
75
|
+
}
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# Returns all the JSON keys this model knows about
|
|
79
|
+
def self.acceptable_attributes
|
|
80
|
+
attribute_map.values
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# Attribute type mapping.
|
|
84
|
+
def self.openapi_types
|
|
85
|
+
{
|
|
86
|
+
:'total_users' => :'Integer',
|
|
87
|
+
:'total_connected_users' => :'Integer',
|
|
88
|
+
:'total_active_connections' => :'Integer',
|
|
89
|
+
:'total_disabled_connections' => :'Integer',
|
|
90
|
+
:'oauth_total_users' => :'Integer',
|
|
91
|
+
:'oauth_total_connected_users' => :'Integer',
|
|
92
|
+
:'oauth_total_active_connections' => :'Integer',
|
|
93
|
+
:'oauth_total_disabled_connections' => :'Integer',
|
|
94
|
+
:'connected_assets' => :'Float',
|
|
95
|
+
:'disabled_connected_assets' => :'Float',
|
|
96
|
+
:'oauth_connected_assets' => :'Float',
|
|
97
|
+
:'oauth_disabled_connected_assets' => :'Float',
|
|
98
|
+
:'connected_assets_currency' => :'String',
|
|
99
|
+
:'connected_assets_calculated_at' => :'Time'
|
|
100
|
+
}
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# List of attributes with nullable: true
|
|
104
|
+
def self.openapi_nullable
|
|
105
|
+
Set.new([
|
|
106
|
+
:'oauth_total_users',
|
|
107
|
+
:'oauth_total_connected_users',
|
|
108
|
+
:'oauth_total_active_connections',
|
|
109
|
+
:'oauth_total_disabled_connections',
|
|
110
|
+
:'connected_assets',
|
|
111
|
+
:'disabled_connected_assets',
|
|
112
|
+
:'oauth_connected_assets',
|
|
113
|
+
:'oauth_disabled_connected_assets',
|
|
114
|
+
:'connected_assets_calculated_at'
|
|
115
|
+
])
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
# Initializes the object
|
|
119
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
120
|
+
def initialize(attributes = {})
|
|
121
|
+
if (!attributes.is_a?(Hash))
|
|
122
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::ConnectedAssetPartnerStats` initialize method"
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
126
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
127
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
128
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::ConnectedAssetPartnerStats`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
129
|
+
end
|
|
130
|
+
h[k.to_sym] = v
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if attributes.key?(:'total_users')
|
|
134
|
+
self.total_users = attributes[:'total_users']
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
if attributes.key?(:'total_connected_users')
|
|
138
|
+
self.total_connected_users = attributes[:'total_connected_users']
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
if attributes.key?(:'total_active_connections')
|
|
142
|
+
self.total_active_connections = attributes[:'total_active_connections']
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
if attributes.key?(:'total_disabled_connections')
|
|
146
|
+
self.total_disabled_connections = attributes[:'total_disabled_connections']
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
if attributes.key?(:'oauth_total_users')
|
|
150
|
+
self.oauth_total_users = attributes[:'oauth_total_users']
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
if attributes.key?(:'oauth_total_connected_users')
|
|
154
|
+
self.oauth_total_connected_users = attributes[:'oauth_total_connected_users']
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
if attributes.key?(:'oauth_total_active_connections')
|
|
158
|
+
self.oauth_total_active_connections = attributes[:'oauth_total_active_connections']
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
if attributes.key?(:'oauth_total_disabled_connections')
|
|
162
|
+
self.oauth_total_disabled_connections = attributes[:'oauth_total_disabled_connections']
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
if attributes.key?(:'connected_assets')
|
|
166
|
+
self.connected_assets = attributes[:'connected_assets']
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
if attributes.key?(:'disabled_connected_assets')
|
|
170
|
+
self.disabled_connected_assets = attributes[:'disabled_connected_assets']
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
if attributes.key?(:'oauth_connected_assets')
|
|
174
|
+
self.oauth_connected_assets = attributes[:'oauth_connected_assets']
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
if attributes.key?(:'oauth_disabled_connected_assets')
|
|
178
|
+
self.oauth_disabled_connected_assets = attributes[:'oauth_disabled_connected_assets']
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
if attributes.key?(:'connected_assets_currency')
|
|
182
|
+
self.connected_assets_currency = attributes[:'connected_assets_currency']
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
if attributes.key?(:'connected_assets_calculated_at')
|
|
186
|
+
self.connected_assets_calculated_at = attributes[:'connected_assets_calculated_at']
|
|
187
|
+
end
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
191
|
+
# @return Array for valid properties with the reasons
|
|
192
|
+
def list_invalid_properties
|
|
193
|
+
invalid_properties = Array.new
|
|
194
|
+
if @total_users.nil?
|
|
195
|
+
invalid_properties.push('invalid value for "total_users", total_users cannot be nil.')
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
if @total_connected_users.nil?
|
|
199
|
+
invalid_properties.push('invalid value for "total_connected_users", total_connected_users cannot be nil.')
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
if @total_active_connections.nil?
|
|
203
|
+
invalid_properties.push('invalid value for "total_active_connections", total_active_connections cannot be nil.')
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
if @total_disabled_connections.nil?
|
|
207
|
+
invalid_properties.push('invalid value for "total_disabled_connections", total_disabled_connections cannot be nil.')
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
if @connected_assets_currency.nil?
|
|
211
|
+
invalid_properties.push('invalid value for "connected_assets_currency", connected_assets_currency cannot be nil.')
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
invalid_properties
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
# Check to see if the all the properties in the model are valid
|
|
218
|
+
# @return true if the model is valid
|
|
219
|
+
def valid?
|
|
220
|
+
return false if @total_users.nil?
|
|
221
|
+
return false if @total_connected_users.nil?
|
|
222
|
+
return false if @total_active_connections.nil?
|
|
223
|
+
return false if @total_disabled_connections.nil?
|
|
224
|
+
return false if @connected_assets_currency.nil?
|
|
225
|
+
true
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
# Checks equality by comparing each attribute.
|
|
229
|
+
# @param [Object] Object to be compared
|
|
230
|
+
def ==(o)
|
|
231
|
+
return true if self.equal?(o)
|
|
232
|
+
self.class == o.class &&
|
|
233
|
+
total_users == o.total_users &&
|
|
234
|
+
total_connected_users == o.total_connected_users &&
|
|
235
|
+
total_active_connections == o.total_active_connections &&
|
|
236
|
+
total_disabled_connections == o.total_disabled_connections &&
|
|
237
|
+
oauth_total_users == o.oauth_total_users &&
|
|
238
|
+
oauth_total_connected_users == o.oauth_total_connected_users &&
|
|
239
|
+
oauth_total_active_connections == o.oauth_total_active_connections &&
|
|
240
|
+
oauth_total_disabled_connections == o.oauth_total_disabled_connections &&
|
|
241
|
+
connected_assets == o.connected_assets &&
|
|
242
|
+
disabled_connected_assets == o.disabled_connected_assets &&
|
|
243
|
+
oauth_connected_assets == o.oauth_connected_assets &&
|
|
244
|
+
oauth_disabled_connected_assets == o.oauth_disabled_connected_assets &&
|
|
245
|
+
connected_assets_currency == o.connected_assets_currency &&
|
|
246
|
+
connected_assets_calculated_at == o.connected_assets_calculated_at
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
# @see the `==` method
|
|
250
|
+
# @param [Object] Object to be compared
|
|
251
|
+
def eql?(o)
|
|
252
|
+
self == o
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
# Calculates hash code according to all attributes.
|
|
256
|
+
# @return [Integer] Hash code
|
|
257
|
+
def hash
|
|
258
|
+
[total_users, total_connected_users, total_active_connections, total_disabled_connections, oauth_total_users, oauth_total_connected_users, oauth_total_active_connections, oauth_total_disabled_connections, connected_assets, disabled_connected_assets, oauth_connected_assets, oauth_disabled_connected_assets, connected_assets_currency, connected_assets_calculated_at].hash
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
# Builds the object from hash
|
|
262
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
263
|
+
# @return [Object] Returns the model itself
|
|
264
|
+
def self.build_from_hash(attributes)
|
|
265
|
+
new.build_from_hash(attributes)
|
|
266
|
+
end
|
|
267
|
+
|
|
268
|
+
# Builds the object from hash
|
|
269
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
270
|
+
# @return [Object] Returns the model itself
|
|
271
|
+
def build_from_hash(attributes)
|
|
272
|
+
return nil unless attributes.is_a?(Hash)
|
|
273
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
274
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
275
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
276
|
+
self.send("#{key}=", nil)
|
|
277
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
278
|
+
# check to ensure the input is an array given that the attribute
|
|
279
|
+
# is documented as an array but the input is not
|
|
280
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
281
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
282
|
+
end
|
|
283
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
284
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
285
|
+
end
|
|
286
|
+
end
|
|
287
|
+
|
|
288
|
+
self
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
# Deserializes the data based on type
|
|
292
|
+
# @param string type Data type
|
|
293
|
+
# @param string value Value to be deserialized
|
|
294
|
+
# @return [Object] Deserialized data
|
|
295
|
+
def _deserialize(type, value)
|
|
296
|
+
case type.to_sym
|
|
297
|
+
when :Time
|
|
298
|
+
Time.parse(value)
|
|
299
|
+
when :Date
|
|
300
|
+
Date.parse(value)
|
|
301
|
+
when :String
|
|
302
|
+
value.to_s
|
|
303
|
+
when :Integer
|
|
304
|
+
value.to_i
|
|
305
|
+
when :Float
|
|
306
|
+
value.to_f
|
|
307
|
+
when :Boolean
|
|
308
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
309
|
+
true
|
|
310
|
+
else
|
|
311
|
+
false
|
|
312
|
+
end
|
|
313
|
+
when :Object
|
|
314
|
+
# generic object (usually a Hash), return directly
|
|
315
|
+
value
|
|
316
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
317
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
318
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
319
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
320
|
+
k_type = Regexp.last_match[:k_type]
|
|
321
|
+
v_type = Regexp.last_match[:v_type]
|
|
322
|
+
{}.tap do |hash|
|
|
323
|
+
value.each do |k, v|
|
|
324
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
325
|
+
end
|
|
326
|
+
end
|
|
327
|
+
else # model
|
|
328
|
+
# models (e.g. Pet) or oneOf
|
|
329
|
+
klass = SnapTrade.const_get(type)
|
|
330
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
331
|
+
end
|
|
332
|
+
end
|
|
333
|
+
|
|
334
|
+
# Returns the string representation of the object
|
|
335
|
+
# @return [String] String presentation of the object
|
|
336
|
+
def to_s
|
|
337
|
+
to_hash.to_s
|
|
338
|
+
end
|
|
339
|
+
|
|
340
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
341
|
+
# @return [Hash] Returns the object in the form of hash
|
|
342
|
+
def to_body
|
|
343
|
+
to_hash
|
|
344
|
+
end
|
|
345
|
+
|
|
346
|
+
# Returns the object in the form of hash
|
|
347
|
+
# @return [Hash] Returns the object in the form of hash
|
|
348
|
+
def to_hash
|
|
349
|
+
hash = {}
|
|
350
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
351
|
+
value = self.send(attr)
|
|
352
|
+
if value.nil?
|
|
353
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
354
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
355
|
+
end
|
|
356
|
+
|
|
357
|
+
hash[param] = _to_hash(value)
|
|
358
|
+
end
|
|
359
|
+
hash
|
|
360
|
+
end
|
|
361
|
+
|
|
362
|
+
# Outputs non-array value in the form of hash
|
|
363
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
364
|
+
# @param [Object] value Any valid value
|
|
365
|
+
# @return [Hash] Returns the value in the form of hash
|
|
366
|
+
def _to_hash(value)
|
|
367
|
+
if value.is_a?(Array)
|
|
368
|
+
value.compact.map { |v| _to_hash(v) }
|
|
369
|
+
elsif value.is_a?(Hash)
|
|
370
|
+
{}.tap do |hash|
|
|
371
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
372
|
+
end
|
|
373
|
+
elsif value.respond_to? :to_hash
|
|
374
|
+
value.to_hash
|
|
375
|
+
else
|
|
376
|
+
value
|
|
377
|
+
end
|
|
378
|
+
end
|
|
379
|
+
|
|
380
|
+
end
|
|
381
|
+
|
|
382
|
+
end
|