snaptrade 3.0.41 → 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/account_balances_v2_response_margin.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 +256 -253
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
|
|
@@ -13,7 +13,7 @@ require 'time'
|
|
|
13
13
|
module SnapTrade
|
|
14
14
|
# Margin details. Null when `cash_or_margin` is `cash`; present for `margin` and `unknown` accounts.
|
|
15
15
|
class AccountBalancesV2ResponseMargin
|
|
16
|
-
# The margin debit the institution is charging interest on, one entry per currency owed, as positive amounts. Debits in different currencies are listed separately and are never netted against cash in another currency, because institutions charge interest on each currency's debit. An empty list means the account isn't borrowing. Null when the institution doesn't report it.
|
|
16
|
+
# The margin debit the institution is charging interest on, one entry per currency owed, as positive amounts. Debits in different currencies are listed separately and are never netted against cash in another currency, because institutions charge interest on each currency's debit. An empty list means the account isn't borrowing. Debits under 0.01 are left out as rounding leftovers. Null when the institution doesn't report it.
|
|
17
17
|
attr_accessor :loan_balances
|
|
18
18
|
|
|
19
19
|
# Attribute mapping from ruby-style variable name to JSON key.
|