snaptrade 2.0.187 → 2.0.189

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.
@@ -17,114 +17,11 @@ 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
-
123
20
  # List all account positions
124
21
  #
125
- # Returns a paginated list of all positions in the specified account.
22
+ # Returns a list of all positions in the specified account.
126
23
  #
127
- # The `results` list can contain multiple instrument types in the same response page, including stocks, ETFs, crypto, futures, and option positions. Use the `instrument.kind` discriminator to determine the schema for each position's `instrument`.
24
+ # The `results` list can contain multiple instrument types in the same response, including stocks, ADRs, ETFs, mutual funds, closed-end funds, crypto, futures, and option positions. Use the `instrument.kind` discriminator to determine the schema for each position's `instrument`.
128
25
  #
129
26
  # Stock positions may also include `cash_equivalent`, and may include `tax_lots` when tax lot data is enabled for the account.
130
27
  #
@@ -133,21 +30,17 @@ module SnapTrade
133
30
  # @param user_id [String]
134
31
  # @param user_secret [String]
135
32
  # @param account_id [String]
136
- # @param page [Integer] The page number to return. Defaults to 1.
137
- # @param page_size [Integer] The number of positions to return per page. Defaults to 100 with a maximum of 1000.
138
33
  # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
139
- def get_all_account_positions(user_id:, user_secret:, account_id:, page: SENTINEL, page_size: SENTINEL, extra: {})
140
- extra[:page] = page if page != SENTINEL
141
- extra[:page_size] = page_size if page_size != SENTINEL
34
+ def get_all_account_positions(user_id:, user_secret:, account_id:, extra: {})
142
35
  data, _status_code, _headers = get_all_account_positions_with_http_info_impl(user_id, user_secret, account_id, extra)
143
36
  data
144
37
  end
145
38
 
146
39
  # List all account positions
147
40
  #
148
- # Returns a paginated list of all positions in the specified account.
41
+ # Returns a list of all positions in the specified account.
149
42
  #
150
- # The `results` list can contain multiple instrument types in the same response page, including stocks, ETFs, crypto, futures, and option positions. Use the `instrument.kind` discriminator to determine the schema for each position's `instrument`.
43
+ # The `results` list can contain multiple instrument types in the same response, including stocks, ADRs, ETFs, mutual funds, closed-end funds, crypto, futures, and option positions. Use the `instrument.kind` discriminator to determine the schema for each position's `instrument`.
151
44
  #
152
45
  # Stock positions may also include `cash_equivalent`, and may include `tax_lots` when tax lot data is enabled for the account.
153
46
  #
@@ -156,23 +49,17 @@ module SnapTrade
156
49
  # @param user_id [String]
157
50
  # @param user_secret [String]
158
51
  # @param account_id [String]
159
- # @param page [Integer] The page number to return. Defaults to 1.
160
- # @param page_size [Integer] The number of positions to return per page. Defaults to 100 with a maximum of 1000.
161
52
  # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
162
- def get_all_account_positions_with_http_info(user_id:, user_secret:, account_id:, page: SENTINEL, page_size: SENTINEL, extra: {})
163
- extra[:page] = page if page != SENTINEL
164
- extra[:page_size] = page_size if page_size != SENTINEL
53
+ def get_all_account_positions_with_http_info(user_id:, user_secret:, account_id:, extra: {})
165
54
  get_all_account_positions_with_http_info_impl(user_id, user_secret, account_id, extra)
166
55
  end
167
56
 
168
57
  # List all account positions
169
- # Returns a paginated list of all positions in the specified account. The `results` list can contain multiple instrument types in the same response page, including stocks, ETFs, crypto, futures, and option positions. Use the `instrument.kind` discriminator to determine the schema for each position's `instrument`. Stock positions may also include `cash_equivalent`, and may include `tax_lots` when tax lot data is enabled for the account. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
58
+ # Returns a list of all positions in the specified account. The `results` list can contain multiple instrument types in the same response, including stocks, ADRs, ETFs, mutual funds, closed-end funds, crypto, futures, and option positions. Use the `instrument.kind` discriminator to determine the schema for each position's `instrument`. Stock positions may also include `cash_equivalent`, and may include `tax_lots` when tax lot data is enabled for the account. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
170
59
  # @param user_id [String]
171
60
  # @param user_secret [String]
172
61
  # @param account_id [String]
173
62
  # @param [Hash] opts the optional parameters
