snaptrade 2.0.31 → 2.0.32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +31 -29
- data/README.md +4 -2
- data/lib/snaptrade/api/account_information_api.rb +6 -2
- data/lib/snaptrade/models/account_holdings_account.rb +1 -1
- data/lib/snaptrade/models/account_order_record.rb +4 -2
- data/lib/snaptrade/models/exchange.rb +9 -1
- data/lib/snaptrade/models/figi_instrument.rb +3 -1
- data/lib/snaptrade/models/option_brokerage_symbol.rb +3 -1
- data/lib/snaptrade/models/options_position.rb +1 -1
- data/lib/snaptrade/models/options_position_currency.rb +1 -0
- data/lib/snaptrade/models/options_symbol.rb +12 -24
- data/lib/snaptrade/models/position_symbol.rb +6 -1
- data/lib/snaptrade/models/security_type.rb +5 -1
- data/lib/snaptrade/models/symbol_figi_instrument.rb +2 -0
- data/lib/snaptrade/models/underlying_symbol.rb +20 -5
- data/lib/snaptrade/models/{model_portfolio.rb → underlying_symbol_exchange.rb} +73 -12
- data/lib/snaptrade/models/{brokerage_symbol.rb → underlying_symbol_type.rb} +28 -38
- data/lib/snaptrade/models/universal_symbol.rb +9 -3
- data/lib/snaptrade/models/{model_asset_class.rb → universal_symbol_currency.rb} +24 -4
- data/lib/snaptrade/models/{portfolio_group.rb → universal_symbol_exchange.rb} +78 -7
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +4 -36
- data/spec/api/account_information_api_spec.rb +1 -1
- data/spec/models/options_symbol_spec.rb +0 -12
- data/spec/models/{brokerage_symbol_option_symbol_spec.rb → underlying_symbol_exchange_spec.rb} +14 -14
- data/spec/models/underlying_symbol_spec.rb +6 -0
- data/spec/models/{trade_impact_spec.rb → underlying_symbol_type_spec.rb} +10 -16
- data/spec/models/{model_portfolio_spec.rb → universal_symbol_currency_spec.rb} +8 -8
- data/spec/models/{trade_spec.rb → universal_symbol_exchange_spec.rb} +13 -13
- metadata +113 -209
- data/lib/snaptrade/models/brokerage_authorization_type.rb +0 -216
- data/lib/snaptrade/models/brokerage_authorization_type_type.rb +0 -37
- data/lib/snaptrade/models/brokerage_symbol_option_symbol.rb +0 -325
- data/lib/snaptrade/models/brokerage_symbol_symbol.rb +0 -339
- data/lib/snaptrade/models/calculated_trade.rb +0 -228
- data/lib/snaptrade/models/excluded_asset.rb +0 -217
- data/lib/snaptrade/models/jwt.rb +0 -217
- data/lib/snaptrade/models/model_asset_class_details.rb +0 -227
- data/lib/snaptrade/models/model_asset_class_target.rb +0 -216
- data/lib/snaptrade/models/model_portfolio_asset_class.rb +0 -249
- data/lib/snaptrade/models/model_portfolio_details.rb +0 -238
- data/lib/snaptrade/models/model_portfolio_security.rb +0 -249
- data/lib/snaptrade/models/model_type.rb +0 -38
- data/lib/snaptrade/models/portfolio_group_info.rb +0 -325
- data/lib/snaptrade/models/portfolio_group_position.rb +0 -237
- data/lib/snaptrade/models/portfolio_group_settings.rb +0 -276
- data/lib/snaptrade/models/redirect_tokenand_pin.rb +0 -226
- data/lib/snaptrade/models/snap_trade_api_disclaimer_accept_status.rb +0 -226
- data/lib/snaptrade/models/state.rb +0 -40
- data/lib/snaptrade/models/strategy_impact.rb +0 -309
- data/lib/snaptrade/models/strategy_impact_legs_inner.rb +0 -270
- data/lib/snaptrade/models/strategy_order_place.rb +0 -228
- data/lib/snaptrade/models/strategy_order_place_orders_inner.rb +0 -596
- data/lib/snaptrade/models/strategy_order_place_orders_inner_legs_inner.rb +0 -270
- data/lib/snaptrade/models/target_asset.rb +0 -289
- data/lib/snaptrade/models/trade.rb +0 -280
- data/lib/snaptrade/models/trade_action.rb +0 -37
- data/lib/snaptrade/models/trade_execution_status.rb +0 -297
- data/lib/snaptrade/models/trade_execution_status_action.rb +0 -37
- data/lib/snaptrade/models/trade_impact.rb +0 -256
- data/lib/snaptrade/models/user_error_log.rb +0 -262
- data/lib/snaptrade/models/user_settings.rb +0 -298
- data/spec/models/brokerage_authorization_type_spec.rb +0 -29
- data/spec/models/brokerage_authorization_type_type_spec.rb +0 -23
- data/spec/models/brokerage_symbol_spec.rb +0 -59
- data/spec/models/brokerage_symbol_symbol_spec.rb +0 -83
- data/spec/models/calculated_trade_spec.rb +0 -35
- data/spec/models/excluded_asset_spec.rb +0 -29
- data/spec/models/jwt_spec.rb +0 -29
- data/spec/models/model_asset_class_details_spec.rb +0 -35
- data/spec/models/model_asset_class_spec.rb +0 -35
- data/spec/models/model_asset_class_target_spec.rb +0 -29
- data/spec/models/model_portfolio_asset_class_spec.rb +0 -35
- data/spec/models/model_portfolio_details_spec.rb +0 -41
- data/spec/models/model_portfolio_security_spec.rb +0 -35
- data/spec/models/model_type_spec.rb +0 -23
- data/spec/models/portfolio_group_info_spec.rb +0 -89
- data/spec/models/portfolio_group_position_spec.rb +0 -41
- data/spec/models/portfolio_group_settings_spec.rb +0 -53
- data/spec/models/portfolio_group_spec.rb +0 -35
- data/spec/models/redirect_tokenand_pin_spec.rb +0 -35
- data/spec/models/snap_trade_api_disclaimer_accept_status_spec.rb +0 -35
- data/spec/models/state_spec.rb +0 -23
- data/spec/models/strategy_impact_legs_inner_spec.rb +0 -65
- data/spec/models/strategy_impact_spec.rb +0 -89
- data/spec/models/strategy_order_place_orders_inner_legs_inner_spec.rb +0 -65
- data/spec/models/strategy_order_place_orders_inner_spec.rb +0 -281
- data/spec/models/strategy_order_place_spec.rb +0 -35
- data/spec/models/target_asset_spec.rb +0 -59
- data/spec/models/trade_action_spec.rb +0 -23
- data/spec/models/trade_execution_status_action_spec.rb +0 -23
- data/spec/models/trade_execution_status_spec.rb +0 -77
- data/spec/models/user_error_log_spec.rb +0 -59
- data/spec/models/user_settings_spec.rb +0 -83
@@ -1,309 +0,0 @@
|
|
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 strategy impact
|
15
|
-
class StrategyImpact
|
16
|
-
attr_accessor :estimated_commissions
|
17
|
-
|
18
|
-
attr_accessor :buying_power_effect
|
19
|
-
|
20
|
-
attr_accessor :buying_power_result
|
21
|
-
|
22
|
-
attr_accessor :maint_excess_effect
|
23
|
-
|
24
|
-
attr_accessor :maint_excess_result
|
25
|
-
|
26
|
-
attr_accessor :trade_value_calculation
|
27
|
-
|
28
|
-
attr_accessor :legs
|
29
|
-
|
30
|
-
attr_accessor :side
|
31
|
-
|
32
|
-
attr_accessor :effect
|
33
|
-
|
34
|
-
attr_accessor :price
|
35
|
-
|
36
|
-
attr_accessor :strategy
|
37
|
-
|
38
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
39
|
-
def self.attribute_map
|
40
|
-
{
|
41
|
-
:'estimated_commissions' => :'estimatedCommissions',
|
42
|
-
:'buying_power_effect' => :'buyingPowerEffect',
|
43
|
-
:'buying_power_result' => :'buyingPowerResult',
|
44
|
-
:'maint_excess_effect' => :'maintExcessEffect',
|
45
|
-
:'maint_excess_result' => :'maintExcessResult',
|
46
|
-
:'trade_value_calculation' => :'tradeValueCalculation',
|
47
|
-
:'legs' => :'legs',
|
48
|
-
:'side' => :'side',
|
49
|
-
:'effect' => :'effect',
|
50
|
-
:'price' => :'price',
|
51
|
-
:'strategy' => :'strategy'
|
52
|
-
}
|
53
|
-
end
|
54
|
-
|
55
|
-
# Returns all the JSON keys this model knows about
|
56
|
-
def self.acceptable_attributes
|
57
|
-
attribute_map.values
|
58
|
-
end
|
59
|
-
|
60
|
-
# Attribute type mapping.
|
61
|
-
def self.openapi_types
|
62
|
-
{
|
63
|
-
:'estimated_commissions' => :'Float',
|
64
|
-
:'buying_power_effect' => :'Float',
|
65
|
-
:'buying_power_result' => :'Float',
|
66
|
-
:'maint_excess_effect' => :'Float',
|
67
|
-
:'maint_excess_result' => :'Float',
|
68
|
-
:'trade_value_calculation' => :'String',
|
69
|
-
:'legs' => :'Array<StrategyImpactLegsInner>',
|
70
|
-
:'side' => :'String',
|
71
|
-
:'effect' => :'String',
|
72
|
-
:'price' => :'Float',
|
73
|
-
:'strategy' => :'String'
|
74
|
-
}
|
75
|
-
end
|
76
|
-
|
77
|
-
# List of attributes with nullable: true
|
78
|
-
def self.openapi_nullable
|
79
|
-
Set.new([
|
80
|
-
])
|
81
|
-
end
|
82
|
-
|
83
|
-
# Initializes the object
|
84
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
85
|
-
def initialize(attributes = {})
|
86
|
-
if (!attributes.is_a?(Hash))
|
87
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::StrategyImpact` initialize method"
|
88
|
-
end
|
89
|
-
|
90
|
-
# check to see if the attribute exists and convert string to symbol for hash key
|
91
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
92
|
-
if (!self.class.attribute_map.key?(k.to_sym))
|
93
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::StrategyImpact`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
94
|
-
end
|
95
|
-
h[k.to_sym] = v
|
96
|
-
}
|
97
|
-
|
98
|
-
if attributes.key?(:'estimated_commissions')
|
99
|
-
self.estimated_commissions = attributes[:'estimated_commissions']
|
100
|
-
end
|
101
|
-
|
102
|
-
if attributes.key?(:'buying_power_effect')
|
103
|
-
self.buying_power_effect = attributes[:'buying_power_effect']
|
104
|
-
end
|
105
|
-
|
106
|
-
if attributes.key?(:'buying_power_result')
|
107
|
-
self.buying_power_result = attributes[:'buying_power_result']
|
108
|
-
end
|
109
|
-
|
110
|
-
if attributes.key?(:'maint_excess_effect')
|
111
|
-
self.maint_excess_effect = attributes[:'maint_excess_effect']
|
112
|
-
end
|
113
|
-
|
114
|
-
if attributes.key?(:'maint_excess_result')
|
115
|
-
self.maint_excess_result = attributes[:'maint_excess_result']
|
116
|
-
end
|
117
|
-
|
118
|
-
if attributes.key?(:'trade_value_calculation')
|
119
|
-
self.trade_value_calculation = attributes[:'trade_value_calculation']
|
120
|
-
end
|
121
|
-
|
122
|
-
if attributes.key?(:'legs')
|
123
|
-
if (value = attributes[:'legs']).is_a?(Array)
|
124
|
-
self.legs = value
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
if attributes.key?(:'side')
|
129
|
-
self.side = attributes[:'side']
|
130
|
-
end
|
131
|
-
|
132
|
-
if attributes.key?(:'effect')
|
133
|
-
self.effect = attributes[:'effect']
|
134
|
-
end
|
135
|
-
|
136
|
-
if attributes.key?(:'price')
|
137
|
-
self.price = attributes[:'price']
|
138
|
-
end
|
139
|
-
|
140
|
-
if attributes.key?(:'strategy')
|
141
|
-
self.strategy = attributes[:'strategy']
|
142
|
-
end
|
143
|
-
end
|
144
|
-
|
145
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
146
|
-
# @return Array for valid properties with the reasons
|
147
|
-
def list_invalid_properties
|
148
|
-
invalid_properties = Array.new
|
149
|
-
invalid_properties
|
150
|
-
end
|
151
|
-
|
152
|
-
# Check to see if the all the properties in the model are valid
|
153
|
-
# @return true if the model is valid
|
154
|
-
def valid?
|
155
|
-
true
|
156
|
-
end
|
157
|
-
|
158
|
-
# Checks equality by comparing each attribute.
|
159
|
-
# @param [Object] Object to be compared
|
160
|
-
def ==(o)
|
161
|
-
return true if self.equal?(o)
|
162
|
-
self.class == o.class &&
|
163
|
-
estimated_commissions == o.estimated_commissions &&
|
164
|
-
buying_power_effect == o.buying_power_effect &&
|
165
|
-
buying_power_result == o.buying_power_result &&
|
166
|
-
maint_excess_effect == o.maint_excess_effect &&
|
167
|
-
maint_excess_result == o.maint_excess_result &&
|
168
|
-
trade_value_calculation == o.trade_value_calculation &&
|
169
|
-
legs == o.legs &&
|
170
|
-
side == o.side &&
|
171
|
-
effect == o.effect &&
|
172
|
-
price == o.price &&
|
173
|
-
strategy == o.strategy
|
174
|
-
end
|
175
|
-
|
176
|
-
# @see the `==` method
|
177
|
-
# @param [Object] Object to be compared
|
178
|
-
def eql?(o)
|
179
|
-
self == o
|
180
|
-
end
|
181
|
-
|
182
|
-
# Calculates hash code according to all attributes.
|
183
|
-
# @return [Integer] Hash code
|
184
|
-
def hash
|
185
|
-
[estimated_commissions, buying_power_effect, buying_power_result, maint_excess_effect, maint_excess_result, trade_value_calculation, legs, side, effect, price, strategy].hash
|
186
|
-
end
|
187
|
-
|
188
|
-
# Builds the object from hash
|
189
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
190
|
-
# @return [Object] Returns the model itself
|
191
|
-
def self.build_from_hash(attributes)
|
192
|
-
new.build_from_hash(attributes)
|
193
|
-
end
|
194
|
-
|
195
|
-
# Builds the object from hash
|
196
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
197
|
-
# @return [Object] Returns the model itself
|
198
|
-
def build_from_hash(attributes)
|
199
|
-
return nil unless attributes.is_a?(Hash)
|
200
|
-
attributes = attributes.transform_keys(&:to_sym)
|
201
|
-
self.class.openapi_types.each_pair do |key, type|
|
202
|
-
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
203
|
-
self.send("#{key}=", nil)
|
204
|
-
elsif type =~ /\AArray<(.*)>/i
|
205
|
-
# check to ensure the input is an array given that the attribute
|
206
|
-
# is documented as an array but the input is not
|
207
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
208
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
209
|
-
end
|
210
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
211
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
212
|
-
end
|
213
|
-
end
|
214
|
-
|
215
|
-
self
|
216
|
-
end
|
217
|
-
|
218
|
-
# Deserializes the data based on type
|
219
|
-
# @param string type Data type
|
220
|
-
# @param string value Value to be deserialized
|
221
|
-
# @return [Object] Deserialized data
|
222
|
-
def _deserialize(type, value)
|
223
|
-
case type.to_sym
|
224
|
-
when :Time
|
225
|
-
Time.parse(value)
|
226
|
-
when :Date
|
227
|
-
Date.parse(value)
|
228
|
-
when :String
|
229
|
-
value.to_s
|
230
|
-
when :Integer
|
231
|
-
value.to_i
|
232
|
-
when :Float
|
233
|
-
value.to_f
|
234
|
-
when :Boolean
|
235
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
236
|
-
true
|
237
|
-
else
|
238
|
-
false
|
239
|
-
end
|
240
|
-
when :Object
|
241
|
-
# generic object (usually a Hash), return directly
|
242
|
-
value
|
243
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
244
|
-
inner_type = Regexp.last_match[:inner_type]
|
245
|
-
value.map { |v| _deserialize(inner_type, v) }
|
246
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
247
|
-
k_type = Regexp.last_match[:k_type]
|
248
|
-
v_type = Regexp.last_match[:v_type]
|
249
|
-
{}.tap do |hash|
|
250
|
-
value.each do |k, v|
|
251
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
252
|
-
end
|
253
|
-
end
|
254
|
-
else # model
|
255
|
-
# models (e.g. Pet) or oneOf
|
256
|
-
klass = SnapTrade.const_get(type)
|
257
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
258
|
-
end
|
259
|
-
end
|
260
|
-
|
261
|
-
# Returns the string representation of the object
|
262
|
-
# @return [String] String presentation of the object
|
263
|
-
def to_s
|
264
|
-
to_hash.to_s
|
265
|
-
end
|
266
|
-
|
267
|
-
# to_body is an alias to to_hash (backward compatibility)
|
268
|
-
# @return [Hash] Returns the object in the form of hash
|
269
|
-
def to_body
|
270
|
-
to_hash
|
271
|
-
end
|
272
|
-
|
273
|
-
# Returns the object in the form of hash
|
274
|
-
# @return [Hash] Returns the object in the form of hash
|
275
|
-
def to_hash
|
276
|
-
hash = {}
|
277
|
-
self.class.attribute_map.each_pair do |attr, param|
|
278
|
-
value = self.send(attr)
|
279
|
-
if value.nil?
|
280
|
-
is_nullable = self.class.openapi_nullable.include?(attr)
|
281
|
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
282
|
-
end
|
283
|
-
|
284
|
-
hash[param] = _to_hash(value)
|
285
|
-
end
|
286
|
-
hash
|
287
|
-
end
|
288
|
-
|
289
|
-
# Outputs non-array value in the form of hash
|
290
|
-
# For object, use to_hash. Otherwise, just return the value
|
291
|
-
# @param [Object] value Any valid value
|
292
|
-
# @return [Hash] Returns the value in the form of hash
|
293
|
-
def _to_hash(value)
|
294
|
-
if value.is_a?(Array)
|
295
|
-
value.compact.map { |v| _to_hash(v) }
|
296
|
-
elsif value.is_a?(Hash)
|
297
|
-
{}.tap do |hash|
|
298
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
299
|
-
end
|
300
|
-
elsif value.respond_to? :to_hash
|
301
|
-
value.to_hash
|
302
|
-
else
|
303
|
-
value
|
304
|
-
end
|
305
|
-
end
|
306
|
-
|
307
|
-
end
|
308
|
-
|
309
|
-
end
|
@@ -1,270 +0,0 @@
|
|
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 StrategyImpactLegsInner
|
15
|
-
attr_accessor :leg_id
|
16
|
-
|
17
|
-
attr_accessor :symbol
|
18
|
-
|
19
|
-
attr_accessor :symbol_id
|
20
|
-
|
21
|
-
attr_accessor :leg_ratio_quantity
|
22
|
-
|
23
|
-
attr_accessor :side
|
24
|
-
|
25
|
-
attr_accessor :avg_exec_price
|
26
|
-
|
27
|
-
attr_accessor :last_exec_price
|
28
|
-
|
29
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
30
|
-
def self.attribute_map
|
31
|
-
{
|
32
|
-
:'leg_id' => :'legId',
|
33
|
-
:'symbol' => :'symbol',
|
34
|
-
:'symbol_id' => :'symbolId',
|
35
|
-
:'leg_ratio_quantity' => :'legRatioQuantity',
|
36
|
-
:'side' => :'side',
|
37
|
-
:'avg_exec_price' => :'avgExecPrice',
|
38
|
-
:'last_exec_price' => :'lastExecPrice'
|
39
|
-
}
|
40
|
-
end
|
41
|
-
|
42
|
-
# Returns all the JSON keys this model knows about
|
43
|
-
def self.acceptable_attributes
|
44
|
-
attribute_map.values
|
45
|
-
end
|
46
|
-
|
47
|
-
# Attribute type mapping.
|
48
|
-
def self.openapi_types
|
49
|
-
{
|
50
|
-
:'leg_id' => :'Integer',
|
51
|
-
:'symbol' => :'String',
|
52
|
-
:'symbol_id' => :'Integer',
|
53
|
-
:'leg_ratio_quantity' => :'Integer',
|
54
|
-
:'side' => :'String',
|
55
|
-
:'avg_exec_price' => :'String',
|
56
|
-
:'last_exec_price' => :'String'
|
57
|
-
}
|
58
|
-
end
|
59
|
-
|
60
|
-
# List of attributes with nullable: true
|
61
|
-
def self.openapi_nullable
|
62
|
-
Set.new([
|
63
|
-
])
|
64
|
-
end
|
65
|
-
|
66
|
-
# Initializes the object
|
67
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
68
|
-
def initialize(attributes = {})
|
69
|
-
if (!attributes.is_a?(Hash))
|
70
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::StrategyImpactLegsInner` initialize method"
|
71
|
-
end
|
72
|
-
|
73
|
-
# check to see if the attribute exists and convert string to symbol for hash key
|
74
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
75
|
-
if (!self.class.attribute_map.key?(k.to_sym))
|
76
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::StrategyImpactLegsInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
77
|
-
end
|
78
|
-
h[k.to_sym] = v
|
79
|
-
}
|
80
|
-
|
81
|
-
if attributes.key?(:'leg_id')
|
82
|
-
self.leg_id = attributes[:'leg_id']
|
83
|
-
end
|
84
|
-
|
85
|
-
if attributes.key?(:'symbol')
|
86
|
-
self.symbol = attributes[:'symbol']
|
87
|
-
end
|
88
|
-
|
89
|
-
if attributes.key?(:'symbol_id')
|
90
|
-
self.symbol_id = attributes[:'symbol_id']
|
91
|
-
end
|
92
|
-
|
93
|
-
if attributes.key?(:'leg_ratio_quantity')
|
94
|
-
self.leg_ratio_quantity = attributes[:'leg_ratio_quantity']
|
95
|
-
end
|
96
|
-
|
97
|
-
if attributes.key?(:'side')
|
98
|
-
self.side = attributes[:'side']
|
99
|
-
end
|
100
|
-
|
101
|
-
if attributes.key?(:'avg_exec_price')
|
102
|
-
self.avg_exec_price = attributes[:'avg_exec_price']
|
103
|
-
end
|
104
|
-
|
105
|
-
if attributes.key?(:'last_exec_price')
|
106
|
-
self.last_exec_price = attributes[:'last_exec_price']
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
111
|
-
# @return Array for valid properties with the reasons
|
112
|
-
def list_invalid_properties
|
113
|
-
invalid_properties = Array.new
|
114
|
-
invalid_properties
|
115
|
-
end
|
116
|
-
|
117
|
-
# Check to see if the all the properties in the model are valid
|
118
|
-
# @return true if the model is valid
|
119
|
-
def valid?
|
120
|
-
true
|
121
|
-
end
|
122
|
-
|
123
|
-
# Checks equality by comparing each attribute.
|
124
|
-
# @param [Object] Object to be compared
|
125
|
-
def ==(o)
|
126
|
-
return true if self.equal?(o)
|
127
|
-
self.class == o.class &&
|
128
|
-
leg_id == o.leg_id &&
|
129
|
-
symbol == o.symbol &&
|
130
|
-
symbol_id == o.symbol_id &&
|
131
|
-
leg_ratio_quantity == o.leg_ratio_quantity &&
|
132
|
-
side == o.side &&
|
133
|
-
avg_exec_price == o.avg_exec_price &&
|
134
|
-
last_exec_price == o.last_exec_price
|
135
|
-
end
|
136
|
-
|
137
|
-
# @see the `==` method
|
138
|
-
# @param [Object] Object to be compared
|
139
|
-
def eql?(o)
|
140
|
-
self == o
|
141
|
-
end
|
142
|
-
|
143
|
-
# Calculates hash code according to all attributes.
|
144
|
-
# @return [Integer] Hash code
|
145
|
-
def hash
|
146
|
-
[leg_id, symbol, symbol_id, leg_ratio_quantity, side, avg_exec_price, last_exec_price].hash
|
147
|
-
end
|
148
|
-
|
149
|
-
# Builds the object from hash
|
150
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
151
|
-
# @return [Object] Returns the model itself
|
152
|
-
def self.build_from_hash(attributes)
|
153
|
-
new.build_from_hash(attributes)
|
154
|
-
end
|
155
|
-
|
156
|
-
# Builds the object from hash
|
157
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
158
|
-
# @return [Object] Returns the model itself
|
159
|
-
def build_from_hash(attributes)
|
160
|
-
return nil unless attributes.is_a?(Hash)
|
161
|
-
attributes = attributes.transform_keys(&:to_sym)
|
162
|
-
self.class.openapi_types.each_pair do |key, type|
|
163
|
-
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
164
|
-
self.send("#{key}=", nil)
|
165
|
-
elsif type =~ /\AArray<(.*)>/i
|
166
|
-
# check to ensure the input is an array given that the attribute
|
167
|
-
# is documented as an array but the input is not
|
168
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
169
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
170
|
-
end
|
171
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
172
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
173
|
-
end
|
174
|
-
end
|
175
|
-
|
176
|
-
self
|
177
|
-
end
|
178
|
-
|
179
|
-
# Deserializes the data based on type
|
180
|
-
# @param string type Data type
|
181
|
-
# @param string value Value to be deserialized
|
182
|
-
# @return [Object] Deserialized data
|
183
|
-
def _deserialize(type, value)
|
184
|
-
case type.to_sym
|
185
|
-
when :Time
|
186
|
-
Time.parse(value)
|
187
|
-
when :Date
|
188
|
-
Date.parse(value)
|
189
|
-
when :String
|
190
|
-
value.to_s
|
191
|
-
when :Integer
|
192
|
-
value.to_i
|
193
|
-
when :Float
|
194
|
-
value.to_f
|
195
|
-
when :Boolean
|
196
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
197
|
-
true
|
198
|
-
else
|
199
|
-
false
|
200
|
-
end
|
201
|
-
when :Object
|
202
|
-
# generic object (usually a Hash), return directly
|
203
|
-
value
|
204
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
205
|
-
inner_type = Regexp.last_match[:inner_type]
|
206
|
-
value.map { |v| _deserialize(inner_type, v) }
|
207
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
208
|
-
k_type = Regexp.last_match[:k_type]
|
209
|
-
v_type = Regexp.last_match[:v_type]
|
210
|
-
{}.tap do |hash|
|
211
|
-
value.each do |k, v|
|
212
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
213
|
-
end
|
214
|
-
end
|
215
|
-
else # model
|
216
|
-
# models (e.g. Pet) or oneOf
|
217
|
-
klass = SnapTrade.const_get(type)
|
218
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
219
|
-
end
|
220
|
-
end
|
221
|
-
|
222
|
-
# Returns the string representation of the object
|
223
|
-
# @return [String] String presentation of the object
|
224
|
-
def to_s
|
225
|
-
to_hash.to_s
|
226
|
-
end
|
227
|
-
|
228
|
-
# to_body is an alias to to_hash (backward compatibility)
|
229
|
-
# @return [Hash] Returns the object in the form of hash
|
230
|
-
def to_body
|
231
|
-
to_hash
|
232
|
-
end
|
233
|
-
|
234
|
-
# Returns the object in the form of hash
|
235
|
-
# @return [Hash] Returns the object in the form of hash
|
236
|
-
def to_hash
|
237
|
-
hash = {}
|
238
|
-
self.class.attribute_map.each_pair do |attr, param|
|
239
|
-
value = self.send(attr)
|
240
|
-
if value.nil?
|
241
|
-
is_nullable = self.class.openapi_nullable.include?(attr)
|
242
|
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
243
|
-
end
|
244
|
-
|
245
|
-
hash[param] = _to_hash(value)
|
246
|
-
end
|
247
|
-
hash
|
248
|
-
end
|
249
|
-
|
250
|
-
# Outputs non-array value in the form of hash
|
251
|
-
# For object, use to_hash. Otherwise, just return the value
|
252
|
-
# @param [Object] value Any valid value
|
253
|
-
# @return [Hash] Returns the value in the form of hash
|
254
|
-
def _to_hash(value)
|
255
|
-
if value.is_a?(Array)
|
256
|
-
value.compact.map { |v| _to_hash(v) }
|
257
|
-
elsif value.is_a?(Hash)
|
258
|
-
{}.tap do |hash|
|
259
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
260
|
-
end
|
261
|
-
elsif value.respond_to? :to_hash
|
262
|
-
value.to_hash
|
263
|
-
else
|
264
|
-
value
|
265
|
-
end
|
266
|
-
end
|
267
|
-
|
268
|
-
end
|
269
|
-
|
270
|
-
end
|