snaptrade 2.0.85 → 2.0.86
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 +2 -2
- data/README.md +2 -2
- data/lib/snaptrade/models/account_order_record.rb +19 -1
- data/lib/snaptrade/models/account_order_record_quote_currency.rb +245 -0
- data/lib/snaptrade/models/account_order_record_quote_universal_symbol.rb +346 -0
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +2 -0
- data/spec/models/account_order_record_quote_currency_spec.rb +41 -0
- data/spec/models/account_order_record_quote_universal_symbol_spec.rb +83 -0
- data/spec/models/account_order_record_spec.rb +12 -0
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2713dd92b6b944dee604818ebe688255770196b905cf9e2dcb433fb0d9c6b0fa
|
4
|
+
data.tar.gz: af7e3d1990da462d603ca17d3e1f02bdc9ae6ffa5881c1082451bf92c56846ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a69d7ead074e9845c83794805b770fe9e38d6124fbcee282714b9dbe0fd5d159f79e461e83db44e46e0345005b940247fe1b5951469c0fea287c6ebfcc68ce1f
|
7
|
+
data.tar.gz: da96199e1dd2c5fa20c52c67c813ce213053fa844344ce36f1b53b6589d6229ba0f2e5bf1212e754d251fb653e21b80e799bc1bbca0b8e03f02dc065de0daf99
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
snaptrade (2.0.
|
4
|
+
snaptrade (2.0.86)
|
5
5
|
faraday (>= 1.0.1, < 3.0)
|
6
6
|
faraday-multipart (~> 1.0, >= 1.0.4)
|
7
7
|
|
@@ -29,7 +29,7 @@ GEM
|
|
29
29
|
method_source (1.1.0)
|
30
30
|
multipart-post (2.4.1)
|
31
31
|
parallel (1.26.3)
|
32
|
-
parser (3.3.7.
|
32
|
+
parser (3.3.7.3)
|
33
33
|
ast (~> 2.4.1)
|
34
34
|
racc
|
35
35
|
prism (1.4.0)
|
data/README.md
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
Connect brokerage accounts to your app for live positions and trading
|
8
8
|
|
9
|
-
[](https://rubygems.org/gems/snaptrade/versions/2.0.86)
|
10
10
|
[](https://snaptrade.com/)
|
11
11
|
|
12
12
|
</div>
|
@@ -80,7 +80,7 @@ Connect brokerage accounts to your app for live positions and trading
|
|
80
80
|
Add to Gemfile:
|
81
81
|
|
82
82
|
```ruby
|
83
|
-
gem 'snaptrade', '~> 2.0.
|
83
|
+
gem 'snaptrade', '~> 2.0.86'
|
84
84
|
```
|
85
85
|
|
86
86
|
## Getting Started<a id="getting-started"></a>
|
@@ -23,6 +23,10 @@ module SnapTrade
|
|
23
23
|
|
24
24
|
attr_accessor :option_symbol
|
25
25
|
|
26
|
+
attr_accessor :quote_universal_symbol
|
27
|
+
|
28
|
+
attr_accessor :quote_currency
|
29
|
+
|
26
30
|
# The action describes the intent or side of a trade. This is usually `BUY` or `SELL` but can include other potential values like the following depending on the specific brokerage. - BUY - SELL - BUY_COVER - SELL_SHORT - BUY_OPEN - BUY_CLOSE - SELL_OPEN - SELL_CLOSE
|
27
31
|
attr_accessor :action
|
28
32
|
|
@@ -77,6 +81,8 @@ module SnapTrade
|
|
77
81
|
:'status' => :'status',
|
78
82
|
:'universal_symbol' => :'universal_symbol',
|
79
83
|
:'option_symbol' => :'option_symbol',
|
84
|
+
:'quote_universal_symbol' => :'quote_universal_symbol',
|
85
|
+
:'quote_currency' => :'quote_currency',
|
80
86
|
:'action' => :'action',
|
81
87
|
:'total_quantity' => :'total_quantity',
|
82
88
|
:'open_quantity' => :'open_quantity',
|
@@ -108,6 +114,8 @@ module SnapTrade
|
|
108
114
|
:'status' => :'AccountOrderRecordStatus',
|
109
115
|
:'universal_symbol' => :'AccountOrderRecordUniversalSymbol',
|
110
116
|
:'option_symbol' => :'AccountOrderRecordOptionSymbol',
|
117
|
+
:'quote_universal_symbol' => :'AccountOrderRecordQuoteUniversalSymbol',
|
118
|
+
:'quote_currency' => :'AccountOrderRecordQuoteCurrency',
|
111
119
|
:'action' => :'String',
|
112
120
|
:'total_quantity' => :'Float',
|
113
121
|
:'open_quantity' => :'Float',
|
@@ -176,6 +184,14 @@ module SnapTrade
|
|
176
184
|
self.option_symbol = attributes[:'option_symbol']
|
177
185
|
end
|
178
186
|
|
187
|
+
if attributes.key?(:'quote_universal_symbol')
|
188
|
+
self.quote_universal_symbol = attributes[:'quote_universal_symbol']
|
189
|
+
end
|
190
|
+
|
191
|
+
if attributes.key?(:'quote_currency')
|
192
|
+
self.quote_currency = attributes[:'quote_currency']
|
193
|
+
end
|
194
|
+
|
179
195
|
if attributes.key?(:'action')
|
180
196
|
self.action = attributes[:'action']
|
181
197
|
end
|
@@ -263,6 +279,8 @@ module SnapTrade
|
|
263
279
|
status == o.status &&
|
264
280
|
universal_symbol == o.universal_symbol &&
|
265
281
|
option_symbol == o.option_symbol &&
|
282
|
+
quote_universal_symbol == o.quote_universal_symbol &&
|
283
|
+
quote_currency == o.quote_currency &&
|
266
284
|
action == o.action &&
|
267
285
|
total_quantity == o.total_quantity &&
|
268
286
|
open_quantity == o.open_quantity &&
|
@@ -290,7 +308,7 @@ module SnapTrade
|
|
290
308
|
# Calculates hash code according to all attributes.
|
291
309
|
# @return [Integer] Hash code
|
292
310
|
def hash
|
293
|
-
[brokerage_order_id, status, universal_symbol, option_symbol, action, total_quantity, open_quantity, canceled_quantity, filled_quantity, execution_price, limit_price, stop_price, order_type, time_in_force, time_placed, time_updated, time_executed, expiry_date, symbol, child_brokerage_order_ids].hash
|
311
|
+
[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, order_type, time_in_force, time_placed, time_updated, time_executed, expiry_date, symbol, child_brokerage_order_ids].hash
|
294
312
|
end
|
295
313
|
|
296
314
|
# Builds the object from hash
|
@@ -0,0 +1,245 @@
|
|
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
|
+
# Quote currency. This field is only present for cryptocurrency pair orders with a fiat currency as quote.
|
15
|
+
class AccountOrderRecordQuoteCurrency
|
16
|
+
# Unique identifier for the currency. This is the UUID used to reference the currency in SnapTrade.
|
17
|
+
attr_accessor :id
|
18
|
+
|
19
|
+
# The ISO-4217 currency code for the currency.
|
20
|
+
attr_accessor :code
|
21
|
+
|
22
|
+
# A human-friendly name of the currency.
|
23
|
+
attr_accessor :name
|
24
|
+
|
25
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
26
|
+
def self.attribute_map
|
27
|
+
{
|
28
|
+
:'id' => :'id',
|
29
|
+
:'code' => :'code',
|
30
|
+
:'name' => :'name'
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
# Returns all the JSON keys this model knows about
|
35
|
+
def self.acceptable_attributes
|
36
|
+
attribute_map.values
|
37
|
+
end
|
38
|
+
|
39
|
+
# Attribute type mapping.
|
40
|
+
def self.openapi_types
|
41
|
+
{
|
42
|
+
:'id' => :'String',
|
43
|
+
:'code' => :'String',
|
44
|
+
:'name' => :'String'
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
48
|
+
# List of attributes with nullable: true
|
49
|
+
def self.openapi_nullable
|
50
|
+
Set.new([
|
51
|
+
])
|
52
|
+
end
|
53
|
+
|
54
|
+
# List of class defined in allOf (OpenAPI v3)
|
55
|
+
def self.openapi_all_of
|
56
|
+
[
|
57
|
+
:'Currency'
|
58
|
+
]
|
59
|
+
end
|
60
|
+
|
61
|
+
# Initializes the object
|
62
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
63
|
+
def initialize(attributes = {})
|
64
|
+
if (!attributes.is_a?(Hash))
|
65
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::AccountOrderRecordQuoteCurrency` initialize method"
|
66
|
+
end
|
67
|
+
|
68
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
69
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
70
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
71
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::AccountOrderRecordQuoteCurrency`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
72
|
+
end
|
73
|
+
h[k.to_sym] = v
|
74
|
+
}
|
75
|
+
|
76
|
+
if attributes.key?(:'id')
|
77
|
+
self.id = attributes[:'id']
|
78
|
+
end
|
79
|
+
|
80
|
+
if attributes.key?(:'code')
|
81
|
+
self.code = attributes[:'code']
|
82
|
+
end
|
83
|
+
|
84
|
+
if attributes.key?(:'name')
|
85
|
+
self.name = attributes[:'name']
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
90
|
+
# @return Array for valid properties with the reasons
|
91
|
+
def list_invalid_properties
|
92
|
+
invalid_properties = Array.new
|
93
|
+
invalid_properties
|
94
|
+
end
|
95
|
+
|
96
|
+
# Check to see if the all the properties in the model are valid
|
97
|
+
# @return true if the model is valid
|
98
|
+
def valid?
|
99
|
+
true
|
100
|
+
end
|
101
|
+
|
102
|
+
# Checks equality by comparing each attribute.
|
103
|
+
# @param [Object] Object to be compared
|
104
|
+
def ==(o)
|
105
|
+
return true if self.equal?(o)
|
106
|
+
self.class == o.class &&
|
107
|
+
id == o.id &&
|
108
|
+
code == o.code &&
|
109
|
+
name == o.name
|
110
|
+
end
|
111
|
+
|
112
|
+
# @see the `==` method
|
113
|
+
# @param [Object] Object to be compared
|
114
|
+
def eql?(o)
|
115
|
+
self == o
|
116
|
+
end
|
117
|
+
|
118
|
+
# Calculates hash code according to all attributes.
|
119
|
+
# @return [Integer] Hash code
|
120
|
+
def hash
|
121
|
+
[id, code, name].hash
|
122
|
+
end
|
123
|
+
|
124
|
+
# Builds the object from hash
|
125
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
126
|
+
# @return [Object] Returns the model itself
|
127
|
+
def self.build_from_hash(attributes)
|
128
|
+
new.build_from_hash(attributes)
|
129
|
+
end
|
130
|
+
|
131
|
+
# Builds the object from hash
|
132
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
133
|
+
# @return [Object] Returns the model itself
|
134
|
+
def build_from_hash(attributes)
|
135
|
+
return nil unless attributes.is_a?(Hash)
|
136
|
+
attributes = attributes.transform_keys(&:to_sym)
|
137
|
+
self.class.openapi_types.each_pair do |key, type|
|
138
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
139
|
+
self.send("#{key}=", nil)
|
140
|
+
elsif type =~ /\AArray<(.*)>/i
|
141
|
+
# check to ensure the input is an array given that the attribute
|
142
|
+
# is documented as an array but the input is not
|
143
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
144
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
145
|
+
end
|
146
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
147
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
self
|
152
|
+
end
|
153
|
+
|
154
|
+
# Deserializes the data based on type
|
155
|
+
# @param string type Data type
|
156
|
+
# @param string value Value to be deserialized
|
157
|
+
# @return [Object] Deserialized data
|
158
|
+
def _deserialize(type, value)
|
159
|
+
case type.to_sym
|
160
|
+
when :Time
|
161
|
+
Time.parse(value)
|
162
|
+
when :Date
|
163
|
+
Date.parse(value)
|
164
|
+
when :String
|
165
|
+
value.to_s
|
166
|
+
when :Integer
|
167
|
+
value.to_i
|
168
|
+
when :Float
|
169
|
+
value.to_f
|
170
|
+
when :Boolean
|
171
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
172
|
+
true
|
173
|
+
else
|
174
|
+
false
|
175
|
+
end
|
176
|
+
when :Object
|
177
|
+
# generic object (usually a Hash), return directly
|
178
|
+
value
|
179
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
180
|
+
inner_type = Regexp.last_match[:inner_type]
|
181
|
+
value.map { |v| _deserialize(inner_type, v) }
|
182
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
183
|
+
k_type = Regexp.last_match[:k_type]
|
184
|
+
v_type = Regexp.last_match[:v_type]
|
185
|
+
{}.tap do |hash|
|
186
|
+
value.each do |k, v|
|
187
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
188
|
+
end
|
189
|
+
end
|
190
|
+
else # model
|
191
|
+
# models (e.g. Pet) or oneOf
|
192
|
+
klass = SnapTrade.const_get(type)
|
193
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
# Returns the string representation of the object
|
198
|
+
# @return [String] String presentation of the object
|
199
|
+
def to_s
|
200
|
+
to_hash.to_s
|
201
|
+
end
|
202
|
+
|
203
|
+
# to_body is an alias to to_hash (backward compatibility)
|
204
|
+
# @return [Hash] Returns the object in the form of hash
|
205
|
+
def to_body
|
206
|
+
to_hash
|
207
|
+
end
|
208
|
+
|
209
|
+
# Returns the object in the form of hash
|
210
|
+
# @return [Hash] Returns the object in the form of hash
|
211
|
+
def to_hash
|
212
|
+
hash = {}
|
213
|
+
self.class.attribute_map.each_pair do |attr, param|
|
214
|
+
value = self.send(attr)
|
215
|
+
if value.nil?
|
216
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
217
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
218
|
+
end
|
219
|
+
|
220
|
+
hash[param] = _to_hash(value)
|
221
|
+
end
|
222
|
+
hash
|
223
|
+
end
|
224
|
+
|
225
|
+
# Outputs non-array value in the form of hash
|
226
|
+
# For object, use to_hash. Otherwise, just return the value
|
227
|
+
# @param [Object] value Any valid value
|
228
|
+
# @return [Hash] Returns the value in the form of hash
|
229
|
+
def _to_hash(value)
|
230
|
+
if value.is_a?(Array)
|
231
|
+
value.compact.map { |v| _to_hash(v) }
|
232
|
+
elsif value.is_a?(Hash)
|
233
|
+
{}.tap do |hash|
|
234
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
235
|
+
end
|
236
|
+
elsif value.respond_to? :to_hash
|
237
|
+
value.to_hash
|
238
|
+
else
|
239
|
+
value
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
end
|
244
|
+
|
245
|
+
end
|
@@ -0,0 +1,346 @@
|
|
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
|
+
# Quote cryptocurrency. This field is only present for cryptocurrency pair orders with a cryptocurrency as quote.
|
15
|
+
class AccountOrderRecordQuoteUniversalSymbol
|
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
|
+
# This field is deprecated and should not be used. Please reach out to SnapTrade support if you have a valid usecase for this.
|
40
|
+
attr_accessor :currencies
|
41
|
+
|
42
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
43
|
+
def self.attribute_map
|
44
|
+
{
|
45
|
+
:'id' => :'id',
|
46
|
+
:'symbol' => :'symbol',
|
47
|
+
:'raw_symbol' => :'raw_symbol',
|
48
|
+
:'description' => :'description',
|
49
|
+
:'currency' => :'currency',
|
50
|
+
:'exchange' => :'exchange',
|
51
|
+
:'type' => :'type',
|
52
|
+
:'figi_code' => :'figi_code',
|
53
|
+
:'figi_instrument' => :'figi_instrument',
|
54
|
+
:'currencies' => :'currencies'
|
55
|
+
}
|
56
|
+
end
|
57
|
+
|
58
|
+
# Returns all the JSON keys this model knows about
|
59
|
+
def self.acceptable_attributes
|
60
|
+
attribute_map.values
|
61
|
+
end
|
62
|
+
|
63
|
+
# Attribute type mapping.
|
64
|
+
def self.openapi_types
|
65
|
+
{
|
66
|
+
:'id' => :'String',
|
67
|
+
:'symbol' => :'String',
|
68
|
+
:'raw_symbol' => :'String',
|
69
|
+
:'description' => :'String',
|
70
|
+
:'currency' => :'SymbolCurrency',
|
71
|
+
:'exchange' => :'SymbolExchange',
|
72
|
+
:'type' => :'SecurityType',
|
73
|
+
:'figi_code' => :'String',
|
74
|
+
:'figi_instrument' => :'SymbolFigiInstrument',
|
75
|
+
:'currencies' => :'Array<Currency>'
|
76
|
+
}
|
77
|
+
end
|
78
|
+
|
79
|
+
# List of attributes with nullable: true
|
80
|
+
def self.openapi_nullable
|
81
|
+
Set.new([
|
82
|
+
:'description',
|
83
|
+
:'figi_code',
|
84
|
+
:'figi_instrument',
|
85
|
+
])
|
86
|
+
end
|
87
|
+
|
88
|
+
# List of class defined in allOf (OpenAPI v3)
|
89
|
+
def self.openapi_all_of
|
90
|
+
[
|
91
|
+
:'UniversalSymbol'
|
92
|
+
]
|
93
|
+
end
|
94
|
+
|
95
|
+
# Initializes the object
|
96
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
97
|
+
def initialize(attributes = {})
|
98
|
+
if (!attributes.is_a?(Hash))
|
99
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::AccountOrderRecordQuoteUniversalSymbol` initialize method"
|
100
|
+
end
|
101
|
+
|
102
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
103
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
104
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
105
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::AccountOrderRecordQuoteUniversalSymbol`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
106
|
+
end
|
107
|
+
h[k.to_sym] = v
|
108
|
+
}
|
109
|
+
|
110
|
+
if attributes.key?(:'id')
|
111
|
+
self.id = attributes[:'id']
|
112
|
+
end
|
113
|
+
|
114
|
+
if attributes.key?(:'symbol')
|
115
|
+
self.symbol = attributes[:'symbol']
|
116
|
+
end
|
117
|
+
|
118
|
+
if attributes.key?(:'raw_symbol')
|
119
|
+
self.raw_symbol = attributes[:'raw_symbol']
|
120
|
+
end
|
121
|
+
|
122
|
+
if attributes.key?(:'description')
|
123
|
+
self.description = attributes[:'description']
|
124
|
+
end
|
125
|
+
|
126
|
+
if attributes.key?(:'currency')
|
127
|
+
self.currency = attributes[:'currency']
|
128
|
+
end
|
129
|
+
|
130
|
+
if attributes.key?(:'exchange')
|
131
|
+
self.exchange = attributes[:'exchange']
|
132
|
+
end
|
133
|
+
|
134
|
+
if attributes.key?(:'type')
|
135
|
+
self.type = attributes[:'type']
|
136
|
+
end
|
137
|
+
|
138
|
+
if attributes.key?(:'figi_code')
|
139
|
+
self.figi_code = attributes[:'figi_code']
|
140
|
+
end
|
141
|
+
|
142
|
+
if attributes.key?(:'figi_instrument')
|
143
|
+
self.figi_instrument = attributes[:'figi_instrument']
|
144
|
+
end
|
145
|
+
|
146
|
+
if attributes.key?(:'currencies')
|
147
|
+
if (value = attributes[:'currencies']).is_a?(Array)
|
148
|
+
self.currencies = value
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
154
|
+
# @return Array for valid properties with the reasons
|
155
|
+
def list_invalid_properties
|
156
|
+
invalid_properties = Array.new
|
157
|
+
if @id.nil?
|
158
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
159
|
+
end
|
160
|
+
|
161
|
+
if @symbol.nil?
|
162
|
+
invalid_properties.push('invalid value for "symbol", symbol cannot be nil.')
|
163
|
+
end
|
164
|
+
|
165
|
+
if @raw_symbol.nil?
|
166
|
+
invalid_properties.push('invalid value for "raw_symbol", raw_symbol cannot be nil.')
|
167
|
+
end
|
168
|
+
|
169
|
+
if @currency.nil?
|
170
|
+
invalid_properties.push('invalid value for "currency", currency cannot be nil.')
|
171
|
+
end
|
172
|
+
|
173
|
+
if @type.nil?
|
174
|
+
invalid_properties.push('invalid value for "type", type cannot be nil.')
|
175
|
+
end
|
176
|
+
|
177
|
+
if @currencies.nil?
|
178
|
+
invalid_properties.push('invalid value for "currencies", currencies cannot be nil.')
|
179
|
+
end
|
180
|
+
|
181
|
+
invalid_properties
|
182
|
+
end
|
183
|
+
|
184
|
+
# Check to see if the all the properties in the model are valid
|
185
|
+
# @return true if the model is valid
|
186
|
+
def valid?
|
187
|
+
return false if @id.nil?
|
188
|
+
return false if @symbol.nil?
|
189
|
+
return false if @raw_symbol.nil?
|
190
|
+
return false if @currency.nil?
|
191
|
+
return false if @type.nil?
|
192
|
+
return false if @currencies.nil?
|
193
|
+
true
|
194
|
+
end
|
195
|
+
|
196
|
+
# Checks equality by comparing each attribute.
|
197
|
+
# @param [Object] Object to be compared
|
198
|
+
def ==(o)
|
199
|
+
return true if self.equal?(o)
|
200
|
+
self.class == o.class &&
|
201
|
+
id == o.id &&
|
202
|
+
symbol == o.symbol &&
|
203
|
+
raw_symbol == o.raw_symbol &&
|
204
|
+
description == o.description &&
|
205
|
+
currency == o.currency &&
|
206
|
+
exchange == o.exchange &&
|
207
|
+
type == o.type &&
|
208
|
+
figi_code == o.figi_code &&
|
209
|
+
figi_instrument == o.figi_instrument &&
|
210
|
+
currencies == o.currencies
|
211
|
+
end
|
212
|
+
|
213
|
+
# @see the `==` method
|
214
|
+
# @param [Object] Object to be compared
|
215
|
+
def eql?(o)
|
216
|
+
self == o
|
217
|
+
end
|
218
|
+
|
219
|
+
# Calculates hash code according to all attributes.
|
220
|
+
# @return [Integer] Hash code
|
221
|
+
def hash
|
222
|
+
[id, symbol, raw_symbol, description, currency, exchange, type, figi_code, figi_instrument, currencies].hash
|
223
|
+
end
|
224
|
+
|
225
|
+
# Builds the object from hash
|
226
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
227
|
+
# @return [Object] Returns the model itself
|
228
|
+
def self.build_from_hash(attributes)
|
229
|
+
new.build_from_hash(attributes)
|
230
|
+
end
|
231
|
+
|
232
|
+
# Builds the object from hash
|
233
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
234
|
+
# @return [Object] Returns the model itself
|
235
|
+
def build_from_hash(attributes)
|
236
|
+
return nil unless attributes.is_a?(Hash)
|
237
|
+
attributes = attributes.transform_keys(&:to_sym)
|
238
|
+
self.class.openapi_types.each_pair do |key, type|
|
239
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
240
|
+
self.send("#{key}=", nil)
|
241
|
+
elsif type =~ /\AArray<(.*)>/i
|
242
|
+
# check to ensure the input is an array given that the attribute
|
243
|
+
# is documented as an array but the input is not
|
244
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
245
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
246
|
+
end
|
247
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
248
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
249
|
+
end
|
250
|
+
end
|
251
|
+
|
252
|
+
self
|
253
|
+
end
|
254
|
+
|
255
|
+
# Deserializes the data based on type
|
256
|
+
# @param string type Data type
|
257
|
+
# @param string value Value to be deserialized
|
258
|
+
# @return [Object] Deserialized data
|
259
|
+
def _deserialize(type, value)
|
260
|
+
case type.to_sym
|
261
|
+
when :Time
|
262
|
+
Time.parse(value)
|
263
|
+
when :Date
|
264
|
+
Date.parse(value)
|
265
|
+
when :String
|
266
|
+
value.to_s
|
267
|
+
when :Integer
|
268
|
+
value.to_i
|
269
|
+
when :Float
|
270
|
+
value.to_f
|
271
|
+
when :Boolean
|
272
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
273
|
+
true
|
274
|
+
else
|
275
|
+
false
|
276
|
+
end
|
277
|
+
when :Object
|
278
|
+
# generic object (usually a Hash), return directly
|
279
|
+
value
|
280
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
281
|
+
inner_type = Regexp.last_match[:inner_type]
|
282
|
+
value.map { |v| _deserialize(inner_type, v) }
|
283
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
284
|
+
k_type = Regexp.last_match[:k_type]
|
285
|
+
v_type = Regexp.last_match[:v_type]
|
286
|
+
{}.tap do |hash|
|
287
|
+
value.each do |k, v|
|
288
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
289
|
+
end
|
290
|
+
end
|
291
|
+
else # model
|
292
|
+
# models (e.g. Pet) or oneOf
|
293
|
+
klass = SnapTrade.const_get(type)
|
294
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
295
|
+
end
|
296
|
+
end
|
297
|
+
|
298
|
+
# Returns the string representation of the object
|
299
|
+
# @return [String] String presentation of the object
|
300
|
+
def to_s
|
301
|
+
to_hash.to_s
|
302
|
+
end
|
303
|
+
|
304
|
+
# to_body is an alias to to_hash (backward compatibility)
|
305
|
+
# @return [Hash] Returns the object in the form of hash
|
306
|
+
def to_body
|
307
|
+
to_hash
|
308
|
+
end
|
309
|
+
|
310
|
+
# Returns the object in the form of hash
|
311
|
+
# @return [Hash] Returns the object in the form of hash
|
312
|
+
def to_hash
|
313
|
+
hash = {}
|
314
|
+
self.class.attribute_map.each_pair do |attr, param|
|
315
|
+
value = self.send(attr)
|
316
|
+
if value.nil?
|
317
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
318
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
319
|
+
end
|
320
|
+
|
321
|
+
hash[param] = _to_hash(value)
|
322
|
+
end
|
323
|
+
hash
|
324
|
+
end
|
325
|
+
|
326
|
+
# Outputs non-array value in the form of hash
|
327
|
+
# For object, use to_hash. Otherwise, just return the value
|
328
|
+
# @param [Object] value Any valid value
|
329
|
+
# @return [Hash] Returns the value in the form of hash
|
330
|
+
def _to_hash(value)
|
331
|
+
if value.is_a?(Array)
|
332
|
+
value.compact.map { |v| _to_hash(v) }
|
333
|
+
elsif value.is_a?(Hash)
|
334
|
+
{}.tap do |hash|
|
335
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
336
|
+
end
|
337
|
+
elsif value.respond_to? :to_hash
|
338
|
+
value.to_hash
|
339
|
+
else
|
340
|
+
value
|
341
|
+
end
|
342
|
+
end
|
343
|
+
|
344
|
+
end
|
345
|
+
|
346
|
+
end
|
data/lib/snaptrade/version.rb
CHANGED
data/lib/snaptrade.rb
CHANGED
@@ -24,6 +24,8 @@ require 'snaptrade/models/account_holdings_account'
|
|
24
24
|
require 'snaptrade/models/account_order_record'
|
25
25
|
require 'snaptrade/models/account_order_record_child_brokerage_order_ids'
|
26
26
|
require 'snaptrade/models/account_order_record_option_symbol'
|
27
|
+
require 'snaptrade/models/account_order_record_quote_currency'
|
28
|
+
require 'snaptrade/models/account_order_record_quote_universal_symbol'
|
27
29
|
require 'snaptrade/models/account_order_record_status'
|
28
30
|
require 'snaptrade/models/account_order_record_universal_symbol'
|
29
31
|
require 'snaptrade/models/account_simple'
|
@@ -0,0 +1,41 @@
|
|
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::AccountOrderRecordQuoteCurrency
|
15
|
+
describe SnapTrade::AccountOrderRecordQuoteCurrency do
|
16
|
+
let(:instance) { SnapTrade::AccountOrderRecordQuoteCurrency.new }
|
17
|
+
|
18
|
+
describe 'test an instance of AccountOrderRecordQuoteCurrency' do
|
19
|
+
it 'should create an instance of AccountOrderRecordQuoteCurrency' do
|
20
|
+
expect(instance).to be_instance_of(SnapTrade::AccountOrderRecordQuoteCurrency)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
describe 'test attribute "id"' 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 "code"' 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 "name"' 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
|
+
end
|
@@ -0,0 +1,83 @@
|
|
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::AccountOrderRecordQuoteUniversalSymbol
|
15
|
+
describe SnapTrade::AccountOrderRecordQuoteUniversalSymbol do
|
16
|
+
let(:instance) { SnapTrade::AccountOrderRecordQuoteUniversalSymbol.new }
|
17
|
+
|
18
|
+
describe 'test an instance of AccountOrderRecordQuoteUniversalSymbol' do
|
19
|
+
it 'should create an instance of AccountOrderRecordQuoteUniversalSymbol' do
|
20
|
+
expect(instance).to be_instance_of(SnapTrade::AccountOrderRecordQuoteUniversalSymbol)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
describe 'test attribute "id"' 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 "symbol"' 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 "raw_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 "description"' 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 "currency"' 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 "exchange"' 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 "type"' 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_code"' 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
|
+
describe 'test attribute "figi_instrument"' do
|
72
|
+
it 'should work' do
|
73
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
describe 'test attribute "currencies"' do
|
78
|
+
it 'should work' do
|
79
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
@@ -44,6 +44,18 @@ describe SnapTrade::AccountOrderRecord do
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
+
describe 'test attribute "quote_universal_symbol"' 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 "quote_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
|
+
|
47
59
|
describe 'test attribute "action"' do
|
48
60
|
it 'should work' do
|
49
61
|
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: snaptrade
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.86
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SnapTrade
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-03-
|
11
|
+
date: 2025-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -104,6 +104,8 @@ files:
|
|
104
104
|
- lib/snaptrade/models/account_order_record.rb
|
105
105
|
- lib/snaptrade/models/account_order_record_child_brokerage_order_ids.rb
|
106
106
|
- lib/snaptrade/models/account_order_record_option_symbol.rb
|
107
|
+
- lib/snaptrade/models/account_order_record_quote_currency.rb
|
108
|
+
- lib/snaptrade/models/account_order_record_quote_universal_symbol.rb
|
107
109
|
- lib/snaptrade/models/account_order_record_status.rb
|
108
110
|
- lib/snaptrade/models/account_order_record_universal_symbol.rb
|
109
111
|
- lib/snaptrade/models/account_simple.rb
|
@@ -251,6 +253,8 @@ files:
|
|
251
253
|
- spec/models/account_holdings_spec.rb
|
252
254
|
- spec/models/account_order_record_child_brokerage_order_ids_spec.rb
|
253
255
|
- spec/models/account_order_record_option_symbol_spec.rb
|
256
|
+
- spec/models/account_order_record_quote_currency_spec.rb
|
257
|
+
- spec/models/account_order_record_quote_universal_symbol_spec.rb
|
254
258
|
- spec/models/account_order_record_spec.rb
|
255
259
|
- spec/models/account_order_record_status_spec.rb
|
256
260
|
- spec/models/account_order_record_universal_symbol_spec.rb
|
@@ -493,6 +497,7 @@ test_files:
|
|
493
497
|
- spec/models/monthly_dividends_spec.rb
|
494
498
|
- spec/models/trading_crypto_spot_place_order_request_spec.rb
|
495
499
|
- spec/models/snap_trade_register_user_request_body_spec.rb
|
500
|
+
- spec/models/account_order_record_quote_currency_spec.rb
|
496
501
|
- spec/models/crypto_spot_order_preview_spec.rb
|
497
502
|
- spec/models/status_spec.rb
|
498
503
|
- spec/models/account_sync_status_spec.rb
|
@@ -553,5 +558,6 @@ test_files:
|
|
553
558
|
- spec/models/brokerage_authorization_type_read_only_spec.rb
|
554
559
|
- spec/models/option_brokerage_symbol_spec.rb
|
555
560
|
- spec/models/crypto_spot_quote_spec.rb
|
561
|
+
- spec/models/account_order_record_quote_universal_symbol_spec.rb
|
556
562
|
- spec/models/manual_trade_symbol_spec.rb
|
557
563
|
- spec/spec_helper.rb
|