snaptrade 2.0.203 → 2.0.205
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 +1 -1
- data/README.md +21 -11
- data/lib/snaptrade/api/connections_api.rb +4 -4
- data/lib/snaptrade/api/trading_api.rb +18 -10
- data/lib/snaptrade/models/account_position.rb +1 -1
- data/lib/snaptrade/models/account_universal_activity.rb +12 -1
- data/lib/snaptrade/models/account_universal_activity_currency.rb +1 -1
- data/lib/snaptrade/models/account_universal_activity_currency_universal_symbol.rb +304 -0
- data/lib/snaptrade/models/brokerage_authorization.rb +14 -4
- data/lib/snaptrade/models/manual_trade_form_complex.rb +0 -1
- data/lib/snaptrade/models/manual_trade_form_with_options.rb +28 -7
- data/lib/snaptrade/models/manual_trade_place_time_in_force_strict.rb +40 -0
- data/lib/snaptrade/models/model429_too_many_requests_response.rb +238 -0
- data/lib/snaptrade/models/position.rb +1 -1
- data/lib/snaptrade/models/universal_activity.rb +12 -1
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +3 -0
- data/spec/api/connections_api_spec.rb +1 -1
- data/spec/api/trading_api_spec.rb +1 -1
- data/spec/models/account_universal_activity_currency_universal_symbol_spec.rb +77 -0
- data/spec/models/account_universal_activity_spec.rb +6 -0
- data/spec/models/brokerage_authorization_spec.rb +6 -0
- data/spec/models/manual_trade_form_with_options_spec.rb +12 -0
- data/spec/models/manual_trade_place_time_in_force_strict_spec.rb +23 -0
- data/spec/models/model429_too_many_requests_response_spec.rb +41 -0
- data/spec/models/universal_activity_spec.rb +6 -0
- metadata +201 -192
|
@@ -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 quote security for the transaction when `price`, `amount`, and `fee` are denominated in a security instead of a fiat currency. This is most common for cryptocurrency trades. The field is `null` when the transaction is denominated in `currency`.
|
|
15
|
+
class AccountUniversalActivityCurrencyUniversalSymbol
|
|
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' => :'StockInstrumentFigiInstrument'
|
|
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::AccountUniversalActivityCurrencyUniversalSymbol` 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::AccountUniversalActivityCurrencyUniversalSymbol`. 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
|
|
@@ -42,6 +42,9 @@ module SnapTrade
|
|
|
42
42
|
# Whether the connection is eligible for a payout. This is an experimental field that is NOT generally available for all partners. Do not use in production without speaking to the SnapTrade team.
|
|
43
43
|
attr_accessor :is_eligible_for_payout
|
|
44
44
|
|
|
45
|
+
# Possible values include: - realtime - delayed Indicates whether SnapTrade will provide delayed or realtime data for this connection. `delayed` means SnapTrade uses cached data for the connection because of the customer's plan, or because of brokerage limitations. `realtime` means SnapTrade retrieves current data from the brokerage during API calls.
|
|
46
|
+
attr_accessor :data_freshness_mode
|
|
47
|
+
|
|
45
48
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
46
49
|
def self.attribute_map
|
|
47
50
|
{
|
|
@@ -54,7 +57,8 @@ module SnapTrade
|
|
|
54
57
|
:'disabled_date' => :'disabled_date',
|
|
55
58
|
:'meta' => :'meta',
|
|
56
59
|
:'updated_date' => :'updated_date',
|
|
57
|
-
:'is_eligible_for_payout' => :'is_eligible_for_payout'
|
|
60
|
+
:'is_eligible_for_payout' => :'is_eligible_for_payout',
|
|
61
|
+
:'data_freshness_mode' => :'data_freshness_mode'
|
|
58
62
|
}
|
|
59
63
|
end
|
|
60
64
|
|
|
@@ -75,7 +79,8 @@ module SnapTrade
|
|
|
75
79
|
:'disabled_date' => :'Time',
|
|
76
80
|
:'meta' => :'Hash<String, Object>',
|
|
77
81
|
:'updated_date' => :'Time',
|
|
78
|
-
:'is_eligible_for_payout' => :'Boolean'
|
|
82
|
+
:'is_eligible_for_payout' => :'Boolean',
|
|
83
|
+
:'data_freshness_mode' => :'String'
|
|
79
84
|
}
|
|
80
85
|
end
|
|
81
86
|
|
|
@@ -142,6 +147,10 @@ module SnapTrade
|
|
|
142
147
|
if attributes.key?(:'is_eligible_for_payout')
|
|
143
148
|
self.is_eligible_for_payout = attributes[:'is_eligible_for_payout']
|
|
144
149
|
end
|
|
150
|
+
|
|
151
|
+
if attributes.key?(:'data_freshness_mode')
|
|
152
|
+
self.data_freshness_mode = attributes[:'data_freshness_mode']
|
|
153
|
+
end
|
|
145
154
|
end
|
|
146
155
|
|
|
147
156
|
# Show invalid properties with the reasons. Usually used together with valid?
|
|
@@ -171,7 +180,8 @@ module SnapTrade
|
|
|
171
180
|
disabled_date == o.disabled_date &&
|
|
172
181
|
meta == o.meta &&
|
|
173
182
|
updated_date == o.updated_date &&
|
|
174
|
-
is_eligible_for_payout == o.is_eligible_for_payout
|
|
183
|
+
is_eligible_for_payout == o.is_eligible_for_payout &&
|
|
184
|
+
data_freshness_mode == o.data_freshness_mode
|
|
175
185
|
end
|
|
176
186
|
|
|
177
187
|
# @see the `==` method
|
|
@@ -183,7 +193,7 @@ module SnapTrade
|
|
|
183
193
|
# Calculates hash code according to all attributes.
|
|
184
194
|
# @return [Integer] Hash code
|
|
185
195
|
def hash
|
|
186
|
-
[id, created_date, brokerage, name, type, disabled, disabled_date, meta, updated_date, is_eligible_for_payout].hash
|
|
196
|
+
[id, created_date, brokerage, name, type, disabled, disabled_date, meta, updated_date, is_eligible_for_payout, data_freshness_mode].hash
|
|
187
197
|
end
|
|
188
198
|
|
|
189
199
|
# Builds the object from hash
|
|
@@ -19,7 +19,6 @@ module SnapTrade
|
|
|
19
19
|
# The orders that make up the complex order. Required counts and roles per type: - `OCO`: exactly 2 orders, both `PEER` - `OTO`: exactly 2 orders, one `TRIGGER` and one `CONDITIONAL` - `OTOCO`: exactly 3 orders, one `TRIGGER` and two `PEER`
|
|
20
20
|
attr_accessor :orders
|
|
21
21
|
|
|
22
|
-
# An optional client-provided identifier for this complex order. Passed through to the brokerage and returned in the response.
|
|
23
22
|
attr_accessor :client_order_id
|
|
24
23
|
|
|
25
24
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
@@ -28,12 +28,15 @@ module SnapTrade
|
|
|
28
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
29
|
attr_accessor :order_type
|
|
30
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. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled.
|
|
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. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled. - `GTD` - Good Til Date. The order is valid until `expiry_date`, which is required. Not available for market orders. GTD orders are only available on certain brokerages. Visit https://support.snaptrade.com/brokerages for brokerage support.
|
|
32
32
|
attr_accessor :time_in_force
|
|
33
33
|
|
|
34
34
|
# The trading session for the order. This field indicates which market session the order will be placed in. This is only available for certain brokerages. Defaults to REGULAR. Here are the supported values: - `REGULAR` - Regular trading hours. - `EXTENDED` - Extended trading hours.
|
|
35
35
|
attr_accessor :trading_session
|
|
36
36
|
|
|
37
|
+
# Timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format indicating when the order expires. Required when `time_in_force` is `GTD`. Include a timezone offset or `Z` for UTC; if no timezone is provided, UTC is assumed. GTD orders are only available on certain brokerages. Visit https://support.snaptrade.com/brokerages for brokerage support.
|
|
38
|
+
attr_accessor :expiry_date
|
|
39
|
+
|
|
37
40
|
# The limit price for `Limit` and `StopLimit` orders.
|
|
38
41
|
attr_accessor :price
|
|
39
42
|
|
|
@@ -45,6 +48,8 @@ module SnapTrade
|
|
|
45
48
|
|
|
46
49
|
attr_accessor :notional_value
|
|
47
50
|
|
|
51
|
+
attr_accessor :client_order_id
|
|
52
|
+
|
|
48
53
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
49
54
|
def self.attribute_map
|
|
50
55
|
{
|
|
@@ -55,10 +60,12 @@ module SnapTrade
|
|
|
55
60
|
:'order_type' => :'order_type',
|
|
56
61
|
:'time_in_force' => :'time_in_force',
|
|
57
62
|
:'trading_session' => :'trading_session',
|
|
63
|
+
:'expiry_date' => :'expiry_date',
|
|
58
64
|
:'price' => :'price',
|
|
59
65
|
:'stop' => :'stop',
|
|
60
66
|
:'units' => :'units',
|
|
61
|
-
:'notional_value' => :'notional_value'
|
|
67
|
+
:'notional_value' => :'notional_value',
|
|
68
|
+
:'client_order_id' => :'client_order_id'
|
|
62
69
|
}
|
|
63
70
|
end
|
|
64
71
|
|
|
@@ -75,12 +82,14 @@ module SnapTrade
|
|
|
75
82
|
:'universal_symbol_id' => :'String',
|
|
76
83
|
:'symbol' => :'String',
|
|
77
84
|
:'order_type' => :'OrderTypeStrict',
|
|
78
|
-
:'time_in_force' => :'
|
|
85
|
+
:'time_in_force' => :'ManualTradePlaceTimeInForceStrict',
|
|
79
86
|
:'trading_session' => :'TradingSession',
|
|
87
|
+
:'expiry_date' => :'Time',
|
|
80
88
|
:'price' => :'Float',
|
|
81
89
|
:'stop' => :'Float',
|
|
82
90
|
:'units' => :'Float',
|
|
83
|
-
:'notional_value' => :'ManualTradeFormNotionalValue'
|
|
91
|
+
:'notional_value' => :'ManualTradeFormNotionalValue',
|
|
92
|
+
:'client_order_id' => :'String'
|
|
84
93
|
}
|
|
85
94
|
end
|
|
86
95
|
|
|
@@ -89,10 +98,12 @@ module SnapTrade
|
|
|
89
98
|
Set.new([
|
|
90
99
|
:'universal_symbol_id',
|
|
91
100
|
:'symbol',
|
|
101
|
+
:'expiry_date',
|
|
92
102
|
:'price',
|
|
93
103
|
:'stop',
|
|
94
104
|
:'units',
|
|
95
|
-
:'notional_value'
|
|
105
|
+
:'notional_value',
|
|
106
|
+
:'client_order_id'
|
|
96
107
|
])
|
|
97
108
|
end
|
|
98
109
|
|
|
@@ -141,6 +152,10 @@ module SnapTrade
|
|
|
141
152
|
self.trading_session = 'REGULAR'
|
|
142
153
|
end
|
|
143
154
|
|
|
155
|
+
if attributes.key?(:'expiry_date')
|
|
156
|
+
self.expiry_date = attributes[:'expiry_date']
|
|
157
|
+
end
|
|
158
|
+
|
|
144
159
|
if attributes.key?(:'price')
|
|
145
160
|
self.price = attributes[:'price']
|
|
146
161
|
end
|
|
@@ -156,6 +171,10 @@ module SnapTrade
|
|
|
156
171
|
if attributes.key?(:'notional_value')
|
|
157
172
|
self.notional_value = attributes[:'notional_value']
|
|
158
173
|
end
|
|
174
|
+
|
|
175
|
+
if attributes.key?(:'client_order_id')
|
|
176
|
+
self.client_order_id = attributes[:'client_order_id']
|
|
177
|
+
end
|
|
159
178
|
end
|
|
160
179
|
|
|
161
180
|
# Show invalid properties with the reasons. Usually used together with valid?
|
|
@@ -203,10 +222,12 @@ module SnapTrade
|
|
|
203
222
|
order_type == o.order_type &&
|
|
204
223
|
time_in_force == o.time_in_force &&
|
|
205
224
|
trading_session == o.trading_session &&
|
|
225
|
+
expiry_date == o.expiry_date &&
|
|
206
226
|
price == o.price &&
|
|
207
227
|
stop == o.stop &&
|
|
208
228
|
units == o.units &&
|
|
209
|
-
notional_value == o.notional_value
|
|
229
|
+
notional_value == o.notional_value &&
|
|
230
|
+
client_order_id == o.client_order_id
|
|
210
231
|
end
|
|
211
232
|
|
|
212
233
|
# @see the `==` method
|
|
@@ -218,7 +239,7 @@ module SnapTrade
|
|
|
218
239
|
# Calculates hash code according to all attributes.
|
|
219
240
|
# @return [Integer] Hash code
|
|
220
241
|
def hash
|
|
221
|
-
[account_id, action, universal_symbol_id, symbol, order_type, time_in_force, trading_session, price, stop, units, notional_value].hash
|
|
242
|
+
[account_id, action, universal_symbol_id, symbol, order_type, time_in_force, trading_session, expiry_date, price, stop, units, notional_value, client_order_id].hash
|
|
222
243
|
end
|
|
223
244
|
|
|
224
245
|
# Builds the object from hash
|
|
@@ -0,0 +1,40 @@
|
|
|
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 ManualTradePlaceTimeInForceStrict
|
|
15
|
+
FOK = "FOK".freeze
|
|
16
|
+
DAY = "Day".freeze
|
|
17
|
+
GTC = "GTC".freeze
|
|
18
|
+
IOC = "IOC".freeze
|
|
19
|
+
GTD = "GTD".freeze
|
|
20
|
+
|
|
21
|
+
def self.all_vars
|
|
22
|
+
@all_vars ||= [FOK, DAY, GTC, IOC, GTD].freeze
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Builds the enum from string
|
|
26
|
+
# @param [String] The enum value in the form of the string
|
|
27
|
+
# @return [String] The enum value
|
|
28
|
+
def self.build_from_hash(value)
|
|
29
|
+
new.build_from_hash(value)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Builds the enum from string
|
|
33
|
+
# @param [String] The enum value in the form of the string
|
|
34
|
+
# @return [String] The enum value
|
|
35
|
+
def build_from_hash(value)
|
|
36
|
+
return value if ManualTradePlaceTimeInForceStrict.all_vars.include?(value)
|
|
37
|
+
raise "Invalid ENUM value #{value} for class #ManualTradePlaceTimeInForceStrict"
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|