174
- # @option opts [Integer] :page The page number to return. Defaults to 1.
175
- # @option opts [Integer] :page_size The number of positions to return per page. Defaults to 100 with a maximum of 1000.
176
63
  # @return [AllAccountPositionsResponse]
177
64
  private def get_all_account_positions_impl(user_id, user_secret, account_id, opts = {})
178
65
  data, _status_code, _headers = get_all_account_positions_with_http_info(user_id, user_secret, account_id, opts)
@@ -180,13 +67,11 @@ module SnapTrade
180
67
  end
181
68
 
182
69
  # List all account positions
183
- # Returns a paginated list of all positions in the specified account. The &#x60;results&#x60; list can contain multiple instrument types in the same response page, including stocks, ETFs, crypto, futures, and option positions. Use the &#x60;instrument.kind&#x60; discriminator to determine the schema for each position&#39;s &#x60;instrument&#x60;. Stock positions may also include &#x60;cash_equivalent&#x60;, and may include &#x60;tax_lots&#x60; when tax lot data is enabled for the account. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
70
+ # Returns a list of all positions in the specified account. The &#x60;results&#x60; list can contain multiple instrument types in the same response, including stocks, ADRs, ETFs, mutual funds, closed-end funds, crypto, futures, and option positions. Use the &#x60;instrument.kind&#x60; discriminator to determine the schema for each position&#39;s &#x60;instrument&#x60;. Stock positions may also include &#x60;cash_equivalent&#x60;, and may include &#x60;tax_lots&#x60; when tax lot data is enabled for the account. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
184
71
  # @param user_id [String]
185
72
  # @param user_secret [String]
186
73
  # @param account_id [String]
187
74
  # @param [Hash] opts the optional parameters
188
- # @option opts [Integer] :page The page number to return. Defaults to 1.
189
- # @option opts [Integer] :page_size The number of positions to return per page. Defaults to 100 with a maximum of 1000.
190
75
  # @return [Array<(AllAccountPositionsResponse, Integer, Hash)>] AllAccountPositionsResponse data, response status code and response headers
191
76
  private def get_all_account_positions_with_http_info_impl(user_id, user_secret, account_id, opts = {})
192
77
  if @api_client.config.debugging
@@ -204,18 +89,6 @@ module SnapTrade
204
89
  if @api_client.config.client_side_validation && account_id.nil?
205
90
  fail ArgumentError, "Missing the required parameter 'account_id' when calling ExperimentalEndpointsApi.get_all_account_positions"
206
91
  end
207
- if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1
208
- fail ArgumentError, 'invalid value for "opts[:"page"]" when calling ExperimentalEndpointsApi.get_all_account_positions, must be greater than or equal to 1.'
209
- end
210
-
211
- if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000
212
- fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ExperimentalEndpointsApi.get_all_account_positions, must be smaller than or equal to 1000.'
213
- end
214
-
215
- if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1
216
- fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ExperimentalEndpointsApi.get_all_account_positions, must be greater than or equal to 1.'
217
- end
218
-
219
92
  # resource path
220
93
  local_var_path = '/accounts/{accountId}/positions/all'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
221
94
 
@@ -223,8 +96,6 @@ module SnapTrade
223
96
  query_params = opts[:query_params] || {}
224
97
  query_params[:'userId'] = user_id
225
98
  query_params[:'userSecret'] = user_secret
226
- query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
227
- query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?
228
99
 
229
100
  # header parameters
230
101
  header_params = opts[:header_params] || {}
@@ -160,7 +160,7 @@ module SnapTrade
160
160
  @ssl_client_cert = nil
161
161
  @ssl_client_key = nil
162
162
  @middlewares = Hash.new { |h, k| h[k] = [] }
163
- @timeout = 60
163
+ @timeout = 120
164
164
  # return data as binary instead of file
165
165
  @return_binary_data = false
166
166
  @params_encoder = nil
