snaptrade 1.17.8 → 1.17.10
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 +1 -1
- data/docs/AccountOrderRecord.md +1 -1
- data/docs/ManualTrade.md +1 -1
- data/docs/ManualTradeForm.md +4 -2
- data/docs/TradingApi.md +8 -0
- data/lib/snaptrade/api/trading_api.rb +16 -8
- data/lib/snaptrade/models/account_order_record.rb +1 -1
- data/lib/snaptrade/models/manual_trade.rb +1 -1
- data/lib/snaptrade/models/manual_trade_form.rb +16 -5
- data/lib/snaptrade/version.rb +1 -1
- data/spec/models/manual_trade_form_spec.rb +6 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc7424d3593efa15d87a6e3b86025ddf9f74889637be92516240f8a374f0a089
|
4
|
+
data.tar.gz: 909f0a3ec77b672b19ae03517cf9580e2ded1dac37e2e47b5ada1b6818952598
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 876380a98c4374c61c4e24ac2bf7065e59814b64c2078d7d46d43b9a5bb80d97a3218e8eb47bf57a0c4c39b42b87c406b7ad27dec34f7a8faf724bf81172a43b
|
7
|
+
data.tar.gz: 45a18abd2a40d531e0bc7844cd58211267538f15955cc7edd3983666e4f3b9133dd2de72249aed5bc8182f9c6c1742ea9881395073a8a2b280bdbbb17e4c780c
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
snaptrade (1.17.
|
4
|
+
snaptrade (1.17.10)
|
5
5
|
faraday (>= 1.0.1, < 3.0)
|
6
6
|
faraday-multipart (~> 1.0, >= 1.0.4)
|
7
7
|
|
@@ -16,7 +16,7 @@ GEM
|
|
16
16
|
irb (>= 1.5.0)
|
17
17
|
reline (>= 0.3.1)
|
18
18
|
diff-lcs (1.5.0)
|
19
|
-
faraday (2.
|
19
|
+
faraday (2.8.1)
|
20
20
|
base64
|
21
21
|
faraday-net_http (>= 2.0, < 3.1)
|
22
22
|
ruby2_keywords (>= 0.0.4)
|
data/README.md
CHANGED
data/docs/AccountOrderRecord.md
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
| **universal_symbol** | [**UniversalSymbol**](UniversalSymbol.md) | | [optional] |
|
11
11
|
| **option_symbol** | [**OptionsSymbol**](OptionsSymbol.md) | | [optional] |
|
12
12
|
| **action** | [**Action**](Action.md) | | [optional] |
|
13
|
-
| **total_quantity** | **Float** | Trade Units | [optional] |
|
13
|
+
| **total_quantity** | **Float** | Trade Units. Cannot work with notional value. | [optional] |
|
14
14
|
| **open_quantity** | **Float** | Trade Units | [optional] |
|
15
15
|
| **canceled_quantity** | **Float** | Trade Units | [optional] |
|
16
16
|
| **filled_quantity** | **Float** | Trade Units | [optional] |
|
data/docs/ManualTrade.md
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
| **time_in_force** | [**TimeInForce**](TimeInForce.md) | | [optional] |
|
11
11
|
| **symbol** | [**ManualTradeSymbol**](ManualTradeSymbol.md) | | [optional] |
|
12
12
|
| **action** | [**Action**](Action.md) | | [optional] |
|
13
|
-
| **units** | **Float** | Trade Units | [optional] |
|
13
|
+
| **units** | **Float** | Trade Units. Cannot work with notional value. | [optional] |
|
14
14
|
| **price** | **Float** | Trade Price if limit or stop limit order | [optional] |
|
15
15
|
|
16
16
|
## Example
|
data/docs/ManualTradeForm.md
CHANGED
@@ -10,8 +10,9 @@
|
|
10
10
|
| **price** | **Float** | Trade Price if limit or stop limit order | [optional] |
|
11
11
|
| **stop** | **Float** | Stop Price. If stop loss or stop limit order, the price to trigger the stop | [optional] |
|
12
12
|
| **time_in_force** | [**TimeInForce**](TimeInForce.md) | | [optional] |
|
13
|
-
| **units** | **Float** | Trade Units | [optional] |
|
13
|
+
| **units** | **Float** | Trade Units. Cannot work with notional value. | [optional] |
|
14
14
|
| **universal_symbol_id** | **String** | | [optional] |
|
15
|
+
| **notional_value** | **Float** | Dollar amount to trade. Cannot work with units. Can only work for market order types and day for time in force. | [optional] |
|
15
16
|
|
16
17
|
## Example
|
17
18
|
|
@@ -26,7 +27,8 @@ instance = SnapTrade::ManualTradeForm.new(
|
|
26
27
|
stop: 31.33,
|
27
28
|
time_in_force: null,
|
28
29
|
units: null,
|
29
|
-
universal_symbol_id: 2bcd7cc3-e922-4976-bce1-9858296801c3
|
30
|
+
universal_symbol_id: 2bcd7cc3-e922-4976-bce1-9858296801c3,
|
31
|
+
notional_value: 100
|
30
32
|
)
|
31
33
|
```
|
32
34
|
|
data/docs/TradingApi.md
CHANGED
@@ -103,6 +103,7 @@ stop = 31.33
|
|
103
103
|
time_in_force = "Day"
|
104
104
|
units = 3.14
|
105
105
|
universal_symbol_id = "2bcd7cc3-e922-4976-bce1-9858296801c3"
|
106
|
+
notional_value = 100
|
106
107
|
|
107
108
|
begin
|
108
109
|
# Check impact of trades on account.
|
@@ -117,6 +118,7 @@ begin
|
|
117
118
|
time_in_force: time_in_force,
|
118
119
|
units: units,
|
119
120
|
universal_symbol_id: universal_symbol_id,
|
121
|
+
notional_value: notional_value,
|
120
122
|
)
|
121
123
|
p result
|
122
124
|
rescue SnapTrade::ApiError => e
|
@@ -139,6 +141,7 @@ stop = 31.33
|
|
139
141
|
time_in_force = "Day"
|
140
142
|
units = 3.14
|
141
143
|
universal_symbol_id = "2bcd7cc3-e922-4976-bce1-9858296801c3"
|
144
|
+
notional_value = 100
|
142
145
|
|
143
146
|
begin
|
144
147
|
# Check impact of trades on account.
|
@@ -153,6 +156,7 @@ begin
|
|
153
156
|
time_in_force: time_in_force,
|
154
157
|
units: units,
|
155
158
|
universal_symbol_id: universal_symbol_id,
|
159
|
+
notional_value: notional_value,
|
156
160
|
)
|
157
161
|
p status_code # => 2xx
|
158
162
|
p headers # => { ... }
|
@@ -271,6 +275,7 @@ stop = 31.33
|
|
271
275
|
time_in_force = "Day"
|
272
276
|
units = 3.14
|
273
277
|
universal_symbol_id = "2bcd7cc3-e922-4976-bce1-9858296801c3"
|
278
|
+
notional_value = 100
|
274
279
|
|
275
280
|
begin
|
276
281
|
# Place a trade with NO validation.
|
@@ -285,6 +290,7 @@ begin
|
|
285
290
|
time_in_force: time_in_force,
|
286
291
|
units: units,
|
287
292
|
universal_symbol_id: universal_symbol_id,
|
293
|
+
notional_value: notional_value,
|
288
294
|
)
|
289
295
|
p result
|
290
296
|
rescue SnapTrade::ApiError => e
|
@@ -307,6 +313,7 @@ stop = 31.33
|
|
307
313
|
time_in_force = "Day"
|
308
314
|
units = 3.14
|
309
315
|
universal_symbol_id = "2bcd7cc3-e922-4976-bce1-9858296801c3"
|
316
|
+
notional_value = 100
|
310
317
|
|
311
318
|
begin
|
312
319
|
# Place a trade with NO validation.
|
@@ -321,6 +328,7 @@ begin
|
|
321
328
|
time_in_force: time_in_force,
|
322
329
|
units: units,
|
323
330
|
universal_symbol_id: universal_symbol_id,
|
331
|
+
notional_value: notional_value,
|
324
332
|
)
|
325
333
|
p status_code # => 2xx
|
326
334
|
p headers # => { ... }
|
@@ -143,11 +143,12 @@ module SnapTrade
|
|
143
143
|
# @param price [Float] Trade Price if limit or stop limit order
|
144
144
|
# @param stop [Float] Stop Price. If stop loss or stop limit order, the price to trigger the stop
|
145
145
|
# @param time_in_force [TimeInForce]
|
146
|
-
# @param units [Float] Trade Units
|
146
|
+
# @param units [Float] Trade Units. Cannot work with notional value.
|
147
147
|
# @param universal_symbol_id [String]
|
148
|
+
# @param notional_value [Float] Dollar amount to trade. Cannot work with units. Can only work for market order types and day for time in force.
|
148
149
|
# @param body [ManualTradeForm]
|
149
150
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
150
|
-
def get_order_impact(user_id:, user_secret:, account_id: SENTINEL, action: SENTINEL, order_type: SENTINEL, price: SENTINEL, stop: SENTINEL, time_in_force: SENTINEL, units: SENTINEL, universal_symbol_id: SENTINEL, extra: {})
|
151
|
+
def get_order_impact(user_id:, user_secret:, account_id: SENTINEL, action: SENTINEL, order_type: SENTINEL, price: SENTINEL, stop: SENTINEL, time_in_force: SENTINEL, units: SENTINEL, universal_symbol_id: SENTINEL, notional_value: SENTINEL, extra: {})
|
151
152
|
_body = {}
|
152
153
|
_body[:account_id] = account_id if account_id != SENTINEL
|
153
154
|
_body[:action] = action if action != SENTINEL
|
@@ -157,6 +158,7 @@ module SnapTrade
|
|
157
158
|
_body[:time_in_force] = time_in_force if time_in_force != SENTINEL
|
158
159
|
_body[:units] = units if units != SENTINEL
|
159
160
|
_body[:universal_symbol_id] = universal_symbol_id if universal_symbol_id != SENTINEL
|
161
|
+
_body[:notional_value] = notional_value if notional_value != SENTINEL
|
160
162
|
manual_trade_form = _body
|
161
163
|
data, _status_code, _headers = get_order_impact_with_http_info_impl(user_id, user_secret, manual_trade_form, extra)
|
162
164
|
data
|
@@ -171,11 +173,12 @@ module SnapTrade
|
|
171
173
|
# @param price [Float] Trade Price if limit or stop limit order
|
172
174
|
# @param stop [Float] Stop Price. If stop loss or stop limit order, the price to trigger the stop
|
173
175
|
# @param time_in_force [TimeInForce]
|
174
|
-
# @param units [Float] Trade Units
|
176
|
+
# @param units [Float] Trade Units. Cannot work with notional value.
|
175
177
|
# @param universal_symbol_id [String]
|
178
|
+
# @param notional_value [Float] Dollar amount to trade. Cannot work with units. Can only work for market order types and day for time in force.
|
176
179
|
# @param body [ManualTradeForm]
|
177
180
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
178
|
-
def get_order_impact_with_http_info(user_id:, user_secret:, account_id: SENTINEL, action: SENTINEL, order_type: SENTINEL, price: SENTINEL, stop: SENTINEL, time_in_force: SENTINEL, units: SENTINEL, universal_symbol_id: SENTINEL, extra: {})
|
181
|
+
def get_order_impact_with_http_info(user_id:, user_secret:, account_id: SENTINEL, action: SENTINEL, order_type: SENTINEL, price: SENTINEL, stop: SENTINEL, time_in_force: SENTINEL, units: SENTINEL, universal_symbol_id: SENTINEL, notional_value: SENTINEL, extra: {})
|
179
182
|
_body = {}
|
180
183
|
_body[:account_id] = account_id if account_id != SENTINEL
|
181
184
|
_body[:action] = action if action != SENTINEL
|
@@ -185,6 +188,7 @@ module SnapTrade
|
|
185
188
|
_body[:time_in_force] = time_in_force if time_in_force != SENTINEL
|
186
189
|
_body[:units] = units if units != SENTINEL
|
187
190
|
_body[:universal_symbol_id] = universal_symbol_id if universal_symbol_id != SENTINEL
|
191
|
+
_body[:notional_value] = notional_value if notional_value != SENTINEL
|
188
192
|
manual_trade_form = _body
|
189
193
|
get_order_impact_with_http_info_impl(user_id, user_secret, manual_trade_form, extra)
|
190
194
|
end
|
@@ -390,11 +394,12 @@ module SnapTrade
|
|
390
394
|
# @param price [Float] Trade Price if limit or stop limit order
|
391
395
|
# @param stop [Float] Stop Price. If stop loss or stop limit order, the price to trigger the stop
|
392
396
|
# @param time_in_force [TimeInForce]
|
393
|
-
# @param units [Float] Trade Units
|
397
|
+
# @param units [Float] Trade Units. Cannot work with notional value.
|
394
398
|
# @param universal_symbol_id [String]
|
399
|
+
# @param notional_value [Float] Dollar amount to trade. Cannot work with units. Can only work for market order types and day for time in force.
|
395
400
|
# @param body [ManualTradeForm]
|
396
401
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
397
|
-
def place_force_order(user_id:, user_secret:, account_id: SENTINEL, action: SENTINEL, order_type: SENTINEL, price: SENTINEL, stop: SENTINEL, time_in_force: SENTINEL, units: SENTINEL, universal_symbol_id: SENTINEL, extra: {})
|
402
|
+
def place_force_order(user_id:, user_secret:, account_id: SENTINEL, action: SENTINEL, order_type: SENTINEL, price: SENTINEL, stop: SENTINEL, time_in_force: SENTINEL, units: SENTINEL, universal_symbol_id: SENTINEL, notional_value: SENTINEL, extra: {})
|
398
403
|
_body = {}
|
399
404
|
_body[:account_id] = account_id if account_id != SENTINEL
|
400
405
|
_body[:action] = action if action != SENTINEL
|
@@ -404,6 +409,7 @@ module SnapTrade
|
|
404
409
|
_body[:time_in_force] = time_in_force if time_in_force != SENTINEL
|
405
410
|
_body[:units] = units if units != SENTINEL
|
406
411
|
_body[:universal_symbol_id] = universal_symbol_id if universal_symbol_id != SENTINEL
|
412
|
+
_body[:notional_value] = notional_value if notional_value != SENTINEL
|
407
413
|
manual_trade_form = _body
|
408
414
|
data, _status_code, _headers = place_force_order_with_http_info_impl(user_id, user_secret, manual_trade_form, extra)
|
409
415
|
data
|
@@ -418,11 +424,12 @@ module SnapTrade
|
|
418
424
|
# @param price [Float] Trade Price if limit or stop limit order
|
419
425
|
# @param stop [Float] Stop Price. If stop loss or stop limit order, the price to trigger the stop
|
420
426
|
# @param time_in_force [TimeInForce]
|
421
|
-
# @param units [Float] Trade Units
|
427
|
+
# @param units [Float] Trade Units. Cannot work with notional value.
|
422
428
|
# @param universal_symbol_id [String]
|
429
|
+
# @param notional_value [Float] Dollar amount to trade. Cannot work with units. Can only work for market order types and day for time in force.
|
423
430
|
# @param body [ManualTradeForm]
|
424
431
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
425
|
-
def place_force_order_with_http_info(user_id:, user_secret:, account_id: SENTINEL, action: SENTINEL, order_type: SENTINEL, price: SENTINEL, stop: SENTINEL, time_in_force: SENTINEL, units: SENTINEL, universal_symbol_id: SENTINEL, extra: {})
|
432
|
+
def place_force_order_with_http_info(user_id:, user_secret:, account_id: SENTINEL, action: SENTINEL, order_type: SENTINEL, price: SENTINEL, stop: SENTINEL, time_in_force: SENTINEL, units: SENTINEL, universal_symbol_id: SENTINEL, notional_value: SENTINEL, extra: {})
|
426
433
|
_body = {}
|
427
434
|
_body[:account_id] = account_id if account_id != SENTINEL
|
428
435
|
_body[:action] = action if action != SENTINEL
|
@@ -432,6 +439,7 @@ module SnapTrade
|
|
432
439
|
_body[:time_in_force] = time_in_force if time_in_force != SENTINEL
|
433
440
|
_body[:units] = units if units != SENTINEL
|
434
441
|
_body[:universal_symbol_id] = universal_symbol_id if universal_symbol_id != SENTINEL
|
442
|
+
_body[:notional_value] = notional_value if notional_value != SENTINEL
|
435
443
|
manual_trade_form = _body
|
436
444
|
place_force_order_with_http_info_impl(user_id, user_secret, manual_trade_form, extra)
|
437
445
|
end
|
@@ -28,11 +28,14 @@ module SnapTrade
|
|
28
28
|
|
29
29
|
attr_accessor :time_in_force
|
30
30
|
|
31
|
-
# Trade Units
|
31
|
+
# Trade Units. Cannot work with notional value.
|
32
32
|
attr_accessor :units
|
33
33
|
|
34
34
|
attr_accessor :universal_symbol_id
|
35
35
|
|
36
|
+
# Dollar amount to trade. Cannot work with units. Can only work for market order types and day for time in force.
|
37
|
+
attr_accessor :notional_value
|
38
|
+
|
36
39
|
# Attribute mapping from ruby-style variable name to JSON key.
|
37
40
|
def self.attribute_map
|
38
41
|
{
|
@@ -43,7 +46,8 @@ module SnapTrade
|
|
43
46
|
:'stop' => :'stop',
|
44
47
|
:'time_in_force' => :'time_in_force',
|
45
48
|
:'units' => :'units',
|
46
|
-
:'universal_symbol_id' => :'universal_symbol_id'
|
49
|
+
:'universal_symbol_id' => :'universal_symbol_id',
|
50
|
+
:'notional_value' => :'notional_value'
|
47
51
|
}
|
48
52
|
end
|
49
53
|
|
@@ -62,7 +66,8 @@ module SnapTrade
|
|
62
66
|
:'stop' => :'Float',
|
63
67
|
:'time_in_force' => :'TimeInForce',
|
64
68
|
:'units' => :'Float',
|
65
|
-
:'universal_symbol_id' => :'String'
|
69
|
+
:'universal_symbol_id' => :'String',
|
70
|
+
:'notional_value' => :'Float'
|
66
71
|
}
|
67
72
|
end
|
68
73
|
|
@@ -71,6 +76,7 @@ module SnapTrade
|
|
71
76
|
Set.new([
|
72
77
|
:'price',
|
73
78
|
:'stop',
|
79
|
+
:'notional_value'
|
74
80
|
])
|
75
81
|
end
|
76
82
|
|
@@ -120,6 +126,10 @@ module SnapTrade
|
|
120
126
|
if attributes.key?(:'universal_symbol_id')
|
121
127
|
self.universal_symbol_id = attributes[:'universal_symbol_id']
|
122
128
|
end
|
129
|
+
|
130
|
+
if attributes.key?(:'notional_value')
|
131
|
+
self.notional_value = attributes[:'notional_value']
|
132
|
+
end
|
123
133
|
end
|
124
134
|
|
125
135
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -147,7 +157,8 @@ module SnapTrade
|
|
147
157
|
stop == o.stop &&
|
148
158
|
time_in_force == o.time_in_force &&
|
149
159
|
units == o.units &&
|
150
|
-
universal_symbol_id == o.universal_symbol_id
|
160
|
+
universal_symbol_id == o.universal_symbol_id &&
|
161
|
+
notional_value == o.notional_value
|
151
162
|
end
|
152
163
|
|
153
164
|
# @see the `==` method
|
@@ -159,7 +170,7 @@ module SnapTrade
|
|
159
170
|
# Calculates hash code according to all attributes.
|
160
171
|
# @return [Integer] Hash code
|
161
172
|
def hash
|
162
|
-
[account_id, action, order_type, price, stop, time_in_force, units, universal_symbol_id].hash
|
173
|
+
[account_id, action, order_type, price, stop, time_in_force, units, universal_symbol_id, notional_value].hash
|
163
174
|
end
|
164
175
|
|
165
176
|
# Builds the object from hash
|
data/lib/snaptrade/version.rb
CHANGED
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: 1.17.
|
4
|
+
version: 1.17.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SnapTrade
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|