snaptrade 2.0.38 → 2.0.40
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 +105 -68
- data/lib/snaptrade/api/authentication_api.rb +18 -14
- data/lib/snaptrade/api/connections_api.rb +8 -8
- data/lib/snaptrade/api/options_api.rb +4 -4
- data/lib/snaptrade/api/trading_api.rb +114 -106
- data/lib/snaptrade/models/brokerage_authorization.rb +1 -1
- 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/snap_trade_login_user_request_body.rb +3 -3
- 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/authentication_api_spec.rb +2 -2
- data/spec/api/connections_api_spec.rb +2 -2
- 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
@@ -17,15 +17,14 @@ module SnapTrade
|
|
17
17
|
@api_client = api_client
|
18
18
|
end
|
19
19
|
|
20
|
-
# Cancel
|
20
|
+
# Cancel order
|
21
21
|
#
|
22
|
-
#
|
23
|
-
# This will only work if the order has not yet been executed.
|
22
|
+
# Attempts to cancel an open order with the brokerage. If the order is no longer cancellable, the request will be rejected.
|
24
23
|
#
|
25
24
|
# @param user_id [String]
|
26
25
|
# @param user_secret [String]
|
27
|
-
# @param account_id [String]
|
28
|
-
# @param brokerage_order_id [String]
|
26
|
+
# @param account_id [String]
|
27
|
+
# @param brokerage_order_id [String] Order ID returned by brokerage. This is the unique identifier for the order in the brokerage system.
|
29
28
|
# @param body [TradingCancelUserAccountOrderRequest]
|
30
29
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
31
30
|
def cancel_user_account_order(user_id:, user_secret:, account_id:, brokerage_order_id: SENTINEL, extra: {})
|
@@ -36,15 +35,14 @@ module SnapTrade
|
|
36
35
|
data
|
37
36
|
end
|
38
37
|
|
39
|
-
# Cancel
|
38
|
+
# Cancel order
|
40
39
|
#
|
41
|
-
#
|
42
|
-
# This will only work if the order has not yet been executed.
|
40
|
+
# Attempts to cancel an open order with the brokerage. If the order is no longer cancellable, the request will be rejected.
|
43
41
|
#
|
44
42
|
# @param user_id [String]
|
45
43
|
# @param user_secret [String]
|
46
|
-
# @param account_id [String]
|
47
|
-
# @param brokerage_order_id [String]
|
44
|
+
# @param account_id [String]
|
45
|
+
# @param brokerage_order_id [String] Order ID returned by brokerage. This is the unique identifier for the order in the brokerage system.
|
48
46
|
# @param body [TradingCancelUserAccountOrderRequest]
|
49
47
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
50
48
|
def cancel_user_account_order_with_http_info(user_id:, user_secret:, account_id:, brokerage_order_id: SENTINEL, extra: {})
|
@@ -54,12 +52,12 @@ module SnapTrade
|
|
54
52
|
cancel_user_account_order_with_http_info_impl(user_id, user_secret, account_id, trading_cancel_user_account_order_request, extra)
|
55
53
|
end
|
56
54
|
|
57
|
-
# Cancel
|
58
|
-
#
|
55
|
+
# Cancel order
|
56
|
+
# Attempts to cancel an open order with the brokerage. If the order is no longer cancellable, the request will be rejected.
|
59
57
|
# @param user_id [String]
|
60
58
|
# @param user_secret [String]
|
61
|
-
# @param account_id [String]
|
62
|
-
# @param trading_cancel_user_account_order_request [TradingCancelUserAccountOrderRequest]
|
59
|
+
# @param account_id [String]
|
60
|
+
# @param trading_cancel_user_account_order_request [TradingCancelUserAccountOrderRequest]
|
63
61
|
# @param [Hash] opts the optional parameters
|
64
62
|
# @return [AccountOrderRecord]
|
65
63
|
private def cancel_user_account_order_impl(user_id, user_secret, account_id, trading_cancel_user_account_order_request, opts = {})
|
@@ -67,12 +65,12 @@ module SnapTrade
|
|
67
65
|
data
|
68
66
|
end
|
69
67
|
|
70
|
-
# Cancel
|
71
|
-
#
|
68
|
+
# Cancel order
|
69
|
+
# Attempts to cancel an open order with the brokerage. If the order is no longer cancellable, the request will be rejected.
|
72
70
|
# @param user_id [String]
|
73
71
|
# @param user_secret [String]
|
74
|
-
# @param account_id [String]
|
75
|
-
# @param trading_cancel_user_account_order_request [TradingCancelUserAccountOrderRequest]
|
72
|
+
# @param account_id [String]
|
73
|
+
# @param trading_cancel_user_account_order_request [TradingCancelUserAccountOrderRequest]
|
76
74
|
# @param [Hash] opts the optional parameters
|
77
75
|
# @return [Array<(AccountOrderRecord, Integer, Hash)>] AccountOrderRecord data, response status code and response headers
|
78
76
|
private def cancel_user_account_order_with_http_info_impl(user_id, user_secret, account_id, trading_cancel_user_account_order_request, opts = {})
|
@@ -143,73 +141,73 @@ module SnapTrade
|
|
143
141
|
end
|
144
142
|
|
145
143
|
|
146
|
-
# Check
|
144
|
+
# Check order impact
|
147
145
|
#
|
148
|
-
#
|
146
|
+
# 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.
|
149
147
|
#
|
148
|
+
# @param account_id [String] Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
|
149
|
+
# @param action [ActionStrict] The action describes the intent or side of a trade. This is either `BUY` or `SELL`
|
150
|
+
# @param universal_symbol_id [String] Unique identifier for the symbol within SnapTrade. This is the ID used to reference the symbol in SnapTrade API calls.
|
151
|
+
# @param order_type [OrderTypeStrict] 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.
|
152
|
+
# @param time_in_force [TimeInForceStrict] 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.
|
150
153
|
# @param user_id [String]
|
151
154
|
# @param user_secret [String]
|
152
|
-
# @param
|
153
|
-
# @param
|
154
|
-
# @param order_type [OrderTypeStrict] Order Type
|
155
|
-
# @param price [Float] Trade Price if limit or stop limit order
|
156
|
-
# @param stop [Float] Stop Price. If stop loss or stop limit order, the price to trigger the stop
|
157
|
-
# @param time_in_force [TimeInForceStrict] Trade time in force examples: * FOK - Fill Or Kill * Day - Day * GTC - Good Til Canceled
|
155
|
+
# @param price [Float] The limit price for `Limit` and `StopLimit` orders.
|
156
|
+
# @param stop [Float] The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
|
158
157
|
# @param units [Float]
|
159
|
-
# @param universal_symbol_id [String]
|
160
158
|
# @param notional_value [ManualTradeFormNotionalValue]
|
161
159
|
# @param body [ManualTradeForm]
|
162
160
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
163
|
-
def get_order_impact(
|
161
|
+
def get_order_impact(account_id:, action:, universal_symbol_id:, order_type:, time_in_force:, user_id:, user_secret:, price: SENTINEL, stop: SENTINEL, units: SENTINEL, notional_value: SENTINEL, extra: {})
|
164
162
|
_body = {}
|
165
163
|
_body[:account_id] = account_id if account_id != SENTINEL
|
166
164
|
_body[:action] = action if action != SENTINEL
|
165
|
+
_body[:universal_symbol_id] = universal_symbol_id if universal_symbol_id != SENTINEL
|
167
166
|
_body[:order_type] = order_type if order_type != SENTINEL
|
167
|
+
_body[:time_in_force] = time_in_force if time_in_force != SENTINEL
|
168
168
|
_body[:price] = price if price != SENTINEL
|
169
169
|
_body[:stop] = stop if stop != SENTINEL
|
170
|
-
_body[:time_in_force] = time_in_force if time_in_force != SENTINEL
|
171
170
|
_body[:units] = units if units != SENTINEL
|
172
|
-
_body[:universal_symbol_id] = universal_symbol_id if universal_symbol_id != SENTINEL
|
173
171
|
_body[:notional_value] = notional_value if notional_value != SENTINEL
|
174
172
|
manual_trade_form = _body
|
175
173
|
data, _status_code, _headers = get_order_impact_with_http_info_impl(user_id, user_secret, manual_trade_form, extra)
|
176
174
|
data
|
177
175
|
end
|
178
176
|
|
179
|
-
# Check
|
177
|
+
# Check order impact
|
180
178
|
#
|
181
|
-
#
|
179
|
+
# 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.
|
182
180
|
#
|
181
|
+
# @param account_id [String] Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
|
182
|
+
# @param action [ActionStrict] The action describes the intent or side of a trade. This is either `BUY` or `SELL`
|
183
|
+
# @param universal_symbol_id [String] Unique identifier for the symbol within SnapTrade. This is the ID used to reference the symbol in SnapTrade API calls.
|
184
|
+
# @param order_type [OrderTypeStrict] 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.
|
185
|
+
# @param time_in_force [TimeInForceStrict] 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.
|
183
186
|
# @param user_id [String]
|
184
187
|
# @param user_secret [String]
|
185
|
-
# @param
|
186
|
-
# @param
|
187
|
-
# @param order_type [OrderTypeStrict] Order Type
|
188
|
-
# @param price [Float] Trade Price if limit or stop limit order
|
189
|
-
# @param stop [Float] Stop Price. If stop loss or stop limit order, the price to trigger the stop
|
190
|
-
# @param time_in_force [TimeInForceStrict] Trade time in force examples: * FOK - Fill Or Kill * Day - Day * GTC - Good Til Canceled
|
188
|
+
# @param price [Float] The limit price for `Limit` and `StopLimit` orders.
|
189
|
+
# @param stop [Float] The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
|
191
190
|
# @param units [Float]
|
192
|
-
# @param universal_symbol_id [String]
|
193
191
|
# @param notional_value [ManualTradeFormNotionalValue]
|
194
192
|
# @param body [ManualTradeForm]
|
195
193
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
196
|
-
def get_order_impact_with_http_info(
|
194
|
+
def get_order_impact_with_http_info(account_id:, action:, universal_symbol_id:, order_type:, time_in_force:, user_id:, user_secret:, price: SENTINEL, stop: SENTINEL, units: SENTINEL, notional_value: SENTINEL, extra: {})
|
197
195
|
_body = {}
|
198
196
|
_body[:account_id] = account_id if account_id != SENTINEL
|
199
197
|
_body[:action] = action if action != SENTINEL
|
198
|
+
_body[:universal_symbol_id] = universal_symbol_id if universal_symbol_id != SENTINEL
|
200
199
|
_body[:order_type] = order_type if order_type != SENTINEL
|
200
|
+
_body[:time_in_force] = time_in_force if time_in_force != SENTINEL
|
201
201
|
_body[:price] = price if price != SENTINEL
|
202
202
|
_body[:stop] = stop if stop != SENTINEL
|
203
|
-
_body[:time_in_force] = time_in_force if time_in_force != SENTINEL
|
204
203
|
_body[:units] = units if units != SENTINEL
|
205
|
-
_body[:universal_symbol_id] = universal_symbol_id if universal_symbol_id != SENTINEL
|
206
204
|
_body[:notional_value] = notional_value if notional_value != SENTINEL
|
207
205
|
manual_trade_form = _body
|
208
206
|
get_order_impact_with_http_info_impl(user_id, user_secret, manual_trade_form, extra)
|
209
207
|
end
|
210
208
|
|
211
|
-
# Check
|
212
|
-
#
|
209
|
+
# Check order impact
|
210
|
+
# 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.
|
213
211
|
# @param user_id [String]
|
214
212
|
# @param user_secret [String]
|
215
213
|
# @param manual_trade_form [ManualTradeForm]
|
@@ -220,8 +218,8 @@ module SnapTrade
|
|
220
218
|
data
|
221
219
|
end
|
222
220
|
|
223
|
-
# Check
|
224
|
-
#
|
221
|
+
# Check order impact
|
222
|
+
# 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.
|
225
223
|
# @param user_id [String]
|
226
224
|
# @param user_secret [String]
|
227
225
|
# @param manual_trade_form [ManualTradeForm]
|
@@ -293,13 +291,13 @@ module SnapTrade
|
|
293
291
|
|
294
292
|
# Get symbol quotes
|
295
293
|
#
|
296
|
-
# Returns
|
294
|
+
# 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.
|
297
295
|
#
|
298
296
|
# @param user_id [String]
|
299
297
|
# @param user_secret [String]
|
300
|
-
# @param symbols [String] List of
|
301
|
-
# @param account_id [String]
|
302
|
-
# @param use_ticker [Boolean] Should be set to True if
|
298
|
+
# @param symbols [String] List of Universal Symbol IDs or tickers to get quotes for.
|
299
|
+
# @param account_id [String]
|
300
|
+
# @param use_ticker [Boolean] Should be set to `True` if `symbols` are comprised of tickers. Defaults to `False` if not provided.
|
303
301
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
304
302
|
def get_user_account_quotes(user_id:, user_secret:, symbols:, account_id:, use_ticker: SENTINEL, extra: {})
|
305
303
|
extra[:use_ticker] = use_ticker if use_ticker != SENTINEL
|
@@ -309,13 +307,13 @@ module SnapTrade
|
|
309
307
|
|
310
308
|
# Get symbol quotes
|
311
309
|
#
|
312
|
-
# Returns
|
310
|
+
# 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.
|
313
311
|
#
|
314
312
|
# @param user_id [String]
|
315
313
|
# @param user_secret [String]
|
316
|
-
# @param symbols [String] List of
|
317
|
-
# @param account_id [String]
|
318
|
-
# @param use_ticker [Boolean] Should be set to True if
|
314
|
+
# @param symbols [String] List of Universal Symbol IDs or tickers to get quotes for.
|
315
|
+
# @param account_id [String]
|
316
|
+
# @param use_ticker [Boolean] Should be set to `True` if `symbols` are comprised of tickers. Defaults to `False` if not provided.
|
319
317
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
320
318
|
def get_user_account_quotes_with_http_info(user_id:, user_secret:, symbols:, account_id:, use_ticker: SENTINEL, extra: {})
|
321
319
|
extra[:use_ticker] = use_ticker if use_ticker != SENTINEL
|
@@ -323,13 +321,13 @@ module SnapTrade
|
|
323
321
|
end
|
324
322
|
|
325
323
|
# Get symbol quotes
|
326
|
-
# Returns
|
324
|
+
# 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.
|
327
325
|
# @param user_id [String]
|
328
326
|
# @param user_secret [String]
|
329
|
-
# @param symbols [String] List of
|
330
|
-
# @param account_id [String]
|
327
|
+
# @param symbols [String] List of Universal Symbol IDs or tickers to get quotes for.
|
328
|
+
# @param account_id [String]
|
331
329
|
# @param [Hash] opts the optional parameters
|
332
|
-
# @option opts [Boolean] :use_ticker Should be set to True if
|
330
|
+
# @option opts [Boolean] :use_ticker Should be set to `True` if `symbols` are comprised of tickers. Defaults to `False` if not provided.
|
333
331
|
# @return [Array<SymbolsQuotesInner>]
|
334
332
|
private def get_user_account_quotes_impl(user_id, user_secret, symbols, account_id, opts = {})
|
335
333
|
data, _status_code, _headers = get_user_account_quotes_with_http_info(user_id, user_secret, symbols, account_id, opts)
|
@@ -337,13 +335,13 @@ module SnapTrade
|
|
337
335
|
end
|
338
336
|
|
339
337
|
# Get symbol quotes
|
340
|
-
# Returns
|
338
|
+
# 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.
|
341
339
|
# @param user_id [String]
|
342
340
|
# @param user_secret [String]
|
343
|
-
# @param symbols [String] List of
|
344
|
-
# @param account_id [String]
|
341
|
+
# @param symbols [String] List of Universal Symbol IDs or tickers to get quotes for.
|
342
|
+
# @param account_id [String]
|
345
343
|
# @param [Hash] opts the optional parameters
|
346
|
-
# @option opts [Boolean] :use_ticker Should be set to True if
|
344
|
+
# @option opts [Boolean] :use_ticker Should be set to `True` if `symbols` are comprised of tickers. Defaults to `False` if not provided.
|
347
345
|
# @return [Array<(Array<SymbolsQuotesInner>, Integer, Hash)>] Array<SymbolsQuotesInner> data, response status code and response headers
|
348
346
|
private def get_user_account_quotes_with_http_info_impl(user_id, user_secret, symbols, account_id, opts = {})
|
349
347
|
if @api_client.config.debugging
|
@@ -410,73 +408,81 @@ module SnapTrade
|
|
410
408
|
end
|
411
409
|
|
412
410
|
|
413
|
-
# Place
|
411
|
+
# Place order
|
414
412
|
#
|
415
|
-
# Places a
|
413
|
+
# 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.
|
414
|
+
#
|
415
|
+
# 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).
|
416
|
+
#
|
417
|
+
# It's recommended to trigger a manual refresh of the account after placing an order to ensure the account is up to date. You can use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint for this.
|
416
418
|
#
|
419
|
+
# @param account_id [String] Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
|
420
|
+
# @param action [ActionStrict] The action describes the intent or side of a trade. This is either `BUY` or `SELL`
|
421
|
+
# @param universal_symbol_id [String] Unique identifier for the symbol within SnapTrade. This is the ID used to reference the symbol in SnapTrade API calls.
|
422
|
+
# @param order_type [OrderTypeStrict] 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.
|
423
|
+
# @param time_in_force [TimeInForceStrict] 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.
|
417
424
|
# @param user_id [String]
|
418
425
|
# @param user_secret [String]
|
419
|
-
# @param
|
420
|
-
# @param
|
421
|
-
# @param order_type [OrderTypeStrict] Order Type
|
422
|
-
# @param price [Float] Trade Price if limit or stop limit order
|
423
|
-
# @param stop [Float] Stop Price. If stop loss or stop limit order, the price to trigger the stop
|
424
|
-
# @param time_in_force [TimeInForceStrict] Trade time in force examples: * FOK - Fill Or Kill * Day - Day * GTC - Good Til Canceled
|
426
|
+
# @param price [Float] The limit price for `Limit` and `StopLimit` orders.
|
427
|
+
# @param stop [Float] The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
|
425
428
|
# @param units [Float]
|
426
|
-
# @param universal_symbol_id [String]
|
427
429
|
# @param notional_value [ManualTradeFormNotionalValue]
|
428
430
|
# @param body [ManualTradeForm]
|
429
431
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
430
|
-
def place_force_order(
|
432
|
+
def place_force_order(account_id:, action:, universal_symbol_id:, order_type:, time_in_force:, user_id:, user_secret:, price: SENTINEL, stop: SENTINEL, units: SENTINEL, notional_value: SENTINEL, extra: {})
|
431
433
|
_body = {}
|
432
434
|
_body[:account_id] = account_id if account_id != SENTINEL
|
433
435
|
_body[:action] = action if action != SENTINEL
|
436
|
+
_body[:universal_symbol_id] = universal_symbol_id if universal_symbol_id != SENTINEL
|
434
437
|
_body[:order_type] = order_type if order_type != SENTINEL
|
438
|
+
_body[:time_in_force] = time_in_force if time_in_force != SENTINEL
|
435
439
|
_body[:price] = price if price != SENTINEL
|
436
440
|
_body[:stop] = stop if stop != SENTINEL
|
437
|
-
_body[:time_in_force] = time_in_force if time_in_force != SENTINEL
|
438
441
|
_body[:units] = units if units != SENTINEL
|
439
|
-
_body[:universal_symbol_id] = universal_symbol_id if universal_symbol_id != SENTINEL
|
440
442
|
_body[:notional_value] = notional_value if notional_value != SENTINEL
|
441
443
|
manual_trade_form = _body
|
442
444
|
data, _status_code, _headers = place_force_order_with_http_info_impl(user_id, user_secret, manual_trade_form, extra)
|
443
445
|
data
|
444
446
|
end
|
445
447
|
|
446
|
-
# Place
|
448
|
+
# Place order
|
447
449
|
#
|
448
|
-
# Places a
|
450
|
+
# 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.
|
451
|
+
#
|
452
|
+
# 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).
|
453
|
+
#
|
454
|
+
# It's recommended to trigger a manual refresh of the account after placing an order to ensure the account is up to date. You can use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint for this.
|
449
455
|
#
|
456
|
+
# @param account_id [String] Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
|
457
|
+
# @param action [ActionStrict] The action describes the intent or side of a trade. This is either `BUY` or `SELL`
|
458
|
+
# @param universal_symbol_id [String] Unique identifier for the symbol within SnapTrade. This is the ID used to reference the symbol in SnapTrade API calls.
|
459
|
+
# @param order_type [OrderTypeStrict] 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.
|
460
|
+
# @param time_in_force [TimeInForceStrict] 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.
|
450
461
|
# @param user_id [String]
|
451
462
|
# @param user_secret [String]
|
452
|
-
# @param
|
453
|
-
# @param
|
454
|
-
# @param order_type [OrderTypeStrict] Order Type
|
455
|
-
# @param price [Float] Trade Price if limit or stop limit order
|
456
|
-
# @param stop [Float] Stop Price. If stop loss or stop limit order, the price to trigger the stop
|
457
|
-
# @param time_in_force [TimeInForceStrict] Trade time in force examples: * FOK - Fill Or Kill * Day - Day * GTC - Good Til Canceled
|
463
|
+
# @param price [Float] The limit price for `Limit` and `StopLimit` orders.
|
464
|
+
# @param stop [Float] The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
|
458
465
|
# @param units [Float]
|
459
|
-
# @param universal_symbol_id [String]
|
460
466
|
# @param notional_value [ManualTradeFormNotionalValue]
|
461
467
|
# @param body [ManualTradeForm]
|
462
468
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
463
|
-
def place_force_order_with_http_info(
|
469
|
+
def place_force_order_with_http_info(account_id:, action:, universal_symbol_id:, order_type:, time_in_force:, user_id:, user_secret:, price: SENTINEL, stop: SENTINEL, units: SENTINEL, notional_value: SENTINEL, extra: {})
|
464
470
|
_body = {}
|
465
471
|
_body[:account_id] = account_id if account_id != SENTINEL
|
466
472
|
_body[:action] = action if action != SENTINEL
|
473
|
+
_body[:universal_symbol_id] = universal_symbol_id if universal_symbol_id != SENTINEL
|
467
474
|
_body[:order_type] = order_type if order_type != SENTINEL
|
475
|
+
_body[:time_in_force] = time_in_force if time_in_force != SENTINEL
|
468
476
|
_body[:price] = price if price != SENTINEL
|
469
477
|
_body[:stop] = stop if stop != SENTINEL
|
470
|
-
_body[:time_in_force] = time_in_force if time_in_force != SENTINEL
|
471
478
|
_body[:units] = units if units != SENTINEL
|
472
|
-
_body[:universal_symbol_id] = universal_symbol_id if universal_symbol_id != SENTINEL
|
473
479
|
_body[:notional_value] = notional_value if notional_value != SENTINEL
|
474
480
|
manual_trade_form = _body
|
475
481
|
place_force_order_with_http_info_impl(user_id, user_secret, manual_trade_form, extra)
|
476
482
|
end
|
477
483
|
|
478
|
-
# Place
|
479
|
-
# Places a
|
484
|
+
# Place order
|
485
|
+
# 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). It's recommended to trigger a manual refresh of the account after placing an order to ensure the account is up to date. You can use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint for this.
|
480
486
|
# @param user_id [String]
|
481
487
|
# @param user_secret [String]
|
482
488
|
# @param manual_trade_form [ManualTradeForm]
|
@@ -487,8 +493,8 @@ module SnapTrade
|
|
487
493
|
data
|
488
494
|
end
|
489
495
|
|
490
|
-
# Place
|
491
|
-
# Places a
|
496
|
+
# Place order
|
497
|
+
# 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). It's recommended to trigger a manual refresh of the account after placing an order to ensure the account is up to date. You can use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint for this.
|
492
498
|
# @param user_id [String]
|
493
499
|
# @param user_secret [String]
|
494
500
|
# @param manual_trade_form [ManualTradeForm]
|
@@ -558,15 +564,16 @@ module SnapTrade
|
|
558
564
|
end
|
559
565
|
|
560
566
|
|
561
|
-
# Place order
|
567
|
+
# Place checked order
|
562
568
|
#
|
563
|
-
# Places the
|
564
|
-
#
|
569
|
+
# 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).
|
570
|
+
#
|
571
|
+
# It's recommended to trigger a manual refresh of the account after placing an order to ensure the account is up to date. You can use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint for this.
|
565
572
|
#
|
566
|
-
# @param trade_id [String]
|
573
|
+
# @param trade_id [String] Obtained from calling the [check order impact endpoint](/reference/Trading/Trading_getOrderImpact)
|
567
574
|
# @param user_id [String]
|
568
575
|
# @param user_secret [String]
|
569
|
-
# @param wait_to_confirm [Boolean] 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
|
576
|
+
# @param wait_to_confirm [Boolean] 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.
|
570
577
|
# @param body [ValidatedTradeBody]
|
571
578
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
572
579
|
def place_order(trade_id:, user_id:, user_secret:, wait_to_confirm: SENTINEL, extra: {})
|
@@ -577,15 +584,16 @@ module SnapTrade
|
|
577
584
|
data
|
578
585
|
end
|
579
586
|
|
580
|
-
# Place order
|
587
|
+
# Place checked order
|
581
588
|
#
|
582
|
-
# Places the
|
583
|
-
#
|
589
|
+
# 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).
|
590
|
+
#
|
591
|
+
# It's recommended to trigger a manual refresh of the account after placing an order to ensure the account is up to date. You can use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint for this.
|
584
592
|
#
|
585
|
-
# @param trade_id [String]
|
593
|
+
# @param trade_id [String] Obtained from calling the [check order impact endpoint](/reference/Trading/Trading_getOrderImpact)
|
586
594
|
# @param user_id [String]
|
587
595
|
# @param user_secret [String]
|
588
|
-
# @param wait_to_confirm [Boolean] 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
|
596
|
+
# @param wait_to_confirm [Boolean] 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.
|
589
597
|
# @param body [ValidatedTradeBody]
|
590
598
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
591
599
|
def place_order_with_http_info(trade_id:, user_id:, user_secret:, wait_to_confirm: SENTINEL, extra: {})
|
@@ -595,9 +603,9 @@ module SnapTrade
|
|
595
603
|
place_order_with_http_info_impl(trade_id, user_id, user_secret, extra)
|
596
604
|
end
|
597
605
|
|
598
|
-
# Place order
|
599
|
-
# Places the
|
600
|
-
# @param trade_id [String]
|
606
|
+
# Place checked order
|
607
|
+
# 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). It's recommended to trigger a manual refresh of the account after placing an order to ensure the account is up to date. You can use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint for this.
|
608
|
+
# @param trade_id [String] Obtained from calling the [check order impact endpoint](/reference/Trading/Trading_getOrderImpact)
|
601
609
|
# @param user_id [String]
|
602
610
|
# @param user_secret [String]
|
603
611
|
# @param [Hash] opts the optional parameters
|
@@ -608,9 +616,9 @@ module SnapTrade
|
|
608
616
|
data
|
609
617
|
end
|
610
618
|
|
611
|
-
# Place order
|
612
|
-
# Places the
|
613
|
-
# @param trade_id [String]
|
619
|
+
# Place checked order
|
620
|
+
# 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). It's recommended to trigger a manual refresh of the account after placing an order to ensure the account is up to date. You can use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint for this.
|
621
|
+
# @param trade_id [String] Obtained from calling the [check order impact endpoint](/reference/Trading/Trading_getOrderImpact)
|
614
622
|
# @param user_id [String]
|
615
623
|
# @param user_secret [String]
|
616
624
|
# @param [Hash] opts the optional parameters
|
@@ -30,7 +30,7 @@ module SnapTrade
|
|
30
30
|
# Whether the connection is read-only or trade-enabled. A read-only connection can only be used to fetch data, while a trade-enabled connection can be used to place trades. Valid values are `read` and `trade`.
|
31
31
|
attr_accessor :type
|
32
32
|
|
33
|
-
# Whether the connection is disabled. A disabled connection can no longer access the latest data from the brokerage, but will continue to return the last cached state. A connection can become disabled for many reasons and differs by brokerage. Here are some common scenarios: - The user has changed their username or password at the brokerage. - The user has explicitly removed the access grant at the brokerage. - The session has expired at the brokerage and now requires explicit user re-authentication. Please see [this guide](
|
33
|
+
# Whether the connection is disabled. A disabled connection can no longer access the latest data from the brokerage, but will continue to return the last cached state. A connection can become disabled for many reasons and differs by brokerage. Here are some common scenarios: - The user has changed their username or password at the brokerage. - The user has explicitly removed the access grant at the brokerage. - The session has expired at the brokerage and now requires explicit user re-authentication. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
|
34
34
|
attr_accessor :disabled
|
35
35
|
|
36
36
|
# Timestamp of when the connection was disabled in SnapTrade.
|
@@ -11,21 +11,23 @@ require 'date'
|
|
11
11
|
require 'time'
|
12
12
|
|
13
13
|
module SnapTrade
|
14
|
-
#
|
14
|
+
# Contains the details of a submitted order.
|
15
15
|
class ManualTrade
|
16
|
+
# Unique identifier for the submitted order through SnapTrade.
|
16
17
|
attr_accessor :id
|
17
18
|
|
19
|
+
# Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
|
18
20
|
attr_accessor :account
|
19
21
|
|
20
|
-
#
|
22
|
+
# 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.
|
21
23
|
attr_accessor :order_type
|
22
24
|
|
23
|
-
#
|
25
|
+
# 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.
|
24
26
|
attr_accessor :time_in_force
|
25
27
|
|
26
28
|
attr_accessor :symbol
|
27
29
|
|
28
|
-
#
|
30
|
+
# The action describes the intent or side of a trade. This is either `BUY` or `SELL`
|
29
31
|
attr_accessor :action
|
30
32
|
|
31
33
|
attr_accessor :units
|
@@ -58,7 +60,7 @@ module SnapTrade
|
|
58
60
|
:'id' => :'String',
|
59
61
|
:'account' => :'String',
|
60
62
|
:'order_type' => :'OrderTypeStrict',
|
61
|
-
:'time_in_force' => :'
|
63
|
+
:'time_in_force' => :'TimeInForceStrict',
|
62
64
|
:'symbol' => :'ManualTradeSymbol',
|
63
65
|
:'action' => :'ActionStrict',
|
64
66
|
:'units' => :'Float',
|
@@ -11,10 +11,10 @@ require 'date'
|
|
11
11
|
require 'time'
|
12
12
|
|
13
13
|
module SnapTrade
|
14
|
-
# Manual Trade and Impact object
|
15
14
|
class ManualTradeAndImpact
|
16
15
|
attr_accessor :trade
|
17
16
|
|
17
|
+
# List of impacts of the trade on the account. The list always contains one value at the moment.
|
18
18
|
attr_accessor :trade_impacts
|
19
19
|
|
20
20
|
attr_accessor :combined_remaining_balance
|
@@ -37,7 +37,7 @@ module SnapTrade
|
|
37
37
|
def self.openapi_types
|
38
38
|
{
|
39
39
|
:'trade' => :'ManualTrade',
|
40
|
-
:'trade_impacts' => :'Array<
|
40
|
+
:'trade_impacts' => :'Array<ManualTradeImpact>',
|
41
41
|
:'combined_remaining_balance' => :'ManualTradeBalance'
|
42
42
|
}
|
43
43
|
end
|
@@ -11,13 +11,13 @@ require 'date'
|
|
11
11
|
require 'time'
|
12
12
|
|
13
13
|
module SnapTrade
|
14
|
-
#
|
14
|
+
# Estimated remaining balance of the account after the trade is executed.
|
15
15
|
class ManualTradeBalance
|
16
16
|
attr_accessor :account
|
17
17
|
|
18
18
|
attr_accessor :currency
|
19
19
|
|
20
|
-
#
|
20
|
+
# Estimated amount of cash remaining in the account after the trade. At the moment this is the same as `remaining_cash` under `trade_impacts`.
|
21
21
|
attr_accessor :cash
|
22
22
|
|
23
23
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -37,7 +37,7 @@ module SnapTrade
|
|
37
37
|
# Attribute type mapping.
|
38
38
|
def self.openapi_types
|
39
39
|
{
|
40
|
-
:'account' => :'
|
40
|
+
:'account' => :'AccountSimple',
|
41
41
|
:'currency' => :'Currency',
|
42
42
|
:'cash' => :'Float'
|
43
43
|
}
|