snaptrade 3.0.37 → 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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 20e784f52231b4ee3525a42ee27761ab1eee6a18f630764fd1d2f47922e67bbc
4
- data.tar.gz: a504fe8d1734fdc4692356653127c4a70013b1b643d089514ed9dff2910c6859
3
+ metadata.gz: b5e11a52d73daa75fdd998c88c23d8055b6737600353cc6f9cf5b6530149f807
4
+ data.tar.gz: d85df14a9c4f11d17aba3e064e7dd09ee19caaeaed7468f78532b560bbb4c7ca
5
5
  SHA512:
6
- metadata.gz: 9cf52f43661ce7f84af6a3825cdb4e1eea0c81451c815fca04081e79d858daa05433b184ee3ae626c1216f7d4fdfd48ad043bfa42db5b6fbf002c869eb3def81
7
- data.tar.gz: 4bea36628b111fa02b4777dcdaee6b7ca60100662b7f88d0db77638b74807fae066224925c3b844f4f824c3496a1d7042afda396321164747d9ab1eca44054f4
6
+ metadata.gz: 425f1540437a66a6ee76f52567d76bec234a333018892c6130bba2c31f00f15910262ea1a7d5d3a0668d0c6afa79b09bbe701517bc0203eb148ac7fb738a39d0
7
+ data.tar.gz: 16b177a50261419abd8efd23b45971d2f7b5978b8a9df7a1085f17054c894a4b079bc4783bdb9fb480f1d7365d9ca16087c82589e147a5d65b9f4f716c64ad24
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
- [![npm](https://img.shields.io/badge/gem-v3.0.37-blue)](https://rubygems.org/gems/snaptrade/versions/3.0.37)
66
+ [![npm](https://img.shields.io/badge/gem-v3.0.39-blue)](https://rubygems.org/gems/snaptrade/versions/3.0.39)
67
67
  [![More Info](https://img.shields.io/badge/More%20Info-Click%20Here-orange)](https://snaptrade.com/)
68
68
 
69
69
  </div>
@@ -112,6 +112,7 @@ See https://docs.snaptrade.com/docs/ratelimiting.
112
112
  * [`snaptrade.experimental_endpoints.get_user_account_recent_orders_v2`](#snaptradeexperimental_endpointsget_user_account_recent_orders_v2)
113
113
  * [`snaptrade.experimental_endpoints.list_subscriptions`](#snaptradeexperimental_endpointslist_subscriptions)
114
114
  * [`snaptrade.experimental_endpoints.place_simple_order`](#snaptradeexperimental_endpointsplace_simple_order)
115
+ * [`snaptrade.management.get_stats`](#snaptrademanagementget_stats)
115
116
  * [`snaptrade.reference_data.get_partner_info`](#snaptradereference_dataget_partner_info)
116
117
  * [`snaptrade.reference_data.get_stock_exchanges`](#snaptradereference_dataget_stock_exchanges)
117
118
  * [`snaptrade.reference_data.get_symbols`](#snaptradereference_dataget_symbols)
@@ -143,7 +144,7 @@ See https://docs.snaptrade.com/docs/ratelimiting.
143
144
  Add to Gemfile:
144
145
 
145
146
  ```ruby
146
- gem 'snaptrade', '~> 3.0.37'
147
+ gem 'snaptrade', '~> 3.0.39'
147
148
  ```
148
149
 
149
150
  ## Getting Started<a id="getting-started"></a>
@@ -1730,6 +1731,40 @@ extended-hours enablement. Futures and multi-leg orders only accept regular.
1730
1731
  ---
1731
1732
 
1732
1733
 
1734
+ ### `snaptrade.management.get_stats`<a id="snaptrademanagementget_stats"></a>
1735
+
1736
+ 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.
1737
+
1738
+ 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.
1739
+
1740
+
1741
+ #### 🛠️ Usage<a id="🛠️-usage"></a>
1742
+
1743
+ ```ruby
1744
+ result = snaptrade.management.get_stats(
1745
+ currency: "USD",
1746
+ )
1747
+ p result
1748
+ ```
1749
+
1750
+ #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1751
+
1752
+ ##### currency: `String`<a id="currency-string"></a>
1753
+ ISO 4217 currency code to express connected asset values in. Defaults to `USD`.
1754
+
1755
+ #### 🔄 Return<a id="🔄-return"></a>
1756
+
1757
+ [PartnerStats](./lib/snaptrade/models/partner_stats.rb)
1758
+
1759
+ #### 🌐 Endpoint<a id="🌐-endpoint"></a>
1760
+
1761
+ `/snapTrade/stats` `GET`
1762
+
1763
+ [🔙 **Back to Table of Contents**](#table-of-contents)
1764
+
1765
+ ---
1766
+
1767
+
1733
1768
  ### `snaptrade.reference_data.get_partner_info`<a id="snaptradereference_dataget_partner_info"></a>
1734
1769
 
1735
1770
  Returns configurations for your SnapTrade Client ID, including allowed brokerages and data access.
@@ -0,0 +1,110 @@
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 'cgi'
11
+
12
+ module SnapTrade
13
+ class ManagementApi
14
+ attr_accessor :api_client
15
+
16
+ def initialize(api_client = ApiClient.default)
17
+ @api_client = api_client
18
+ end
19
+
20
+ # Get usage stats
21
+ #
22
+ # 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
+ #
24
+ # 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.
25
+ #
26
+ # @param currency [String] ISO 4217 currency code to express connected asset values in. Defaults to `USD`.
27
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
28
+ def get_stats(currency: SENTINEL, extra: {})
29
+ extra[:currency] = currency if currency != SENTINEL
30
+ data, _status_code, _headers = get_stats_with_http_info_impl(extra)
31
+ data
32
+ end
33
+
34
+ # Get usage stats
35
+ #
36
+ # 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
+ #
38
+ # 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.
39
+ #
40
+ # @param currency [String] ISO 4217 currency code to express connected asset values in. Defaults to `USD`.
41
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
42
+ def get_stats_with_http_info(currency: SENTINEL, extra: {})
43
+ extra[:currency] = currency if currency != SENTINEL
44
+ get_stats_with_http_info_impl(extra)
45
+ end
46
+
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; `assets_under_management_calculated_at` indicates when it was last calculated.
49
+ # @param [Hash] opts the optional parameters
50
+ # @option opts [String] :currency ISO 4217 currency code to express connected asset values in. Defaults to `USD`.
51
+ # @return [PartnerStats]
52
+ private def get_stats_impl(opts = {})
53
+ data, _status_code, _headers = get_stats_with_http_info(opts)
54
+ data
55
+ end
56
+
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 &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.
59
+ # @param [Hash] opts the optional parameters
60
+ # @option opts [String] :currency ISO 4217 currency code to express connected asset values in. Defaults to `USD`.
61
+ # @return [Array<(PartnerStats, Integer, Hash)>] PartnerStats data, response status code and response headers
62
+ private def get_stats_with_http_info_impl(opts = {})
63
+ if @api_client.config.debugging
64
+ @api_client.config.logger.debug 'Calling API: ManagementApi.get_stats ...'
65
+ end
66
+ # resource path
67
+ local_var_path = '/snapTrade/stats'
68
+
69
+ # query parameters
70
+ query_params = opts[:query_params] || {}
71
+ query_params[:'currency'] = opts[:'currency'] if !opts[:'currency'].nil?
72
+
73
+ # header parameters
74
+ header_params = opts[:header_params] || {}
75
+ # HTTP header 'Accept' (if needed)
76
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
77
+
78
+ # form parameters
79
+ form_params = opts[:form_params] || {}
80
+
81
+ # http body (model)
82
+ post_body = opts[:debug_body]
83
+
84
+ # return_type
85
+ return_type = opts[:debug_return_type] || 'PartnerStats'
86
+
87
+ # auth_names
88
+ auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
89
+
90
+ new_options = opts.merge(
91
+ :operation => :"ManagementApi.get_stats",
92
+ :header_params => header_params,
93
+ :query_params => query_params,
94
+ :form_params => form_params,
95
+ :body => post_body,
96
+ :auth_names => auth_names,
97
+ :return_type => return_type
98
+ )
99
+
100
+ data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
101
+ if @api_client.config.debugging
102
+ @api_client.config.logger.debug "API called: ManagementApi#get_stats\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
103
+ end
104
+ return data, status_code, headers, response
105
+ end
106
+ end
107
+
108
+ # top-level client access to avoid having the user to insantiate their own API instances
109
+ Management = ManagementApi::new
110
+ end
@@ -114,7 +114,7 @@ module SnapTrade
114
114
  :'has_reporting' => :'Boolean',
115
115
  :'is_real_time_connection' => :'Boolean',
116
116
  :'brokerage_type' => :'BrokerageType',
117
- :'exchanges' => :'Array<String>',
117
+ :'exchanges' => :'Array<Object>',
118
118
  :'open_url' => :'String'
119
119
  }
120
120
  end
@@ -33,14 +33,16 @@ module SnapTrade
33
33
  # Attribute type mapping.
34
34
  def self.openapi_types
35
35
  {
36
- :'default_detail' => :'String',
37
- :'default_code' => :'String'
36
+ :'default_detail' => :'Object',
37
+ :'default_code' => :'Object'
38
38
  }
39
39
  end
40
40
 
41
41
  # List of attributes with nullable: true
42
42
  def self.openapi_nullable
43
43
  Set.new([
44
+ :'default_detail',
45
+ :'default_code'
44
46
  ])
45
47
  end
46
48
 
@@ -33,14 +33,16 @@ module SnapTrade
33
33
  # Attribute type mapping.
34
34
  def self.openapi_types
35
35
  {
36
- :'default_detail' => :'String',
37
- :'default_code' => :'String'
36
+ :'default_detail' => :'Object',
37
+ :'default_code' => :'Object'
38
38
  }
39
39
  end
40
40
 
41
41
  # List of attributes with nullable: true
42
42
  def self.openapi_nullable
43
43
  Set.new([
44
+ :'default_detail',
45
+ :'default_code'
44
46
  ])
45
47
  end
46
48
 
@@ -33,14 +33,16 @@ module SnapTrade
33
33
  # Attribute type mapping.
34
34
  def self.openapi_types
35
35
  {
36
- :'detail' => :'String',
37
- :'code' => :'String'
36
+ :'detail' => :'Object',
37
+ :'code' => :'Object'
38
38
  }
39
39
  end
40
40
 
41
41
  # List of attributes with nullable: true
42
42
  def self.openapi_nullable
43
43
  Set.new([
44
+ :'detail',
45
+ :'code'
44
46
  ])
45
47
  end
46
48
 
@@ -33,14 +33,16 @@ module SnapTrade
33
33
  # Attribute type mapping.
34
34
  def self.openapi_types
35
35
  {
36
- :'detail' => :'String',
37
- :'code' => :'String'
36
+ :'detail' => :'Object',
37
+ :'code' => :'Object'
38
38
  }
39
39
  end
40
40
 
41
41
  # List of attributes with nullable: true
42
42
  def self.openapi_nullable
43
43
  Set.new([
44
+ :'detail',
45
+ :'code'
44
46
  ])
45
47
  end
46
48
 
@@ -33,14 +33,16 @@ module SnapTrade
33
33
  # Attribute type mapping.
34
34
  def self.openapi_types
35
35
  {
36
- :'default_detail' => :'String',
37
- :'default_code' => :'String'
36
+ :'default_detail' => :'Object',
37
+ :'default_code' => :'Object'
38
38
  }
39
39
  end
40
40
 
41
41
  # List of attributes with nullable: true
42
42
  def self.openapi_nullable
43
43
  Set.new([
44
+ :'default_detail',
45
+ :'default_code'
44
46
  ])
45
47
  end
46
48
 
@@ -33,14 +33,16 @@ module SnapTrade
33
33
  # Attribute type mapping.
34
34
  def self.openapi_types
35
35
  {
36
- :'detail' => :'String',
37
- :'default_code' => :'String'
36
+ :'detail' => :'Object',
37
+ :'default_code' => :'Object'
38
38
  }
39
39
  end
40
40
 
41
41
  # List of attributes with nullable: true
42
42
  def self.openapi_nullable
43
43
  Set.new([
44
+ :'detail',
45
+ :'default_code'
44
46
  ])
45
47
  end
46
48
 
@@ -33,14 +33,16 @@ module SnapTrade
33
33
  # Attribute type mapping.
34
34
  def self.openapi_types
35
35
  {
36
- :'default_detail' => :'String',
37
- :'default_code' => :'String'
36
+ :'default_detail' => :'Object',
37
+ :'default_code' => :'Object'
38
38
  }
39
39
  end
40
40
 
41
41
  # List of attributes with nullable: true
42
42
  def self.openapi_nullable
43
43
  Set.new([
44
+ :'default_detail',
45
+ :'default_code'
44
46
  ])
45
47
  end
46
48
 
@@ -33,14 +33,16 @@ module SnapTrade
33
33
  # Attribute type mapping.
34
34
  def self.openapi_types
35
35
  {
36
- :'detail' => :'String',
37
- :'code' => :'String'
36
+ :'detail' => :'Object',
37
+ :'code' => :'Object'
38
38
  }
39
39
  end
40
40
 
41
41
  # List of attributes with nullable: true
42
42
  def self.openapi_nullable
43
43
  Set.new([
44
+ :'detail',
45
+ :'code'
44
46
  ])
45
47
  end
46
48
 
@@ -36,15 +36,18 @@ module SnapTrade
36
36
  # Attribute type mapping.
37
37
  def self.openapi_types
38
38
  {
39
- :'detail' => :'String',
40
- :'status_code' => :'Integer',
41
- :'code' => :'String'
39
+ :'detail' => :'Object',
40
+ :'status_code' => :'Object',
41
+ :'code' => :'Object'
42
42
  }
43
43
  end
44
44
 
45
45
  # List of attributes with nullable: true
46
46
  def self.openapi_nullable
47
47
  Set.new([
48
+ :'detail',
49
+ :'status_code',
50
+ :'code'
48
51
  ])
49
52
  end
50
53
 
@@ -36,15 +36,18 @@ module SnapTrade
36
36
  # Attribute type mapping.
37
37
  def self.openapi_types
38
38
  {
39
- :'detail' => :'String',
40
- :'status_code' => :'Integer',
41
- :'code' => :'String'
39
+ :'detail' => :'Object',
40
+ :'status_code' => :'Object',
41
+ :'code' => :'Object'
42
42
  }
43
43
  end
44
44
 
45
45
  # List of attributes with nullable: true
46
46
  def self.openapi_nullable
47
47
  Set.new([
48
+ :'detail',
49
+ :'status_code',
50
+ :'code'
48
51
  ])
49
52
  end
50
53
 
@@ -30,13 +30,14 @@ module SnapTrade
30
30
  # Attribute type mapping.
31
31
  def self.openapi_types
32
32
  {
33
- :'error' => :'String'
33
+ :'error' => :'Object'
34
34
  }
35
35
  end
36
36
 
37
37
  # List of attributes with nullable: true
38
38
  def self.openapi_nullable
39
39
  Set.new([
40
+ :'error'
40
41
  ])
41
42
  end
42
43
 
@@ -36,15 +36,18 @@ module SnapTrade
36
36
  # Attribute type mapping.
37
37
  def self.openapi_types
38
38
  {
39
- :'detail' => :'String',
40
- :'status_code' => :'Integer',
41
- :'code' => :'String'
39
+ :'detail' => :'Object',
40
+ :'status_code' => :'Object',
41
+ :'code' => :'Object'
42
42
  }
43
43
  end
44
44
 
45
45
  # List of attributes with nullable: true
46
46
  def self.openapi_nullable
47
47
  Set.new([
48
+ :'detail',
49
+ :'status_code',
50
+ :'code'
48
51
  ])
49
52
  end
50
53