snaptrade 2.0.107 → 2.0.108
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +161 -161
- data/lib/snaptrade/api/trading_api.rb +386 -0
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +0 -3
- data/spec/api/trading_api_spec.rb +46 -0
- metadata +2 -5
- data/lib/snaptrade/api/crypto_trading_api.rb +0 -408
- data/spec/api/crypto_trading_api_spec.rb +0 -76
@@ -252,6 +252,117 @@ module SnapTrade
|
|
252
252
|
end
|
253
253
|
|
254
254
|
|
255
|
+
# Get cryptocurrency pair quote
|
256
|
+
#
|
257
|
+
# Gets a quote for the specified account.
|
258
|
+
#
|
259
|
+
# @param user_id [String]
|
260
|
+
# @param user_secret [String]
|
261
|
+
# @param account_id [String]
|
262
|
+
# @param instrument_symbol [String]
|
263
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
264
|
+
def get_cryptocurrency_pair_quote(user_id:, user_secret:, account_id:, instrument_symbol:, extra: {})
|
265
|
+
data, _status_code, _headers = get_cryptocurrency_pair_quote_with_http_info_impl(user_id, user_secret, account_id, instrument_symbol, extra)
|
266
|
+
data
|
267
|
+
end
|
268
|
+
|
269
|
+
# Get cryptocurrency pair quote
|
270
|
+
#
|
271
|
+
# Gets a quote for the specified account.
|
272
|
+
#
|
273
|
+
# @param user_id [String]
|
274
|
+
# @param user_secret [String]
|
275
|
+
# @param account_id [String]
|
276
|
+
# @param instrument_symbol [String]
|
277
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
278
|
+
def get_cryptocurrency_pair_quote_with_http_info(user_id:, user_secret:, account_id:, instrument_symbol:, extra: {})
|
279
|
+
get_cryptocurrency_pair_quote_with_http_info_impl(user_id, user_secret, account_id, instrument_symbol, extra)
|
280
|
+
end
|
281
|
+
|
282
|
+
# Get cryptocurrency pair quote
|
283
|
+
# Gets a quote for the specified account.
|
284
|
+
# @param user_id [String]
|
285
|
+
# @param user_secret [String]
|
286
|
+
# @param account_id [String]
|
287
|
+
# @param instrument_symbol [String]
|
288
|
+
# @param [Hash] opts the optional parameters
|
289
|
+
# @return [CryptocurrencyPairQuote]
|
290
|
+
private def get_cryptocurrency_pair_quote_impl(user_id, user_secret, account_id, instrument_symbol, opts = {})
|
291
|
+
data, _status_code, _headers = get_cryptocurrency_pair_quote_with_http_info(user_id, user_secret, account_id, instrument_symbol, opts)
|
292
|
+
data
|
293
|
+
end
|
294
|
+
|
295
|
+
# Get cryptocurrency pair quote
|
296
|
+
# Gets a quote for the specified account.
|
297
|
+
# @param user_id [String]
|
298
|
+
# @param user_secret [String]
|
299
|
+
# @param account_id [String]
|
300
|
+
# @param instrument_symbol [String]
|
301
|
+
# @param [Hash] opts the optional parameters
|
302
|
+
# @return [Array<(CryptocurrencyPairQuote, Integer, Hash)>] CryptocurrencyPairQuote data, response status code and response headers
|
303
|
+
private def get_cryptocurrency_pair_quote_with_http_info_impl(user_id, user_secret, account_id, instrument_symbol, opts = {})
|
304
|
+
if @api_client.config.debugging
|
305
|
+
@api_client.config.logger.debug 'Calling API: TradingApi.get_cryptocurrency_pair_quote ...'
|
306
|
+
end
|
307
|
+
# verify the required parameter 'user_id' is set
|
308
|
+
if @api_client.config.client_side_validation && user_id.nil?
|
309
|
+
fail ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.get_cryptocurrency_pair_quote"
|
310
|
+
end
|
311
|
+
# verify the required parameter 'user_secret' is set
|
312
|
+
if @api_client.config.client_side_validation && user_secret.nil?
|
313
|
+
fail ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.get_cryptocurrency_pair_quote"
|
314
|
+
end
|
315
|
+
# verify the required parameter 'account_id' is set
|
316
|
+
if @api_client.config.client_side_validation && account_id.nil?
|
317
|
+
fail ArgumentError, "Missing the required parameter 'account_id' when calling TradingApi.get_cryptocurrency_pair_quote"
|
318
|
+
end
|
319
|
+
# verify the required parameter 'instrument_symbol' is set
|
320
|
+
if @api_client.config.client_side_validation && instrument_symbol.nil?
|
321
|
+
fail ArgumentError, "Missing the required parameter 'instrument_symbol' when calling TradingApi.get_cryptocurrency_pair_quote"
|
322
|
+
end
|
323
|
+
# resource path
|
324
|
+
local_var_path = '/accounts/{accountId}/trading/instruments/cryptocurrencyPairs/{instrumentSymbol}/quote'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'instrumentSymbol' + '}', CGI.escape(instrument_symbol.to_s))
|
325
|
+
|
326
|
+
# query parameters
|
327
|
+
query_params = opts[:query_params] || {}
|
328
|
+
query_params[:'userId'] = user_id
|
329
|
+
query_params[:'userSecret'] = user_secret
|
330
|
+
|
331
|
+
# header parameters
|
332
|
+
header_params = opts[:header_params] || {}
|
333
|
+
# HTTP header 'Accept' (if needed)
|
334
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
335
|
+
|
336
|
+
# form parameters
|
337
|
+
form_params = opts[:form_params] || {}
|
338
|
+
|
339
|
+
# http body (model)
|
340
|
+
post_body = opts[:debug_body]
|
341
|
+
|
342
|
+
# return_type
|
343
|
+
return_type = opts[:debug_return_type] || 'CryptocurrencyPairQuote'
|
344
|
+
|
345
|
+
# auth_names
|
346
|
+
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
347
|
+
|
348
|
+
new_options = opts.merge(
|
349
|
+
:operation => :"TradingApi.get_cryptocurrency_pair_quote",
|
350
|
+
:header_params => header_params,
|
351
|
+
:query_params => query_params,
|
352
|
+
:form_params => form_params,
|
353
|
+
:body => post_body,
|
354
|
+
:auth_names => auth_names,
|
355
|
+
:return_type => return_type
|
356
|
+
)
|
357
|
+
|
358
|
+
data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
|
359
|
+
if @api_client.config.debugging
|
360
|
+
@api_client.config.logger.debug "API called: TradingApi#get_cryptocurrency_pair_quote\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
361
|
+
end
|
362
|
+
return data, status_code, headers, response
|
363
|
+
end
|
364
|
+
|
365
|
+
|
255
366
|
# Check order impact
|
256
367
|
#
|
257
368
|
# 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.
|
@@ -1109,6 +1220,164 @@ module SnapTrade
|
|
1109
1220
|
end
|
1110
1221
|
|
1111
1222
|
|
1223
|
+
# Place order
|
1224
|
+
#
|
1225
|
+
# Places an order in the specified account.
|
1226
|
+
# This endpoint does not compute the impact to the account balance from the order before submitting the order.
|
1227
|
+
#
|
1228
|
+
# @param instrument [TradingInstrument]
|
1229
|
+
# @param side [ActionStrict] The action describes the intent or side of a trade. This is either `BUY` or `SELL`.
|
1230
|
+
# @param type [SimpleOrderFormType] The type of order to place.
|
1231
|
+
# @param time_in_force [SimpleOrderFormTimeInForce] The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. - `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. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled. - `GTD` - Good Til Date. The order is valid until the specified date.
|
1232
|
+
# @param amount [Float] The amount of the base currency to buy or sell.
|
1233
|
+
# @param user_id [String]
|
1234
|
+
# @param user_secret [String]
|
1235
|
+
# @param account_id [String]
|
1236
|
+
# @param limit_price [Float] The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT or TAKE_PROFIT_LIMIT.
|
1237
|
+
# @param stop_price [Float] The stop price. Required if the order type is STOP_LOSS_MARKET, STOP_LOSS_LIMIT, TAKE_PROFIT_MARKET or TAKE_PROFIT_LIMIT.
|
1238
|
+
# @param post_only [Boolean] Valid and required only for order type LIMIT. If true orders that would be filled immediately are rejected to avoid incurring TAKER fees.
|
1239
|
+
# @param expiration_date [Time] The expiration date of the order. Required if the time_in_force is GTD.
|
1240
|
+
# @param body [SimpleOrderForm]
|
1241
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
1242
|
+
def place_simple_order(instrument:, side:, type:, time_in_force:, amount:, user_id:, user_secret:, account_id:, limit_price: SENTINEL, stop_price: SENTINEL, post_only: SENTINEL, expiration_date: SENTINEL, extra: {})
|
1243
|
+
_body = {}
|
1244
|
+
_body[:instrument] = instrument if instrument != SENTINEL
|
1245
|
+
_body[:side] = side if side != SENTINEL
|
1246
|
+
_body[:type] = type if type != SENTINEL
|
1247
|
+
_body[:time_in_force] = time_in_force if time_in_force != SENTINEL
|
1248
|
+
_body[:amount] = amount if amount != SENTINEL
|
1249
|
+
_body[:limit_price] = limit_price if limit_price != SENTINEL
|
1250
|
+
_body[:stop_price] = stop_price if stop_price != SENTINEL
|
1251
|
+
_body[:post_only] = post_only if post_only != SENTINEL
|
1252
|
+
_body[:expiration_date] = expiration_date if expiration_date != SENTINEL
|
1253
|
+
simple_order_form = _body
|
1254
|
+
data, _status_code, _headers = place_simple_order_with_http_info_impl(user_id, user_secret, account_id, simple_order_form, extra)
|
1255
|
+
data
|
1256
|
+
end
|
1257
|
+
|
1258
|
+
# Place order
|
1259
|
+
#
|
1260
|
+
# Places an order in the specified account.
|
1261
|
+
# This endpoint does not compute the impact to the account balance from the order before submitting the order.
|
1262
|
+
#
|
1263
|
+
# @param instrument [TradingInstrument]
|
1264
|
+
# @param side [ActionStrict] The action describes the intent or side of a trade. This is either `BUY` or `SELL`.
|
1265
|
+
# @param type [SimpleOrderFormType] The type of order to place.
|
1266
|
+
# @param time_in_force [SimpleOrderFormTimeInForce] The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. - `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. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled. - `GTD` - Good Til Date. The order is valid until the specified date.
|
1267
|
+
# @param amount [Float] The amount of the base currency to buy or sell.
|
1268
|
+
# @param user_id [String]
|
1269
|
+
# @param user_secret [String]
|
1270
|
+
# @param account_id [String]
|
1271
|
+
# @param limit_price [Float] The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT or TAKE_PROFIT_LIMIT.
|
1272
|
+
# @param stop_price [Float] The stop price. Required if the order type is STOP_LOSS_MARKET, STOP_LOSS_LIMIT, TAKE_PROFIT_MARKET or TAKE_PROFIT_LIMIT.
|
1273
|
+
# @param post_only [Boolean] Valid and required only for order type LIMIT. If true orders that would be filled immediately are rejected to avoid incurring TAKER fees.
|
1274
|
+
# @param expiration_date [Time] The expiration date of the order. Required if the time_in_force is GTD.
|
1275
|
+
# @param body [SimpleOrderForm]
|
1276
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
1277
|
+
def place_simple_order_with_http_info(instrument:, side:, type:, time_in_force:, amount:, user_id:, user_secret:, account_id:, limit_price: SENTINEL, stop_price: SENTINEL, post_only: SENTINEL, expiration_date: SENTINEL, extra: {})
|
1278
|
+
_body = {}
|
1279
|
+
_body[:instrument] = instrument if instrument != SENTINEL
|
1280
|
+
_body[:side] = side if side != SENTINEL
|
1281
|
+
_body[:type] = type if type != SENTINEL
|
1282
|
+
_body[:time_in_force] = time_in_force if time_in_force != SENTINEL
|
1283
|
+
_body[:amount] = amount if amount != SENTINEL
|
1284
|
+
_body[:limit_price] = limit_price if limit_price != SENTINEL
|
1285
|
+
_body[:stop_price] = stop_price if stop_price != SENTINEL
|
1286
|
+
_body[:post_only] = post_only if post_only != SENTINEL
|
1287
|
+
_body[:expiration_date] = expiration_date if expiration_date != SENTINEL
|
1288
|
+
simple_order_form = _body
|
1289
|
+
place_simple_order_with_http_info_impl(user_id, user_secret, account_id, simple_order_form, extra)
|
1290
|
+
end
|
1291
|
+
|
1292
|
+
# Place order
|
1293
|
+
# Places an order in the specified account. This endpoint does not compute the impact to the account balance from the order before submitting the order.
|
1294
|
+
# @param user_id [String]
|
1295
|
+
# @param user_secret [String]
|
1296
|
+
# @param account_id [String]
|
1297
|
+
# @param simple_order_form [SimpleOrderForm]
|
1298
|
+
# @param [Hash] opts the optional parameters
|
1299
|
+
# @return [OrderUpdatedResponse]
|
1300
|
+
private def place_simple_order_impl(user_id, user_secret, account_id, simple_order_form, opts = {})
|
1301
|
+
data, _status_code, _headers = place_simple_order_with_http_info(user_id, user_secret, account_id, simple_order_form, opts)
|
1302
|
+
data
|
1303
|
+
end
|
1304
|
+
|
1305
|
+
# Place order
|
1306
|
+
# Places an order in the specified account. This endpoint does not compute the impact to the account balance from the order before submitting the order.
|
1307
|
+
# @param user_id [String]
|
1308
|
+
# @param user_secret [String]
|
1309
|
+
# @param account_id [String]
|
1310
|
+
# @param simple_order_form [SimpleOrderForm]
|
1311
|
+
# @param [Hash] opts the optional parameters
|
1312
|
+
# @return [Array<(OrderUpdatedResponse, Integer, Hash)>] OrderUpdatedResponse data, response status code and response headers
|
1313
|
+
private def place_simple_order_with_http_info_impl(user_id, user_secret, account_id, simple_order_form, opts = {})
|
1314
|
+
if @api_client.config.debugging
|
1315
|
+
@api_client.config.logger.debug 'Calling API: TradingApi.place_simple_order ...'
|
1316
|
+
end
|
1317
|
+
# verify the required parameter 'user_id' is set
|
1318
|
+
if @api_client.config.client_side_validation && user_id.nil?
|
1319
|
+
fail ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.place_simple_order"
|
1320
|
+
end
|
1321
|
+
# verify the required parameter 'user_secret' is set
|
1322
|
+
if @api_client.config.client_side_validation && user_secret.nil?
|
1323
|
+
fail ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.place_simple_order"
|
1324
|
+
end
|
1325
|
+
# verify the required parameter 'account_id' is set
|
1326
|
+
if @api_client.config.client_side_validation && account_id.nil?
|
1327
|
+
fail ArgumentError, "Missing the required parameter 'account_id' when calling TradingApi.place_simple_order"
|
1328
|
+
end
|
1329
|
+
# verify the required parameter 'simple_order_form' is set
|
1330
|
+
if @api_client.config.client_side_validation && simple_order_form.nil?
|
1331
|
+
fail ArgumentError, "Missing the required parameter 'simple_order_form' when calling TradingApi.place_simple_order"
|
1332
|
+
end
|
1333
|
+
# resource path
|
1334
|
+
local_var_path = '/accounts/{accountId}/trading/simple'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
|
1335
|
+
|
1336
|
+
# query parameters
|
1337
|
+
query_params = opts[:query_params] || {}
|
1338
|
+
query_params[:'userId'] = user_id
|
1339
|
+
query_params[:'userSecret'] = user_secret
|
1340
|
+
|
1341
|
+
# header parameters
|
1342
|
+
header_params = opts[:header_params] || {}
|
1343
|
+
# HTTP header 'Accept' (if needed)
|
1344
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
1345
|
+
# HTTP header 'Content-Type'
|
1346
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
1347
|
+
if !content_type.nil?
|
1348
|
+
header_params['Content-Type'] = content_type
|
1349
|
+
end
|
1350
|
+
|
1351
|
+
# form parameters
|
1352
|
+
form_params = opts[:form_params] || {}
|
1353
|
+
|
1354
|
+
# http body (model)
|
1355
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(simple_order_form)
|
1356
|
+
|
1357
|
+
# return_type
|
1358
|
+
return_type = opts[:debug_return_type] || 'OrderUpdatedResponse'
|
1359
|
+
|
1360
|
+
# auth_names
|
1361
|
+
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
1362
|
+
|
1363
|
+
new_options = opts.merge(
|
1364
|
+
:operation => :"TradingApi.place_simple_order",
|
1365
|
+
:header_params => header_params,
|
1366
|
+
:query_params => query_params,
|
1367
|
+
:form_params => form_params,
|
1368
|
+
:body => post_body,
|
1369
|
+
:auth_names => auth_names,
|
1370
|
+
:return_type => return_type
|
1371
|
+
)
|
1372
|
+
|
1373
|
+
data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
|
1374
|
+
if @api_client.config.debugging
|
1375
|
+
@api_client.config.logger.debug "API called: TradingApi#place_simple_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
1376
|
+
end
|
1377
|
+
return data, status_code, headers, response
|
1378
|
+
end
|
1379
|
+
|
1380
|
+
|
1112
1381
|
# Preview order
|
1113
1382
|
#
|
1114
1383
|
# Previews an order using the specified account.
|
@@ -1423,6 +1692,123 @@ module SnapTrade
|
|
1423
1692
|
end
|
1424
1693
|
return data, status_code, headers, response
|
1425
1694
|
end
|
1695
|
+
|
1696
|
+
|
1697
|
+
# Search cryptocurrency pairs instruments
|
1698
|
+
#
|
1699
|
+
# Searches cryptocurrency pairs instruments accessible to the specified account.
|
1700
|
+
#
|
1701
|
+
# @param user_id [String]
|
1702
|
+
# @param user_secret [String]
|
1703
|
+
# @param account_id [String]
|
1704
|
+
# @param base [String]
|
1705
|
+
# @param quote [String]
|
1706
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
1707
|
+
def search_cryptocurrency_pair_instruments(user_id:, user_secret:, account_id:, base: SENTINEL, quote: SENTINEL, extra: {})
|
1708
|
+
extra[:base] = base if base != SENTINEL
|
1709
|
+
extra[:quote] = quote if quote != SENTINEL
|
1710
|
+
data, _status_code, _headers = search_cryptocurrency_pair_instruments_with_http_info_impl(user_id, user_secret, account_id, extra)
|
1711
|
+
data
|
1712
|
+
end
|
1713
|
+
|
1714
|
+
# Search cryptocurrency pairs instruments
|
1715
|
+
#
|
1716
|
+
# Searches cryptocurrency pairs instruments accessible to the specified account.
|
1717
|
+
#
|
1718
|
+
# @param user_id [String]
|
1719
|
+
# @param user_secret [String]
|
1720
|
+
# @param account_id [String]
|
1721
|
+
# @param base [String]
|
1722
|
+
# @param quote [String]
|
1723
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
1724
|
+
def search_cryptocurrency_pair_instruments_with_http_info(user_id:, user_secret:, account_id:, base: SENTINEL, quote: SENTINEL, extra: {})
|
1725
|
+
extra[:base] = base if base != SENTINEL
|
1726
|
+
extra[:quote] = quote if quote != SENTINEL
|
1727
|
+
search_cryptocurrency_pair_instruments_with_http_info_impl(user_id, user_secret, account_id, extra)
|
1728
|
+
end
|
1729
|
+
|
1730
|
+
# Search cryptocurrency pairs instruments
|
1731
|
+
# Searches cryptocurrency pairs instruments accessible to the specified account.
|
1732
|
+
# @param user_id [String]
|
1733
|
+
# @param user_secret [String]
|
1734
|
+
# @param account_id [String]
|
1735
|
+
# @param [Hash] opts the optional parameters
|
1736
|
+
# @option opts [String] :base
|
1737
|
+
# @option opts [String] :quote
|
1738
|
+
# @return [TradingSearchCryptocurrencyPairInstruments200Response]
|
1739
|
+
private def search_cryptocurrency_pair_instruments_impl(user_id, user_secret, account_id, opts = {})
|
1740
|
+
data, _status_code, _headers = search_cryptocurrency_pair_instruments_with_http_info(user_id, user_secret, account_id, opts)
|
1741
|
+
data
|
1742
|
+
end
|
1743
|
+
|
1744
|
+
# Search cryptocurrency pairs instruments
|
1745
|
+
# Searches cryptocurrency pairs instruments accessible to the specified account.
|
1746
|
+
# @param user_id [String]
|
1747
|
+
# @param user_secret [String]
|
1748
|
+
# @param account_id [String]
|
1749
|
+
# @param [Hash] opts the optional parameters
|
1750
|
+
# @option opts [String] :base
|
1751
|
+
# @option opts [String] :quote
|
1752
|
+
# @return [Array<(TradingSearchCryptocurrencyPairInstruments200Response, Integer, Hash)>] TradingSearchCryptocurrencyPairInstruments200Response data, response status code and response headers
|
1753
|
+
private def search_cryptocurrency_pair_instruments_with_http_info_impl(user_id, user_secret, account_id, opts = {})
|
1754
|
+
if @api_client.config.debugging
|
1755
|
+
@api_client.config.logger.debug 'Calling API: TradingApi.search_cryptocurrency_pair_instruments ...'
|
1756
|
+
end
|
1757
|
+
# verify the required parameter 'user_id' is set
|
1758
|
+
if @api_client.config.client_side_validation && user_id.nil?
|
1759
|
+
fail ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.search_cryptocurrency_pair_instruments"
|
1760
|
+
end
|
1761
|
+
# verify the required parameter 'user_secret' is set
|
1762
|
+
if @api_client.config.client_side_validation && user_secret.nil?
|
1763
|
+
fail ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.search_cryptocurrency_pair_instruments"
|
1764
|
+
end
|
1765
|
+
# verify the required parameter 'account_id' is set
|
1766
|
+
if @api_client.config.client_side_validation && account_id.nil?
|
1767
|
+
fail ArgumentError, "Missing the required parameter 'account_id' when calling TradingApi.search_cryptocurrency_pair_instruments"
|
1768
|
+
end
|
1769
|
+
# resource path
|
1770
|
+
local_var_path = '/accounts/{accountId}/trading/instruments/cryptocurrencyPairs'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
|
1771
|
+
|
1772
|
+
# query parameters
|
1773
|
+
query_params = opts[:query_params] || {}
|
1774
|
+
query_params[:'userId'] = user_id
|
1775
|
+
query_params[:'userSecret'] = user_secret
|
1776
|
+
query_params[:'base'] = opts[:'base'] if !opts[:'base'].nil?
|
1777
|
+
query_params[:'quote'] = opts[:'quote'] if !opts[:'quote'].nil?
|
1778
|
+
|
1779
|
+
# header parameters
|
1780
|
+
header_params = opts[:header_params] || {}
|
1781
|
+
# HTTP header 'Accept' (if needed)
|
1782
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
1783
|
+
|
1784
|
+
# form parameters
|
1785
|
+
form_params = opts[:form_params] || {}
|
1786
|
+
|
1787
|
+
# http body (model)
|
1788
|
+
post_body = opts[:debug_body]
|
1789
|
+
|
1790
|
+
# return_type
|
1791
|
+
return_type = opts[:debug_return_type] || 'TradingSearchCryptocurrencyPairInstruments200Response'
|
1792
|
+
|
1793
|
+
# auth_names
|
1794
|
+
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
1795
|
+
|
1796
|
+
new_options = opts.merge(
|
1797
|
+
:operation => :"TradingApi.search_cryptocurrency_pair_instruments",
|
1798
|
+
:header_params => header_params,
|
1799
|
+
:query_params => query_params,
|
1800
|
+
:form_params => form_params,
|
1801
|
+
:body => post_body,
|
1802
|
+
:auth_names => auth_names,
|
1803
|
+
:return_type => return_type
|
1804
|
+
)
|
1805
|
+
|
1806
|
+
data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
|
1807
|
+
if @api_client.config.debugging
|
1808
|
+
@api_client.config.logger.debug "API called: TradingApi#search_cryptocurrency_pair_instruments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
1809
|
+
end
|
1810
|
+
return data, status_code, headers, response
|
1811
|
+
end
|
1426
1812
|
end
|
1427
1813
|
|
1428
1814
|
# top-level client access to avoid having the user to insantiate their own API instances
|
data/lib/snaptrade/version.rb
CHANGED
data/lib/snaptrade.rb
CHANGED
@@ -169,7 +169,6 @@ require 'snaptrade/api/account_information_api'
|
|
169
169
|
require 'snaptrade/api/api_status_api'
|
170
170
|
require 'snaptrade/api/authentication_api'
|
171
171
|
require 'snaptrade/api/connections_api'
|
172
|
-
require 'snaptrade/api/crypto_trading_api'
|
173
172
|
require 'snaptrade/api/options_api'
|
174
173
|
require 'snaptrade/api/reference_data_api'
|
175
174
|
require 'snaptrade/api/trading_api'
|
@@ -243,7 +242,6 @@ module SnapTrade
|
|
243
242
|
attr_reader :api_status
|
244
243
|
attr_reader :authentication
|
245
244
|
attr_reader :connections
|
246
|
-
attr_reader :crypto_trading
|
247
245
|
attr_reader :options
|
248
246
|
attr_reader :reference_data
|
249
247
|
attr_reader :trading
|
@@ -255,7 +253,6 @@ module SnapTrade
|
|
255
253
|
@api_status = SnapTrade::APIStatusApi.new(@api_client)
|
256
254
|
@authentication = SnapTrade::AuthenticationApi.new(@api_client)
|
257
255
|
@connections = SnapTrade::ConnectionsApi.new(@api_client)
|
258
|
-
@crypto_trading = SnapTrade::CryptoTradingApi.new(@api_client)
|
259
256
|
@options = SnapTrade::OptionsApi.new(@api_client)
|
260
257
|
@reference_data = SnapTrade::ReferenceDataApi.new(@api_client)
|
261
258
|
@trading = SnapTrade::TradingApi.new(@api_client)
|
@@ -57,6 +57,21 @@ describe 'TradingApi' do
|
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
|
+
# unit tests for get_cryptocurrency_pair_quote
|
61
|
+
# Get cryptocurrency pair quote
|
62
|
+
# Gets a quote for the specified account.
|
63
|
+
# @param user_id
|
64
|
+
# @param user_secret
|
65
|
+
# @param account_id
|
66
|
+
# @param instrument_symbol
|
67
|
+
# @param [Hash] opts the optional parameters
|
68
|
+
# @return [CryptocurrencyPairQuote]
|
69
|
+
describe 'get_cryptocurrency_pair_quote test' do
|
70
|
+
it 'should work' do
|
71
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
60
75
|
# unit tests for get_order_impact
|
61
76
|
# Check order impact
|
62
77
|
# 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.
|
@@ -146,6 +161,21 @@ describe 'TradingApi' do
|
|
146
161
|
end
|
147
162
|
end
|
148
163
|
|
164
|
+
# unit tests for place_simple_order
|
165
|
+
# Place order
|
166
|
+
# Places an order in the specified account. This endpoint does not compute the impact to the account balance from the order before submitting the order.
|
167
|
+
# @param user_id
|
168
|
+
# @param user_secret
|
169
|
+
# @param account_id
|
170
|
+
# @param simple_order_form
|
171
|
+
# @param [Hash] opts the optional parameters
|
172
|
+
# @return [OrderUpdatedResponse]
|
173
|
+
describe 'place_simple_order test' do
|
174
|
+
it 'should work' do
|
175
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
149
179
|
# unit tests for preview_simple_order
|
150
180
|
# Preview order
|
151
181
|
# Previews an order using the specified account.
|
@@ -177,4 +207,20 @@ describe 'TradingApi' do
|
|
177
207
|
end
|
178
208
|
end
|
179
209
|
|
210
|
+
# unit tests for search_cryptocurrency_pair_instruments
|
211
|
+
# Search cryptocurrency pairs instruments
|
212
|
+
# Searches cryptocurrency pairs instruments accessible to the specified account.
|
213
|
+
# @param user_id
|
214
|
+
# @param user_secret
|
215
|
+
# @param account_id
|
216
|
+
# @param [Hash] opts the optional parameters
|
217
|
+
# @option opts [String] :base
|
218
|
+
# @option opts [String] :quote
|
219
|
+
# @return [TradingSearchCryptocurrencyPairInstruments200Response]
|
220
|
+
describe 'search_cryptocurrency_pair_instruments test' do
|
221
|
+
it 'should work' do
|
222
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
180
226
|
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.108
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SnapTrade
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-06-
|
11
|
+
date: 2025-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -87,7 +87,6 @@ files:
|
|
87
87
|
- lib/snaptrade/api/api_status_api.rb
|
88
88
|
- lib/snaptrade/api/authentication_api.rb
|
89
89
|
- lib/snaptrade/api/connections_api.rb
|
90
|
-
- lib/snaptrade/api/crypto_trading_api.rb
|
91
90
|
- lib/snaptrade/api/options_api.rb
|
92
91
|
- lib/snaptrade/api/reference_data_api.rb
|
93
92
|
- lib/snaptrade/api/trading_api.rb
|
@@ -249,7 +248,6 @@ files:
|
|
249
248
|
- spec/api/api_status_api_spec.rb
|
250
249
|
- spec/api/authentication_api_spec.rb
|
251
250
|
- spec/api/connections_api_spec.rb
|
252
|
-
- spec/api/crypto_trading_api_spec.rb
|
253
251
|
- spec/api/options_api_spec.rb
|
254
252
|
- spec/api/reference_data_api_spec.rb
|
255
253
|
- spec/api/trading_api_spec.rb
|
@@ -439,7 +437,6 @@ test_files:
|
|
439
437
|
- spec/api/authentication_api_spec.rb
|
440
438
|
- spec/api/reference_data_api_spec.rb
|
441
439
|
- spec/api/trading_api_spec.rb
|
442
|
-
- spec/api/crypto_trading_api_spec.rb
|
443
440
|
- spec/api_client_spec.rb
|
444
441
|
- spec/configuration_spec.rb
|
445
442
|
- spec/getting_started_spec.rb
|