snaptrade 3.0.24 → 3.0.26
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 +33 -5
- data/lib/snaptrade/api/account_information_api.rb +8 -8
- data/lib/snaptrade/api/connections_api.rb +4 -4
- data/lib/snaptrade/api/reference_data_api.rb +81 -0
- data/lib/snaptrade/models/brokerage_authorization_data_freshness_mode.rb +1 -1
- data/lib/snaptrade/models/brokerage_authorization_institution.rb +37 -0
- data/lib/snaptrade/models/institution.rb +339 -15
- data/lib/snaptrade/models/institution_connection.rb +270 -0
- data/lib/snaptrade/models/position.rb +1 -1
- data/lib/snaptrade/models/release_stage.rb +37 -0
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +3 -0
- data/spec/api/account_information_api_spec.rb +2 -2
- data/spec/api/connections_api_spec.rb +1 -1
- data/spec/api/reference_data_api_spec.rb +11 -0
- data/spec/models/brokerage_authorization_institution_spec.rb +23 -0
- data/spec/models/institution_connection_spec.rb +43 -0
- data/spec/models/institution_spec.rb +64 -0
- data/spec/models/release_stage_spec.rb +23 -0
- metadata +235 -226
data/lib/snaptrade.rb
CHANGED
|
@@ -62,6 +62,7 @@ require 'snaptrade/models/brokerage'
|
|
|
62
62
|
require 'snaptrade/models/brokerage_authorization'
|
|
63
63
|
require 'snaptrade/models/brokerage_authorization_data_freshness_mode'
|
|
64
64
|
require 'snaptrade/models/brokerage_authorization_disabled_confirmation'
|
|
65
|
+
require 'snaptrade/models/brokerage_authorization_institution'
|
|
65
66
|
require 'snaptrade/models/brokerage_authorization_refresh_confirmation'
|
|
66
67
|
require 'snaptrade/models/brokerage_authorization_transactions_sync_confirmation'
|
|
67
68
|
require 'snaptrade/models/brokerage_authorization_type_read_only'
|
|
@@ -118,6 +119,7 @@ require 'snaptrade/models/future_option_instrument'
|
|
|
118
119
|
require 'snaptrade/models/future_option_instrument_kind'
|
|
119
120
|
require 'snaptrade/models/holdings_status'
|
|
120
121
|
require 'snaptrade/models/institution'
|
|
122
|
+
require 'snaptrade/models/institution_connection'
|
|
121
123
|
require 'snaptrade/models/instrument'
|
|
122
124
|
require 'snaptrade/models/investment_account'
|
|
123
125
|
require 'snaptrade/models/investment_account_net_value'
|
|
@@ -206,6 +208,7 @@ require 'snaptrade/models/price_effect'
|
|
|
206
208
|
require 'snaptrade/models/rate_of_return_object'
|
|
207
209
|
require 'snaptrade/models/rate_of_return_response'
|
|
208
210
|
require 'snaptrade/models/recent_orders_response'
|
|
211
|
+
require 'snaptrade/models/release_stage'
|
|
209
212
|
require 'snaptrade/models/schema_version'
|
|
210
213
|
require 'snaptrade/models/security_type'
|
|
211
214
|
require 'snaptrade/models/session_event'
|
|
@@ -48,7 +48,7 @@ describe 'AccountInformationApi' do
|
|
|
48
48
|
|
|
49
49
|
# unit tests for get_account_balance_history
|
|
50
50
|
# List historical account total value
|
|
51
|
-
# An experimental endpoint that returns estimated historical total account value for the specified account. Total account value is the sum of the market value of all positions and cash in the account at a given time. This endpoint is experimental, disabled by default, and has a maximum lookback of 1 year. Because the data is dynamically generated, we recommend replacing your dataset with each request as opposed to combining data from multiple requests. Enable this feature for free in the Add-on
|
|
51
|
+
# An experimental endpoint that returns estimated historical total account value for the specified account. Total account value is the sum of the market value of all positions and cash in the account at a given time. This endpoint is experimental, disabled by default, and has a maximum lookback of 1 year. Because the data is dynamically generated, we recommend replacing your dataset with each request as opposed to combining data from multiple requests. Enable this feature for free in the [Add-on page of the Customer Dashboard](https://dashboard.snaptrade.com/add-ons)
|
|
52
52
|
# @param user_id
|
|
53
53
|
# @param user_secret
|
|
54
54
|
# @param account_id
|
|
@@ -150,7 +150,7 @@ describe 'AccountInformationApi' do
|
|
|
150
150
|
|
|
151
151
|
# unit tests for get_user_account_return_rates
|
|
152
152
|
# List account rate of returns
|
|
153
|
-
# Returns a list of rate of return percents for a given account.
|
|
153
|
+
# DEPRECATED. Returns a list of rate of return percents for a given account.
|
|
154
154
|
# @param user_id
|
|
155
155
|
# @param user_secret
|
|
156
156
|
# @param account_id
|
|
@@ -126,7 +126,7 @@ describe 'ConnectionsApi' do
|
|
|
126
126
|
|
|
127
127
|
# unit tests for return_rates
|
|
128
128
|
# List connection rate of returns
|
|
129
|
-
# Returns a list of rate of return percents for a given connection.
|
|
129
|
+
# DEPRECATED. Returns a list of rate of return percents for a given connection.
|
|
130
130
|
# @param user_id
|
|
131
131
|
# @param user_secret
|
|
132
132
|
# @param authorization_id
|
|
@@ -108,6 +108,17 @@ describe 'ReferenceDataApi' do
|
|
|
108
108
|
end
|
|
109
109
|
end
|
|
110
110
|
|
|
111
|
+
# unit tests for list_institutions
|
|
112
|
+
# List institutions
|
|
113
|
+
# Returns the public catalog of institutions SnapTrade supports and what each one supports. The response is the same for every caller and needs no authentication. To list the brokerages a specific Client ID can connect to right now, use `GET /brokerages` instead. A `null` field means the information is not documented yet, never that the institution lacks it. New fields and new enum values may be added over time, so ignore any you don't recognize.
|
|
114
|
+
# @param [Hash] opts the optional parameters
|
|
115
|
+
# @return [Array<Institution>]
|
|
116
|
+
describe 'list_institutions test' do
|
|
117
|
+
it 'should work' do
|
|
118
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
|
|
111
122
|
# unit tests for symbol_search_user_account
|
|
112
123
|
# Search account symbols
|
|
113
124
|
# Returns a list of Universal Symbol objects that match the given query. The matching takes into consideration both the ticker and the name of the symbol. Only the first 20 results are returned. The search results are further limited to the symbols supported by the brokerage for which the account is under.
|
|
@@ -0,0 +1,23 @@
|
|
|
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::BrokerageAuthorizationInstitution
|
|
15
|
+
describe SnapTrade::BrokerageAuthorizationInstitution do
|
|
16
|
+
let(:instance) { SnapTrade::BrokerageAuthorizationInstitution.new }
|
|
17
|
+
|
|
18
|
+
describe 'test an instance of BrokerageAuthorizationInstitution' do
|
|
19
|
+
it 'should create an instance of BrokerageAuthorizationInstitution' do
|
|
20
|
+
expect(instance).to be_instance_of(SnapTrade::BrokerageAuthorizationInstitution)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
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::InstitutionConnection
|
|
15
|
+
describe SnapTrade::InstitutionConnection do
|
|
16
|
+
let(:instance) { SnapTrade::InstitutionConnection.new }
|
|
17
|
+
|
|
18
|
+
describe 'test an instance of InstitutionConnection' do
|
|
19
|
+
it 'should create an instance of InstitutionConnection' do
|
|
20
|
+
expect(instance).to be_instance_of(SnapTrade::InstitutionConnection)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
describe 'test attribute "methods"' do
|
|
24
|
+
it 'should work' do
|
|
25
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
26
|
+
# validator = Petstore::EnumTest::EnumAttributeValidator.new('Array<String>', ["OAUTH", "CREDENTIALS", "API_KEY"])
|
|
27
|
+
# validator.allowable_values.each do |value|
|
|
28
|
+
# expect { instance.methods = value }.not_to raise_error
|
|
29
|
+
# end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
describe 'test attribute "scopes"' do
|
|
34
|
+
it 'should work' do
|
|
35
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
36
|
+
# validator = Petstore::EnumTest::EnumAttributeValidator.new('Array<String>', ["READ", "TRADE"])
|
|
37
|
+
# validator.allowable_values.each do |value|
|
|
38
|
+
# expect { instance.scopes = value }.not_to raise_error
|
|
39
|
+
# end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
end
|
|
@@ -20,4 +20,68 @@ describe SnapTrade::Institution do
|
|
|
20
20
|
expect(instance).to be_instance_of(SnapTrade::Institution)
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
|
+
describe 'test attribute "slug"' 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 "name"' 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 "display_name"' 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 "description"' 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 "website"' 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 "logo_url"' 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 "square_logo_url"' 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 "release_stage"' 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 "regions"' do
|
|
72
|
+
it 'should work' do
|
|
73
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
74
|
+
# validator = Petstore::EnumTest::EnumAttributeValidator.new('Array<String>', ["US", "CA", "EUROPE", "AU", "IN"])
|
|
75
|
+
# validator.allowable_values.each do |value|
|
|
76
|
+
# expect { instance.regions = value }.not_to raise_error
|
|
77
|
+
# end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
describe 'test attribute "connection"' do
|
|
82
|
+
it 'should work' do
|
|
83
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
23
87
|
end
|
|
@@ -0,0 +1,23 @@
|
|
|
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::ReleaseStage
|
|
15
|
+
describe SnapTrade::ReleaseStage do
|
|
16
|
+
let(:instance) { SnapTrade::ReleaseStage.new }
|
|
17
|
+
|
|
18
|
+
describe 'test an instance of ReleaseStage' do
|
|
19
|
+
it 'should create an instance of ReleaseStage' do
|
|
20
|
+
expect(instance).to be_instance_of(SnapTrade::ReleaseStage)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|