@@ -0,0 +1,311 @@
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
+ # Security instrument metadata for ADR positions.
15
+ class AdrInstrument
16
+ # Type of security instrument.
17
+ attr_accessor :kind
18
+
19
+ # Unique identifier for the instrument.
20
+ attr_accessor :id
21
+
22
+ # The formatted trading symbol for the security.
23
+ attr_accessor :symbol
24
+
25
+ # The raw symbol without any exchange suffix.
26
+ attr_accessor :raw_symbol
27
+
28
+ # Human-readable description of the security.
29
+ attr_accessor :description
30
+
31
+ # ISO-4217 currency code for the security listing.
32
+ attr_accessor :currency
33
+
34
+ # Exchange MIC code or exchange code for the security.
35
+ attr_accessor :exchange
36
+
37
+ attr_accessor :figi_instrument
38
+
39
+ # Attribute mapping from ruby-style variable name to JSON key.
40
+ def self.attribute_map
41
+ {
42
+ :'kind' => :'kind',
43
+ :'id' => :'id',
44
+ :'symbol' => :'symbol',
45
+ :'raw_symbol' => :'raw_symbol',
46
+ :'description' => :'description',
47
+ :'currency' => :'currency',
48
+ :'exchange' => :'exchange',
49
+ :'figi_instrument' => :'figi_instrument'
50
+ }
51
+ end
52
+
53
+ # Returns all the JSON keys this model knows about
54
+ def self.acceptable_attributes
55
+ attribute_map.values
56
+ end
57
+
58
+ # Attribute type mapping.
59
+ def self.openapi_types
60
+ {
61
+ :'kind' => :'AdrInstrumentKind',
62
+ :'id' => :'String',
63
+ :'symbol' => :'String',
64
+ :'raw_symbol' => :'String',
65
+ :'description' => :'String',
66
+ :'currency' => :'String',
67
+ :'exchange' => :'String',
68
+ :'figi_instrument' => :'StockInstrumentFigiInstrument'
69
+ }
70
+ end
71
+
72
+ # List of attributes with nullable: true
73
+ def self.openapi_nullable
74
+ Set.new([
75
+ :'description',
76
+ :'currency',
77
+ :'exchange',
78
+ :'figi_instrument'
79
+ ])
80
+ end
81
+
82
+ # Initializes the object
83
+ # @param [Hash] attributes Model attributes in the form of hash
84
+ def initialize(attributes = {})
85
+ if (!attributes.is_a?(Hash))
86
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::AdrInstrument` initialize method"
87
+ end
88
+
89
+ # check to see if the attribute exists and convert string to symbol for hash key
90
+ attributes = attributes.each_with_object({}) { |(k, v), h|
91
+ if (!self.class.attribute_map.key?(k.to_sym))
92
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::AdrInstrument`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
93
+ end
94
+ h[k.to_sym] = v
95
+ }
96
+
97
+ if attributes.key?(:'kind')
98
+ self.kind = attributes[:'kind']
99
+ end
100
+
101
+ if attributes.key?(:'id')
102
+ self.id = attributes[:'id']
103
+ end
104
+
105
+ if attributes.key?(:'symbol')
106
+ self.symbol = attributes[:'symbol']
107
+ end
108
+
109
+ if attributes.key?(:'raw_symbol')
110
+ self.raw_symbol = attributes[:'raw_symbol']
111
+ end
112
+
113
+ if attributes.key?(:'description')
114
+ self.description = attributes[:'description']
115
+ end
116
+
117
+ if attributes.key?(:'currency')
118
+ self.currency = attributes[:'currency']
119
+ end
120
+
121
+ if attributes.key?(:'exchange')
122
+ self.exchange = attributes[:'exchange']
123
+ end
124
+
125
+ if attributes.key?(:'figi_instrument')
126
+ self.figi_instrument = attributes[:'figi_instrument']
127
+ end
128
+ end
129
+
130
+ # Show invalid properties with the reasons. Usually used together with valid?
131
+ # @return Array for valid properties with the reasons
132
+ def list_invalid_properties
133
+ invalid_properties = Array.new
134
+ if @kind.nil?
135
+ invalid_properties.push('invalid value for "kind", kind cannot be nil.')
136
+ end
137
+
138
+ if @id.nil?
139
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
140
+ end
141
+
142
+ if @symbol.nil?
143
+ invalid_properties.push('invalid value for "symbol", symbol cannot be nil.')
144
+ end
145
+
146
+ if @raw_symbol.nil?
147
+ invalid_properties.push('invalid value for "raw_symbol", raw_symbol cannot be nil.')
148
+ end
149
+
150
+ invalid_properties
151
+ end
152
+
153
+ # Check to see if the all the properties in the model are valid
154
+ # @return true if the model is valid
155
+ def valid?
156
+ return false if @kind.nil?
157
+ return false if @id.nil?
158
+ return false if @symbol.nil?
159
+ return false if @raw_symbol.nil?
160
+ true
161
+ end
162
+
163
+ # Checks equality by comparing each attribute.
164
+ # @param [Object] Object to be compared
165
+ def ==(o)
166
+ return true if self.equal?(o)
167
+ self.class == o.class &&
168
+ kind == o.kind &&
169
+ id == o.id &&
170
+ symbol == o.symbol &&
171
+ raw_symbol == o.raw_symbol &&
172
+ description == o.description &&
173
+ currency == o.currency &&
174
+ exchange == o.exchange &&
175
+ figi_instrument == o.figi_instrument
176
+ end
177
+
178
+ # @see the `==` method
179
+ # @param [Object] Object to be compared
180
+ def eql?(o)
181
+ self == o
182
+ end
183
+
184
+ # Calculates hash code according to all attributes.
185
+ # @return [Integer] Hash code
186
+ def hash
187
+ [kind, id, symbol, raw_symbol, description, currency, exchange, figi_instrument].hash
188
+ end
189
+
190
+ # Builds the object from hash
191
+ # @param [Hash] attributes Model attributes in the form of hash
192
+ # @return [Object] Returns the model itself
193
+ def self.build_from_hash(attributes)
194
+ new.build_from_hash(attributes)
195
+ end
196
+
197
+ # Builds the object from hash
198
+ # @param [Hash] attributes Model attributes in the form of hash
199
+ # @return [Object] Returns the model itself
200
+ def build_from_hash(attributes)
201
+ return nil unless attributes.is_a?(Hash)
202
+ attributes = attributes.transform_keys(&:to_sym)
203
+ self.class.openapi_types.each_pair do |key, type|
204
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
205
+ self.send("#{key}=", nil)
206
+ elsif type =~ /\AArray<(.*)>/i
207
+ # check to ensure the input is an array given that the attribute
208
+ # is documented as an array but the input is not
209
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
210
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
211
+ end
212
+ elsif !attributes[self.class.attribute_map[key]].nil?
213
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
214
+ end
215
+ end
216
+
217
+ self
218
+ end
219
+
220
+ # Deserializes the data based on type
221
+ # @param string type Data type
222
+ # @param string value Value to be deserialized
223
+ # @return [Object] Deserialized data
224
+ def _deserialize(type, value)
225
+ case type.to_sym
226
+ when :Time
227
+ Time.parse(value)
228
+ when :Date
229
+ Date.parse(value)
230
+ when :String
231
+ value.to_s
232
+ when :Integer
233
+ value.to_i
234
+ when :Float
235
+ value.to_f
236
+ when :Boolean
237
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
238
+ true
239
+ else
240
+ false
241
+ end
242
+ when :Object
243
+ # generic object (usually a Hash), return directly
244
+ value
245
+ when /\AArray<(?<inner_type>.+)>\z/
246
+ inner_type = Regexp.last_match[:inner_type]
247
+ value.map { |v| _deserialize(inner_type, v) }
248
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
249
+ k_type = Regexp.last_match[:k_type]
250
+ v_type = Regexp.last_match[:v_type]
251
+ {}.tap do |hash|
252
+ value.each do |k, v|
253
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
254
+ end
255
+ end
256
+ else # model
257
+ # models (e.g. Pet) or oneOf
258
+ klass = SnapTrade.const_get(type)
259
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
260
+ end
261
+ end
262
+
263
+ # Returns the string representation of the object
264
+ # @return [String] String presentation of the object
265
+ def to_s
266
+ to_hash.to_s
267
+ end
268
+
269
+ # to_body is an alias to to_hash (backward compatibility)
270
+ # @return [Hash] Returns the object in the form of hash
271
+ def to_body
272
+ to_hash
273
+ end
274
+
275
+ # Returns the object in the form of hash
276
+ # @return [Hash] Returns the object in the form of hash
277
+ def to_hash
278
+ hash = {}
279
+ self.class.attribute_map.each_pair do |attr, param|
280
+ value = self.send(attr)
281
+ if value.nil?
282
+ is_nullable = self.class.openapi_nullable.include?(attr)
283
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
284
+ end
285
+
286
+ hash[param] = _to_hash(value)
287
+ end
288
+ hash
289
+ end
290
+
291
+ # Outputs non-array value in the form of hash
292
+ # For object, use to_hash. Otherwise, just return the value
293
+ # @param [Object] value Any valid value
294
+ # @return [Hash] Returns the value in the form of hash
295
+ def _to_hash(value)
296
+ if value.is_a?(Array)
297
+ value.compact.map { |v| _to_hash(v) }
298
+ elsif value.is_a?(Hash)
299
+ {}.tap do |hash|
300
+ value.each { |k, v| hash[k] = _to_hash(v) }
301
+ end
302
+ elsif value.respond_to? :to_hash
303
+ value.to_hash
304
+ else
305
+ value
306
+ end
307
+ end
308
+
309
+ end
310
+
311
+ end
@@ -0,0 +1,36 @@
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
+ class AdrInstrumentKind
15
+ ADR = "adr".freeze
16
+
17
+ def self.all_vars
18
+ @all_vars ||= [ADR].freeze
19
+ end
20
+
21
+ # Builds the enum from string
22
+ # @param [String] The enum value in the form of the string
23
+ # @return [String] The enum value
24
+ def self.build_from_hash(value)
25
+ new.build_from_hash(value)
26
+ end
27
+
28
+ # Builds the enum from string
29
+ # @param [String] The enum value in the form of the string
30
+ # @return [String] The enum value
31
+ def build_from_hash(value)
32
+ return value if AdrInstrumentKind.all_vars.include?(value)
33
+ raise "Invalid ENUM value #{value} for class #AdrInstrumentKind"
34
+ end
35
+ end
36
+ end
@@ -11,26 +11,14 @@ require 'date'
11
11
  require 'time'
