snaptrade 3.0.38 → 3.0.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,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 PartnerStats
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 `assets_under_management_currency`. `null` until the first daily snapshot has been calculated.
41
+ attr_accessor :assets_under_management
42
+
43
+ # Total account value across disabled connections of users registered with your Client ID, as of each connection's last sync, in `assets_under_management_currency`. `null` until the first daily snapshot has been calculated.
44
+ attr_accessor :disabled_assets_under_management
45
+
46
+ # Total latest account value across active connections of users who have authorized your OAuth application, in `assets_under_management_currency`. `null` if your Client ID has no OAuth application, or until the first daily snapshot after it was added.
47
+ attr_accessor :oauth_assets_under_management
48
+
49
+ # Total account value across disabled connections of users who have authorized your OAuth application, as of each connection's last sync, in `assets_under_management_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_assets_under_management
51
+
52
+ # ISO 4217 currency code the asset values are expressed in.
53
+ attr_accessor :assets_under_management_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 :assets_under_management_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
+ :'assets_under_management' => :'assets_under_management',
70
+ :'disabled_assets_under_management' => :'disabled_assets_under_management',
71
+ :'oauth_assets_under_management' => :'oauth_assets_under_management',
72
+ :'oauth_disabled_assets_under_management' => :'oauth_disabled_assets_under_management',
73
+ :'assets_under_management_currency' => :'assets_under_management_currency',
74
+ :'assets_under_management_calculated_at' => :'assets_under_management_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
+ :'assets_under_management' => :'Float',
95
+ :'disabled_assets_under_management' => :'Float',
96
+ :'oauth_assets_under_management' => :'Float',
97
+ :'oauth_disabled_assets_under_management' => :'Float',
98
+ :'assets_under_management_currency' => :'String',
99
+ :'assets_under_management_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
+ :'assets_under_management',
111
+ :'disabled_assets_under_management',
112
+ :'oauth_assets_under_management',
113
+ :'oauth_disabled_assets_under_management',
114
+ :'assets_under_management_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::PartnerStats` 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::PartnerStats`. 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?(:'assets_under_management')
166
+ self.assets_under_management = attributes[:'assets_under_management']
167
+ end
168
+
169
+ if attributes.key?(:'disabled_assets_under_management')
170
+ self.disabled_assets_under_management = attributes[:'disabled_assets_under_management']
171
+ end
172
+
173
+ if attributes.key?(:'oauth_assets_under_management')
174
+ self.oauth_assets_under_management = attributes[:'oauth_assets_under_management']
175
+ end
176
+
177
+ if attributes.key?(:'oauth_disabled_assets_under_management')
178
+ self.oauth_disabled_assets_under_management = attributes[:'oauth_disabled_assets_under_management']
179
+ end
180
+
181
+ if attributes.key?(:'assets_under_management_currency')
182
+ self.assets_under_management_currency = attributes[:'assets_under_management_currency']
183
+ end
184
+
185
+ if attributes.key?(:'assets_under_management_calculated_at')
186
+ self.assets_under_management_calculated_at = attributes[:'assets_under_management_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 @assets_under_management_currency.nil?
211
+ invalid_properties.push('invalid value for "assets_under_management_currency", assets_under_management_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 @assets_under_management_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
+ assets_under_management == o.assets_under_management &&
242
+ disabled_assets_under_management == o.disabled_assets_under_management &&
243
+ oauth_assets_under_management == o.oauth_assets_under_management &&
244
+ oauth_disabled_assets_under_management == o.oauth_disabled_assets_under_management &&
245
+ assets_under_management_currency == o.assets_under_management_currency &&
246
+ assets_under_management_calculated_at == o.assets_under_management_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, assets_under_management, disabled_assets_under_management, oauth_assets_under_management, oauth_disabled_assets_under_management, assets_under_management_currency, assets_under_management_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
@@ -8,5 +8,5 @@ Contact: api@snaptrade.com
8
8
  =end
9
9
 
10
10
  module SnapTrade
11
- VERSION = '3.0.38'
11
+ VERSION = '3.0.39'
12
12
  end
data/lib/snaptrade.rb CHANGED
@@ -167,6 +167,7 @@ require 'snaptrade/models/model429_too_many_requests_response'
167
167
  require 'snaptrade/models/model500_unexpected_exception_response'
168
168
  require 'snaptrade/models/model501_not_implemented_response'
169
169
  require 'snaptrade/models/model503_brokerage_request_response'
170
+ require 'snaptrade/models/model503_currency_conversion_unavailable_response'
170
171
  require 'snaptrade/models/monthly_dividends'
171
172
  require 'snaptrade/models/mutual_fund_instrument'
172
173
  require 'snaptrade/models/mutual_fund_instrument_kind'
@@ -202,6 +203,7 @@ require 'snaptrade/models/other_instrument_kind'
202
203
  require 'snaptrade/models/paginated_universal_activity'
203
204
  require 'snaptrade/models/pagination_details'
204
205
  require 'snaptrade/models/partner_data'
206
+ require 'snaptrade/models/partner_stats'
205
207
  require 'snaptrade/models/past_value'
206
208
  require 'snaptrade/models/performance_custom'
207
209
  require 'snaptrade/models/position'
@@ -286,6 +288,7 @@ require 'snaptrade/api/api_status_api'
286
288
  require 'snaptrade/api/authentication_api'
287
289
  require 'snaptrade/api/connections_api'
288
290
  require 'snaptrade/api/experimental_endpoints_api'
291
+ require 'snaptrade/api/management_api'
289
292
  require 'snaptrade/api/reference_data_api'
290
293
  require 'snaptrade/api/trading_api'
291
294
 
@@ -358,6 +361,7 @@ module SnapTrade
358
361
  attr_reader :authentication
359
362
  attr_reader :connections
360
363
  attr_reader :experimental_endpoints
364
+ attr_reader :management
361
365
  attr_reader :reference_data
362
366
  attr_reader :trading
363
367
 
@@ -368,6 +372,7 @@ module SnapTrade
368
372
  @authentication = SnapTrade::AuthenticationApi.new(@api_client)
369
373
  @connections = SnapTrade::ConnectionsApi.new(@api_client)
370
374
  @experimental_endpoints = SnapTrade::ExperimentalEndpointsApi.new(@api_client)
375
+ @management = SnapTrade::ManagementApi.new(@api_client)
371
376
  @reference_data = SnapTrade::ReferenceDataApi.new(@api_client)
372
377
  @trading = SnapTrade::TradingApi.new(@api_client)
373
378
  end
@@ -0,0 +1,42 @@
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 'spec_helper'
11
+ require 'json'
12
+
13
+ # Unit tests for SnapTrade::ManagementApi
14
+ describe 'ManagementApi' do
15
+ before do
16
+ # run before each test
17
+ @api_instance = SnapTrade::ManagementApi.new
18
+ end
19
+
20
+ after do
21
+ # run after each test
22
+ end
23
+
24
+ describe 'test an instance of ManagementApi' do
25
+ it 'should create an instance of ManagementApi' do
26
+ expect(@api_instance).to be_instance_of(SnapTrade::ManagementApi)
27
+ end
28
+ end
29
+
30
+ # unit tests for get_stats
31
+ # Get usage stats
32
+ # Returns user, connection, and connected asset totals for your SnapTrade Client ID. These are the same numbers shown on the Users &amp; 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; &#x60;assets_under_management_calculated_at&#x60; indicates when it was last calculated.
33
+ # @param [Hash] opts the optional parameters
34
+ # @option opts [String] :currency ISO 4217 currency code to express connected asset values in. Defaults to &#x60;USD&#x60;.
35
+ # @return [PartnerStats]
36
+ describe 'get_stats test' do
37
+ it 'should work' do
38
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
39
+ end
40
+ end
41
+
42
+ end
@@ -0,0 +1,41 @@
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 'spec_helper'
11
+ require 'json'
12
+ require 'date'
13
+
14
+ # Unit tests for SnapTrade::Model503CurrencyConversionUnavailableResponse
15
+ describe SnapTrade::Model503CurrencyConversionUnavailableResponse do
16
+ let(:instance) { SnapTrade::Model503CurrencyConversionUnavailableResponse.new }
17
+
18
+ describe 'test an instance of Model503CurrencyConversionUnavailableResponse' do
19
+ it 'should create an instance of Model503CurrencyConversionUnavailableResponse' do
20
+ expect(instance).to be_instance_of(SnapTrade::Model503CurrencyConversionUnavailableResponse)
21
+ end
22
+ end
23
+ describe 'test attribute "detail"' do
24
+ it 'should work' do
25
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
26
+ end
27
+ end
28
+
29
+ describe 'test attribute "status_code"' do
30
+ it 'should work' do
31
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
32
+ end
33
+ end
34
+
35
+ describe 'test attribute "code"' do
36
+ it 'should work' do
37
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
38
+ end
39
+ end
40
+
41
+ end
@@ -0,0 +1,107 @@
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 'spec_helper'
11
+ require 'json'
12
+ require 'date'
13
+
14
+ # Unit tests for SnapTrade::PartnerStats
15
+ describe SnapTrade::PartnerStats do
16
+ let(:instance) { SnapTrade::PartnerStats.new }
17
+
18
+ describe 'test an instance of PartnerStats' do
19
+ it 'should create an instance of PartnerStats' do
20
+ expect(instance).to be_instance_of(SnapTrade::PartnerStats)
21
+ end
22
+ end
23
+ describe 'test attribute "total_users"' do
24
+ it 'should work' do
25
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
26
+ end
27
+ end
28
+
29
+ describe 'test attribute "total_connected_users"' do
30
+ it 'should work' do
31
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
32
+ end
33
+ end
34
+
35
+ describe 'test attribute "total_active_connections"' do
36
+ it 'should work' do
37
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
38
+ end
39
+ end
40
+
41
+ describe 'test attribute "total_disabled_connections"' do
42
+ it 'should work' do
43
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
44
+ end
45
+ end
46
+
47
+ describe 'test attribute "oauth_total_users"' do
48
+ it 'should work' do
49
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
50
+ end
51
+ end
52
+
53
+ describe 'test attribute "oauth_total_connected_users"' do
54
+ it 'should work' do
55
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
56
+ end
57
+ end
58
+
59
+ describe 'test attribute "oauth_total_active_connections"' do
60
+ it 'should work' do
61
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
62
+ end
63
+ end
64
+
65
+ describe 'test attribute "oauth_total_disabled_connections"' do
66
+ it 'should work' do
67
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
68
+ end
69
+ end
70
+
71
+ describe 'test attribute "assets_under_management"' do
72
+ it 'should work' do
73
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
74
+ end
75
+ end
76
+
77
+ describe 'test attribute "disabled_assets_under_management"' do
78
+ it 'should work' do
79
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
80
+ end
81
+ end
82
+
83
+ describe 'test attribute "oauth_assets_under_management"' do
84
+ it 'should work' do
85
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
86
+ end
87
+ end
88
+
89
+ describe 'test attribute "oauth_disabled_assets_under_management"' do
90
+ it 'should work' do
91
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
92
+ end
93
+ end
94
+
95
+ describe 'test attribute "assets_under_management_currency"' do
96
+ it 'should work' do
97
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
98
+ end
99
+ end
100
+
101
+ describe 'test attribute "assets_under_management_calculated_at"' do
102
+ it 'should work' do
103
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
104
+ end
105
+ end
106
+
107
+ end