snaptrade 2.0.177 → 2.0.178
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 +2 -2
- data/lib/snaptrade/models/account_order_record.rb +11 -1
- data/lib/snaptrade/models/account_order_record_trailing_stop.rb +245 -0
- data/lib/snaptrade/models/account_order_record_v2.rb +11 -1
- data/lib/snaptrade/models/brokerage_authorization_type_read_only.rb +1 -1
- data/lib/snaptrade/models/brokerage_authorization_type_read_only_type.rb +37 -0
- data/lib/snaptrade/models/order_updated_response_order.rb +11 -1
- data/lib/snaptrade/models/trailing_stop.rb +238 -0
- data/lib/snaptrade/models/type.rb +3 -3
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +3 -0
- data/spec/models/account_order_record_spec.rb +6 -0
- data/spec/models/account_order_record_trailing_stop_spec.rb +35 -0
- data/spec/models/account_order_record_v2_spec.rb +6 -0
- data/spec/models/brokerage_authorization_type_read_only_type_spec.rb +23 -0
- data/spec/models/order_updated_response_order_spec.rb +6 -0
- data/spec/models/trailing_stop_spec.rb +35 -0
- metadata +11 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3aee02b8395b2541364299b60491489481dce44bdb9e6984168d940656c68ecc
|
|
4
|
+
data.tar.gz: e45b885174875715a1868d72c19f98b03a5e8d3b7ce74644de5aebdbf6afc8f1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3ca23922cf82d18208ca9214ac59ed62d47dc8a0a8d042d7ff48ce240251e8c8a63235c45be5466800325f4583224ac66ed09d57208483daa3e42f1aba1e36b5
|
|
7
|
+
data.tar.gz: f4ce20b7fa4965cd8605a70ccc8f44c6a72ecd7a5005bf43851e3973e0aa77b71a9b41d1a812821d403f6c3ff308228f9ac103dcd4d46fee706934af64ec15a4
|
data/Gemfile.lock
CHANGED
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.178)
|
|
10
10
|
[](https://snaptrade.com/)
|
|
11
11
|
|
|
12
12
|
</div>
|
|
@@ -87,7 +87,7 @@ Connect brokerage accounts to your app for live positions and trading
|
|
|
87
87
|
Add to Gemfile:
|
|
88
88
|
|
|
89
89
|
```ruby
|
|
90
|
-
gem 'snaptrade', '~> 2.0.
|
|
90
|
+
gem 'snaptrade', '~> 2.0.178'
|
|
91
91
|
```
|
|
92
92
|
|
|
93
93
|
## Getting Started<a id="getting-started"></a>
|
|
@@ -51,6 +51,8 @@ module SnapTrade
|
|
|
51
51
|
# The stop price is the price at which a stop order is triggered. Should only apply to `Stop` and `StopLimit` orders. For option orders, this represents the price per share.
|
|
52
52
|
attr_accessor :stop_price
|
|
53
53
|
|
|
54
|
+
attr_accessor :trailing_stop
|
|
55
|
+
|
|
54
56
|
# The type of order placed. The most common values are `Market`, `Limit`, `Stop`, and `StopLimit`. We try our best to map brokerage order types to these values. When mapping fails, we will return the brokerage's order type value.
|
|
55
57
|
attr_accessor :order_type
|
|
56
58
|
|
|
@@ -91,6 +93,7 @@ module SnapTrade
|
|
|
91
93
|
:'execution_price' => :'execution_price',
|
|
92
94
|
:'limit_price' => :'limit_price',
|
|
93
95
|
:'stop_price' => :'stop_price',
|
|
96
|
+
:'trailing_stop' => :'trailing_stop',
|
|
94
97
|
:'order_type' => :'order_type',
|
|
95
98
|
:'time_in_force' => :'time_in_force',
|
|
96
99
|
:'time_placed' => :'time_placed',
|
|
@@ -124,6 +127,7 @@ module SnapTrade
|
|
|
124
127
|
:'execution_price' => :'Float',
|
|
125
128
|
:'limit_price' => :'Float',
|
|
126
129
|
:'stop_price' => :'Float',
|
|
130
|
+
:'trailing_stop' => :'AccountOrderRecordTrailingStop',
|
|
127
131
|
:'order_type' => :'String',
|
|
128
132
|
:'time_in_force' => :'String',
|
|
129
133
|
:'time_placed' => :'Time',
|
|
@@ -145,6 +149,7 @@ module SnapTrade
|
|
|
145
149
|
:'execution_price',
|
|
146
150
|
:'limit_price',
|
|
147
151
|
:'stop_price',
|
|
152
|
+
:'trailing_stop',
|
|
148
153
|
:'order_type',
|
|
149
154
|
:'time_updated',
|
|
150
155
|
:'time_executed',
|
|
@@ -224,6 +229,10 @@ module SnapTrade
|
|
|
224
229
|
self.stop_price = attributes[:'stop_price']
|
|
225
230
|
end
|
|
226
231
|
|
|
232
|
+
if attributes.key?(:'trailing_stop')
|
|
233
|
+
self.trailing_stop = attributes[:'trailing_stop']
|
|
234
|
+
end
|
|
235
|
+
|
|
227
236
|
if attributes.key?(:'order_type')
|
|
228
237
|
self.order_type = attributes[:'order_type']
|
|
229
238
|
end
|
|
@@ -289,6 +298,7 @@ module SnapTrade
|
|
|
289
298
|
execution_price == o.execution_price &&
|
|
290
299
|
limit_price == o.limit_price &&
|
|
291
300
|
stop_price == o.stop_price &&
|
|
301
|
+
trailing_stop == o.trailing_stop &&
|
|
292
302
|
order_type == o.order_type &&
|
|
293
303
|
time_in_force == o.time_in_force &&
|
|
294
304
|
time_placed == o.time_placed &&
|
|
@@ -308,7 +318,7 @@ module SnapTrade
|
|
|
308
318
|
# Calculates hash code according to all attributes.
|
|
309
319
|
# @return [Integer] Hash code
|
|
310
320
|
def 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
|
|
321
|
+
[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
|
|
312
322
|
end
|
|
313
323
|
|
|
314
324
|
# 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
|
+
# For trailing stop orders, contains the trail configuration. Null for all other order types.
|
|
15
|
+
class AccountOrderRecordTrailingStop
|
|
16
|
+
# The trail amount. Interpreted as dollars if `type` is `DOLLAR`, or a percentage if `type` is `PERCENT`.
|
|
17
|
+
attr_accessor :amount
|
|
18
|
+
|
|
19
|
+
# Whether the trail `amount` is a dollar amount (`DOLLAR`) or a percentage (`PERCENT`). For example, if `amount` is \"0.60\" and `type` is `DOLLAR`, the stop price will trail the market price by $0.60. If `amount` is \"5\" and `type` is `PERCENT`, the stop price will trail the market price by 5%.
|
|
20
|
+
attr_accessor :type
|
|
21
|
+
|
|
22
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
23
|
+
def self.attribute_map
|
|
24
|
+
{
|
|
25
|
+
:'amount' => :'amount',
|
|
26
|
+
:'type' => :'type'
|
|
27
|
+
}
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Returns all the JSON keys this model knows about
|
|
31
|
+
def self.acceptable_attributes
|
|
32
|
+
attribute_map.values
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Attribute type mapping.
|
|
36
|
+
def self.openapi_types
|
|
37
|
+
{
|
|
38
|
+
:'amount' => :'String',
|
|
39
|
+
:'type' => :'Type'
|
|
40
|
+
}
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# List of attributes with nullable: true
|
|
44
|
+
def self.openapi_nullable
|
|
45
|
+
Set.new([
|
|
46
|
+
])
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# List of class defined in allOf (OpenAPI v3)
|
|
50
|
+
def self.openapi_all_of
|
|
51
|
+
[
|
|
52
|
+
:'TrailingStop'
|
|
53
|
+
]
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Initializes the object
|
|
57
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
58
|
+
def initialize(attributes = {})
|
|
59
|
+
if (!attributes.is_a?(Hash))
|
|
60
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::AccountOrderRecordTrailingStop` initialize method"
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
64
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
65
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
66
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::AccountOrderRecordTrailingStop`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
67
|
+
end
|
|
68
|
+
h[k.to_sym] = v
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if attributes.key?(:'amount')
|
|
72
|
+
self.amount = attributes[:'amount']
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
if attributes.key?(:'type')
|
|
76
|
+
self.type = attributes[:'type']
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
81
|
+
# @return Array for valid properties with the reasons
|
|
82
|
+
def list_invalid_properties
|
|
83
|
+
invalid_properties = Array.new
|
|
84
|
+
if @amount.nil?
|
|
85
|
+
invalid_properties.push('invalid value for "amount", amount cannot be nil.')
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
if @type.nil?
|
|
89
|
+
invalid_properties.push('invalid value for "type", type cannot be nil.')
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
invalid_properties
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# Check to see if the all the properties in the model are valid
|
|
96
|
+
# @return true if the model is valid
|
|
97
|
+
def valid?
|
|
98
|
+
return false if @amount.nil?
|
|
99
|
+
return false if @type.nil?
|
|
100
|
+
true
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Checks equality by comparing each attribute.
|
|
104
|
+
# @param [Object] Object to be compared
|
|
105
|
+
def ==(o)
|
|
106
|
+
return true if self.equal?(o)
|
|
107
|
+
self.class == o.class &&
|
|
108
|
+
amount == o.amount &&
|
|
109
|
+
type == o.type
|
|
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
|
+
[amount, type].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
|
|
@@ -43,6 +43,8 @@ module SnapTrade
|
|
|
43
43
|
# The stop price is the price at which a stop order is triggered. Should only apply to `Stop` and `StopLimit` orders.
|
|
44
44
|
attr_accessor :stop_price
|
|
45
45
|
|
|
46
|
+
attr_accessor :trailing_stop
|
|
47
|
+
|
|
46
48
|
# List of legs that make up the order.
|
|
47
49
|
attr_accessor :legs
|
|
48
50
|
|
|
@@ -59,6 +61,7 @@ module SnapTrade
|
|
|
59
61
|
:'execution_price' => :'execution_price',
|
|
60
62
|
:'limit_price' => :'limit_price',
|
|
61
63
|
:'stop_price' => :'stop_price',
|
|
64
|
+
:'trailing_stop' => :'trailing_stop',
|
|
62
65
|
:'legs' => :'legs'
|
|
63
66
|
}
|
|
64
67
|
end
|
|
@@ -81,6 +84,7 @@ module SnapTrade
|
|
|
81
84
|
:'execution_price' => :'Float',
|
|
82
85
|
:'limit_price' => :'Float',
|
|
83
86
|
:'stop_price' => :'Float',
|
|
87
|
+
:'trailing_stop' => :'AccountOrderRecordTrailingStop',
|
|
84
88
|
:'legs' => :'Array<AccountOrderRecordLeg>'
|
|
85
89
|
}
|
|
86
90
|
end
|
|
@@ -93,6 +97,7 @@ module SnapTrade
|
|
|
93
97
|
:'execution_price',
|
|
94
98
|
:'limit_price',
|
|
95
99
|
:'stop_price',
|
|
100
|
+
:'trailing_stop',
|
|
96
101
|
])
|
|
97
102
|
end
|
|
98
103
|
|
|
@@ -151,6 +156,10 @@ module SnapTrade
|
|
|
151
156
|
self.stop_price = attributes[:'stop_price']
|
|
152
157
|
end
|
|
153
158
|
|
|
159
|
+
if attributes.key?(:'trailing_stop')
|
|
160
|
+
self.trailing_stop = attributes[:'trailing_stop']
|
|
161
|
+
end
|
|
162
|
+
|
|
154
163
|
if attributes.key?(:'legs')
|
|
155
164
|
if (value = attributes[:'legs']).is_a?(Array)
|
|
156
165
|
self.legs = value
|
|
@@ -186,6 +195,7 @@ module SnapTrade
|
|
|
186
195
|
execution_price == o.execution_price &&
|
|
187
196
|
limit_price == o.limit_price &&
|
|
188
197
|
stop_price == o.stop_price &&
|
|
198
|
+
trailing_stop == o.trailing_stop &&
|
|
189
199
|
legs == o.legs
|
|
190
200
|
end
|
|
191
201
|
|
|
@@ -198,7 +208,7 @@ module SnapTrade
|
|
|
198
208
|
# Calculates hash code according to all attributes.
|
|
199
209
|
# @return [Integer] Hash code
|
|
200
210
|
def hash
|
|
201
|
-
[brokerage_order_id, status, order_type, time_in_force, time_placed, time_executed, quote_currency, execution_price, limit_price, stop_price, legs].hash
|
|
211
|
+
[brokerage_order_id, status, order_type, time_in_force, time_placed, time_executed, quote_currency, execution_price, limit_price, stop_price, trailing_stop, legs].hash
|
|
202
212
|
end
|
|
203
213
|
|
|
204
214
|
# Builds the object from hash
|
|
@@ -0,0 +1,37 @@
|
|
|
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 BrokerageAuthorizationTypeReadOnlyType
|
|
15
|
+
READ = "read".freeze
|
|
16
|
+
TRADE = "trade".freeze
|
|
17
|
+
|
|
18
|
+
def self.all_vars
|
|
19
|
+
@all_vars ||= [READ, TRADE].freeze
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# Builds the enum from string
|
|
23
|
+
# @param [String] The enum value in the form of the string
|
|
24
|
+
# @return [String] The enum value
|
|
25
|
+
def self.build_from_hash(value)
|
|
26
|
+
new.build_from_hash(value)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Builds the enum from string
|
|
30
|
+
# @param [String] The enum value in the form of the string
|
|
31
|
+
# @return [String] The enum value
|
|
32
|
+
def build_from_hash(value)
|
|
33
|
+
return value if BrokerageAuthorizationTypeReadOnlyType.all_vars.include?(value)
|
|
34
|
+
raise "Invalid ENUM value #{value} for class #BrokerageAuthorizationTypeReadOnlyType"
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -50,6 +50,8 @@ module SnapTrade
|
|
|
50
50
|
# The stop price is the price at which a stop order is triggered. Should only apply to `Stop` and `StopLimit` orders. For option orders, this represents the price per share.
|
|
51
51
|
attr_accessor :stop_price
|
|
52
52
|
|
|
53
|
+
attr_accessor :trailing_stop
|
|
54
|
+
|
|
53
55
|
# The type of order placed. The most common values are `Market`, `Limit`, `Stop`, and `StopLimit`. We try our best to map brokerage order types to these values. When mapping fails, we will return the brokerage's order type value.
|
|
54
56
|
attr_accessor :order_type
|
|
55
57
|
|
|
@@ -90,6 +92,7 @@ module SnapTrade
|
|
|
90
92
|
:'execution_price' => :'execution_price',
|
|
91
93
|
:'limit_price' => :'limit_price',
|
|
92
94
|
:'stop_price' => :'stop_price',
|
|
95
|
+
:'trailing_stop' => :'trailing_stop',
|
|
93
96
|
:'order_type' => :'order_type',
|
|
94
97
|
:'time_in_force' => :'time_in_force',
|
|
95
98
|
:'time_placed' => :'time_placed',
|
|
@@ -123,6 +126,7 @@ module SnapTrade
|
|
|
123
126
|
:'execution_price' => :'Float',
|
|
124
127
|
:'limit_price' => :'Float',
|
|
125
128
|
:'stop_price' => :'Float',
|
|
129
|
+
:'trailing_stop' => :'AccountOrderRecordTrailingStop',
|
|
126
130
|
:'order_type' => :'String',
|
|
127
131
|
:'time_in_force' => :'String',
|
|
128
132
|
:'time_placed' => :'Time',
|
|
@@ -144,6 +148,7 @@ module SnapTrade
|
|
|
144
148
|
:'execution_price',
|
|
145
149
|
:'limit_price',
|
|
146
150
|
:'stop_price',
|
|
151
|
+
:'trailing_stop',
|
|
147
152
|
:'order_type',
|
|
148
153
|
:'time_updated',
|
|
149
154
|
:'time_executed',
|
|
@@ -230,6 +235,10 @@ module SnapTrade
|
|
|
230
235
|
self.stop_price = attributes[:'stop_price']
|
|
231
236
|
end
|
|
232
237
|
|
|
238
|
+
if attributes.key?(:'trailing_stop')
|
|
239
|
+
self.trailing_stop = attributes[:'trailing_stop']
|
|
240
|
+
end
|
|
241
|
+
|
|
233
242
|
if attributes.key?(:'order_type')
|
|
234
243
|
self.order_type = attributes[:'order_type']
|
|
235
244
|
end
|
|
@@ -295,6 +304,7 @@ module SnapTrade
|
|
|
295
304
|
execution_price == o.execution_price &&
|
|
296
305
|
limit_price == o.limit_price &&
|
|
297
306
|
stop_price == o.stop_price &&
|
|
307
|
+
trailing_stop == o.trailing_stop &&
|
|
298
308
|
order_type == o.order_type &&
|
|
299
309
|
time_in_force == o.time_in_force &&
|
|
300
310
|
time_placed == o.time_placed &&
|
|
@@ -314,7 +324,7 @@ module SnapTrade
|
|
|
314
324
|
# Calculates hash code according to all attributes.
|
|
315
325
|
# @return [Integer] Hash code
|
|
316
326
|
def hash
|
|
317
|
-
[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
|
|
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
|
|
318
328
|
end
|
|
319
329
|
|
|
320
330
|
# Builds the object from hash
|
|
@@ -0,0 +1,238 @@
|
|
|
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
|
+
# Trail configuration for trailing stop orders.
|
|
15
|
+
class TrailingStop
|
|
16
|
+
# The trail amount. Interpreted as dollars if `type` is `DOLLAR`, or a percentage if `type` is `PERCENT`.
|
|
17
|
+
attr_accessor :amount
|
|
18
|
+
|
|
19
|
+
# Whether the trail `amount` is a dollar amount (`DOLLAR`) or a percentage (`PERCENT`). For example, if `amount` is \"0.60\" and `type` is `DOLLAR`, the stop price will trail the market price by $0.60. If `amount` is \"5\" and `type` is `PERCENT`, the stop price will trail the market price by 5%.
|
|
20
|
+
attr_accessor :type
|
|
21
|
+
|
|
22
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
23
|
+
def self.attribute_map
|
|
24
|
+
{
|
|
25
|
+
:'amount' => :'amount',
|
|
26
|
+
:'type' => :'type'
|
|
27
|
+
}
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Returns all the JSON keys this model knows about
|
|
31
|
+
def self.acceptable_attributes
|
|
32
|
+
attribute_map.values
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Attribute type mapping.
|
|
36
|
+
def self.openapi_types
|
|
37
|
+
{
|
|
38
|
+
:'amount' => :'String',
|
|
39
|
+
:'type' => :'Type'
|
|
40
|
+
}
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# List of attributes with nullable: true
|
|
44
|
+
def self.openapi_nullable
|
|
45
|
+
Set.new([
|
|
46
|
+
])
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Initializes the object
|
|
50
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
51
|
+
def initialize(attributes = {})
|
|
52
|
+
if (!attributes.is_a?(Hash))
|
|
53
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::TrailingStop` initialize method"
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
57
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
58
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
59
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::TrailingStop`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
60
|
+
end
|
|
61
|
+
h[k.to_sym] = v
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if attributes.key?(:'amount')
|
|
65
|
+
self.amount = attributes[:'amount']
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
if attributes.key?(:'type')
|
|
69
|
+
self.type = attributes[:'type']
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
74
|
+
# @return Array for valid properties with the reasons
|
|
75
|
+
def list_invalid_properties
|
|
76
|
+
invalid_properties = Array.new
|
|
77
|
+
if @amount.nil?
|
|
78
|
+
invalid_properties.push('invalid value for "amount", amount cannot be nil.')
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
if @type.nil?
|
|
82
|
+
invalid_properties.push('invalid value for "type", type cannot be nil.')
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
invalid_properties
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# Check to see if the all the properties in the model are valid
|
|
89
|
+
# @return true if the model is valid
|
|
90
|
+
def valid?
|
|
91
|
+
return false if @amount.nil?
|
|
92
|
+
return false if @type.nil?
|
|
93
|
+
true
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# Checks equality by comparing each attribute.
|
|
97
|
+
# @param [Object] Object to be compared
|
|
98
|
+
def ==(o)
|
|
99
|
+
return true if self.equal?(o)
|
|
100
|
+
self.class == o.class &&
|
|
101
|
+
amount == o.amount &&
|
|
102
|
+
type == o.type
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# @see the `==` method
|
|
106
|
+
# @param [Object] Object to be compared
|
|
107
|
+
def eql?(o)
|
|
108
|
+
self == o
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# Calculates hash code according to all attributes.
|
|
112
|
+
# @return [Integer] Hash code
|
|
113
|
+
def hash
|
|
114
|
+
[amount, type].hash
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
# Builds the object from hash
|
|
118
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
119
|
+
# @return [Object] Returns the model itself
|
|
120
|
+
def self.build_from_hash(attributes)
|
|
121
|
+
new.build_from_hash(attributes)
|
|
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 build_from_hash(attributes)
|
|
128
|
+
return nil unless attributes.is_a?(Hash)
|
|
129
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
130
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
131
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
132
|
+
self.send("#{key}=", nil)
|
|
133
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
134
|
+
# check to ensure the input is an array given that the attribute
|
|
135
|
+
# is documented as an array but the input is not
|
|
136
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
137
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
138
|
+
end
|
|
139
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
140
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
self
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
# Deserializes the data based on type
|
|
148
|
+
# @param string type Data type
|
|
149
|
+
# @param string value Value to be deserialized
|
|
150
|
+
# @return [Object] Deserialized data
|
|
151
|
+
def _deserialize(type, value)
|
|
152
|
+
case type.to_sym
|
|
153
|
+
when :Time
|
|
154
|
+
Time.parse(value)
|
|
155
|
+
when :Date
|
|
156
|
+
Date.parse(value)
|
|
157
|
+
when :String
|
|
158
|
+
value.to_s
|
|
159
|
+
when :Integer
|
|
160
|
+
value.to_i
|
|
161
|
+
when :Float
|
|
162
|
+
value.to_f
|
|
163
|
+
when :Boolean
|
|
164
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
165
|
+
true
|
|
166
|
+
else
|
|
167
|
+
false
|
|
168
|
+
end
|
|
169
|
+
when :Object
|
|
170
|
+
# generic object (usually a Hash), return directly
|
|
171
|
+
value
|
|
172
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
173
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
174
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
175
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
176
|
+
k_type = Regexp.last_match[:k_type]
|
|
177
|
+
v_type = Regexp.last_match[:v_type]
|
|
178
|
+
{}.tap do |hash|
|
|
179
|
+
value.each do |k, v|
|
|
180
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
181
|
+
end
|
|
182
|
+
end
|
|
183
|
+
else # model
|
|
184
|
+
# models (e.g. Pet) or oneOf
|
|
185
|
+
klass = SnapTrade.const_get(type)
|
|
186
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
187
|
+
end
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
# Returns the string representation of the object
|
|
191
|
+
# @return [String] String presentation of the object
|
|
192
|
+
def to_s
|
|
193
|
+
to_hash.to_s
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
197
|
+
# @return [Hash] Returns the object in the form of hash
|
|
198
|
+
def to_body
|
|
199
|
+
to_hash
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
# Returns the object in the form of hash
|
|
203
|
+
# @return [Hash] Returns the object in the form of hash
|
|
204
|
+
def to_hash
|
|
205
|
+
hash = {}
|
|
206
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
207
|
+
value = self.send(attr)
|
|
208
|
+
if value.nil?
|
|
209
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
210
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
hash[param] = _to_hash(value)
|
|
214
|
+
end
|
|
215
|
+
hash
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
# Outputs non-array value in the form of hash
|
|
219
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
220
|
+
# @param [Object] value Any valid value
|
|
221
|
+
# @return [Hash] Returns the value in the form of hash
|
|
222
|
+
def _to_hash(value)
|
|
223
|
+
if value.is_a?(Array)
|
|
224
|
+
value.compact.map { |v| _to_hash(v) }
|
|
225
|
+
elsif value.is_a?(Hash)
|
|
226
|
+
{}.tap do |hash|
|
|
227
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
228
|
+
end
|
|
229
|
+
elsif value.respond_to? :to_hash
|
|
230
|
+
value.to_hash
|
|
231
|
+
else
|
|
232
|
+
value
|
|
233
|
+
end
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
end
|
|
@@ -12,11 +12,11 @@ require 'time'
|
|
|
12
12
|
|
|
13
13
|
module SnapTrade
|
|
14
14
|
class Type
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
DOLLAR = "DOLLAR".freeze
|
|
16
|
+
PERCENT = "PERCENT".freeze
|
|
17
17
|
|
|
18
18
|
def self.all_vars
|
|
19
|
-
@all_vars ||= [
|
|
19
|
+
@all_vars ||= [DOLLAR, PERCENT].freeze
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
# Builds the enum from string
|
data/lib/snaptrade/version.rb
CHANGED
data/lib/snaptrade.rb
CHANGED
|
@@ -31,6 +31,7 @@ require 'snaptrade/models/account_order_record_quote_currency'
|
|
|
31
31
|
require 'snaptrade/models/account_order_record_quote_universal_symbol'
|
|
32
32
|
require 'snaptrade/models/account_order_record_status'
|
|
33
33
|
require 'snaptrade/models/account_order_record_status_v2'
|
|
34
|
+
require 'snaptrade/models/account_order_record_trailing_stop'
|
|
34
35
|
require 'snaptrade/models/account_order_record_universal_symbol'
|
|
35
36
|
require 'snaptrade/models/account_order_record_v2'
|
|
36
37
|
require 'snaptrade/models/account_orders_v2_response'
|
|
@@ -55,6 +56,7 @@ require 'snaptrade/models/brokerage_authorization_disabled_confirmation'
|
|
|
55
56
|
require 'snaptrade/models/brokerage_authorization_refresh_confirmation'
|
|
56
57
|
require 'snaptrade/models/brokerage_authorization_type_read_only'
|
|
57
58
|
require 'snaptrade/models/brokerage_authorization_type_read_only_brokerage'
|
|
59
|
+
require 'snaptrade/models/brokerage_authorization_type_read_only_type'
|
|
58
60
|
require 'snaptrade/models/brokerage_instrument'
|
|
59
61
|
require 'snaptrade/models/brokerage_instruments_response'
|
|
60
62
|
require 'snaptrade/models/brokerage_type'
|
|
@@ -176,6 +178,7 @@ require 'snaptrade/models/trading_instrument'
|
|
|
176
178
|
require 'snaptrade/models/trading_instrument_type'
|
|
177
179
|
require 'snaptrade/models/trading_search_cryptocurrency_pair_instruments200_response'
|
|
178
180
|
require 'snaptrade/models/trading_session'
|
|
181
|
+
require 'snaptrade/models/trailing_stop'
|
|
179
182
|
require 'snaptrade/models/transactions_status'
|
|
180
183
|
require 'snaptrade/models/type'
|
|
181
184
|
require 'snaptrade/models/us_exchange'
|
|
@@ -104,6 +104,12 @@ describe SnapTrade::AccountOrderRecord do
|
|
|
104
104
|
end
|
|
105
105
|
end
|
|
106
106
|
|
|
107
|
+
describe 'test attribute "trailing_stop"' do
|
|
108
|
+
it 'should work' do
|
|
109
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
|
|
107
113
|
describe 'test attribute "order_type"' do
|
|
108
114
|
it 'should work' do
|
|
109
115
|
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
@@ -0,0 +1,35 @@
|
|
|
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::AccountOrderRecordTrailingStop
|
|
15
|
+
describe SnapTrade::AccountOrderRecordTrailingStop do
|
|
16
|
+
let(:instance) { SnapTrade::AccountOrderRecordTrailingStop.new }
|
|
17
|
+
|
|
18
|
+
describe 'test an instance of AccountOrderRecordTrailingStop' do
|
|
19
|
+
it 'should create an instance of AccountOrderRecordTrailingStop' do
|
|
20
|
+
expect(instance).to be_instance_of(SnapTrade::AccountOrderRecordTrailingStop)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
describe 'test attribute "amount"' 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 "type"' 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
|
+
end
|
|
@@ -80,6 +80,12 @@ describe SnapTrade::AccountOrderRecordV2 do
|
|
|
80
80
|
end
|
|
81
81
|
end
|
|
82
82
|
|
|
83
|
+
describe 'test attribute "trailing_stop"' do
|
|
84
|
+
it 'should work' do
|
|
85
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
83
89
|
describe 'test attribute "legs"' do
|
|
84
90
|
it 'should work' do
|
|
85
91
|
# 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::BrokerageAuthorizationTypeReadOnlyType
|
|
15
|
+
describe SnapTrade::BrokerageAuthorizationTypeReadOnlyType do
|
|
16
|
+
let(:instance) { SnapTrade::BrokerageAuthorizationTypeReadOnlyType.new }
|
|
17
|
+
|
|
18
|
+
describe 'test an instance of BrokerageAuthorizationTypeReadOnlyType' do
|
|
19
|
+
it 'should create an instance of BrokerageAuthorizationTypeReadOnlyType' do
|
|
20
|
+
expect(instance).to be_instance_of(SnapTrade::BrokerageAuthorizationTypeReadOnlyType)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -104,6 +104,12 @@ describe SnapTrade::OrderUpdatedResponseOrder do
|
|
|
104
104
|
end
|
|
105
105
|
end
|
|
106
106
|
|
|
107
|
+
describe 'test attribute "trailing_stop"' do
|
|
108
|
+
it 'should work' do
|
|
109
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
|
|
107
113
|
describe 'test attribute "order_type"' do
|
|
108
114
|
it 'should work' do
|
|
109
115
|
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
@@ -0,0 +1,35 @@
|
|
|
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::TrailingStop
|
|
15
|
+
describe SnapTrade::TrailingStop do
|
|
16
|
+
let(:instance) { SnapTrade::TrailingStop.new }
|
|
17
|
+
|
|
18
|
+
describe 'test an instance of TrailingStop' do
|
|
19
|
+
it 'should create an instance of TrailingStop' do
|
|
20
|
+
expect(instance).to be_instance_of(SnapTrade::TrailingStop)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
describe 'test attribute "amount"' 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 "type"' 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
|
+
end
|
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.178
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- SnapTrade
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-04-
|
|
11
|
+
date: 2026-04-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|
|
@@ -111,6 +111,7 @@ files:
|
|
|
111
111
|
- lib/snaptrade/models/account_order_record_quote_universal_symbol.rb
|
|
112
112
|
- lib/snaptrade/models/account_order_record_status.rb
|
|
113
113
|
- lib/snaptrade/models/account_order_record_status_v2.rb
|
|
114
|
+
- lib/snaptrade/models/account_order_record_trailing_stop.rb
|
|
114
115
|
- lib/snaptrade/models/account_order_record_universal_symbol.rb
|
|
115
116
|
- lib/snaptrade/models/account_order_record_v2.rb
|
|
116
117
|
- lib/snaptrade/models/account_orders_v2_response.rb
|
|
@@ -135,6 +136,7 @@ files:
|
|
|
135
136
|
- lib/snaptrade/models/brokerage_authorization_refresh_confirmation.rb
|
|
136
137
|
- lib/snaptrade/models/brokerage_authorization_type_read_only.rb
|
|
137
138
|
- lib/snaptrade/models/brokerage_authorization_type_read_only_brokerage.rb
|
|
139
|
+
- lib/snaptrade/models/brokerage_authorization_type_read_only_type.rb
|
|
138
140
|
- lib/snaptrade/models/brokerage_instrument.rb
|
|
139
141
|
- lib/snaptrade/models/brokerage_instruments_response.rb
|
|
140
142
|
- lib/snaptrade/models/brokerage_type.rb
|
|
@@ -256,6 +258,7 @@ files:
|
|
|
256
258
|
- lib/snaptrade/models/trading_instrument_type.rb
|
|
257
259
|
- lib/snaptrade/models/trading_search_cryptocurrency_pair_instruments200_response.rb
|
|
258
260
|
- lib/snaptrade/models/trading_session.rb
|
|
261
|
+
- lib/snaptrade/models/trailing_stop.rb
|
|
259
262
|
- lib/snaptrade/models/transactions_status.rb
|
|
260
263
|
- lib/snaptrade/models/type.rb
|
|
261
264
|
- lib/snaptrade/models/underlying_symbol.rb
|
|
@@ -294,6 +297,7 @@ files:
|
|
|
294
297
|
- spec/models/account_order_record_spec.rb
|
|
295
298
|
- spec/models/account_order_record_status_spec.rb
|
|
296
299
|
- spec/models/account_order_record_status_v2_spec.rb
|
|
300
|
+
- spec/models/account_order_record_trailing_stop_spec.rb
|
|
297
301
|
- spec/models/account_order_record_universal_symbol_spec.rb
|
|
298
302
|
- spec/models/account_order_record_v2_spec.rb
|
|
299
303
|
- spec/models/account_orders_v2_response_spec.rb
|
|
@@ -318,6 +322,7 @@ files:
|
|
|
318
322
|
- spec/models/brokerage_authorization_spec.rb
|
|
319
323
|
- spec/models/brokerage_authorization_type_read_only_brokerage_spec.rb
|
|
320
324
|
- spec/models/brokerage_authorization_type_read_only_spec.rb
|
|
325
|
+
- spec/models/brokerage_authorization_type_read_only_type_spec.rb
|
|
321
326
|
- spec/models/brokerage_instrument_spec.rb
|
|
322
327
|
- spec/models/brokerage_instruments_response_spec.rb
|
|
323
328
|
- spec/models/brokerage_spec.rb
|
|
@@ -440,6 +445,7 @@ files:
|
|
|
440
445
|
- spec/models/trading_instrument_type_spec.rb
|
|
441
446
|
- spec/models/trading_search_cryptocurrency_pair_instruments200_response_spec.rb
|
|
442
447
|
- spec/models/trading_session_spec.rb
|
|
448
|
+
- spec/models/trailing_stop_spec.rb
|
|
443
449
|
- spec/models/transactions_status_spec.rb
|
|
444
450
|
- spec/models/type_spec.rb
|
|
445
451
|
- spec/models/underlying_symbol_exchange_spec.rb
|
|
@@ -541,6 +547,7 @@ test_files:
|
|
|
541
547
|
- spec/models/manual_trade_form_spec.rb
|
|
542
548
|
- spec/models/account_holdings_account_spec.rb
|
|
543
549
|
- spec/models/net_contributions_spec.rb
|
|
550
|
+
- spec/models/trailing_stop_spec.rb
|
|
544
551
|
- spec/models/option_strategy_legs_inner_spec.rb
|
|
545
552
|
- spec/models/account_balance_total_spec.rb
|
|
546
553
|
- spec/models/account_order_record_status_v2_spec.rb
|
|
@@ -596,6 +603,7 @@ test_files:
|
|
|
596
603
|
- spec/models/crypto_trading_instrument_spec.rb
|
|
597
604
|
- spec/models/status_spec.rb
|
|
598
605
|
- spec/models/rate_of_return_object_spec.rb
|
|
606
|
+
- spec/models/account_order_record_trailing_stop_spec.rb
|
|
599
607
|
- spec/models/performance_custom_spec.rb
|
|
600
608
|
- spec/models/option_leg_spec.rb
|
|
601
609
|
- spec/models/simple_order_form_spec.rb
|
|
@@ -603,6 +611,7 @@ test_files:
|
|
|
603
611
|
- spec/models/session_event_type_spec.rb
|
|
604
612
|
- spec/models/position_currency_spec.rb
|
|
605
613
|
- spec/models/figi_instrument_spec.rb
|
|
614
|
+
- spec/models/brokerage_authorization_type_read_only_type_spec.rb
|
|
606
615
|
- spec/models/notional_value_spec.rb
|
|
607
616
|
- spec/models/partner_data_spec.rb
|
|
608
617
|
- spec/models/account_simple_spec.rb
|