12
12
 
13
13
  module SnapTrade
14
- # A paginated list of all account positions.
14
+ # Information about all account positions.
15
15
  class AllAccountPositionsResponse
16
- # The total number of positions available across all pages.
17
- attr_accessor :count
18
-
19
- # The URL for the next page of results, or `null` if there is no next page.
20
- attr_accessor :_next
21
-
22
- # The URL for the previous page of results, or `null` if there is no previous page.
23
- attr_accessor :previous
24
-
25
- # Positions returned for the current page.
16
+ # Positions returned for the request.
26
17
  attr_accessor :results
27
18
 
28
19
  # Attribute mapping from ruby-style variable name to JSON key.
29
20
  def self.attribute_map
30
21
  {
31
- :'count' => :'count',
32
- :'_next' => :'next',
33
- :'previous' => :'previous',
34
22
  :'results' => :'results'
35
23
  }
36
24
  end
@@ -43,9 +31,6 @@ module SnapTrade
43
31
  # Attribute type mapping.
44
32
  def self.openapi_types
45
33
  {
46
- :'count' => :'Integer',
47
- :'_next' => :'String',
48
- :'previous' => :'String',
49
34
  :'results' => :'Array<AccountPosition>'
50
35
  }
51
36
  end
@@ -53,8 +38,6 @@ module SnapTrade
53
38
  # List of attributes with nullable: true
