snaptrade 2.0.186 → 2.0.188
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 +39 -48
- data/lib/snaptrade/api/account_information_api.rb +103 -0
- data/lib/snaptrade/api/experimental_endpoints_api.rb +8 -137
- data/lib/snaptrade/configuration.rb +1 -1
- data/lib/snaptrade/models/account_order_record.rb +23 -1
- data/lib/snaptrade/models/account_order_record_v2.rb +57 -1
- data/lib/snaptrade/models/adr_instrument.rb +311 -0
- data/lib/snaptrade/models/adr_instrument_kind.rb +36 -0
- data/lib/snaptrade/models/all_account_positions_response.rb +3 -40
- data/lib/snaptrade/models/cef_instrument.rb +311 -0
- data/lib/snaptrade/models/cef_instrument_kind.rb +36 -0
- data/lib/snaptrade/models/complex_order_leg.rb +1 -1
- data/lib/snaptrade/models/complex_order_leg_order_role.rb +38 -0
- data/lib/snaptrade/models/instrument.rb +6 -0
- data/lib/snaptrade/models/mutual_fund_instrument.rb +311 -0
- data/lib/snaptrade/models/mutual_fund_instrument_kind.rb +36 -0
- data/lib/snaptrade/models/order_updated_response_order.rb +23 -1
- data/lib/snaptrade/models/underlying_option_instrument.rb +6 -0
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +7 -0
- data/spec/api/account_information_api_spec.rb +14 -0
- data/spec/api/experimental_endpoints_api_spec.rb +1 -17
- data/spec/models/account_order_record_spec.rb +12 -0
- data/spec/models/account_order_record_v2_spec.rb +16 -0
- data/spec/models/adr_instrument_kind_spec.rb +23 -0
- data/spec/models/adr_instrument_spec.rb +71 -0
- data/spec/models/all_account_positions_response_spec.rb +0 -18
- data/spec/models/cef_instrument_kind_spec.rb +23 -0
- data/spec/models/cef_instrument_spec.rb +71 -0
- data/spec/models/complex_order_leg_order_role_spec.rb +23 -0
- data/spec/models/mutual_fund_instrument_kind_spec.rb +23 -0
- data/spec/models/mutual_fund_instrument_spec.rb +71 -0
- data/spec/models/order_updated_response_order_spec.rb +12 -0
- metadata +202 -181
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#SnapTrade
|
|
3
|
+
|
|
4
|
+
#Connect brokerage accounts to your app for live positions and trading
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
Contact: api@snaptrade.com
|
|
8
|
+
=end
|
|
9
|
+
|
|
10
|
+
require 'date'
|
|
11
|
+
require 'time'
|
|
12
|
+
|
|
13
|
+
module SnapTrade
|
|
14
|
+
# Security instrument metadata for mutual fund positions.
|
|
15
|
+
class MutualFundInstrument
|
|
16
|
+
# Type of security instrument.
|
|
17
|
+
attr_accessor :kind
|
|
18
|
+
|
|
19
|
+
# Unique identifier for the instrument.
|
|
20
|
+
attr_accessor :id
|
|
21
|
+
|
|
22
|
+
# The formatted trading symbol for the security.
|
|
23
|
+
attr_accessor :symbol
|
|
24
|
+
|
|
25
|
+
# The raw symbol without any exchange suffix.
|
|
26
|
+
attr_accessor :raw_symbol
|
|
27
|
+
|
|
28
|
+
# Human-readable description of the security.
|
|
29
|
+
attr_accessor :description
|
|
30
|
+
|
|
31
|
+
# ISO-4217 currency code for the security listing.
|
|
32
|
+
attr_accessor :currency
|
|
33
|
+
|
|
34
|
+
# Exchange MIC code or exchange code for the security.
|
|
35
|
+
attr_accessor :exchange
|
|
36
|
+
|
|
37
|
+
attr_accessor :figi_instrument
|
|
38
|
+
|
|
39
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
40
|
+
def self.attribute_map
|
|
41
|
+
{
|
|
42
|
+
:'kind' => :'kind',
|
|
43
|
+
:'id' => :'id',
|
|
44
|
+
:'symbol' => :'symbol',
|
|
45
|
+
:'raw_symbol' => :'raw_symbol',
|
|
46
|
+
:'description' => :'description',
|
|
47
|
+
:'currency' => :'currency',
|
|
48
|
+
:'exchange' => :'exchange',
|
|
49
|
+
:'figi_instrument' => :'figi_instrument'
|
|
50
|
+
}
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Returns all the JSON keys this model knows about
|
|
54
|
+
def self.acceptable_attributes
|
|
55
|
+
attribute_map.values
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Attribute type mapping.
|
|
59
|
+
def self.openapi_types
|
|
60
|
+
{
|
|
61
|
+
:'kind' => :'MutualFundInstrumentKind',
|
|
62
|
+
:'id' => :'String',
|
|
63
|
+
:'symbol' => :'String',
|
|
64
|
+
:'raw_symbol' => :'String',
|
|
65
|
+
:'description' => :'String',
|
|
66
|
+
:'currency' => :'String',
|
|
67
|
+
:'exchange' => :'String',
|
|
68
|
+
:'figi_instrument' => :'StockInstrumentFigiInstrument'
|
|
69
|
+
}
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# List of attributes with nullable: true
|
|
73
|
+
def self.openapi_nullable
|
|
74
|
+
Set.new([
|
|
75
|
+
:'description',
|
|
76
|
+
:'currency',
|
|
77
|
+
:'exchange',
|
|
78
|
+
:'figi_instrument'
|
|
79
|
+
])
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# Initializes the object
|
|
83
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
84
|
+
def initialize(attributes = {})
|
|
85
|
+
if (!attributes.is_a?(Hash))
|
|
86
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::MutualFundInstrument` initialize method"
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
90
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
91
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
92
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::MutualFundInstrument`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
93
|
+
end
|
|
94
|
+
h[k.to_sym] = v
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if attributes.key?(:'kind')
|
|
98
|
+
self.kind = attributes[:'kind']
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
if attributes.key?(:'id')
|
|
102
|
+
self.id = attributes[:'id']
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
if attributes.key?(:'symbol')
|
|
106
|
+
self.symbol = attributes[:'symbol']
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
if attributes.key?(:'raw_symbol')
|
|
110
|
+
self.raw_symbol = attributes[:'raw_symbol']
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
if attributes.key?(:'description')
|
|
114
|
+
self.description = attributes[:'description']
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
if attributes.key?(:'currency')
|
|
118
|
+
self.currency = attributes[:'currency']
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
if attributes.key?(:'exchange')
|
|
122
|
+
self.exchange = attributes[:'exchange']
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
if attributes.key?(:'figi_instrument')
|
|
126
|
+
self.figi_instrument = attributes[:'figi_instrument']
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
131
|
+
# @return Array for valid properties with the reasons
|
|
132
|
+
def list_invalid_properties
|
|
133
|
+
invalid_properties = Array.new
|
|
134
|
+
if @kind.nil?
|
|
135
|
+
invalid_properties.push('invalid value for "kind", kind cannot be nil.')
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
if @id.nil?
|
|
139
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
if @symbol.nil?
|
|
143
|
+
invalid_properties.push('invalid value for "symbol", symbol cannot be nil.')
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
if @raw_symbol.nil?
|
|
147
|
+
invalid_properties.push('invalid value for "raw_symbol", raw_symbol cannot be nil.')
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
invalid_properties
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
# Check to see if the all the properties in the model are valid
|
|
154
|
+
# @return true if the model is valid
|
|
155
|
+
def valid?
|
|
156
|
+
return false if @kind.nil?
|
|
157
|
+
return false if @id.nil?
|
|
158
|
+
return false if @symbol.nil?
|
|
159
|
+
return false if @raw_symbol.nil?
|
|
160
|
+
true
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
# Checks equality by comparing each attribute.
|
|
164
|
+
# @param [Object] Object to be compared
|
|
165
|
+
def ==(o)
|
|
166
|
+
return true if self.equal?(o)
|
|
167
|
+
self.class == o.class &&
|
|
168
|
+
kind == o.kind &&
|
|
169
|
+
id == o.id &&
|
|
170
|
+
symbol == o.symbol &&
|
|
171
|
+
raw_symbol == o.raw_symbol &&
|
|
172
|
+
description == o.description &&
|
|
173
|
+
currency == o.currency &&
|
|
174
|
+
exchange == o.exchange &&
|
|
175
|
+
figi_instrument == o.figi_instrument
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
# @see the `==` method
|
|
179
|
+
# @param [Object] Object to be compared
|
|
180
|
+
def eql?(o)
|
|
181
|
+
self == o
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
# Calculates hash code according to all attributes.
|
|
185
|
+
# @return [Integer] Hash code
|
|
186
|
+
def hash
|
|
187
|
+
[kind, id, symbol, raw_symbol, description, currency, exchange, figi_instrument].hash
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
# Builds the object from hash
|
|
191
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
192
|
+
# @return [Object] Returns the model itself
|
|
193
|
+
def self.build_from_hash(attributes)
|
|
194
|
+
new.build_from_hash(attributes)
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
# Builds the object from hash
|
|
198
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
199
|
+
# @return [Object] Returns the model itself
|
|
200
|
+
def build_from_hash(attributes)
|
|
201
|
+
return nil unless attributes.is_a?(Hash)
|
|
202
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
203
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
204
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
205
|
+
self.send("#{key}=", nil)
|
|
206
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
207
|
+
# check to ensure the input is an array given that the attribute
|
|
208
|
+
# is documented as an array but the input is not
|
|
209
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
210
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
211
|
+
end
|
|
212
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
213
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
214
|
+
end
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
self
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
# Deserializes the data based on type
|
|
221
|
+
# @param string type Data type
|
|
222
|
+
# @param string value Value to be deserialized
|
|
223
|
+
# @return [Object] Deserialized data
|
|
224
|
+
def _deserialize(type, value)
|
|
225
|
+
case type.to_sym
|
|
226
|
+
when :Time
|
|
227
|
+
Time.parse(value)
|
|
228
|
+
when :Date
|
|
229
|
+
Date.parse(value)
|
|
230
|
+
when :String
|
|
231
|
+
value.to_s
|
|
232
|
+
when :Integer
|
|
233
|
+
value.to_i
|
|
234
|
+
when :Float
|
|
235
|
+
value.to_f
|
|
236
|
+
when :Boolean
|
|
237
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
238
|
+
true
|
|
239
|
+
else
|
|
240
|
+
false
|
|
241
|
+
end
|
|
242
|
+
when :Object
|
|
243
|
+
# generic object (usually a Hash), return directly
|
|
244
|
+
value
|
|
245
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
246
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
247
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
248
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
249
|
+
k_type = Regexp.last_match[:k_type]
|
|
250
|
+
v_type = Regexp.last_match[:v_type]
|
|
251
|
+
{}.tap do |hash|
|
|
252
|
+
value.each do |k, v|
|
|
253
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
254
|
+
end
|
|
255
|
+
end
|
|
256
|
+
else # model
|
|
257
|
+
# models (e.g. Pet) or oneOf
|
|
258
|
+
klass = SnapTrade.const_get(type)
|
|
259
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
260
|
+
end
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
# Returns the string representation of the object
|
|
264
|
+
# @return [String] String presentation of the object
|
|
265
|
+
def to_s
|
|
266
|
+
to_hash.to_s
|
|
267
|
+
end
|
|
268
|
+
|
|
269
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
270
|
+
# @return [Hash] Returns the object in the form of hash
|
|
271
|
+
def to_body
|
|
272
|
+
to_hash
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
# Returns the object in the form of hash
|
|
276
|
+
# @return [Hash] Returns the object in the form of hash
|
|
277
|
+
def to_hash
|
|
278
|
+
hash = {}
|
|
279
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
280
|
+
value = self.send(attr)
|
|
281
|
+
if value.nil?
|
|
282
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
283
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
hash[param] = _to_hash(value)
|
|
287
|
+
end
|
|
288
|
+
hash
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
# Outputs non-array value in the form of hash
|
|
292
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
293
|
+
# @param [Object] value Any valid value
|
|
294
|
+
# @return [Hash] Returns the value in the form of hash
|
|
295
|
+
def _to_hash(value)
|
|
296
|
+
if value.is_a?(Array)
|
|
297
|
+
value.compact.map { |v| _to_hash(v) }
|
|
298
|
+
elsif value.is_a?(Hash)
|
|
299
|
+
{}.tap do |hash|
|
|
300
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
301
|
+
end
|
|
302
|
+
elsif value.respond_to? :to_hash
|
|
303
|
+
value.to_hash
|
|
304
|
+
else
|
|
305
|
+
value
|
|
306
|
+
end
|
|
307
|
+
end
|
|
308
|
+
|
|
309
|
+
end
|
|
310
|
+
|
|
311
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#SnapTrade
|
|
3
|
+
|
|
4
|
+
#Connect brokerage accounts to your app for live positions and trading
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
Contact: api@snaptrade.com
|
|
8
|
+
=end
|
|
9
|
+
|
|
10
|
+
require 'date'
|
|
11
|
+
require 'time'
|
|
12
|
+
|
|
13
|
+
module SnapTrade
|
|
14
|
+
class MutualFundInstrumentKind
|
|
15
|
+
MUTUALFUND = "mutualfund".freeze
|
|
16
|
+
|
|
17
|
+
def self.all_vars
|
|
18
|
+
@all_vars ||= [MUTUALFUND].freeze
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# Builds the enum from string
|
|
22
|
+
# @param [String] The enum value in the form of the string
|
|
23
|
+
# @return [String] The enum value
|
|
24
|
+
def self.build_from_hash(value)
|
|
25
|
+
new.build_from_hash(value)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Builds the enum from string
|
|
29
|
+
# @param [String] The enum value in the form of the string
|
|
30
|
+
# @return [String] The enum value
|
|
31
|
+
def build_from_hash(value)
|
|
32
|
+
return value if MutualFundInstrumentKind.all_vars.include?(value)
|
|
33
|
+
raise "Invalid ENUM value #{value} for class #MutualFundInstrumentKind"
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -15,6 +15,12 @@ module SnapTrade
|
|
|
15
15
|
# Order ID returned by brokerage. This is the unique identifier for the order in the brokerage system.
|
|
16
16
|
attr_accessor :brokerage_order_id
|
|
17
17
|
|
|
18
|
+
# The brokerage-assigned identifier that links all orders within a complex order (OCO, OTO, OTOCO) together. Null for non-complex orders or when the brokerage does not return a group identifier.
|
|
19
|
+
attr_accessor :brokerage_group_order_id
|
|
20
|
+
|
|
21
|
+
# The role of this order within a complex order group (OCO, OTO, OTOCO). Null for non-complex orders.
|
|
22
|
+
attr_accessor :order_role
|
|
23
|
+
|
|
18
24
|
# Indicates the status of an order. SnapTrade does a best effort to map brokerage statuses to statuses in this enum. Possible values include: - NONE - PENDING - ACCEPTED - FAILED - REJECTED - CANCELED - PARTIAL_CANCELED - CANCEL_PENDING - EXECUTED - PARTIAL - REPLACE_PENDING - REPLACED - EXPIRED - QUEUED - TRIGGERED - ACTIVATED
|
|
19
25
|
attr_accessor :status
|
|
20
26
|
|
|
@@ -79,6 +85,8 @@ module SnapTrade
|
|
|
79
85
|
def self.attribute_map
|
|
80
86
|
{
|
|
81
87
|
:'brokerage_order_id' => :'brokerage_order_id',
|
|
88
|
+
:'brokerage_group_order_id' => :'brokerage_group_order_id',
|
|
89
|
+
:'order_role' => :'order_role',
|
|
82
90
|
:'status' => :'status',
|
|
83
91
|
:'universal_symbol' => :'universal_symbol',
|
|
84
92
|
:'option_symbol' => :'option_symbol',
|
|
@@ -113,6 +121,8 @@ module SnapTrade
|
|
|
113
121
|
def self.openapi_types
|
|
114
122
|
{
|
|
115
123
|
:'brokerage_order_id' => :'String',
|
|
124
|
+
:'brokerage_group_order_id' => :'String',
|
|
125
|
+
:'order_role' => :'OrderRole',
|
|
116
126
|
:'status' => :'AccountOrderRecordStatus',
|
|
117
127
|
:'universal_symbol' => :'AccountOrderRecordUniversalSymbol',
|
|
118
128
|
:'option_symbol' => :'AccountOrderRecordOptionSymbol',
|
|
@@ -141,6 +151,8 @@ module SnapTrade
|
|
|
141
151
|
# List of attributes with nullable: true
|
|
142
152
|
def self.openapi_nullable
|
|
143
153
|
Set.new([
|
|
154
|
+
:'brokerage_group_order_id',
|
|
155
|
+
:'order_role',
|
|
144
156
|
:'total_quantity',
|
|
145
157
|
:'open_quantity',
|
|
146
158
|
:'canceled_quantity',
|
|
@@ -183,6 +195,14 @@ module SnapTrade
|
|
|
183
195
|
self.brokerage_order_id = attributes[:'brokerage_order_id']
|
|
184
196
|
end
|
|
185
197
|
|
|
198
|
+
if attributes.key?(:'brokerage_group_order_id')
|
|
199
|
+
self.brokerage_group_order_id = attributes[:'brokerage_group_order_id']
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
if attributes.key?(:'order_role')
|
|
203
|
+
self.order_role = attributes[:'order_role']
|
|
204
|
+
end
|
|
205
|
+
|
|
186
206
|
if attributes.key?(:'status')
|
|
187
207
|
self.status = attributes[:'status']
|
|
188
208
|
end
|
|
@@ -291,6 +311,8 @@ module SnapTrade
|
|
|
291
311
|
return true if self.equal?(o)
|
|
292
312
|
self.class == o.class &&
|
|
293
313
|
brokerage_order_id == o.brokerage_order_id &&
|
|
314
|
+
brokerage_group_order_id == o.brokerage_group_order_id &&
|
|
315
|
+
order_role == o.order_role &&
|
|
294
316
|
status == o.status &&
|
|
295
317
|
universal_symbol == o.universal_symbol &&
|
|
296
318
|
option_symbol == o.option_symbol &&
|
|
@@ -324,7 +346,7 @@ module SnapTrade
|
|
|
324
346
|
# Calculates hash code according to all attributes.
|
|
325
347
|
# @return [Integer] Hash code
|
|
326
348
|
def hash
|
|
327
|
-
[brokerage_order_id, status, universal_symbol, option_symbol, quote_universal_symbol, quote_currency, action, total_quantity, open_quantity, canceled_quantity, filled_quantity, execution_price, limit_price, stop_price, trailing_stop, order_type, time_in_force, time_placed, time_updated, time_executed, expiry_date, symbol, child_brokerage_order_ids].hash
|
|
349
|
+
[brokerage_order_id, brokerage_group_order_id, order_role, status, universal_symbol, option_symbol, quote_universal_symbol, quote_currency, action, total_quantity, open_quantity, canceled_quantity, filled_quantity, execution_price, limit_price, stop_price, trailing_stop, order_type, time_in_force, time_placed, time_updated, time_executed, expiry_date, symbol, child_brokerage_order_ids].hash
|
|
328
350
|
end
|
|
329
351
|
|
|
330
352
|
# Builds the object from hash
|
|
@@ -17,8 +17,11 @@ module SnapTrade
|
|
|
17
17
|
# List of class defined in oneOf (OpenAPI v3)
|
|
18
18
|
def openapi_one_of
|
|
19
19
|
[
|
|
20
|
+
:'AdrInstrument',
|
|
21
|
+
:'CefInstrument',
|
|
20
22
|
:'CryptoInstrument',
|
|
21
23
|
:'EtfInstrument',
|
|
24
|
+
:'MutualFundInstrument',
|
|
22
25
|
:'OtherInstrument',
|
|
23
26
|
:'StockInstrument'
|
|
24
27
|
]
|
|
@@ -32,8 +35,11 @@ module SnapTrade
|
|
|
32
35
|
# Discriminator's mapping (OpenAPI v3)
|
|
33
36
|
def openapi_discriminator_mapping
|
|
34
37
|
{
|
|
38
|
+
:'adr' => :'AdrInstrument',
|
|
39
|
+
:'cef' => :'CefInstrument',
|
|
35
40
|
:'crypto' => :'CryptoInstrument',
|
|
36
41
|
:'etf' => :'EtfInstrument',
|
|
42
|
+
:'mutualfund' => :'MutualFundInstrument',
|
|
37
43
|
:'other' => :'OtherInstrument',
|
|
38
44
|
:'stock' => :'StockInstrument'
|
|
39
45
|
}
|
data/lib/snaptrade/version.rb
CHANGED
data/lib/snaptrade.rb
CHANGED
|
@@ -48,6 +48,8 @@ require 'snaptrade/models/account_value_history_item'
|
|
|
48
48
|
require 'snaptrade/models/account_value_history_response'
|
|
49
49
|
require 'snaptrade/models/action_strict'
|
|
50
50
|
require 'snaptrade/models/action_strict_with_options'
|
|
51
|
+
require 'snaptrade/models/adr_instrument'
|
|
52
|
+
require 'snaptrade/models/adr_instrument_kind'
|
|
51
53
|
require 'snaptrade/models/all_account_positions_response'
|
|
52
54
|
require 'snaptrade/models/auth_type'
|
|
53
55
|
require 'snaptrade/models/authentication_login_snap_trade_user200_response'
|
|
@@ -66,8 +68,11 @@ require 'snaptrade/models/brokerage_instruments_response'
|
|
|
66
68
|
require 'snaptrade/models/brokerage_type'
|
|
67
69
|
require 'snaptrade/models/cancel_order_response'
|
|
68
70
|
require 'snaptrade/models/cash_change_direction'
|
|
71
|
+
require 'snaptrade/models/cef_instrument'
|
|
72
|
+
require 'snaptrade/models/cef_instrument_kind'
|
|
69
73
|
require 'snaptrade/models/child_brokerage_order_ids'
|
|
70
74
|
require 'snaptrade/models/complex_order_leg'
|
|
75
|
+
require 'snaptrade/models/complex_order_leg_order_role'
|
|
71
76
|
require 'snaptrade/models/complex_order_response'
|
|
72
77
|
require 'snaptrade/models/complex_order_response_type'
|
|
73
78
|
require 'snaptrade/models/connection_portal_version'
|
|
@@ -131,6 +136,8 @@ require 'snaptrade/models/model404_failed_request_response'
|
|
|
131
136
|
require 'snaptrade/models/model425_failed_request_response'
|
|
132
137
|
require 'snaptrade/models/model500_unexpected_exception_response'
|
|
133
138
|
require 'snaptrade/models/monthly_dividends'
|
|
139
|
+
require 'snaptrade/models/mutual_fund_instrument'
|
|
140
|
+
require 'snaptrade/models/mutual_fund_instrument_kind'
|
|
134
141
|
require 'snaptrade/models/net_contributions'
|
|
135
142
|
require 'snaptrade/models/net_dividend'
|
|
136
143
|
require 'snaptrade/models/notional_value'
|
|
@@ -46,6 +46,20 @@ describe 'AccountInformationApi' do
|
|
|
46
46
|
end
|
|
47
47
|
end
|
|
48
48
|
|
|
49
|
+
# unit tests for get_account_balance_history
|
|
50
|
+
# List historical account total value
|
|
51
|
+
# An experimental endpoint that returns estimated historical total account value for the specified account. Total account value is the sum of the market value of all positions and cash in the account at a given time. This endpoint is experimental, disabled by default, and has a maximum lookback of 1 year.
|
|
52
|
+
# @param user_id
|
|
53
|
+
# @param user_secret
|
|
54
|
+
# @param account_id
|
|
55
|
+
# @param [Hash] opts the optional parameters
|
|
56
|
+
# @return [AccountValueHistoryResponse]
|
|
57
|
+
describe 'get_account_balance_history test' do
|
|
58
|
+
it 'should work' do
|
|
59
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
49
63
|
# unit tests for get_all_user_holdings
|
|
50
64
|
# List all accounts for the user, plus balances, positions, and orders for each account.
|
|
51
65
|
# **Deprecated, please use the account-specific holdings endpoint instead.** List all accounts for the user, plus balances, positions, and orders for each account. **Note:** This endpoint will return HTTP 410 Gone for all customers that sign up after April 25, 2026.
|
|
@@ -27,29 +27,13 @@ describe 'ExperimentalEndpointsApi' do
|
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
-
# unit tests for get_account_balance_history
|
|
31
|
-
# List historical account total value
|
|
32
|
-
# An experimental endpoint that returns estimated historical total account value for the specified account. Total account value is the sum of the market value of all positions and cash in the account at a given time. This endpoint is experimental, disabled by default, and only available for certain brokerages with a maximum lookback of 1 year.
|
|
33
|
-
# @param user_id
|
|
34
|
-
# @param user_secret
|
|
35
|
-
# @param account_id
|
|
36
|
-
# @param [Hash] opts the optional parameters
|
|
37
|
-
# @return [AccountValueHistoryResponse]
|
|
38
|
-
describe 'get_account_balance_history test' do
|
|
39
|
-
it 'should work' do
|
|
40
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
|
|
44
30
|
# unit tests for get_all_account_positions
|
|
45
31
|
# List all account positions
|
|
46
|
-
# Returns a
|
|
32
|
+
# Returns a list of all positions in the specified account. The `results` list can contain multiple instrument types in the same response, including stocks, ADRs, ETFs, mutual funds, closed-end funds, crypto, futures, and option positions. Use the `instrument.kind` discriminator to determine the schema for each position's `instrument`. Stock positions may also include `cash_equivalent`, and may include `tax_lots` when tax lot data is enabled for the account. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
|
|
47
33
|
# @param user_id
|
|
48
34
|
# @param user_secret
|
|
49
35
|
# @param account_id
|
|
50
36
|
# @param [Hash] opts the optional parameters
|
|
51
|
-
# @option opts [Integer] :page The page number to return. Defaults to 1.
|
|
52
|
-
# @option opts [Integer] :page_size The number of positions to return per page. Defaults to 100 with a maximum of 1000.
|
|
53
37
|
# @return [AllAccountPositionsResponse]
|
|
54
38
|
describe 'get_all_account_positions test' do
|
|
55
39
|
it 'should work' do
|
|
@@ -26,6 +26,18 @@ describe SnapTrade::AccountOrderRecord do
|
|
|
26
26
|
end
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
+
describe 'test attribute "brokerage_group_order_id"' do
|
|
30
|
+
it 'should work' do
|
|
31
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
describe 'test attribute "order_role"' do
|
|
36
|
+
it 'should work' do
|
|
37
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
29
41
|
describe 'test attribute "status"' do
|
|
30
42
|
it 'should work' do
|
|
31
43
|
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
@@ -26,6 +26,22 @@ describe SnapTrade::AccountOrderRecordV2 do
|
|
|
26
26
|
end
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
+
describe 'test attribute "brokerage_group_order_id"' do
|
|
30
|
+
it 'should work' do
|
|
31
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
describe 'test attribute "order_role"' do
|
|
36
|
+
it 'should work' do
|
|
37
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
38
|
+
# validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["TRIGGER", "CONDITIONAL", "PEER"])
|
|
39
|
+
# validator.allowable_values.each do |value|
|
|
40
|
+
# expect { instance.order_role = value }.not_to raise_error
|
|
41
|
+
# end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
29
45
|
describe 'test attribute "status"' do
|
|
30
46
|
it 'should work' do
|
|
31
47
|
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
@@ -0,0 +1,23 @@
|
|
|
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 'spec_helper'
|
|
11
|
+
require 'json'
|
|
12
|
+
require 'date'
|
|
13
|
+
|
|
14
|
+
# Unit tests for SnapTrade::AdrInstrumentKind
|
|
15
|
+
describe SnapTrade::AdrInstrumentKind do
|
|
16
|
+
let(:instance) { SnapTrade::AdrInstrumentKind.new }
|
|
17
|
+
|
|
18
|
+
describe 'test an instance of AdrInstrumentKind' do
|
|
19
|
+
it 'should create an instance of AdrInstrumentKind' do
|
|
20
|
+
expect(instance).to be_instance_of(SnapTrade::AdrInstrumentKind)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,71 @@
|
|
|
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 'spec_helper'
|
|
11
|
+
require 'json'
|
|
12
|
+
require 'date'
|
|
13
|
+
|
|
14
|
+
# Unit tests for SnapTrade::AdrInstrument
|
|
15
|
+
describe SnapTrade::AdrInstrument do
|
|
16
|
+
let(:instance) { SnapTrade::AdrInstrument.new }
|
|
17
|
+
|
|
18
|
+
describe 'test an instance of AdrInstrument' do
|
|
19
|
+
it 'should create an instance of AdrInstrument' do
|
|
20
|
+
expect(instance).to be_instance_of(SnapTrade::AdrInstrument)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
describe 'test attribute "kind"' do
|
|
24
|
+
it 'should work' do
|
|
25
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
describe 'test attribute "id"' do
|
|
30
|
+
it 'should work' do
|
|
31
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
describe 'test attribute "symbol"' do
|
|
36
|
+
it 'should work' do
|
|
37
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
describe 'test attribute "raw_symbol"' do
|
|
42
|
+
it 'should work' do
|
|
43
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
describe 'test attribute "description"' do
|
|
48
|
+
it 'should work' do
|
|
49
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
describe 'test attribute "currency"' do
|
|
54
|
+
it 'should work' do
|
|
55
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
describe 'test attribute "exchange"' do
|
|
60
|
+
it 'should work' do
|
|
61
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
describe 'test attribute "figi_instrument"' do
|
|
66
|
+
it 'should work' do
|
|
67
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
end
|