snaptrade 2.0.166 → 2.0.167

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: 8aa143629fa26cbb52541f1cd1a31499067e0e6fedae392961eacee812eb08ef
4
- data.tar.gz: b25bc59d48c3d7792c9dcd05056ba29d1446c305d99ec20935ae497418cb174b
3
+ metadata.gz: 2da974f02fc7d2c3c05f005d006a93a6477e129a7210fc1f623f6c7c90488a77
4
+ data.tar.gz: 4adc63029cfb498069b83681be15c996b2a208563e22381876f90f19d5abd58c
5
5
  SHA512:
6
- metadata.gz: 45bb7b21ad3c1406712b949aad0908d2948d64703f6c27559e15ac189daafbed8b622260969962fc5793617304362d221d211cc875f84816048eae319a863b54
7
- data.tar.gz: 1bd606a59657cdf5e6b0a5c6d6693c94fa66805c4bb3d33e948dfa90d6178151daaf99ca594c58d2d285158cb060ecd62498c4c42edcab8facb297f2c72c3278
6
+ metadata.gz: 38f6a7f22d174a851180750ebeb67642dd170bde081424e9da9c437f3b79fc501dae57776c54f0512a5c12fa252db2054c8dda5de3315566ec05d3b82b37edd0
7
+ data.tar.gz: 4f97b1691aebeb8a880219d0fe98920e49415480041d2639581546af5aafb77ac899ffd146d59ebceca3229bd88966b95e9a4a5a93b708030dc1a9a50fb350a8
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- snaptrade (2.0.166)
4
+ snaptrade (2.0.167)
5
5
  faraday (>= 1.0.1, < 3.0)
6
6
  faraday-multipart (~> 1.0, >= 1.0.4)
7
7
 
data/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  Connect brokerage accounts to your app for live positions and trading
8
8
 
