snaptrade 2.0.38 → 2.0.39
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +92 -58
- data/lib/snaptrade/api/options_api.rb +4 -4
- data/lib/snaptrade/api/trading_api.rb +106 -106
- data/lib/snaptrade/models/manual_trade.rb +7 -5
- data/lib/snaptrade/models/manual_trade_and_impact.rb +2 -2
- data/lib/snaptrade/models/manual_trade_balance.rb +3 -3
- data/lib/snaptrade/models/manual_trade_form.rb +52 -25
- data/lib/snaptrade/models/manual_trade_impact.rb +260 -0
- data/lib/snaptrade/models/manual_trade_symbol.rb +6 -1
- data/lib/snaptrade/models/notional_value.rb +1 -1
- data/lib/snaptrade/models/options_place_option_strategy_request.rb +2 -2
- data/lib/snaptrade/models/symbols_quotes_inner.rb +15 -10
- data/lib/snaptrade/models/trading_cancel_user_account_order_request.rb +1 -0
- data/lib/snaptrade/models/validated_trade_body.rb +1 -2
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +1 -0
- data/spec/api/trading_api_spec.rb +15 -15
- data/spec/models/manual_trade_form_spec.rb +6 -6
- data/spec/models/manual_trade_impact_spec.rb +53 -0
- data/spec/models/symbols_quotes_inner_spec.rb +3 -3
- metadata +5 -2
@@ -11,29 +11,31 @@ require 'date'
|
|
11
11
|
require 'time'
|
12
12
|
|
13
13
|
module SnapTrade
|
14
|
-
#
|
14
|
+
# Inputs for placing an order with the brokerage.
|
15
15
|
class ManualTradeForm
|
16
|
+
# Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
|
16
17
|
attr_accessor :account_id
|
17
18
|
|
18
|
-
#
|
19
|
+
# The action describes the intent or side of a trade. This is either `BUY` or `SELL`
|
19
20
|
attr_accessor :action
|
20
21
|
|
21
|
-
#
|
22
|
+
# Unique identifier for the symbol within SnapTrade. This is the ID used to reference the symbol in SnapTrade API calls.
|
23
|
+
attr_accessor :universal_symbol_id
|
24
|
+
|
25
|
+
# The type of order to place. - For `Limit` and `StopLimit` orders, the `price` field is required. - For `Stop` and `StopLimit` orders, the `stop` field is required.
|
22
26
|
attr_accessor :order_type
|
23
27
|
|
24
|
-
#
|
28
|
+
# The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely.
|
29
|
+
attr_accessor :time_in_force
|
30
|
+
|
31
|
+
# The limit price for `Limit` and `StopLimit` orders.
|
25
32
|
attr_accessor :price
|
26
33
|
|
27
|
-
#
|
34
|
+
# The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
|
28
35
|
attr_accessor :stop
|
29
36
|
|
30
|
-
# Trade time in force examples: * FOK - Fill Or Kill * Day - Day * GTC - Good Til Canceled
|
31
|
-
attr_accessor :time_in_force
|
32
|
-
|
33
37
|
attr_accessor :units
|
34
38
|
|
35
|
-
attr_accessor :universal_symbol_id
|
36
|
-
|
37
39
|
attr_accessor :notional_value
|
38
40
|
|
39
41
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -41,12 +43,12 @@ module SnapTrade
|
|
41
43
|
{
|
42
44
|
:'account_id' => :'account_id',
|
43
45
|
:'action' => :'action',
|
46
|
+
:'universal_symbol_id' => :'universal_symbol_id',
|
44
47
|
:'order_type' => :'order_type',
|
48
|
+
:'time_in_force' => :'time_in_force',
|
45
49
|
:'price' => :'price',
|
46
50
|
:'stop' => :'stop',
|
47
|
-
:'time_in_force' => :'time_in_force',
|
48
51
|
:'units' => :'units',
|
49
|
-
:'universal_symbol_id' => :'universal_symbol_id',
|
50
52
|
:'notional_value' => :'notional_value'
|
51
53
|
}
|
52
54
|
end
|
@@ -61,12 +63,12 @@ module SnapTrade
|
|
61
63
|
{
|
62
64
|
:'account_id' => :'String',
|
63
65
|
:'action' => :'ActionStrict',
|
66
|
+
:'universal_symbol_id' => :'String',
|
64
67
|
:'order_type' => :'OrderTypeStrict',
|
68
|
+
:'time_in_force' => :'TimeInForceStrict',
|
65
69
|
:'price' => :'Float',
|
66
70
|
:'stop' => :'Float',
|
67
|
-
:'time_in_force' => :'TimeInForceStrict',
|
68
71
|
:'units' => :'Float',
|
69
|
-
:'universal_symbol_id' => :'String',
|
70
72
|
:'notional_value' => :'ManualTradeFormNotionalValue'
|
71
73
|
}
|
72
74
|
end
|
@@ -104,10 +106,18 @@ module SnapTrade
|
|
104
106
|
self.action = attributes[:'action']
|
105
107
|
end
|
106
108
|
|
109
|
+
if attributes.key?(:'universal_symbol_id')
|
110
|
+
self.universal_symbol_id = attributes[:'universal_symbol_id']
|
111
|
+
end
|
112
|
+
|
107
113
|
if attributes.key?(:'order_type')
|
108
114
|
self.order_type = attributes[:'order_type']
|
109
115
|
end
|
110
116
|
|
117
|
+
if attributes.key?(:'time_in_force')
|
118
|
+
self.time_in_force = attributes[:'time_in_force']
|
119
|
+
end
|
120
|
+
|
111
121
|
if attributes.key?(:'price')
|
112
122
|
self.price = attributes[:'price']
|
113
123
|
end
|
@@ -116,18 +126,10 @@ module SnapTrade
|
|
116
126
|
self.stop = attributes[:'stop']
|
117
127
|
end
|
118
128
|
|
119
|
-
if attributes.key?(:'time_in_force')
|
120
|
-
self.time_in_force = attributes[:'time_in_force']
|
121
|
-
end
|
122
|
-
|
123
129
|
if attributes.key?(:'units')
|
124
130
|
self.units = attributes[:'units']
|
125
131
|
end
|
126
132
|
|
127
|
-
if attributes.key?(:'universal_symbol_id')
|
128
|
-
self.universal_symbol_id = attributes[:'universal_symbol_id']
|
129
|
-
end
|
130
|
-
|
131
133
|
if attributes.key?(:'notional_value')
|
132
134
|
self.notional_value = attributes[:'notional_value']
|
133
135
|
end
|
@@ -137,12 +139,37 @@ module SnapTrade
|
|
137
139
|
# @return Array for valid properties with the reasons
|
138
140
|
def list_invalid_properties
|
139
141
|
invalid_properties = Array.new
|
142
|
+
if @account_id.nil?
|
143
|
+
invalid_properties.push('invalid value for "account_id", account_id cannot be nil.')
|
144
|
+
end
|
145
|
+
|
146
|
+
if @action.nil?
|
147
|
+
invalid_properties.push('invalid value for "action", action cannot be nil.')
|
148
|
+
end
|
149
|
+
|
150
|
+
if @universal_symbol_id.nil?
|
151
|
+
invalid_properties.push('invalid value for "universal_symbol_id", universal_symbol_id cannot be nil.')
|
152
|
+
end
|
153
|
+
|
154
|
+
if @order_type.nil?
|
155
|
+
invalid_properties.push('invalid value for "order_type", order_type cannot be nil.')
|
156
|
+
end
|
157
|
+
|
158
|
+
if @time_in_force.nil?
|
159
|
+
invalid_properties.push('invalid value for "time_in_force", time_in_force cannot be nil.')
|
160
|
+
end
|
161
|
+
|
140
162
|
invalid_properties
|
141
163
|
end
|
142
164
|
|
143
165
|
# Check to see if the all the properties in the model are valid
|
144
166
|
# @return true if the model is valid
|
145
167
|
def valid?
|
168
|
+
return false if @account_id.nil?
|
169
|
+
return false if @action.nil?
|
170
|
+
return false if @universal_symbol_id.nil?
|
171
|
+
return false if @order_type.nil?
|
172
|
+
return false if @time_in_force.nil?
|
146
173
|
true
|
147
174
|
end
|
148
175
|
|
@@ -153,12 +180,12 @@ module SnapTrade
|
|
153
180
|
self.class == o.class &&
|
154
181
|
account_id == o.account_id &&
|
155
182
|
action == o.action &&
|
183
|
+
universal_symbol_id == o.universal_symbol_id &&
|
156
184
|
order_type == o.order_type &&
|
185
|
+
time_in_force == o.time_in_force &&
|
157
186
|
price == o.price &&
|
158
187
|
stop == o.stop &&
|
159
|
-
time_in_force == o.time_in_force &&
|
160
188
|
units == o.units &&
|
161
|
-
universal_symbol_id == o.universal_symbol_id &&
|
162
189
|
notional_value == o.notional_value
|
163
190
|
end
|
164
191
|
|
@@ -171,7 +198,7 @@ module SnapTrade
|
|
171
198
|
# Calculates hash code according to all attributes.
|
172
199
|
# @return [Integer] Hash code
|
173
200
|
def hash
|
174
|
-
[account_id, action, order_type, price, stop,
|
201
|
+
[account_id, action, universal_symbol_id, order_type, time_in_force, price, stop, units, notional_value].hash
|
175
202
|
end
|
176
203
|
|
177
204
|
# Builds the object from hash
|
@@ -0,0 +1,260 @@
|
|
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 ManualTradeImpact
|
15
|
+
# Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
|
16
|
+
attr_accessor :account
|
17
|
+
|
18
|
+
# Unique identifier for the currency. This is the UUID used to reference the currency in SnapTrade.
|
19
|
+
attr_accessor :currency
|
20
|
+
|
21
|
+
# Estimated amount of cash remaining in the account after the trade.
|
22
|
+
attr_accessor :remaining_cash
|
23
|
+
|
24
|
+
# Estimated commission for the trade.
|
25
|
+
attr_accessor :estimated_commission
|
26
|
+
|
27
|
+
# Estimated foreign transaction fees for the trade.
|
28
|
+
attr_accessor :forex_fees
|
29
|
+
|
30
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
31
|
+
def self.attribute_map
|
32
|
+
{
|
33
|
+
:'account' => :'account',
|
34
|
+
:'currency' => :'currency',
|
35
|
+
:'remaining_cash' => :'remaining_cash',
|
36
|
+
:'estimated_commission' => :'estimated_commission',
|
37
|
+
:'forex_fees' => :'forex_fees'
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
# Returns all the JSON keys this model knows about
|
42
|
+
def self.acceptable_attributes
|
43
|
+
attribute_map.values
|
44
|
+
end
|
45
|
+
|
46
|
+
# Attribute type mapping.
|
47
|
+
def self.openapi_types
|
48
|
+
{
|
49
|
+
:'account' => :'String',
|
50
|
+
:'currency' => :'String',
|
51
|
+
:'remaining_cash' => :'Float',
|
52
|
+
:'estimated_commission' => :'Float',
|
53
|
+
:'forex_fees' => :'Float'
|
54
|
+
}
|
55
|
+
end
|
56
|
+
|
57
|
+
# List of attributes with nullable: true
|
58
|
+
def self.openapi_nullable
|
59
|
+
Set.new([
|
60
|
+
:'remaining_cash',
|
61
|
+
:'estimated_commission',
|
62
|
+
:'forex_fees'
|
63
|
+
])
|
64
|
+
end
|
65
|
+
|
66
|
+
# Initializes the object
|
67
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
68
|
+
def initialize(attributes = {})
|
69
|
+
if (!attributes.is_a?(Hash))
|
70
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::ManualTradeImpact` initialize method"
|
71
|
+
end
|
72
|
+
|
73
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
74
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
75
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
76
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::ManualTradeImpact`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
77
|
+
end
|
78
|
+
h[k.to_sym] = v
|
79
|
+
}
|
80
|
+
|
81
|
+
if attributes.key?(:'account')
|
82
|
+
self.account = attributes[:'account']
|
83
|
+
end
|
84
|
+
|
85
|
+
if attributes.key?(:'currency')
|
86
|
+
self.currency = attributes[:'currency']
|
87
|
+
end
|
88
|
+
|
89
|
+
if attributes.key?(:'remaining_cash')
|
90
|
+
self.remaining_cash = attributes[:'remaining_cash']
|
91
|
+
end
|
92
|
+
|
93
|
+
if attributes.key?(:'estimated_commission')
|
94
|
+
self.estimated_commission = attributes[:'estimated_commission']
|
95
|
+
end
|
96
|
+
|
97
|
+
if attributes.key?(:'forex_fees')
|
98
|
+
self.forex_fees = attributes[:'forex_fees']
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
103
|
+
# @return Array for valid properties with the reasons
|
104
|
+
def list_invalid_properties
|
105
|
+
invalid_properties = Array.new
|
106
|
+
invalid_properties
|
107
|
+
end
|
108
|
+
|
109
|
+
# Check to see if the all the properties in the model are valid
|
110
|
+
# @return true if the model is valid
|
111
|
+
def valid?
|
112
|
+
true
|
113
|
+
end
|
114
|
+
|
115
|
+
# Checks equality by comparing each attribute.
|
116
|
+
# @param [Object] Object to be compared
|
117
|
+
def ==(o)
|
118
|
+
return true if self.equal?(o)
|
119
|
+
self.class == o.class &&
|
120
|
+
account == o.account &&
|
121
|
+
currency == o.currency &&
|
122
|
+
remaining_cash == o.remaining_cash &&
|
123
|
+
estimated_commission == o.estimated_commission &&
|
124
|
+
forex_fees == o.forex_fees
|
125
|
+
end
|
126
|
+
|
127
|
+
# @see the `==` method
|
128
|
+
# @param [Object] Object to be compared
|
129
|
+
def eql?(o)
|
130
|
+
self == o
|
131
|
+
end
|
132
|
+
|
133
|
+
# Calculates hash code according to all attributes.
|
134
|
+
# @return [Integer] Hash code
|
135
|
+
def hash
|
136
|
+
[account, currency, remaining_cash, estimated_commission, forex_fees].hash
|
137
|
+
end
|
138
|
+
|
139
|
+
# Builds the object from hash
|
140
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
141
|
+
# @return [Object] Returns the model itself
|
142
|
+
def self.build_from_hash(attributes)
|
143
|
+
new.build_from_hash(attributes)
|
144
|
+
end
|
145
|
+
|
146
|
+
# Builds the object from hash
|
147
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
148
|
+
# @return [Object] Returns the model itself
|
149
|
+
def build_from_hash(attributes)
|
150
|
+
return nil unless attributes.is_a?(Hash)
|
151
|
+
attributes = attributes.transform_keys(&:to_sym)
|
152
|
+
self.class.openapi_types.each_pair do |key, type|
|
153
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
154
|
+
self.send("#{key}=", nil)
|
155
|
+
elsif type =~ /\AArray<(.*)>/i
|
156
|
+
# check to ensure the input is an array given that the attribute
|
157
|
+
# is documented as an array but the input is not
|
158
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
159
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
160
|
+
end
|
161
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
162
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
self
|
167
|
+
end
|
168
|
+
|
169
|
+
# Deserializes the data based on type
|
170
|
+
# @param string type Data type
|
171
|
+
# @param string value Value to be deserialized
|
172
|
+
# @return [Object] Deserialized data
|
173
|
+
def _deserialize(type, value)
|
174
|
+
case type.to_sym
|
175
|
+
when :Time
|
176
|
+
Time.parse(value)
|
177
|
+
when :Date
|
178
|
+
Date.parse(value)
|
179
|
+
when :String
|
180
|
+
value.to_s
|
181
|
+
when :Integer
|
182
|
+
value.to_i
|
183
|
+
when :Float
|
184
|
+
value.to_f
|
185
|
+
when :Boolean
|
186
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
187
|
+
true
|
188
|
+
else
|
189
|
+
false
|
190
|
+
end
|
191
|
+
when :Object
|
192
|
+
# generic object (usually a Hash), return directly
|
193
|
+
value
|
194
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
195
|
+
inner_type = Regexp.last_match[:inner_type]
|
196
|
+
value.map { |v| _deserialize(inner_type, v) }
|
197
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
198
|
+
k_type = Regexp.last_match[:k_type]
|
199
|
+
v_type = Regexp.last_match[:v_type]
|
200
|
+
{}.tap do |hash|
|
201
|
+
value.each do |k, v|
|
202
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
203
|
+
end
|
204
|
+
end
|
205
|
+
else # model
|
206
|
+
# models (e.g. Pet) or oneOf
|
207
|
+
klass = SnapTrade.const_get(type)
|
208
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
# Returns the string representation of the object
|
213
|
+
# @return [String] String presentation of the object
|
214
|
+
def to_s
|
215
|
+
to_hash.to_s
|
216
|
+
end
|
217
|
+
|
218
|
+
# to_body is an alias to to_hash (backward compatibility)
|
219
|
+
# @return [Hash] Returns the object in the form of hash
|
220
|
+
def to_body
|
221
|
+
to_hash
|
222
|
+
end
|
223
|
+
|
224
|
+
# Returns the object in the form of hash
|
225
|
+
# @return [Hash] Returns the object in the form of hash
|
226
|
+
def to_hash
|
227
|
+
hash = {}
|
228
|
+
self.class.attribute_map.each_pair do |attr, param|
|
229
|
+
value = self.send(attr)
|
230
|
+
if value.nil?
|
231
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
232
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
233
|
+
end
|
234
|
+
|
235
|
+
hash[param] = _to_hash(value)
|
236
|
+
end
|
237
|
+
hash
|
238
|
+
end
|
239
|
+
|
240
|
+
# Outputs non-array value in the form of hash
|
241
|
+
# For object, use to_hash. Otherwise, just return the value
|
242
|
+
# @param [Object] value Any valid value
|
243
|
+
# @return [Hash] Returns the value in the form of hash
|
244
|
+
def _to_hash(value)
|
245
|
+
if value.is_a?(Array)
|
246
|
+
value.compact.map { |v| _to_hash(v) }
|
247
|
+
elsif value.is_a?(Hash)
|
248
|
+
{}.tap do |hash|
|
249
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
250
|
+
end
|
251
|
+
elsif value.respond_to? :to_hash
|
252
|
+
value.to_hash
|
253
|
+
else
|
254
|
+
value
|
255
|
+
end
|
256
|
+
end
|
257
|
+
|
258
|
+
end
|
259
|
+
|
260
|
+
end
|
@@ -11,18 +11,23 @@ require 'date'
|
|
11
11
|
require 'time'
|
12
12
|
|
13
13
|
module SnapTrade
|
14
|
-
#
|
14
|
+
# Information about the security for the order.
|
15
15
|
class ManualTradeSymbol
|
16
|
+
# A unique ID for the security within SnapTrade, scoped to the brokerage account that the security belongs to. This is a legacy field and should not be used. Do not rely on this being a stable ID as it can change.
|
16
17
|
attr_accessor :brokerage_symbol_id
|
17
18
|
|
19
|
+
# Unique identifier for the symbol within SnapTrade. This is the ID used to reference the symbol in SnapTrade API calls.
|
18
20
|
attr_accessor :universal_symbol_id
|
19
21
|
|
20
22
|
attr_accessor :currency
|
21
23
|
|
24
|
+
# This field is deprecated and should not be used.
|
22
25
|
attr_accessor :local_id
|
23
26
|
|
27
|
+
# This field is deprecated and should not be used.
|
24
28
|
attr_accessor :description
|
25
29
|
|
30
|
+
# This field is deprecated and should not be used.
|
26
31
|
attr_accessor :symbol
|
27
32
|
|
28
33
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -11,7 +11,7 @@ require 'date'
|
|
11
11
|
require 'time'
|
12
12
|
|
13
13
|
module SnapTrade
|
14
|
-
#
|
14
|
+
# Total notional amount for the order. Must be `null` if `units` is provided. Can only work with `Market` for `order_type` and `Day` for `time_in_force`. This is only available for certain brokerages. Please check the [integrations doc](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=e7bbcbf9f272441593f93decde660687) for more information.
|
15
15
|
module NotionalValue
|
16
16
|
class << self
|
17
17
|
# List of class defined in oneOf (OpenAPI v3)
|
@@ -12,10 +12,10 @@ require 'time'
|
|
12
12
|
|
13
13
|
module SnapTrade
|
14
14
|
class OptionsPlaceOptionStrategyRequest
|
15
|
-
#
|
15
|
+
# The type of order to place. - For `Limit` and `StopLimit` orders, the `price` field is required. - For `Stop` and `StopLimit` orders, the `stop` field is required.
|
16
16
|
attr_accessor :order_type
|
17
17
|
|
18
|
-
#
|
18
|
+
# The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely.
|
19
19
|
attr_accessor :time_in_force
|
20
20
|
|
21
21
|
# Trade Price if limit or stop limit order
|
@@ -14,23 +14,28 @@ module SnapTrade
|
|
14
14
|
class SymbolsQuotesInner
|
15
15
|
attr_accessor :symbol
|
16
16
|
|
17
|
+
# The most recent trade price from the brokerage.
|
18
|
+
attr_accessor :last_trade_price
|
19
|
+
|
20
|
+
# The most recent bid price from the brokerage.
|
17
21
|
attr_accessor :bid_price
|
18
22
|
|
23
|
+
# The most recent price from the brokerage.
|
19
24
|
attr_accessor :ask_price
|
20
25
|
|
21
|
-
|
22
|
-
|
26
|
+
# The most recent bid size from the brokerage.
|
23
27
|
attr_accessor :bid_size
|
24
28
|
|
29
|
+
# The most recent ask size from the brokerage.
|
25
30
|
attr_accessor :ask_size
|
26
31
|
|
27
32
|
# Attribute mapping from ruby-style variable name to JSON key.
|
28
33
|
def self.attribute_map
|
29
34
|
{
|
30
35
|
:'symbol' => :'symbol',
|
36
|
+
:'last_trade_price' => :'last_trade_price',
|
31
37
|
:'bid_price' => :'bid_price',
|
32
38
|
:'ask_price' => :'ask_price',
|
33
|
-
:'last_trade_price' => :'last_trade_price',
|
34
39
|
:'bid_size' => :'bid_size',
|
35
40
|
:'ask_size' => :'ask_size'
|
36
41
|
}
|
@@ -45,9 +50,9 @@ module SnapTrade
|
|
45
50
|
def self.openapi_types
|
46
51
|
{
|
47
52
|
:'symbol' => :'UniversalSymbol',
|
53
|
+
:'last_trade_price' => :'Float',
|
48
54
|
:'bid_price' => :'Float',
|
49
55
|
:'ask_price' => :'Float',
|
50
|
-
:'last_trade_price' => :'Float',
|
51
56
|
:'bid_size' => :'Float',
|
52
57
|
:'ask_size' => :'Float'
|
53
58
|
}
|
@@ -78,6 +83,10 @@ module SnapTrade
|
|
78
83
|
self.symbol = attributes[:'symbol']
|
79
84
|
end
|
80
85
|
|
86
|
+
if attributes.key?(:'last_trade_price')
|
87
|
+
self.last_trade_price = attributes[:'last_trade_price']
|
88
|
+
end
|
89
|
+
|
81
90
|
if attributes.key?(:'bid_price')
|
82
91
|
self.bid_price = attributes[:'bid_price']
|
83
92
|
end
|
@@ -86,10 +95,6 @@ module SnapTrade
|
|
86
95
|
self.ask_price = attributes[:'ask_price']
|
87
96
|
end
|
88
97
|
|
89
|
-
if attributes.key?(:'last_trade_price')
|
90
|
-
self.last_trade_price = attributes[:'last_trade_price']
|
91
|
-
end
|
92
|
-
|
93
98
|
if attributes.key?(:'bid_size')
|
94
99
|
self.bid_size = attributes[:'bid_size']
|
95
100
|
end
|
@@ -118,9 +123,9 @@ module SnapTrade
|
|
118
123
|
return true if self.equal?(o)
|
119
124
|
self.class == o.class &&
|
120
125
|
symbol == o.symbol &&
|
126
|
+
last_trade_price == o.last_trade_price &&
|
121
127
|
bid_price == o.bid_price &&
|
122
128
|
ask_price == o.ask_price &&
|
123
|
-
last_trade_price == o.last_trade_price &&
|
124
129
|
bid_size == o.bid_size &&
|
125
130
|
ask_size == o.ask_size
|
126
131
|
end
|
@@ -134,7 +139,7 @@ module SnapTrade
|
|
134
139
|
# Calculates hash code according to all attributes.
|
135
140
|
# @return [Integer] Hash code
|
136
141
|
def hash
|
137
|
-
[symbol, bid_price, ask_price,
|
142
|
+
[symbol, last_trade_price, bid_price, ask_price, bid_size, ask_size].hash
|
138
143
|
end
|
139
144
|
|
140
145
|
# Builds the object from hash
|
@@ -12,6 +12,7 @@ require 'time'
|
|
12
12
|
|
13
13
|
module SnapTrade
|
14
14
|
class TradingCancelUserAccountOrderRequest
|
15
|
+
# Order ID returned by brokerage. This is the unique identifier for the order in the brokerage system.
|
15
16
|
attr_accessor :brokerage_order_id
|
16
17
|
|
17
18
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -11,9 +11,8 @@ require 'date'
|
|
11
11
|
require 'time'
|
12
12
|
|
13
13
|
module SnapTrade
|
14
|
-
# Validated Trade Form
|
15
14
|
class ValidatedTradeBody
|
16
|
-
# Optional, defaults to true. Determines if a wait is performed to check on order status. If false, latency will be reduced but orders returned will be more likely to be of status PENDING as we will not wait to check on the status before responding to the request
|
15
|
+
# Optional, defaults to true. Determines if a wait is performed to check on order status. If false, latency will be reduced but orders returned will be more likely to be of status `PENDING` as we will not wait to check on the status before responding to the request.
|
17
16
|
attr_accessor :wait_to_confirm
|
18
17
|
|
19
18
|
# Attribute mapping from ruby-style variable name to JSON key.
|
data/lib/snaptrade/version.rb
CHANGED
data/lib/snaptrade.rb
CHANGED
@@ -57,6 +57,7 @@ require 'snaptrade/models/manual_trade_and_impact'
|
|
57
57
|
require 'snaptrade/models/manual_trade_balance'
|
58
58
|
require 'snaptrade/models/manual_trade_form'
|
59
59
|
require 'snaptrade/models/manual_trade_form_notional_value'
|
60
|
+
require 'snaptrade/models/manual_trade_impact'
|
60
61
|
require 'snaptrade/models/manual_trade_symbol'
|
61
62
|
require 'snaptrade/models/model400_failed_request_response'
|
62
63
|
require 'snaptrade/models/model401_failed_request_response'
|
@@ -28,12 +28,12 @@ describe 'TradingApi' do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
# unit tests for cancel_user_account_order
|
31
|
-
# Cancel
|
32
|
-
#
|
31
|
+
# Cancel order
|
32
|
+
# Attempts to cancel an open order with the brokerage. If the order is no longer cancellable, the request will be rejected.
|
33
33
|
# @param user_id
|
34
34
|
# @param user_secret
|
35
|
-
# @param account_id
|
36
|
-
# @param trading_cancel_user_account_order_request
|
35
|
+
# @param account_id
|
36
|
+
# @param trading_cancel_user_account_order_request
|
37
37
|
# @param [Hash] opts the optional parameters
|
38
38
|
# @return [AccountOrderRecord]
|
39
39
|
describe 'cancel_user_account_order test' do
|
@@ -43,8 +43,8 @@ describe 'TradingApi' do
|
|
43
43
|
end
|
44
44
|
|
45
45
|
# unit tests for get_order_impact
|
46
|
-
# Check
|
47
|
-
#
|
46
|
+
# Check order impact
|
47
|
+
# Simulates an order and its impact on the account. This endpoint does not place the order with the brokerage. If successful, it returns a `Trade` object and the ID of the object can be used to place the order with the brokerage using the [place checked order endpoint](/reference/Trading/Trading_placeOrder). Please note that the `Trade` object returned expires after 5 minutes. Any order placed using an expired `Trade` will be rejected.
|
48
48
|
# @param user_id
|
49
49
|
# @param user_secret
|
50
50
|
# @param manual_trade_form
|
@@ -58,13 +58,13 @@ describe 'TradingApi' do
|
|
58
58
|
|
59
59
|
# unit tests for get_user_account_quotes
|
60
60
|
# Get symbol quotes
|
61
|
-
# Returns
|
61
|
+
# Returns quotes from the brokerage for the specified symbols and account. The quotes returned can be delayed depending on the brokerage the account belongs to. It is highly recommended that you use your own market data provider for real-time quotes instead of relying on this endpoint. This endpoint does not work for options quotes.
|
62
62
|
# @param user_id
|
63
63
|
# @param user_secret
|
64
|
-
# @param symbols List of
|
65
|
-
# @param account_id
|
64
|
+
# @param symbols List of Universal Symbol IDs or tickers to get quotes for.
|
65
|
+
# @param account_id
|
66
66
|
# @param [Hash] opts the optional parameters
|
67
|
-
# @option opts [Boolean] :use_ticker Should be set to True if
|
67
|
+
# @option opts [Boolean] :use_ticker Should be set to `True` if `symbols` are comprised of tickers. Defaults to `False` if not provided.
|
68
68
|
# @return [Array<SymbolsQuotesInner>]
|
69
69
|
describe 'get_user_account_quotes test' do
|
70
70
|
it 'should work' do
|
@@ -73,8 +73,8 @@ describe 'TradingApi' do
|
|
73
73
|
end
|
74
74
|
|
75
75
|
# unit tests for place_force_order
|
76
|
-
# Place
|
77
|
-
# Places a
|
76
|
+
# Place order
|
77
|
+
# Places a brokerage order in the specified account. The order could be rejected by the brokerage if it is invalid or if the account does not have sufficient funds. This endpoint does not compute the impact to the account balance from the order and any potential commissions before submitting the order to the brokerage. If that is desired, you can use the [check order impact endpoint](/reference/Trading/Trading_getOrderImpact).
|
78
78
|
# @param user_id
|
79
79
|
# @param user_secret
|
80
80
|
# @param manual_trade_form
|
@@ -87,9 +87,9 @@ describe 'TradingApi' do
|
|
87
87
|
end
|
88
88
|
|
89
89
|
# unit tests for place_order
|
90
|
-
# Place order
|
91
|
-
# Places the
|
92
|
-
# @param trade_id
|
90
|
+
# Place checked order
|
91
|
+
# Places the previously checked order with the brokerage. The `tradeId` is obtained from the [check order impact endpoint](/reference/Trading/Trading_getOrderImpact). If you prefer to place the order without checking for impact first, you can use the [place order endpoint](/reference/Trading/Trading_placeForceOrder).
|
92
|
+
# @param trade_id Obtained from calling the [check order impact endpoint](/reference/Trading/Trading_getOrderImpact)
|
93
93
|
# @param user_id
|
94
94
|
# @param user_secret
|
95
95
|
# @param [Hash] opts the optional parameters
|