54
39
  def self.openapi_nullable
55
40
  Set.new([
56
- :'_next',
57
- :'previous',
58
41
  ])
59
42
  end
60
43
 
@@ -73,18 +56,6 @@ module SnapTrade
73
56
  h[k.to_sym] = v
74
57
  }
75
58
 
76
- if attributes.key?(:'count')
77
- self.count = attributes[:'count']
78
- end
79
-
80
- if attributes.key?(:'_next')
81
- self._next = attributes[:'_next']
82
- end
83
-
84
- if attributes.key?(:'previous')
85
- self.previous = attributes[:'previous']
86
- end
87
-
88
59
  if attributes.key?(:'results')
89
60
  if (value = attributes[:'results']).is_a?(Array)
90
61
  self.results = value
@@ -96,10 +67,6 @@ module SnapTrade
96
67
  # @return Array for valid properties with the reasons
97
68
  def list_invalid_properties
98
69
  invalid_properties = Array.new
99
- if @count.nil?
100
- invalid_properties.push('invalid value for "count", count cannot be nil.')
101
- end
102
-
103
70
  if @results.nil?
104
71
  invalid_properties.push('invalid value for "results", results cannot be nil.')
105
72
  end
@@ -110,7 +77,6 @@ module SnapTrade
110
77
  # Check to see if the all the properties in the model are valid
111
78
  # @return true if the model is valid
112
79
  def valid?
113
- return false if @count.nil?
114
80
  return false if @results.nil?
115
81
  true
116
82
  end
@@ -120,9 +86,6 @@ module SnapTrade
120
86
  def ==(o)
121
87
  return true if self.equal?(o)
122
88
  self.class == o.class &&
123
- count == o.count &&
124
- _next == o._next &&
125
- previous == o.previous &&
126
89
  results == o.results
127
90
  end
128
91
 
@@ -135,7 +98,7 @@ module SnapTrade
135
98
  # Calculates hash code according to all attributes.
136
99
  # @return [Integer] Hash code
137
100
  def hash
138
- [count, _next, previous, results].hash
101
+ [results].hash
139
102
  end
140
103
 
141
104
  # Builds the object from hash