9
- [![npm](https://img.shields.io/badge/gem-v2.0.166-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.166)
9
+ [![npm](https://img.shields.io/badge/gem-v2.0.167-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.167)
10
10
  [![More Info](https://img.shields.io/badge/More%20Info-Click%20Here-orange)](https://snaptrade.com/)
11
11
 
12
12
  </div>
@@ -45,6 +45,7 @@ Connect brokerage accounts to your app for live positions and trading
45
45
  * [`snaptrade.connections.remove_brokerage_authorization`](#snaptradeconnectionsremove_brokerage_authorization)
46
46
  * [`snaptrade.connections.return_rates`](#snaptradeconnectionsreturn_rates)
47
47
  * [`snaptrade.connections.session_events`](#snaptradeconnectionssession_events)
48
+ * [`snaptrade.experimental_endpoints.get_account_balance_history`](#snaptradeexperimental_endpointsget_account_balance_history)
48
49
  * [`snaptrade.experimental_endpoints.get_user_account_order_detail_v2`](#snaptradeexperimental_endpointsget_user_account_order_detail_v2)
49
50
  * [`snaptrade.experimental_endpoints.get_user_account_orders_v2`](#snaptradeexperimental_endpointsget_user_account_orders_v2)
50
51
  * [`snaptrade.experimental_endpoints.get_user_account_recent_orders_v2`](#snaptradeexperimental_endpointsget_user_account_recent_orders_v2)
@@ -87,7 +88,7 @@ Connect brokerage accounts to your app for live positions and trading
87
88
  Add to Gemfile:
88
89
 
89
90
  ```ruby
90
- gem 'snaptrade', '~> 2.0.166'
91
+ gem 'snaptrade', '~> 2.0.167'
91
92
  ```
92
93
 
93
94
  ## Getting Started<a id="getting-started"></a>
@@ -1167,6 +1168,40 @@ specific users
1167
1168
  ---
1168
1169
 
1169
1170
 
1171
+ ### `snaptrade.experimental_endpoints.get_account_balance_history`<a id="snaptradeexperimental_endpointsget_account_balance_history"></a>
1172
+
1173
+ 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 only available for certain brokerages with a maximum lookback of 1 year.
1174
+
1175
+
1176
+ #### 🛠️ Usage<a id="🛠️-usage"></a>
1177
+
1178
+ ```ruby
1179
+ result = snaptrade.experimental_endpoints.get_account_balance_history(
1180
+ user_id: "snaptrade-user-123",
1181
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
1182
+ account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
1183
+ )
1184
+ p result
1185
+ ```
1186
+
1187
+ #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1188
+
1189
+ ##### user_id: `String`<a id="user_id-string"></a>
1190
+ ##### user_secret: `String`<a id="user_secret-string"></a>
1191
+ ##### account_id: `String`<a id="account_id-string"></a>
1192
+ #### 🔄 Return<a id="🔄-return"></a>
1193
+
1194
+ [AccountValueHistoryResponse](./lib/snaptrade/models/account_value_history_response.rb)
1195
+
1196
+ #### 🌐 Endpoint<a id="🌐-endpoint"></a>
1197
+
1198
+ `/accounts/{accountId}/balanceHistory` `GET`
1199
+
1200
+ [🔙 **Back to Table of Contents**](#table-of-contents)
1201
+
1202
+ ---
1203
+
1204
+
1170
1205
  ### `snaptrade.experimental_endpoints.get_user_account_order_detail_v2`<a id="snaptradeexperimental_endpointsget_user_account_order_detail_v2"></a>
1171
1206
 
1172
1207
  Returns the detail of a single order using the brokerage order ID provided as a path parameter.
@@ -17,6 +17,109 @@ module SnapTrade
17
17
  @api_client = api_client
18
18
  end
19
19
 
20
+ # List historical account total value
21
+ #
22
+ # 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 only available for certain brokerages with a maximum lookback of 1 year.
23
+ #
24
+ # @param user_id [String]
25
+ # @param user_secret [String]
26
+ # @param account_id [String]
27
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
28
+ def get_account_balance_history(user_id:, user_secret:, account_id:, extra: {})
29
+ data, _status_code, _headers = get_account_balance_history_with_http_info_impl(user_id, user_secret, account_id, extra)
30
+ data
31
+ end
32
+
33
+ # List historical account total value
34
+ #
35
+ # 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 only available for certain brokerages with a maximum lookback of 1 year.
36
+ #
37
+ # @param user_id [String]
38
+ # @param user_secret [String]
39
+ # @param account_id [String]
40
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
41
+ def get_account_balance_history_with_http_info(user_id:, user_secret:, account_id:, extra: {})
42
+ get_account_balance_history_with_http_info_impl(user_id, user_secret, account_id, extra)
43
+ end
44
+
45
+ # List historical account total value
46
+ # 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 only available for certain brokerages with a maximum lookback of 1 year.
47
+ # @param user_id [String]
48
+ # @param user_secret [String]
49
+ # @param account_id [String]
50
+ # @param [Hash] opts the optional parameters
51
+ # @return [AccountValueHistoryResponse]
52
+ private def get_account_balance_history_impl(user_id, user_secret, account_id, opts = {})
53
+ data, _status_code, _headers = get_account_balance_history_with_http_info(user_id, user_secret, account_id, opts)
54
+ data
55
+ end
56
+
57
+ # List historical account total value
58
+ # 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 only available for certain brokerages with a maximum lookback of 1 year.
59
+ # @param user_id [String]
60
+ # @param user_secret [String]
61
+ # @param account_id [String]
62
+ # @param [Hash] opts the optional parameters
63
+ # @return [Array<(AccountValueHistoryResponse, Integer, Hash)>] AccountValueHistoryResponse data, response status code and response headers
64
+ private def get_account_balance_history_with_http_info_impl(user_id, user_secret, account_id, opts = {})
65
+ if @api_client.config.debugging
66
+ @api_client.config.logger.debug 'Calling API: ExperimentalEndpointsApi.get_account_balance_history ...'
67
+ end
68
+ # verify the required parameter 'user_id' is set
69
+ if @api_client.config.client_side_validation && user_id.nil?
70
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling ExperimentalEndpointsApi.get_account_balance_history"
71
+ end
72
+ # verify the required parameter 'user_secret' is set
73
+ if @api_client.config.client_side_validation && user_secret.nil?
74
+ fail ArgumentError, "Missing the required parameter 'user_secret' when calling ExperimentalEndpointsApi.get_account_balance_history"
75
+ end
76
+ # verify the required parameter 'account_id' is set
77
+ if @api_client.config.client_side_validation && account_id.nil?
78
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling ExperimentalEndpointsApi.get_account_balance_history"
79
+ end
80
+ # resource path
81
+ local_var_path = '/accounts/{accountId}/balanceHistory'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
82
+
83
+ # query parameters
84
+ query_params = opts[:query_params] || {}
85
+ query_params[:'userId'] = user_id
86
+ query_params[:'userSecret'] = user_secret
87
+
88
+ # header parameters
89
+ header_params = opts[:header_params] || {}
90
+ # HTTP header 'Accept' (if needed)
91
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
92
+
93
+ # form parameters
94
+ form_params = opts[:form_params] || {}
95
+
96
+ # http body (model)
97
+ post_body = opts[:debug_body]
98
+
99
+ # return_type
100
+ return_type = opts[:debug_return_type] || 'AccountValueHistoryResponse'
101
+
102
+ # auth_names
103
+ auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
104
+
105
+ new_options = opts.merge(
106
+ :operation => :"ExperimentalEndpointsApi.get_account_balance_history",
107
+ :header_params => header_params,
108
+ :query_params => query_params,
109
+ :form_params => form_params,
110
+ :body => post_body,
111
+ :auth_names => auth_names,
112
+ :return_type => return_type
113
+ )
114
+
115
+ data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
116
+ if @api_client.config.debugging
117
+ @api_client.config.logger.debug "API called: ExperimentalEndpointsApi#get_account_balance_history\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
118
+ end
119
+ return data, status_code, headers, response
120
+ end
121
+
122
+
20
123
  # Get account order detail (V2)
21
124
  #
22
125
  # Returns the detail of a single order using the brokerage order ID provided as a path parameter.
@@ -0,0 +1,228 @@
1
+ =begin
2
+ #SnapTrade
3
+
4
+ #Connect brokerage accounts to your app for live positions and trading
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
+ # The estimeated account value at a specific point in time.
15
+ class AccountValueHistoryItem
16
+ # The date of the estimated account value
17
+ attr_accessor :date
18
+
19
+ # Estimate of the total market value of this account (includes cash, equity, fixed income, etc) at the given date.
20
+ attr_accessor :total_value
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'date' => :'date',
26
+ :'total_value' => :'total_value'
27
+ }
28
+ end
29
+
30
+ # Returns all the JSON keys this model knows about
31
+ def self.acceptable_attributes
32
+ attribute_map.values
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'date' => :'Date',
39
+ :'total_value' => :'String'
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.openapi_nullable
45
+ Set.new([
46
+ ])
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ if (!attributes.is_a?(Hash))
53
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::AccountValueHistoryItem` initialize method"
54
+ end
55
+
56
+ # check to see if the attribute exists and convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}) { |(k, v), h|
58
+ if (!self.class.attribute_map.key?(k.to_sym))
59
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::AccountValueHistoryItem`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
60
+ end
61
+ h[k.to_sym] = v
62
+ }
63
+
64
+ if attributes.key?(:'date')
65
+ self.date = attributes[:'date']
66
+ end
67
+
68
+ if attributes.key?(:'total_value')
69
+ self.total_value = attributes[:'total_value']
70
+ end
71
+ end
72
+
73
+ # Show invalid properties with the reasons. Usually used together with valid?
74
+ # @return Array for valid properties with the reasons
75
+ def list_invalid_properties
76
+ invalid_properties = Array.new
77
+ invalid_properties
78
+ end
79
+
80
+ # Check to see if the all the properties in the model are valid
81
+ # @return true if the model is valid
82
+ def valid?
83
+ true
84
+ end
85
+
86
+ # Checks equality by comparing each attribute.
87
+ # @param [Object] Object to be compared
88
+ def ==(o)
89
+ return true if self.equal?(o)
90
+ self.class == o.class &&
91
+ date == o.date &&
92
+ total_value == o.total_value
93
+ end
94
+
95
+ # @see the `==` method
96
+ # @param [Object] Object to be compared
97
+ def eql?(o)
98
+ self == o
99
+ end
100
+
101
+ # Calculates hash code according to all attributes.
102
+ # @return [Integer] Hash code
103
+ def hash
104
+ [date, total_value].hash
105
+ end
106
+
107
+ # Builds the object from hash
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ # @return [Object] Returns the model itself
110
+ def self.build_from_hash(attributes)
111
+ new.build_from_hash(attributes)
112
+ end
113
+
114
+ # Builds the object from hash
115
+ # @param [Hash] attributes Model attributes in the form of hash
116
+ # @return [Object] Returns the model itself
117
+ def build_from_hash(attributes)
118
+ return nil unless attributes.is_a?(Hash)
119
+ attributes = attributes.transform_keys(&:to_sym)
120
+ self.class.openapi_types.each_pair do |key, type|
121
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
122
+ self.send("#{key}=", nil)
123
+ elsif type =~ /\AArray<(.*)>/i
124
+ # check to ensure the input is an array given that the attribute
125
+ # is documented as an array but the input is not
126
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
127
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
128
+ end
129
+ elsif !attributes[self.class.attribute_map[key]].nil?
130
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
131
+ end
132
+ end
133
+
134
+ self
135
+ end
136
+
137
+ # Deserializes the data based on type
138
+ # @param string type Data type
139
+ # @param string value Value to be deserialized
140
+ # @return [Object] Deserialized data
141
+ def _deserialize(type, value)
142
+ case type.to_sym
143
+ when :Time
144
+ Time.parse(value)
145
+ when :Date
146
+ Date.parse(value)
147
+ when :String
148
+ value.to_s
149
+ when :Integer
150
+ value.to_i
151
+ when :Float
152
+ value.to_f
153
+ when :Boolean
154
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
155
+ true
156
+ else
157
+ false
158
+ end
159
+ when :Object
160
+ # generic object (usually a Hash), return directly
161
+ value
162
+ when /\AArray<(?<inner_type>.+)>\z/
163
+ inner_type = Regexp.last_match[:inner_type]
164
+ value.map { |v| _deserialize(inner_type, v) }
165
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
166
+ k_type = Regexp.last_match[:k_type]
167
+ v_type = Regexp.last_match[:v_type]
168
+ {}.tap do |hash|
169
+ value.each do |k, v|
170
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
171
+ end
172
+ end
173
+ else # model
174
+ # models (e.g. Pet) or oneOf
175
+ klass = SnapTrade.const_get(type)
176
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
177
+ end
178
+ end
179
+
180
+ # Returns the string representation of the object
181
+ # @return [String] String presentation of the object
182
+ def to_s
183
+ to_hash.to_s
184
+ end
185
+
186
+ # to_body is an alias to to_hash (backward compatibility)
187
+ # @return [Hash] Returns the object in the form of hash
188
+ def to_body
189
+ to_hash
190
+ end
191
+
192
+ # Returns the object in the form of hash
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_hash
195
+ hash = {}
196
+ self.class.attribute_map.each_pair do |attr, param|
197
+ value = self.send(attr)
198
+ if value.nil?
199
+ is_nullable = self.class.openapi_nullable.include?(attr)
200
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
201
+ end
202
+
203
+ hash[param] = _to_hash(value)
204
+ end
205
+ hash
206
+ end
207
+
208
+ # Outputs non-array value in the form of hash
209
+ # For object, use to_hash. Otherwise, just return the value
210
+ # @param [Object] value Any valid value
211
+ # @return [Hash] Returns the value in the form of hash
212
+ def _to_hash(value)
213
+ if value.is_a?(Array)
214
+ value.compact.map { |v| _to_hash(v) }
215
+ elsif value.is_a?(Hash)
216
+ {}.tap do |hash|
217
+ value.each { |k, v| hash[k] = _to_hash(v) }
218
+ end
219
+ elsif value.respond_to? :to_hash
220
+ value.to_hash
221
+ else
222
+ value
223
+ end
224
+ end
225
+
226
+ end
227
+
228
+ end
@@ -0,0 +1,230 @@
1
+ =begin
2
+ #SnapTrade
3
+
4
+ #Connect brokerage accounts to your app for live positions and trading
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
+ # The response to the account value history endpoint, containing a list of estimated account values at different points in time.
15
+ class AccountValueHistoryResponse
16
+ # List of estimated account values over time returned by the endpoint.
17
+ attr_accessor :history
18
+
19
+ # The ISO-4217 currency code for the account values.
20
+ attr_accessor :currency
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'history' => :'history',
26
+ :'currency' => :'currency'
27
+ }
28
+ end
29
+
30
+ # Returns all the JSON keys this model knows about
31
+ def self.acceptable_attributes
32
+ attribute_map.values
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'history' => :'Array<AccountValueHistoryItem>',
39
+ :'currency' => :'String'
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.openapi_nullable
45
+ Set.new([
46
+ ])
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ if (!attributes.is_a?(Hash))
53
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::AccountValueHistoryResponse` initialize method"
54
+ end
55
+
56
+ # check to see if the attribute exists and convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}) { |(k, v), h|
58
+ if (!self.class.attribute_map.key?(k.to_sym))
59
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::AccountValueHistoryResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
60
+ end
61
+ h[k.to_sym] = v
62
+ }
63
+
64
+ if attributes.key?(:'history')
65
+ if (value = attributes[:'history']).is_a?(Array)
66
+ self.history = value
67
+ end
68
+ end
69
+
70
+ if attributes.key?(:'currency')
71
+ self.currency = attributes[:'currency']
72
+ end
73
+ end
74
+
75
+ # Show invalid properties with the reasons. Usually used together with valid?
76
+ # @return Array for valid properties with the reasons
77
+ def list_invalid_properties
78
+ invalid_properties = Array.new
79
+ invalid_properties
80
+ end
81
+
82
+ # Check to see if the all the properties in the model are valid
83
+ # @return true if the model is valid
84
+ def valid?
85
+ true
86
+ end
87
+
88
+ # Checks equality by comparing each attribute.
89
+ # @param [Object] Object to be compared
90
+ def ==(o)
91
+ return true if self.equal?(o)
92
+ self.class == o.class &&
93
+ history == o.history &&
94
+ currency == o.currency
95
+ end
96
+
97
+ # @see the `==` method
98
+ # @param [Object] Object to be compared
99
+ def eql?(o)
100
+ self == o
101
+ end
102
+
103
+ # Calculates hash code according to all attributes.
104
+ # @return [Integer] Hash code
105
+ def hash
106
+ [history, currency].hash
107
+ end
108
+
109
+ # Builds the object from hash
110
+ # @param [Hash] attributes Model attributes in the form of hash
111
+ # @return [Object] Returns the model itself
112
+ def self.build_from_hash(attributes)
113
+ new.build_from_hash(attributes)
114
+ end
115
+
116
+ # Builds the object from hash
117
+ # @param [Hash] attributes Model attributes in the form of hash
118
+ # @return [Object] Returns the model itself
119
+ def build_from_hash(attributes)
120
+ return nil unless attributes.is_a?(Hash)
121
+ attributes = attributes.transform_keys(&:to_sym)
122
+ self.class.openapi_types.each_pair do |key, type|
123
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
124
+ self.send("#{key}=", nil)
125
+ elsif type =~ /\AArray<(.*)>/i
126
+ # check to ensure the input is an array given that the attribute
127
+ # is documented as an array but the input is not
128
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
129
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
130
+ end
131
+ elsif !attributes[self.class.attribute_map[key]].nil?
132
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
133
+ end
134
+ end
135
+
136
+ self
137
+ end
138
+
139
+ # Deserializes the data based on type
140
+ # @param string type Data type
141
+ # @param string value Value to be deserialized
142
+ # @return [Object] Deserialized data
143
+ def _deserialize(type, value)
144
+ case type.to_sym
145
+ when :Time
146
+ Time.parse(value)
147
+ when :Date
148
+ Date.parse(value)
149
+ when :String
150
+ value.to_s
151
+ when :Integer
152
+ value.to_i
153
+ when :Float
154
+ value.to_f
155
+ when :Boolean
156
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
157
+ true
158
+ else
159
+ false
160
+ end
161
+ when :Object
162
+ # generic object (usually a Hash), return directly
163
+ value
164
+ when /\AArray<(?<inner_type>.+)>\z/
165
+ inner_type = Regexp.last_match[:inner_type]
166
+ value.map { |v| _deserialize(inner_type, v) }
167
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
168
+ k_type = Regexp.last_match[:k_type]
169
+ v_type = Regexp.last_match[:v_type]
170
+ {}.tap do |hash|
171
+ value.each do |k, v|
172
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
173
+ end
174
+ end
175
+ else # model
176
+ # models (e.g. Pet) or oneOf
177
+ klass = SnapTrade.const_get(type)
178
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
179
+ end
180
+ end
181
+
182
+ # Returns the string representation of the object
183
+ # @return [String] String presentation of the object
184
+ def to_s
185
+ to_hash.to_s
186
+ end
187
+
188
+ # to_body is an alias to to_hash (backward compatibility)
189
+ # @return [Hash] Returns the object in the form of hash
190
+ def to_body
191
+ to_hash
192
+ end
193
+
194
+ # Returns the object in the form of hash
195
+ # @return [Hash] Returns the object in the form of hash
196
+ def to_hash
197
+ hash = {}
198
+ self.class.attribute_map.each_pair do |attr, param|
199
+ value = self.send(attr)
200
+ if value.nil?
201
+ is_nullable = self.class.openapi_nullable.include?(attr)
202
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
203
+ end
204
+
205
+ hash[param] = _to_hash(value)
206
+ end
207
+ hash
208
+ end
209
+
210
+ # Outputs non-array value in the form of hash
211
+ # For object, use to_hash. Otherwise, just return the value
212
+ # @param [Object] value Any valid value
213
+ # @return [Hash] Returns the value in the form of hash
214
+ def _to_hash(value)
215
+ if value.is_a?(Array)
216
+ value.compact.map { |v| _to_hash(v) }
217
+ elsif value.is_a?(Hash)
218
+ {}.tap do |hash|
219
+ value.each { |k, v| hash[k] = _to_hash(v) }
220
+ end
221
+ elsif value.respond_to? :to_hash
222
+ value.to_hash
223
+ else
224
+ value
225
+ end
226
+ end
227
+
228
+ end
229
+
230
+ end
@@ -43,6 +43,9 @@ module SnapTrade
43
43
  # Whether the brokerage is currently in maintenance mode. A brokerage in maintenance mode will not be available for new connections.
44
44
  attr_accessor :maintenance_mode
45
45
 
46
+ # Whether the brokerage is currently degraded. A degraded brokerage may have reduced functionality or be experiencing technical issues.
47
+ attr_accessor :is_degraded
48
+
46
49
  # Whether the brokerage allows trading through SnapTrade.
47
50
  attr_accessor :allows_trading
48
51
 
@@ -76,6 +79,7 @@ module SnapTrade
76
79
  :'url' => :'url',
77
80
  :'enabled' => :'enabled',
78
81
  :'maintenance_mode' => :'maintenance_mode',
82
+ :'is_degraded' => :'is_degraded',
79
83
  :'allows_trading' => :'allows_trading',
80
84
  :'allows_fractional_units' => :'allows_fractional_units',
81
85
  :'has_reporting' => :'has_reporting',
@@ -104,6 +108,7 @@ module SnapTrade
104
108
  :'url' => :'String',
105
109
  :'enabled' => :'Boolean',
106
110
  :'maintenance_mode' => :'Boolean',
111
+ :'is_degraded' => :'Boolean',
107
112
  :'allows_trading' => :'Boolean',
108
113
  :'allows_fractional_units' => :'Boolean',
109
114
  :'has_reporting' => :'Boolean',
@@ -180,6 +185,10 @@ module SnapTrade
180
185
  self.maintenance_mode = attributes[:'maintenance_mode']
181
186
  end
182
187
 
188
+ if attributes.key?(:'is_degraded')
189
+ self.is_degraded = attributes[:'is_degraded']
190
+ end
191
+
183
192
  if attributes.key?(:'allows_trading')
184
193
  self.allows_trading = attributes[:'allows_trading']
185
194
  end
@@ -239,6 +248,7 @@ module SnapTrade
239
248
  url == o.url &&
240
249
  enabled == o.enabled &&
241
250
  maintenance_mode == o.maintenance_mode &&
251
+ is_degraded == o.is_degraded &&
242
252
  allows_trading == o.allows_trading &&
243
253
  allows_fractional_units == o.allows_fractional_units &&
244
254
  has_reporting == o.has_reporting &&
@@ -257,7 +267,7 @@ module SnapTrade
257
267
  # Calculates hash code according to all attributes.
258
268
  # @return [Integer] Hash code
259
269
  def hash
260
- [id, slug, name, display_name, description, aws_s3_logo_url, aws_s3_square_logo_url, url, enabled, maintenance_mode, allows_trading, allows_fractional_units, has_reporting, is_real_time_connection, brokerage_type, exchanges, open_url].hash
270
+ [id, slug, name, display_name, description, aws_s3_logo_url, aws_s3_square_logo_url, url, enabled, maintenance_mode, is_degraded, allows_trading, allows_fractional_units, has_reporting, is_real_time_connection, brokerage_type, exchanges, open_url].hash
261
271
  end
262
272
 
263
273
  # Builds the object from hash
@@ -8,5 +8,5 @@ Contact: api@snaptrade.com
8
8
  =end
9
9
 
10
10
  module SnapTrade
11
- VERSION = '2.0.166'
11
+ VERSION = '2.0.167'
12
12
  end
data/lib/snaptrade.rb CHANGED
@@ -41,6 +41,8 @@ require 'snaptrade/models/account_universal_activity'
41
41
  require 'snaptrade/models/account_universal_activity_currency'
42
42
  require 'snaptrade/models/account_universal_activity_option_symbol'
43
43
  require 'snaptrade/models/account_universal_activity_symbol'
44
+ require 'snaptrade/models/account_value_history_item'
45
+ require 'snaptrade/models/account_value_history_response'
44
46
  require 'snaptrade/models/action_strict'
45
47
  require 'snaptrade/models/action_strict_with_options'
46
48
  require 'snaptrade/models/auth_type'
@@ -27,6 +27,20 @@ describe 'ExperimentalEndpointsApi' do
27
27
  end
28
28
  end
29
29
 
30
+ # unit tests for get_account_balance_history
31
+ # List historical account total value
32
+ # 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 only available for certain brokerages with a maximum lookback of 1 year.
33
+ # @param user_id
34
+ # @param user_secret
35
+ # @param account_id
36
+ # @param [Hash] opts the optional parameters
37
+ # @return [AccountValueHistoryResponse]
38
+ describe 'get_account_balance_history test' do
39
+ it 'should work' do
40
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
41
+ end
42
+ end
43
+
30
44
  # unit tests for get_user_account_order_detail_v2
31
45
  # Get account order detail (V2)
32
46
  # Returns the detail of a single order using the brokerage order ID provided as a path parameter. The V2 order response format includes all legs of the order in the &#x60;legs&#x60; list field. If the order is single legged, &#x60;legs&#x60; will be a list of one leg. This endpoint is always realtime and does not rely on cached data. This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint.
@@ -0,0 +1,35 @@
1
+ =begin
2
+ #SnapTrade
3
+
4
+ #Connect brokerage accounts to your app for live positions and trading
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::AccountValueHistoryItem
15
+ describe SnapTrade::AccountValueHistoryItem do
16
+ let(:instance) { SnapTrade::AccountValueHistoryItem.new }
17
+
18
+ describe 'test an instance of AccountValueHistoryItem' do
19
+ it 'should create an instance of AccountValueHistoryItem' do
20
+ expect(instance).to be_instance_of(SnapTrade::AccountValueHistoryItem)
21
+ end
22
+ end
23
+ describe 'test attribute "date"' 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_value"' 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
+ end
@@ -0,0 +1,35 @@
1
+ =begin
2
+ #SnapTrade
3
+
4
+ #Connect brokerage accounts to your app for live positions and trading
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::AccountValueHistoryResponse
15
+ describe SnapTrade::AccountValueHistoryResponse do
16
+ let(:instance) { SnapTrade::AccountValueHistoryResponse.new }
17
+
18
+ describe 'test an instance of AccountValueHistoryResponse' do
19
+ it 'should create an instance of AccountValueHistoryResponse' do
20
+ expect(instance).to be_instance_of(SnapTrade::AccountValueHistoryResponse)
21
+ end
22
+ end
23
+ describe 'test attribute "history"' 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 "currency"' 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
+ end
@@ -80,6 +80,12 @@ describe SnapTrade::Brokerage do
80
80
  end
81
81
  end
82
82
 
83
+ describe 'test attribute "is_degraded"' 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
+
83
89
  describe 'test attribute "allows_trading"' do
84
90
  it 'should work' do
85
91
  # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snaptrade
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.166
4
+ version: 2.0.167
5
5
  platform: ruby
6
6
  authors:
7
7
  - SnapTrade
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-03-03 00:00:00.000000000 Z
11
+ date: 2026-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -121,6 +121,8 @@ files:
121
121
  - lib/snaptrade/models/account_universal_activity_currency.rb
122
122
  - lib/snaptrade/models/account_universal_activity_option_symbol.rb
123
123
  - lib/snaptrade/models/account_universal_activity_symbol.rb
124
+ - lib/snaptrade/models/account_value_history_item.rb
125
+ - lib/snaptrade/models/account_value_history_response.rb
124
126
  - lib/snaptrade/models/action_strict.rb
125
127
  - lib/snaptrade/models/action_strict_with_options.rb
126
128
  - lib/snaptrade/models/auth_type.rb
@@ -300,6 +302,8 @@ files:
300
302
  - spec/models/account_universal_activity_option_symbol_spec.rb
301
303
  - spec/models/account_universal_activity_spec.rb
302
304
  - spec/models/account_universal_activity_symbol_spec.rb
305
+ - spec/models/account_value_history_item_spec.rb
306
+ - spec/models/account_value_history_response_spec.rb
303
307
  - spec/models/action_strict_spec.rb
304
308
  - spec/models/action_strict_with_options_spec.rb
305
309
  - spec/models/auth_type_spec.rb
@@ -498,6 +502,7 @@ test_files:
498
502
  - spec/models/brokerage_spec.rb
499
503
  - spec/models/account_order_record_quote_universal_symbol_spec.rb
500
504
  - spec/models/simple_order_form_spec.rb
505
+ - spec/models/account_value_history_response_spec.rb
501
506
  - spec/models/partner_data_spec.rb
502
507
  - spec/models/manual_trade_symbol_spec.rb
503
508
  - spec/models/mleg_price_effect_strict_spec.rb
@@ -575,6 +580,7 @@ test_files:
575
580
  - spec/models/brokerage_type_spec.rb
576
581
  - spec/models/dividend_at_date_spec.rb
577
582
  - spec/models/brokerage_instrument_spec.rb
583
+ - spec/models/account_value_history_item_spec.rb
578
584
  - spec/models/mleg_action_strict_spec.rb
579
585
  - spec/models/crypto_order_form_spec.rb
580
586
  - spec/models/figi_instrument_spec.rb