snaptrade 2.0.34 → 2.0.35
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +57 -35
- data/lib/snaptrade/api/account_information_api.rb +4 -4
- data/lib/snaptrade/api/authentication_api.rb +44 -46
- data/lib/snaptrade/api/connections_api.rb +8 -8
- data/lib/snaptrade/api/transactions_and_reporting_api.rb +36 -28
- data/lib/snaptrade/models/account_order_record.rb +1 -1
- data/lib/snaptrade/models/account_order_record_universal_symbol.rb +2 -2
- data/lib/snaptrade/models/account_simple.rb +4 -1
- data/lib/snaptrade/models/delete_user_response.rb +12 -3
- data/lib/snaptrade/models/login_redirect_uri.rb +3 -2
- data/lib/snaptrade/models/snap_trade_login_user_request_body.rb +10 -6
- data/lib/snaptrade/models/symbol.rb +16 -10
- data/lib/snaptrade/models/{universal_symbol_currency.rb → symbol_currency.rb} +3 -3
- data/lib/snaptrade/models/{universal_symbol_exchange.rb → symbol_exchange.rb} +3 -3
- data/lib/snaptrade/models/underlying_symbol.rb +1 -1
- data/lib/snaptrade/models/universal_activity.rb +91 -81
- data/lib/snaptrade/models/universal_activity_currency.rb +245 -0
- data/lib/snaptrade/models/universal_activity_option_symbol.rb +314 -0
- data/lib/snaptrade/models/universal_activity_symbol.rb +304 -0
- data/lib/snaptrade/models/universal_symbol.rb +2 -2
- data/lib/snaptrade/models/user_i_dand_secret.rb +1 -1
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +5 -2
- data/spec/api/account_information_api_spec.rb +1 -1
- data/spec/api/authentication_api_spec.rb +7 -7
- data/spec/api/connections_api_spec.rb +2 -2
- data/spec/api/transactions_and_reporting_api_spec.rb +7 -7
- data/spec/models/delete_user_response_spec.rb +6 -0
- data/spec/models/{universal_symbol_currency_spec.rb → symbol_currency_spec.rb} +6 -6
- data/spec/models/{universal_symbol_exchange_spec.rb → symbol_exchange_spec.rb} +6 -6
- data/spec/models/symbol_spec.rb +1 -1
- data/spec/models/universal_activity_currency_spec.rb +41 -0
- data/spec/models/universal_activity_option_symbol_spec.rb +65 -0
- data/spec/models/universal_activity_spec.rb +15 -15
- data/spec/models/universal_activity_symbol_spec.rb +77 -0
- metadata +17 -8
@@ -0,0 +1,314 @@
|
|
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 option security for the transaction. The field is `null` if the transaction is not related to an option security (like a deposit, withdrawal, fee, etc). SnapTrade does a best effort to map the brokerage's option symbol. In cases where the brokerage option symbol is not recognized, the field will be set to `null`.
|
15
|
+
class UniversalActivityOptionSymbol
|
16
|
+
# Unique identifier for the option symbol within SnapTrade. This is the ID used to reference the symbol in SnapTrade API calls.
|
17
|
+
attr_accessor :id
|
18
|
+
|
19
|
+
# The [OCC symbol](https://en.wikipedia.org/wiki/Option_symbol) for the option.
|
20
|
+
attr_accessor :ticker
|
21
|
+
|
22
|
+
# The type of option. Either \"CALL\" or \"PUT\".
|
23
|
+
attr_accessor :option_type
|
24
|
+
|
25
|
+
# The option strike price.
|
26
|
+
attr_accessor :strike_price
|
27
|
+
|
28
|
+
# The option expiration date.
|
29
|
+
attr_accessor :expiration_date
|
30
|
+
|
31
|
+
# Whether the option is a mini option. Mini options have 10 underlying shares per contract instead of the standard 100.
|
32
|
+
attr_accessor :is_mini_option
|
33
|
+
|
34
|
+
attr_accessor :underlying_symbol
|
35
|
+
|
36
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
37
|
+
def self.attribute_map
|
38
|
+
{
|
39
|
+
:'id' => :'id',
|
40
|
+
:'ticker' => :'ticker',
|
41
|
+
:'option_type' => :'option_type',
|
42
|
+
:'strike_price' => :'strike_price',
|
43
|
+
:'expiration_date' => :'expiration_date',
|
44
|
+
:'is_mini_option' => :'is_mini_option',
|
45
|
+
:'underlying_symbol' => :'underlying_symbol'
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
49
|
+
# Returns all the JSON keys this model knows about
|
50
|
+
def self.acceptable_attributes
|
51
|
+
attribute_map.values
|
52
|
+
end
|
53
|
+
|
54
|
+
# Attribute type mapping.
|
55
|
+
def self.openapi_types
|
56
|
+
{
|
57
|
+
:'id' => :'String',
|
58
|
+
:'ticker' => :'String',
|
59
|
+
:'option_type' => :'OptionType',
|
60
|
+
:'strike_price' => :'Float',
|
61
|
+
:'expiration_date' => :'Date',
|
62
|
+
:'is_mini_option' => :'Boolean',
|
63
|
+
:'underlying_symbol' => :'UnderlyingSymbol'
|
64
|
+
}
|
65
|
+
end
|
66
|
+
|
67
|
+
# List of attributes with nullable: true
|
68
|
+
def self.openapi_nullable
|
69
|
+
Set.new([
|
70
|
+
])
|
71
|
+
end
|
72
|
+
|
73
|
+
# List of class defined in allOf (OpenAPI v3)
|
74
|
+
def self.openapi_all_of
|
75
|
+
[
|
76
|
+
:'OptionsSymbol'
|
77
|
+
]
|
78
|
+
end
|
79
|
+
|
80
|
+
# Initializes the object
|
81
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
82
|
+
def initialize(attributes = {})
|
83
|
+
if (!attributes.is_a?(Hash))
|
84
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::UniversalActivityOptionSymbol` initialize method"
|
85
|
+
end
|
86
|
+
|
87
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
88
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
89
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
90
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::UniversalActivityOptionSymbol`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
91
|
+
end
|
92
|
+
h[k.to_sym] = v
|
93
|
+
}
|
94
|
+
|
95
|
+
if attributes.key?(:'id')
|
96
|
+
self.id = attributes[:'id']
|
97
|
+
end
|
98
|
+
|
99
|
+
if attributes.key?(:'ticker')
|
100
|
+
self.ticker = attributes[:'ticker']
|
101
|
+
end
|
102
|
+
|
103
|
+
if attributes.key?(:'option_type')
|
104
|
+
self.option_type = attributes[:'option_type']
|
105
|
+
end
|
106
|
+
|
107
|
+
if attributes.key?(:'strike_price')
|
108
|
+
self.strike_price = attributes[:'strike_price']
|
109
|
+
end
|
110
|
+
|
111
|
+
if attributes.key?(:'expiration_date')
|
112
|
+
self.expiration_date = attributes[:'expiration_date']
|
113
|
+
end
|
114
|
+
|
115
|
+
if attributes.key?(:'is_mini_option')
|
116
|
+
self.is_mini_option = attributes[:'is_mini_option']
|
117
|
+
end
|
118
|
+
|
119
|
+
if attributes.key?(:'underlying_symbol')
|
120
|
+
self.underlying_symbol = attributes[:'underlying_symbol']
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
125
|
+
# @return Array for valid properties with the reasons
|
126
|
+
def list_invalid_properties
|
127
|
+
invalid_properties = Array.new
|
128
|
+
if @id.nil?
|
129
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
130
|
+
end
|
131
|
+
|
132
|
+
if @ticker.nil?
|
133
|
+
invalid_properties.push('invalid value for "ticker", ticker cannot be nil.')
|
134
|
+
end
|
135
|
+
|
136
|
+
if @option_type.nil?
|
137
|
+
invalid_properties.push('invalid value for "option_type", option_type cannot be nil.')
|
138
|
+
end
|
139
|
+
|
140
|
+
if @strike_price.nil?
|
141
|
+
invalid_properties.push('invalid value for "strike_price", strike_price cannot be nil.')
|
142
|
+
end
|
143
|
+
|
144
|
+
if @expiration_date.nil?
|
145
|
+
invalid_properties.push('invalid value for "expiration_date", expiration_date cannot be nil.')
|
146
|
+
end
|
147
|
+
|
148
|
+
if @underlying_symbol.nil?
|
149
|
+
invalid_properties.push('invalid value for "underlying_symbol", underlying_symbol cannot be nil.')
|
150
|
+
end
|
151
|
+
|
152
|
+
invalid_properties
|
153
|
+
end
|
154
|
+
|
155
|
+
# Check to see if the all the properties in the model are valid
|
156
|
+
# @return true if the model is valid
|
157
|
+
def valid?
|
158
|
+
return false if @id.nil?
|
159
|
+
return false if @ticker.nil?
|
160
|
+
return false if @option_type.nil?
|
161
|
+
return false if @strike_price.nil?
|
162
|
+
return false if @expiration_date.nil?
|
163
|
+
return false if @underlying_symbol.nil?
|
164
|
+
true
|
165
|
+
end
|
166
|
+
|
167
|
+
# Checks equality by comparing each attribute.
|
168
|
+
# @param [Object] Object to be compared
|
169
|
+
def ==(o)
|
170
|
+
return true if self.equal?(o)
|
171
|
+
self.class == o.class &&
|
172
|
+
id == o.id &&
|
173
|
+
ticker == o.ticker &&
|
174
|
+
option_type == o.option_type &&
|
175
|
+
strike_price == o.strike_price &&
|
176
|
+
expiration_date == o.expiration_date &&
|
177
|
+
is_mini_option == o.is_mini_option &&
|
178
|
+
underlying_symbol == o.underlying_symbol
|
179
|
+
end
|
180
|
+
|
181
|
+
# @see the `==` method
|
182
|
+
# @param [Object] Object to be compared
|
183
|
+
def eql?(o)
|
184
|
+
self == o
|
185
|
+
end
|
186
|
+
|
187
|
+
# Calculates hash code according to all attributes.
|
188
|
+
# @return [Integer] Hash code
|
189
|
+
def hash
|
190
|
+
[id, ticker, option_type, strike_price, expiration_date, is_mini_option, underlying_symbol].hash
|
191
|
+
end
|
192
|
+
|
193
|
+
# Builds the object from hash
|
194
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
195
|
+
# @return [Object] Returns the model itself
|
196
|
+
def self.build_from_hash(attributes)
|
197
|
+
new.build_from_hash(attributes)
|
198
|
+
end
|
199
|
+
|
200
|
+
# Builds the object from hash
|
201
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
202
|
+
# @return [Object] Returns the model itself
|
203
|
+
def build_from_hash(attributes)
|
204
|
+
return nil unless attributes.is_a?(Hash)
|
205
|
+
attributes = attributes.transform_keys(&:to_sym)
|
206
|
+
self.class.openapi_types.each_pair do |key, type|
|
207
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
208
|
+
self.send("#{key}=", nil)
|
209
|
+
elsif type =~ /\AArray<(.*)>/i
|
210
|
+
# check to ensure the input is an array given that the attribute
|
211
|
+
# is documented as an array but the input is not
|
212
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
213
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
214
|
+
end
|
215
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
216
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
self
|
221
|
+
end
|
222
|
+
|
223
|
+
# Deserializes the data based on type
|
224
|
+
# @param string type Data type
|
225
|
+
# @param string value Value to be deserialized
|
226
|
+
# @return [Object] Deserialized data
|
227
|
+
def _deserialize(type, value)
|
228
|
+
case type.to_sym
|
229
|
+
when :Time
|
230
|
+
Time.parse(value)
|
231
|
+
when :Date
|
232
|
+
Date.parse(value)
|
233
|
+
when :String
|
234
|
+
value.to_s
|
235
|
+
when :Integer
|
236
|
+
value.to_i
|
237
|
+
when :Float
|
238
|
+
value.to_f
|
239
|
+
when :Boolean
|
240
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
241
|
+
true
|
242
|
+
else
|
243
|
+
false
|
244
|
+
end
|
245
|
+
when :Object
|
246
|
+
# generic object (usually a Hash), return directly
|
247
|
+
value
|
248
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
249
|
+
inner_type = Regexp.last_match[:inner_type]
|
250
|
+
value.map { |v| _deserialize(inner_type, v) }
|
251
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
252
|
+
k_type = Regexp.last_match[:k_type]
|
253
|
+
v_type = Regexp.last_match[:v_type]
|
254
|
+
{}.tap do |hash|
|
255
|
+
value.each do |k, v|
|
256
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
257
|
+
end
|
258
|
+
end
|
259
|
+
else # model
|
260
|
+
# models (e.g. Pet) or oneOf
|
261
|
+
klass = SnapTrade.const_get(type)
|
262
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
263
|
+
end
|
264
|
+
end
|
265
|
+
|
266
|
+
# Returns the string representation of the object
|
267
|
+
# @return [String] String presentation of the object
|
268
|
+
def to_s
|
269
|
+
to_hash.to_s
|
270
|
+
end
|
271
|
+
|
272
|
+
# to_body is an alias to to_hash (backward compatibility)
|
273
|
+
# @return [Hash] Returns the object in the form of hash
|
274
|
+
def to_body
|
275
|
+
to_hash
|
276
|
+
end
|
277
|
+
|
278
|
+
# Returns the object in the form of hash
|
279
|
+
# @return [Hash] Returns the object in the form of hash
|
280
|
+
def to_hash
|
281
|
+
hash = {}
|
282
|
+
self.class.attribute_map.each_pair do |attr, param|
|
283
|
+
value = self.send(attr)
|
284
|
+
if value.nil?
|
285
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
286
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
287
|
+
end
|
288
|
+
|
289
|
+
hash[param] = _to_hash(value)
|
290
|
+
end
|
291
|
+
hash
|
292
|
+
end
|
293
|
+
|
294
|
+
# Outputs non-array value in the form of hash
|
295
|
+
# For object, use to_hash. Otherwise, just return the value
|
296
|
+
# @param [Object] value Any valid value
|
297
|
+
# @return [Hash] Returns the value in the form of hash
|
298
|
+
def _to_hash(value)
|
299
|
+
if value.is_a?(Array)
|
300
|
+
value.compact.map { |v| _to_hash(v) }
|
301
|
+
elsif value.is_a?(Hash)
|
302
|
+
{}.tap do |hash|
|
303
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
304
|
+
end
|
305
|
+
elsif value.respond_to? :to_hash
|
306
|
+
value.to_hash
|
307
|
+
else
|
308
|
+
value
|
309
|
+
end
|
310
|
+
end
|
311
|
+
|
312
|
+
end
|
313
|
+
|
314
|
+
end
|
@@ -0,0 +1,304 @@
|
|
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 security for the transaction. The field is `null` if the transaction is not related to a security (like a deposit, withdrawal, fee, etc). SnapTrade does a best effort to map the brokerage's symbol. In cases where the brokerage symbol is not recognized, the field will be set to `null`.
|
15
|
+
class UniversalActivitySymbol
|
16
|
+
# Unique identifier for the symbol within SnapTrade. This is the ID used to reference the symbol in SnapTrade API calls.
|
17
|
+
attr_accessor :id
|
18
|
+
|
19
|
+
# The security's trading ticker symbol. For example \"AAPL\" for Apple Inc. We largely follow the [Yahoo Finance ticker format](https://help.yahoo.com/kb/SLN2310.html)(click on \"Yahoo Finance Market Coverage and Data Delays\"). For example, for securities traded on the Toronto Stock Exchange, the symbol has a '.TO' suffix. For securities traded on NASDAQ or NYSE, the symbol does not have a suffix.
|
20
|
+
attr_accessor :symbol
|
21
|
+
|
22
|
+
# The raw symbol is `symbol` with the exchange suffix removed. For example, if `symbol` is \"VAB.TO\", then `raw_symbol` is \"VAB\".
|
23
|
+
attr_accessor :raw_symbol
|
24
|
+
|
25
|
+
# A human-readable description of the security. This is usually the company name or ETF name.
|
26
|
+
attr_accessor :description
|
27
|
+
|
28
|
+
attr_accessor :currency
|
29
|
+
|
30
|
+
attr_accessor :exchange
|
31
|
+
|
32
|
+
attr_accessor :type
|
33
|
+
|
34
|
+
# This identifier is unique per security per trading venue. See section 1.4.1 of the [FIGI Standard](https://www.openfigi.com/assets/local/figi-allocation-rules.pdf) for more information. This value should be the same as the `figi_code` in the `figi_instrument` child property.
|
35
|
+
attr_accessor :figi_code
|
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
|
+
:'id' => :'id',
|
43
|
+
:'symbol' => :'symbol',
|
44
|
+
:'raw_symbol' => :'raw_symbol',
|
45
|
+
:'description' => :'description',
|
46
|
+
:'currency' => :'currency',
|
47
|
+
:'exchange' => :'exchange',
|
48
|
+
:'type' => :'type',
|
49
|
+
:'figi_code' => :'figi_code',
|
50
|
+
:'figi_instrument' => :'figi_instrument'
|
51
|
+
}
|
52
|
+
end
|
53
|
+
|
54
|
+
# Returns all the JSON keys this model knows about
|
55
|
+
def self.acceptable_attributes
|
56
|
+
attribute_map.values
|
57
|
+
end
|
58
|
+
|
59
|
+
# Attribute type mapping.
|
60
|
+
def self.openapi_types
|
61
|
+
{
|
62
|
+
:'id' => :'String',
|
63
|
+
:'symbol' => :'String',
|
64
|
+
:'raw_symbol' => :'String',
|
65
|
+
:'description' => :'String',
|
66
|
+
:'currency' => :'SymbolCurrency',
|
67
|
+
:'exchange' => :'SymbolExchange',
|
68
|
+
:'type' => :'SecurityType',
|
69
|
+
:'figi_code' => :'String',
|
70
|
+
:'figi_instrument' => :'SymbolFigiInstrument'
|
71
|
+
}
|
72
|
+
end
|
73
|
+
|
74
|
+
# List of attributes with nullable: true
|
75
|
+
def self.openapi_nullable
|
76
|
+
Set.new([
|
77
|
+
:'description',
|
78
|
+
:'figi_code',
|
79
|
+
:'figi_instrument'
|
80
|
+
])
|
81
|
+
end
|
82
|
+
|
83
|
+
# List of class defined in allOf (OpenAPI v3)
|
84
|
+
def self.openapi_all_of
|
85
|
+
[
|
86
|
+
:'Symbol'
|
87
|
+
]
|
88
|
+
end
|
89
|
+
|
90
|
+
# Initializes the object
|
91
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
92
|
+
def initialize(attributes = {})
|
93
|
+
if (!attributes.is_a?(Hash))
|
94
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::UniversalActivitySymbol` initialize method"
|
95
|
+
end
|
96
|
+
|
97
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
98
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
99
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
100
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::UniversalActivitySymbol`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
101
|
+
end
|
102
|
+
h[k.to_sym] = v
|
103
|
+
}
|
104
|
+
|
105
|
+
if attributes.key?(:'id')
|
106
|
+
self.id = attributes[:'id']
|
107
|
+
end
|
108
|
+
|
109
|
+
if attributes.key?(:'symbol')
|
110
|
+
self.symbol = attributes[:'symbol']
|
111
|
+
end
|
112
|
+
|
113
|
+
if attributes.key?(:'raw_symbol')
|
114
|
+
self.raw_symbol = attributes[:'raw_symbol']
|
115
|
+
end
|
116
|
+
|
117
|
+
if attributes.key?(:'description')
|
118
|
+
self.description = attributes[:'description']
|
119
|
+
end
|
120
|
+
|
121
|
+
if attributes.key?(:'currency')
|
122
|
+
self.currency = attributes[:'currency']
|
123
|
+
end
|
124
|
+
|
125
|
+
if attributes.key?(:'exchange')
|
126
|
+
self.exchange = attributes[:'exchange']
|
127
|
+
end
|
128
|
+
|
129
|
+
if attributes.key?(:'type')
|
130
|
+
self.type = attributes[:'type']
|
131
|
+
end
|
132
|
+
|
133
|
+
if attributes.key?(:'figi_code')
|
134
|
+
self.figi_code = attributes[:'figi_code']
|
135
|
+
end
|
136
|
+
|
137
|
+
if attributes.key?(:'figi_instrument')
|
138
|
+
self.figi_instrument = attributes[:'figi_instrument']
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
143
|
+
# @return Array for valid properties with the reasons
|
144
|
+
def list_invalid_properties
|
145
|
+
invalid_properties = Array.new
|
146
|
+
invalid_properties
|
147
|
+
end
|
148
|
+
|
149
|
+
# Check to see if the all the properties in the model are valid
|
150
|
+
# @return true if the model is valid
|
151
|
+
def valid?
|
152
|
+
true
|
153
|
+
end
|
154
|
+
|
155
|
+
# Checks equality by comparing each attribute.
|
156
|
+
# @param [Object] Object to be compared
|
157
|
+
def ==(o)
|
158
|
+
return true if self.equal?(o)
|
159
|
+
self.class == o.class &&
|
160
|
+
id == o.id &&
|
161
|
+
symbol == o.symbol &&
|
162
|
+
raw_symbol == o.raw_symbol &&
|
163
|
+
description == o.description &&
|
164
|
+
currency == o.currency &&
|
165
|
+
exchange == o.exchange &&
|
166
|
+
type == o.type &&
|
167
|
+
figi_code == o.figi_code &&
|
168
|
+
figi_instrument == o.figi_instrument
|
169
|
+
end
|
170
|
+
|
171
|
+
# @see the `==` method
|
172
|
+
# @param [Object] Object to be compared
|
173
|
+
def eql?(o)
|
174
|
+
self == o
|
175
|
+
end
|
176
|
+
|
177
|
+
# Calculates hash code according to all attributes.
|
178
|
+
# @return [Integer] Hash code
|
179
|
+
def hash
|
180
|
+
[id, symbol, raw_symbol, description, currency, exchange, type, figi_code, figi_instrument].hash
|
181
|
+
end
|
182
|
+
|
183
|
+
# Builds the object from hash
|
184
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
185
|
+
# @return [Object] Returns the model itself
|
186
|
+
def self.build_from_hash(attributes)
|
187
|
+
new.build_from_hash(attributes)
|
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 build_from_hash(attributes)
|
194
|
+
return nil unless attributes.is_a?(Hash)
|
195
|
+
attributes = attributes.transform_keys(&:to_sym)
|
196
|
+
self.class.openapi_types.each_pair do |key, type|
|
197
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
198
|
+
self.send("#{key}=", nil)
|
199
|
+
elsif type =~ /\AArray<(.*)>/i
|
200
|
+
# check to ensure the input is an array given that the attribute
|
201
|
+
# is documented as an array but the input is not
|
202
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
203
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
204
|
+
end
|
205
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
206
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
self
|
211
|
+
end
|
212
|
+
|
213
|
+
# Deserializes the data based on type
|
214
|
+
# @param string type Data type
|
215
|
+
# @param string value Value to be deserialized
|
216
|
+
# @return [Object] Deserialized data
|
217
|
+
def _deserialize(type, value)
|
218
|
+
case type.to_sym
|
219
|
+
when :Time
|
220
|
+
Time.parse(value)
|
221
|
+
when :Date
|
222
|
+
Date.parse(value)
|
223
|
+
when :String
|
224
|
+
value.to_s
|
225
|
+
when :Integer
|
226
|
+
value.to_i
|
227
|
+
when :Float
|
228
|
+
value.to_f
|
229
|
+
when :Boolean
|
230
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
231
|
+
true
|
232
|
+
else
|
233
|
+
false
|
234
|
+
end
|
235
|
+
when :Object
|
236
|
+
# generic object (usually a Hash), return directly
|
237
|
+
value
|
238
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
239
|
+
inner_type = Regexp.last_match[:inner_type]
|
240
|
+
value.map { |v| _deserialize(inner_type, v) }
|
241
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
242
|
+
k_type = Regexp.last_match[:k_type]
|
243
|
+
v_type = Regexp.last_match[:v_type]
|
244
|
+
{}.tap do |hash|
|
245
|
+
value.each do |k, v|
|
246
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
247
|
+
end
|
248
|
+
end
|
249
|
+
else # model
|
250
|
+
# models (e.g. Pet) or oneOf
|
251
|
+
klass = SnapTrade.const_get(type)
|
252
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
256
|
+
# Returns the string representation of the object
|
257
|
+
# @return [String] String presentation of the object
|
258
|
+
def to_s
|
259
|
+
to_hash.to_s
|
260
|
+
end
|
261
|
+
|
262
|
+
# to_body is an alias to to_hash (backward compatibility)
|
263
|
+
# @return [Hash] Returns the object in the form of hash
|
264
|
+
def to_body
|
265
|
+
to_hash
|
266
|
+
end
|
267
|
+
|
268
|
+
# Returns the object in the form of hash
|
269
|
+
# @return [Hash] Returns the object in the form of hash
|
270
|
+
def to_hash
|
271
|
+
hash = {}
|
272
|
+
self.class.attribute_map.each_pair do |attr, param|
|
273
|
+
value = self.send(attr)
|
274
|
+
if value.nil?
|
275
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
276
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
277
|
+
end
|
278
|
+
|
279
|
+
hash[param] = _to_hash(value)
|
280
|
+
end
|
281
|
+
hash
|
282
|
+
end
|
283
|
+
|
284
|
+
# Outputs non-array value in the form of hash
|
285
|
+
# For object, use to_hash. Otherwise, just return the value
|
286
|
+
# @param [Object] value Any valid value
|
287
|
+
# @return [Hash] Returns the value in the form of hash
|
288
|
+
def _to_hash(value)
|
289
|
+
if value.is_a?(Array)
|
290
|
+
value.compact.map { |v| _to_hash(v) }
|
291
|
+
elsif value.is_a?(Hash)
|
292
|
+
{}.tap do |hash|
|
293
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
294
|
+
end
|
295
|
+
elsif value.respond_to? :to_hash
|
296
|
+
value.to_hash
|
297
|
+
else
|
298
|
+
value
|
299
|
+
end
|
300
|
+
end
|
301
|
+
|
302
|
+
end
|
303
|
+
|
304
|
+
end
|
@@ -67,8 +67,8 @@ module SnapTrade
|
|
67
67
|
:'symbol' => :'String',
|
68
68
|
:'raw_symbol' => :'String',
|
69
69
|
:'description' => :'String',
|
70
|
-
:'currency' => :'
|
71
|
-
:'exchange' => :'
|
70
|
+
:'currency' => :'SymbolCurrency',
|
71
|
+
:'exchange' => :'SymbolExchange',
|
72
72
|
:'type' => :'SecurityType',
|
73
73
|
:'currencies' => :'Array<Currency>',
|
74
74
|
:'figi_code' => :'String',
|
@@ -16,7 +16,7 @@ module SnapTrade
|
|
16
16
|
# SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
|
17
17
|
attr_accessor :user_id
|
18
18
|
|
19
|
-
# SnapTrade User Secret randomly generated by SnapTrade. This is privileged information and if compromised, should be rotated via the
|
19
|
+
# SnapTrade User Secret randomly generated by SnapTrade. This is privileged information and if compromised, should be rotated via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret)
|
20
20
|
attr_accessor :user_secret
|
21
21
|
|
22
22
|
# Attribute mapping from ruby-style variable name to JSON key.
|
data/lib/snaptrade/version.rb
CHANGED
data/lib/snaptrade.rb
CHANGED
@@ -105,6 +105,8 @@ require 'snaptrade/models/strategy_quotes_greek'
|
|
105
105
|
require 'snaptrade/models/strategy_type'
|
106
106
|
require 'snaptrade/models/sub_period_return_rate'
|
107
107
|
require 'snaptrade/models/symbol'
|
108
|
+
require 'snaptrade/models/symbol_currency'
|
109
|
+
require 'snaptrade/models/symbol_exchange'
|
108
110
|
require 'snaptrade/models/symbol_figi_instrument'
|
109
111
|
require 'snaptrade/models/symbol_query'
|
110
112
|
require 'snaptrade/models/symbols_quotes_inner'
|
@@ -117,9 +119,10 @@ require 'snaptrade/models/underlying_symbol'
|
|
117
119
|
require 'snaptrade/models/underlying_symbol_exchange'
|
118
120
|
require 'snaptrade/models/underlying_symbol_type'
|
119
121
|
require 'snaptrade/models/universal_activity'
|
122
|
+
require 'snaptrade/models/universal_activity_currency'
|
123
|
+
require 'snaptrade/models/universal_activity_option_symbol'
|
124
|
+
require 'snaptrade/models/universal_activity_symbol'
|
120
125
|
require 'snaptrade/models/universal_symbol'
|
121
|
-
require 'snaptrade/models/universal_symbol_currency'
|
122
|
-
require 'snaptrade/models/universal_symbol_exchange'
|
123
126
|
require 'snaptrade/models/user_i_dand_secret'
|
124
127
|
require 'snaptrade/models/validated_trade_body'
|
125
128
|
|
@@ -33,7 +33,7 @@ describe 'AccountInformationApi' do
|
|
33
33
|
# @param user_id
|
34
34
|
# @param user_secret
|
35
35
|
# @param [Hash] opts the optional parameters
|
36
|
-
# @option opts [String] :brokerage_authorizations Optional. Comma
|
36
|
+
# @option opts [String] :brokerage_authorizations Optional. Comma separated list of authorization IDs (only use if filtering is needed on one or more authorizations).
|
37
37
|
# @return [Array<AccountHoldings>]
|
38
38
|
describe 'get_all_user_holdings test' do
|
39
39
|
it 'should work' do
|