snaptrade 2.0.46 → 2.0.48
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 +4 -4
- data/Gemfile.lock +3 -3
- data/README.md +28 -11
- data/lib/snaptrade/api/trading_api.rb +29 -25
- data/lib/snaptrade/api/transactions_and_reporting_api.rb +4 -4
- data/lib/snaptrade/models/account_order_record.rb +15 -15
- data/lib/snaptrade/models/account_order_record_universal_symbol.rb +17 -17
- data/lib/snaptrade/models/action_strict_with_options.rb +41 -0
- data/lib/snaptrade/models/brokerage.rb +26 -26
- data/lib/snaptrade/models/brokerage_authorization.rb +14 -14
- data/lib/snaptrade/models/holdings_status.rb +1 -0
- data/lib/snaptrade/models/manual_trade.rb +1 -1
- data/lib/snaptrade/models/manual_trade_form.rb +1 -1
- data/lib/snaptrade/models/manual_trade_form_with_options.rb +333 -0
- data/lib/snaptrade/models/manual_trade_symbol.rb +14 -14
- data/lib/snaptrade/models/option_brokerage_symbol.rb +13 -13
- data/lib/snaptrade/models/options_position.rb +15 -15
- data/lib/snaptrade/models/position.rb +16 -16
- data/lib/snaptrade/models/position_symbol.rb +10 -10
- data/lib/snaptrade/models/transactions_status.rb +1 -0
- data/lib/snaptrade/models/underlying_symbol.rb +17 -17
- data/lib/snaptrade/models/universal_activity.rb +1 -1
- data/lib/snaptrade/models/universal_symbol.rb +17 -17
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +2 -0
- data/spec/api/trading_api_spec.rb +1 -1
- data/spec/api/transactions_and_reporting_api_spec.rb +1 -1
- data/spec/models/account_order_record_spec.rb +6 -6
- data/spec/models/account_order_record_universal_symbol_spec.rb +3 -3
- data/spec/models/action_strict_with_options_spec.rb +23 -0
- data/spec/models/brokerage_authorization_spec.rb +6 -6
- data/spec/models/brokerage_spec.rb +8 -8
- data/spec/models/manual_trade_form_with_options_spec.rb +83 -0
- data/spec/models/manual_trade_symbol_spec.rb +6 -6
- data/spec/models/option_brokerage_symbol_spec.rb +3 -3
- data/spec/models/options_position_spec.rb +2 -2
- data/spec/models/position_spec.rb +2 -2
- data/spec/models/position_symbol_spec.rb +3 -3
- data/spec/models/underlying_symbol_spec.rb +3 -3
- data/spec/models/universal_symbol_spec.rb +3 -3
- metadata +8 -2
@@ -34,9 +34,6 @@ module SnapTrade
|
|
34
34
|
# URL to the brokerage's logo in square format.
|
35
35
|
attr_accessor :aws_s3_square_logo_url
|
36
36
|
|
37
|
-
# This field is deprecated.
|
38
|
-
attr_accessor :open_url
|
39
|
-
|
40
37
|
# URL to the brokerage's website.
|
41
38
|
attr_accessor :url
|
42
39
|
|
@@ -46,12 +43,12 @@ module SnapTrade
|
|
46
43
|
# Whether the brokerage is currently in maintenance mode. A brokerage in maintenance mode will not be available for new connections.
|
47
44
|
attr_accessor :maintenance_mode
|
48
45
|
|
49
|
-
# This field is deprecated. Please contact us if you have a valid use case for it.
|
50
|
-
attr_accessor :allows_fractional_units
|
51
|
-
|
52
46
|
# Whether the brokerage allows trading through SnapTrade.
|
53
47
|
attr_accessor :allows_trading
|
54
48
|
|
49
|
+
# This field is deprecated. Please contact us if you have a valid use case for it.
|
50
|
+
attr_accessor :allows_fractional_units
|
51
|
+
|
55
52
|
# This field is deprecated. Please contact us if you have a valid use case for it.
|
56
53
|
attr_accessor :has_reporting
|
57
54
|
|
@@ -63,6 +60,9 @@ module SnapTrade
|
|
63
60
|
# This field is deprecated. Please contact us if you have a valid use case for it.
|
64
61
|
attr_accessor :exchanges
|
65
62
|
|
63
|
+
# This field is deprecated.
|
64
|
+
attr_accessor :open_url
|
65
|
+
|
66
66
|
# Attribute mapping from ruby-style variable name to JSON key.
|
67
67
|
def self.attribute_map
|
68
68
|
{
|
@@ -73,16 +73,16 @@ module SnapTrade
|
|
73
73
|
:'description' => :'description',
|
74
74
|
:'aws_s3_logo_url' => :'aws_s3_logo_url',
|
75
75
|
:'aws_s3_square_logo_url' => :'aws_s3_square_logo_url',
|
76
|
-
:'open_url' => :'open_url',
|
77
76
|
:'url' => :'url',
|
78
77
|
:'enabled' => :'enabled',
|
79
78
|
:'maintenance_mode' => :'maintenance_mode',
|
80
|
-
:'allows_fractional_units' => :'allows_fractional_units',
|
81
79
|
:'allows_trading' => :'allows_trading',
|
80
|
+
:'allows_fractional_units' => :'allows_fractional_units',
|
82
81
|
:'has_reporting' => :'has_reporting',
|
83
82
|
:'is_real_time_connection' => :'is_real_time_connection',
|
84
83
|
:'brokerage_type' => :'brokerage_type',
|
85
|
-
:'exchanges' => :'exchanges'
|
84
|
+
:'exchanges' => :'exchanges',
|
85
|
+
:'open_url' => :'open_url'
|
86
86
|
}
|
87
87
|
end
|
88
88
|
|
@@ -101,16 +101,16 @@ module SnapTrade
|
|
101
101
|
:'description' => :'String',
|
102
102
|
:'aws_s3_logo_url' => :'String',
|
103
103
|
:'aws_s3_square_logo_url' => :'String',
|
104
|
-
:'open_url' => :'String',
|
105
104
|
:'url' => :'String',
|
106
105
|
:'enabled' => :'Boolean',
|
107
106
|
:'maintenance_mode' => :'Boolean',
|
108
|
-
:'allows_fractional_units' => :'Boolean',
|
109
107
|
:'allows_trading' => :'Boolean',
|
108
|
+
:'allows_fractional_units' => :'Boolean',
|
110
109
|
:'has_reporting' => :'Boolean',
|
111
110
|
:'is_real_time_connection' => :'Boolean',
|
112
111
|
:'brokerage_type' => :'BrokerageType',
|
113
|
-
:'exchanges' => :'Array<Object>'
|
112
|
+
:'exchanges' => :'Array<Object>',
|
113
|
+
:'open_url' => :'String'
|
114
114
|
}
|
115
115
|
end
|
116
116
|
|
@@ -118,10 +118,10 @@ module SnapTrade
|
|
118
118
|
def self.openapi_nullable
|
119
119
|
Set.new([
|
120
120
|
:'aws_s3_square_logo_url',
|
121
|
-
:'open_url',
|
122
|
-
:'allows_fractional_units',
|
123
121
|
:'allows_trading',
|
122
|
+
:'allows_fractional_units',
|
124
123
|
:'has_reporting',
|
124
|
+
:'open_url'
|
125
125
|
])
|
126
126
|
end
|
127
127
|
|
@@ -168,10 +168,6 @@ module SnapTrade
|
|
168
168
|
self.aws_s3_square_logo_url = attributes[:'aws_s3_square_logo_url']
|
169
169
|
end
|
170
170
|
|
171
|
-
if attributes.key?(:'open_url')
|
172
|
-
self.open_url = attributes[:'open_url']
|
173
|
-
end
|
174
|
-
|
175
171
|
if attributes.key?(:'url')
|
176
172
|
self.url = attributes[:'url']
|
177
173
|
end
|
@@ -184,14 +180,14 @@ module SnapTrade
|
|
184
180
|
self.maintenance_mode = attributes[:'maintenance_mode']
|
185
181
|
end
|
186
182
|
|
187
|
-
if attributes.key?(:'allows_fractional_units')
|
188
|
-
self.allows_fractional_units = attributes[:'allows_fractional_units']
|
189
|
-
end
|
190
|
-
|
191
183
|
if attributes.key?(:'allows_trading')
|
192
184
|
self.allows_trading = attributes[:'allows_trading']
|
193
185
|
end
|
194
186
|
|
187
|
+
if attributes.key?(:'allows_fractional_units')
|
188
|
+
self.allows_fractional_units = attributes[:'allows_fractional_units']
|
189
|
+
end
|
190
|
+
|
195
191
|
if attributes.key?(:'has_reporting')
|
196
192
|
self.has_reporting = attributes[:'has_reporting']
|
197
193
|
end
|
@@ -209,6 +205,10 @@ module SnapTrade
|
|
209
205
|
self.exchanges = value
|
210
206
|
end
|
211
207
|
end
|
208
|
+
|
209
|
+
if attributes.key?(:'open_url')
|
210
|
+
self.open_url = attributes[:'open_url']
|
211
|
+
end
|
212
212
|
end
|
213
213
|
|
214
214
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -236,16 +236,16 @@ module SnapTrade
|
|
236
236
|
description == o.description &&
|
237
237
|
aws_s3_logo_url == o.aws_s3_logo_url &&
|
238
238
|
aws_s3_square_logo_url == o.aws_s3_square_logo_url &&
|
239
|
-
open_url == o.open_url &&
|
240
239
|
url == o.url &&
|
241
240
|
enabled == o.enabled &&
|
242
241
|
maintenance_mode == o.maintenance_mode &&
|
243
|
-
allows_fractional_units == o.allows_fractional_units &&
|
244
242
|
allows_trading == o.allows_trading &&
|
243
|
+
allows_fractional_units == o.allows_fractional_units &&
|
245
244
|
has_reporting == o.has_reporting &&
|
246
245
|
is_real_time_connection == o.is_real_time_connection &&
|
247
246
|
brokerage_type == o.brokerage_type &&
|
248
|
-
exchanges == o.exchanges
|
247
|
+
exchanges == o.exchanges &&
|
248
|
+
open_url == o.open_url
|
249
249
|
end
|
250
250
|
|
251
251
|
# @see the `==` method
|
@@ -257,7 +257,7 @@ module SnapTrade
|
|
257
257
|
# Calculates hash code according to all attributes.
|
258
258
|
# @return [Integer] Hash code
|
259
259
|
def hash
|
260
|
-
[id, slug, name, display_name, description, aws_s3_logo_url, aws_s3_square_logo_url,
|
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
|
261
261
|
end
|
262
262
|
|
263
263
|
# Builds the object from hash
|
@@ -19,9 +19,6 @@ module SnapTrade
|
|
19
19
|
# Timestamp of when the connection was established in SnapTrade.
|
20
20
|
attr_accessor :created_date
|
21
21
|
|
22
|
-
# Timestamp of when the connection was last updated in SnapTrade. This field is deprecated. Please let us know if you have a valid use case for this field.
|
23
|
-
attr_accessor :updated_date
|
24
|
-
|
25
22
|
attr_accessor :brokerage
|
26
23
|
|
27
24
|
# A short, human-readable name for the connection.
|
@@ -39,18 +36,21 @@ module SnapTrade
|
|
39
36
|
# Additional data about the connection. This information is specific to the brokerage and there's no standard format for this data. This field is deprecated and subject to removal in a future version.
|
40
37
|
attr_accessor :meta
|
41
38
|
|
39
|
+
# Timestamp of when the connection was last updated in SnapTrade. This field is deprecated. Please let us know if you have a valid use case for this field.
|
40
|
+
attr_accessor :updated_date
|
41
|
+
|
42
42
|
# Attribute mapping from ruby-style variable name to JSON key.
|
43
43
|
def self.attribute_map
|
44
44
|
{
|
45
45
|
:'id' => :'id',
|
46
46
|
:'created_date' => :'created_date',
|
47
|
-
:'updated_date' => :'updated_date',
|
48
47
|
:'brokerage' => :'brokerage',
|
49
48
|
:'name' => :'name',
|
50
49
|
:'type' => :'type',
|
51
50
|
:'disabled' => :'disabled',
|
52
51
|
:'disabled_date' => :'disabled_date',
|
53
|
-
:'meta' => :'meta'
|
52
|
+
:'meta' => :'meta',
|
53
|
+
:'updated_date' => :'updated_date'
|
54
54
|
}
|
55
55
|
end
|
56
56
|
|
@@ -64,13 +64,13 @@ module SnapTrade
|
|
64
64
|
{
|
65
65
|
:'id' => :'String',
|
66
66
|
:'created_date' => :'Time',
|
67
|
-
:'updated_date' => :'Time',
|
68
67
|
:'brokerage' => :'Brokerage',
|
69
68
|
:'name' => :'String',
|
70
69
|
:'type' => :'String',
|
71
70
|
:'disabled' => :'Boolean',
|
72
71
|
:'disabled_date' => :'Time',
|
73
|
-
:'meta' => :'Hash<String, Object>'
|
72
|
+
:'meta' => :'Hash<String, Object>',
|
73
|
+
:'updated_date' => :'Time'
|
74
74
|
}
|
75
75
|
end
|
76
76
|
|
@@ -104,10 +104,6 @@ module SnapTrade
|
|
104
104
|
self.created_date = attributes[:'created_date']
|
105
105
|
end
|
106
106
|
|
107
|
-
if attributes.key?(:'updated_date')
|
108
|
-
self.updated_date = attributes[:'updated_date']
|
109
|
-
end
|
110
|
-
|
111
107
|
if attributes.key?(:'brokerage')
|
112
108
|
self.brokerage = attributes[:'brokerage']
|
113
109
|
end
|
@@ -133,6 +129,10 @@ module SnapTrade
|
|
133
129
|
self.meta = value
|
134
130
|
end
|
135
131
|
end
|
132
|
+
|
133
|
+
if attributes.key?(:'updated_date')
|
134
|
+
self.updated_date = attributes[:'updated_date']
|
135
|
+
end
|
136
136
|
end
|
137
137
|
|
138
138
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -155,13 +155,13 @@ module SnapTrade
|
|
155
155
|
self.class == o.class &&
|
156
156
|
id == o.id &&
|
157
157
|
created_date == o.created_date &&
|
158
|
-
updated_date == o.updated_date &&
|
159
158
|
brokerage == o.brokerage &&
|
160
159
|
name == o.name &&
|
161
160
|
type == o.type &&
|
162
161
|
disabled == o.disabled &&
|
163
162
|
disabled_date == o.disabled_date &&
|
164
|
-
meta == o.meta
|
163
|
+
meta == o.meta &&
|
164
|
+
updated_date == o.updated_date
|
165
165
|
end
|
166
166
|
|
167
167
|
# @see the `==` method
|
@@ -173,7 +173,7 @@ module SnapTrade
|
|
173
173
|
# Calculates hash code according to all attributes.
|
174
174
|
# @return [Integer] Hash code
|
175
175
|
def hash
|
176
|
-
[id, created_date,
|
176
|
+
[id, created_date, brokerage, name, type, disabled, disabled_date, meta, updated_date].hash
|
177
177
|
end
|
178
178
|
|
179
179
|
# Builds the object from hash
|
@@ -27,7 +27,7 @@ module SnapTrade
|
|
27
27
|
|
28
28
|
attr_accessor :symbol
|
29
29
|
|
30
|
-
# The action describes the intent or side of a trade. This is either `BUY` or `SELL
|
30
|
+
# The action describes the intent or side of a trade. This is either `BUY` or `SELL`.
|
31
31
|
attr_accessor :action
|
32
32
|
|
33
33
|
attr_accessor :units
|
@@ -16,7 +16,7 @@ module SnapTrade
|
|
16
16
|
# Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
|
17
17
|
attr_accessor :account_id
|
18
18
|
|
19
|
-
# The action describes the intent or side of a trade. This is either `BUY` or `SELL
|
19
|
+
# The action describes the intent or side of a trade. This is either `BUY` or `SELL`.
|
20
20
|
attr_accessor :action
|
21
21
|
|
22
22
|
# Unique identifier for the symbol within SnapTrade. This is the ID used to reference the symbol in SnapTrade API calls.
|
@@ -0,0 +1,333 @@
|
|
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
|
+
# Inputs for placing an order with the brokerage.
|
15
|
+
class ManualTradeFormWithOptions
|
16
|
+
# Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
|
17
|
+
attr_accessor :account_id
|
18
|
+
|
19
|
+
# The action describes the intent or side of a trade. This is either `BUY` or `SELL` for Equity symbols or `BUY_TO_OPEN`, `BUY_TO_CLOSE`, `SELL_TO_OPEN` or `SELL_TO_CLOSE` for Options.
|
20
|
+
attr_accessor :action
|
21
|
+
|
22
|
+
# The universal symbol ID of the security to trade. Must be 'null' if `symbol` is provided, otherwise must be provided.
|
23
|
+
attr_accessor :universal_symbol_id
|
24
|
+
|
25
|
+
# The security's trading ticker symbol. This currently only support Options symbols in the 21 character OCC format. For example \"AAPL 131124C00240000\" represents a call option on AAPL expiring on 2024-11-13 with a strike price of $240. For more information on the OCC format, see [here](https://en.wikipedia.org/wiki/Option_symbol#OCC_format). If 'symbol' is provided, then 'universal_symbol_id' must be 'null'.
|
26
|
+
attr_accessor :symbol
|
27
|
+
|
28
|
+
# The type of order to place. - For `Limit` and `StopLimit` orders, the `price` field is required. - For `Stop` and `StopLimit` orders, the `stop` field is required.
|
29
|
+
attr_accessor :order_type
|
30
|
+
|
31
|
+
# The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely.
|
32
|
+
attr_accessor :time_in_force
|
33
|
+
|
34
|
+
# The limit price for `Limit` and `StopLimit` orders.
|
35
|
+
attr_accessor :price
|
36
|
+
|
37
|
+
# The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
|
38
|
+
attr_accessor :stop
|
39
|
+
|
40
|
+
# For Equity orders, this represents the number of shares for the order. This can be a decimal for fractional orders. Must be `null` if `notional_value` is provided. If placing an Option order, this field represents the number of contracts to buy or sell. (e.g., 1 contract = 100 shares).
|
41
|
+
attr_accessor :units
|
42
|
+
|
43
|
+
attr_accessor :notional_value
|
44
|
+
|
45
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
46
|
+
def self.attribute_map
|
47
|
+
{
|
48
|
+
:'account_id' => :'account_id',
|
49
|
+
:'action' => :'action',
|
50
|
+
:'universal_symbol_id' => :'universal_symbol_id',
|
51
|
+
:'symbol' => :'symbol',
|
52
|
+
:'order_type' => :'order_type',
|
53
|
+
:'time_in_force' => :'time_in_force',
|
54
|
+
:'price' => :'price',
|
55
|
+
:'stop' => :'stop',
|
56
|
+
:'units' => :'units',
|
57
|
+
:'notional_value' => :'notional_value'
|
58
|
+
}
|
59
|
+
end
|
60
|
+
|
61
|
+
# Returns all the JSON keys this model knows about
|
62
|
+
def self.acceptable_attributes
|
63
|
+
attribute_map.values
|
64
|
+
end
|
65
|
+
|
66
|
+
# Attribute type mapping.
|
67
|
+
def self.openapi_types
|
68
|
+
{
|
69
|
+
:'account_id' => :'String',
|
70
|
+
:'action' => :'ActionStrictWithOptions',
|
71
|
+
:'universal_symbol_id' => :'String',
|
72
|
+
:'symbol' => :'String',
|
73
|
+
:'order_type' => :'OrderTypeStrict',
|
74
|
+
:'time_in_force' => :'TimeInForceStrict',
|
75
|
+
:'price' => :'Float',
|
76
|
+
:'stop' => :'Float',
|
77
|
+
:'units' => :'Float',
|
78
|
+
:'notional_value' => :'ManualTradeFormNotionalValue'
|
79
|
+
}
|
80
|
+
end
|
81
|
+
|
82
|
+
# List of attributes with nullable: true
|
83
|
+
def self.openapi_nullable
|
84
|
+
Set.new([
|
85
|
+
:'universal_symbol_id',
|
86
|
+
:'symbol',
|
87
|
+
:'price',
|
88
|
+
:'stop',
|
89
|
+
:'units',
|
90
|
+
:'notional_value'
|
91
|
+
])
|
92
|
+
end
|
93
|
+
|
94
|
+
# Initializes the object
|
95
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
96
|
+
def initialize(attributes = {})
|
97
|
+
if (!attributes.is_a?(Hash))
|
98
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::ManualTradeFormWithOptions` initialize method"
|
99
|
+
end
|
100
|
+
|
101
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
102
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
103
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
104
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::ManualTradeFormWithOptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
105
|
+
end
|
106
|
+
h[k.to_sym] = v
|
107
|
+
}
|
108
|
+
|
109
|
+
if attributes.key?(:'account_id')
|
110
|
+
self.account_id = attributes[:'account_id']
|
111
|
+
end
|
112
|
+
|
113
|
+
if attributes.key?(:'action')
|
114
|
+
self.action = attributes[:'action']
|
115
|
+
end
|
116
|
+
|
117
|
+
if attributes.key?(:'universal_symbol_id')
|
118
|
+
self.universal_symbol_id = attributes[:'universal_symbol_id']
|
119
|
+
end
|
120
|
+
|
121
|
+
if attributes.key?(:'symbol')
|
122
|
+
self.symbol = attributes[:'symbol']
|
123
|
+
end
|
124
|
+
|
125
|
+
if attributes.key?(:'order_type')
|
126
|
+
self.order_type = attributes[:'order_type']
|
127
|
+
end
|
128
|
+
|
129
|
+
if attributes.key?(:'time_in_force')
|
130
|
+
self.time_in_force = attributes[:'time_in_force']
|
131
|
+
end
|
132
|
+
|
133
|
+
if attributes.key?(:'price')
|
134
|
+
self.price = attributes[:'price']
|
135
|
+
end
|
136
|
+
|
137
|
+
if attributes.key?(:'stop')
|
138
|
+
self.stop = attributes[:'stop']
|
139
|
+
end
|
140
|
+
|
141
|
+
if attributes.key?(:'units')
|
142
|
+
self.units = attributes[:'units']
|
143
|
+
end
|
144
|
+
|
145
|
+
if attributes.key?(:'notional_value')
|
146
|
+
self.notional_value = attributes[:'notional_value']
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
151
|
+
# @return Array for valid properties with the reasons
|
152
|
+
def list_invalid_properties
|
153
|
+
invalid_properties = Array.new
|
154
|
+
if @account_id.nil?
|
155
|
+
invalid_properties.push('invalid value for "account_id", account_id cannot be nil.')
|
156
|
+
end
|
157
|
+
|
158
|
+
if @action.nil?
|
159
|
+
invalid_properties.push('invalid value for "action", action cannot be nil.')
|
160
|
+
end
|
161
|
+
|
162
|
+
if @order_type.nil?
|
163
|
+
invalid_properties.push('invalid value for "order_type", order_type cannot be nil.')
|
164
|
+
end
|
165
|
+
|
166
|
+
if @time_in_force.nil?
|
167
|
+
invalid_properties.push('invalid value for "time_in_force", time_in_force cannot be nil.')
|
168
|
+
end
|
169
|
+
|
170
|
+
invalid_properties
|
171
|
+
end
|
172
|
+
|
173
|
+
# Check to see if the all the properties in the model are valid
|
174
|
+
# @return true if the model is valid
|
175
|
+
def valid?
|
176
|
+
return false if @account_id.nil?
|
177
|
+
return false if @action.nil?
|
178
|
+
return false if @order_type.nil?
|
179
|
+
return false if @time_in_force.nil?
|
180
|
+
true
|
181
|
+
end
|
182
|
+
|
183
|
+
# Checks equality by comparing each attribute.
|
184
|
+
# @param [Object] Object to be compared
|
185
|
+
def ==(o)
|
186
|
+
return true if self.equal?(o)
|
187
|
+
self.class == o.class &&
|
188
|
+
account_id == o.account_id &&
|
189
|
+
action == o.action &&
|
190
|
+
universal_symbol_id == o.universal_symbol_id &&
|
191
|
+
symbol == o.symbol &&
|
192
|
+
order_type == o.order_type &&
|
193
|
+
time_in_force == o.time_in_force &&
|
194
|
+
price == o.price &&
|
195
|
+
stop == o.stop &&
|
196
|
+
units == o.units &&
|
197
|
+
notional_value == o.notional_value
|
198
|
+
end
|
199
|
+
|
200
|
+
# @see the `==` method
|
201
|
+
# @param [Object] Object to be compared
|
202
|
+
def eql?(o)
|
203
|
+
self == o
|
204
|
+
end
|
205
|
+
|
206
|
+
# Calculates hash code according to all attributes.
|
207
|
+
# @return [Integer] Hash code
|
208
|
+
def hash
|
209
|
+
[account_id, action, universal_symbol_id, symbol, order_type, time_in_force, price, stop, units, notional_value].hash
|
210
|
+
end
|
211
|
+
|
212
|
+
# Builds the object from hash
|
213
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
214
|
+
# @return [Object] Returns the model itself
|
215
|
+
def self.build_from_hash(attributes)
|
216
|
+
new.build_from_hash(attributes)
|
217
|
+
end
|
218
|
+
|
219
|
+
# Builds the object from hash
|
220
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
221
|
+
# @return [Object] Returns the model itself
|
222
|
+
def build_from_hash(attributes)
|
223
|
+
return nil unless attributes.is_a?(Hash)
|
224
|
+
attributes = attributes.transform_keys(&:to_sym)
|
225
|
+
self.class.openapi_types.each_pair do |key, type|
|
226
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
227
|
+
self.send("#{key}=", nil)
|
228
|
+
elsif type =~ /\AArray<(.*)>/i
|
229
|
+
# check to ensure the input is an array given that the attribute
|
230
|
+
# is documented as an array but the input is not
|
231
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
232
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
233
|
+
end
|
234
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
235
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
self
|
240
|
+
end
|
241
|
+
|
242
|
+
# Deserializes the data based on type
|
243
|
+
# @param string type Data type
|
244
|
+
# @param string value Value to be deserialized
|
245
|
+
# @return [Object] Deserialized data
|
246
|
+
def _deserialize(type, value)
|
247
|
+
case type.to_sym
|
248
|
+
when :Time
|
249
|
+
Time.parse(value)
|
250
|
+
when :Date
|
251
|
+
Date.parse(value)
|
252
|
+
when :String
|
253
|
+
value.to_s
|
254
|
+
when :Integer
|
255
|
+
value.to_i
|
256
|
+
when :Float
|
257
|
+
value.to_f
|
258
|
+
when :Boolean
|
259
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
260
|
+
true
|
261
|
+
else
|
262
|
+
false
|
263
|
+
end
|
264
|
+
when :Object
|
265
|
+
# generic object (usually a Hash), return directly
|
266
|
+
value
|
267
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
268
|
+
inner_type = Regexp.last_match[:inner_type]
|
269
|
+
value.map { |v| _deserialize(inner_type, v) }
|
270
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
271
|
+
k_type = Regexp.last_match[:k_type]
|
272
|
+
v_type = Regexp.last_match[:v_type]
|
273
|
+
{}.tap do |hash|
|
274
|
+
value.each do |k, v|
|
275
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
276
|
+
end
|
277
|
+
end
|
278
|
+
else # model
|
279
|
+
# models (e.g. Pet) or oneOf
|
280
|
+
klass = SnapTrade.const_get(type)
|
281
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
282
|
+
end
|
283
|
+
end
|
284
|
+
|
285
|
+
# Returns the string representation of the object
|
286
|
+
# @return [String] String presentation of the object
|
287
|
+
def to_s
|
288
|
+
to_hash.to_s
|
289
|
+
end
|
290
|
+
|
291
|
+
# to_body is an alias to to_hash (backward compatibility)
|
292
|
+
# @return [Hash] Returns the object in the form of hash
|
293
|
+
def to_body
|
294
|
+
to_hash
|
295
|
+
end
|
296
|
+
|
297
|
+
# Returns the object in the form of hash
|
298
|
+
# @return [Hash] Returns the object in the form of hash
|
299
|
+
def to_hash
|
300
|
+
hash = {}
|
301
|
+
self.class.attribute_map.each_pair do |attr, param|
|
302
|
+
value = self.send(attr)
|
303
|
+
if value.nil?
|
304
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
305
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
306
|
+
end
|
307
|
+
|
308
|
+
hash[param] = _to_hash(value)
|
309
|
+
end
|
310
|
+
hash
|
311
|
+
end
|
312
|
+
|
313
|
+
# Outputs non-array value in the form of hash
|
314
|
+
# For object, use to_hash. Otherwise, just return the value
|
315
|
+
# @param [Object] value Any valid value
|
316
|
+
# @return [Hash] Returns the value in the form of hash
|
317
|
+
def _to_hash(value)
|
318
|
+
if value.is_a?(Array)
|
319
|
+
value.compact.map { |v| _to_hash(v) }
|
320
|
+
elsif value.is_a?(Hash)
|
321
|
+
{}.tap do |hash|
|
322
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
323
|
+
end
|
324
|
+
elsif value.respond_to? :to_hash
|
325
|
+
value.to_hash
|
326
|
+
else
|
327
|
+
value
|
328
|
+
end
|
329
|
+
end
|
330
|
+
|
331
|
+
end
|
332
|
+
|
333
|
+
end
|