snaptrade 2.0.111 → 2.0.113
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +41 -41
- data/lib/snaptrade/api/trading_api.rb +133 -16
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +0 -3
- data/spec/api/trading_api_spec.rb +20 -4
- metadata +2 -5
- data/lib/snaptrade/api/crypto_trading_api.rb +0 -139
- data/spec/api/crypto_trading_api_spec.rb +0 -46
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c8414fe113d2fbcf57068fdf8abd6a3d780a6821598ec5e7721570720f1c8b8
|
4
|
+
data.tar.gz: ff961ec2d3e3b3950fc1fd56c93444d6f386fa6a96b495b42a179f50d744f1b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4773fe79516dea7a09c7567b63a2e76922bcfd7cec6fa5044dca9379117336a61d816d97e99ea8655531afadbb4114440875a3a1c9dcfe540cb718c119b12090
|
7
|
+
data.tar.gz: fd635308f0b5d66f93de6f3b8a7a582b740f47b852cec63341d78ede7c3f865b307bd8a5315ba3d97370845935d84ce3f8cb7a5908a1c9f7dd37362840609754
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
Connect brokerage accounts to your app for live positions and trading
|
8
8
|
|
9
|
-
[](https://rubygems.org/gems/snaptrade/versions/2.0.113)
|
10
10
|
[](https://snaptrade.com/)
|
11
11
|
|
12
12
|
</div>
|
@@ -43,7 +43,6 @@ Connect brokerage accounts to your app for live positions and trading
|
|
43
43
|
* [`snaptrade.connections.remove_brokerage_authorization`](#snaptradeconnectionsremove_brokerage_authorization)
|
44
44
|
* [`snaptrade.connections.return_rates`](#snaptradeconnectionsreturn_rates)
|
45
45
|
* [`snaptrade.connections.session_events`](#snaptradeconnectionssession_events)
|
46
|
-
* [`snaptrade.crypto_trading.search_cryptocurrency_pair_instruments`](#snaptradecrypto_tradingsearch_cryptocurrency_pair_instruments)
|
47
46
|
* [`snaptrade.options.get_option_strategy`](#snaptradeoptionsget_option_strategy)
|
48
47
|
* [`snaptrade.options.get_options_chain`](#snaptradeoptionsget_options_chain)
|
49
48
|
* [`snaptrade.options.get_options_strategy_quote`](#snaptradeoptionsget_options_strategy_quote)
|
@@ -72,6 +71,7 @@ Connect brokerage accounts to your app for live positions and trading
|
|
72
71
|
* [`snaptrade.trading.place_simple_order`](#snaptradetradingplace_simple_order)
|
73
72
|
* [`snaptrade.trading.preview_simple_order`](#snaptradetradingpreview_simple_order)
|
74
73
|
* [`snaptrade.trading.replace_order`](#snaptradetradingreplace_order)
|
74
|
+
* [`snaptrade.trading.search_cryptocurrency_pair_instruments`](#snaptradetradingsearch_cryptocurrency_pair_instruments)
|
75
75
|
* [`snaptrade.transactions_and_reporting.get_activities`](#snaptradetransactions_and_reportingget_activities)
|
76
76
|
* [`snaptrade.transactions_and_reporting.get_reporting_custom_range`](#snaptradetransactions_and_reportingget_reporting_custom_range)
|
77
77
|
|
@@ -82,7 +82,7 @@ Connect brokerage accounts to your app for live positions and trading
|
|
82
82
|
Add to Gemfile:
|
83
83
|
|
84
84
|
```ruby
|
85
|
-
gem 'snaptrade', '~> 2.0.
|
85
|
+
gem 'snaptrade', '~> 2.0.113'
|
86
86
|
```
|
87
87
|
|
88
88
|
## Getting Started<a id="getting-started"></a>
|
@@ -1047,44 +1047,6 @@ specific users
|
|
1047
1047
|
---
|
1048
1048
|
|
1049
1049
|
|
1050
|
-
### `snaptrade.crypto_trading.search_cryptocurrency_pair_instruments`<a id="snaptradecrypto_tradingsearch_cryptocurrency_pair_instruments"></a>
|
1051
|
-
|
1052
|
-
Searches cryptocurrency pairs instruments accessible to the specified account.
|
1053
|
-
|
1054
|
-
|
1055
|
-
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
1056
|
-
|
1057
|
-
```ruby
|
1058
|
-
result = snaptrade.crypto_trading.search_cryptocurrency_pair_instruments(
|
1059
|
-
user_id: "snaptrade-user-123",
|
1060
|
-
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
1061
|
-
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
1062
|
-
base: "BTC",
|
1063
|
-
quote: "USD",
|
1064
|
-
)
|
1065
|
-
p result
|
1066
|
-
```
|
1067
|
-
|
1068
|
-
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
1069
|
-
|
1070
|
-
##### user_id: `String`<a id="user_id-string"></a>
|
1071
|
-
##### user_secret: `String`<a id="user_secret-string"></a>
|
1072
|
-
##### account_id: `String`<a id="account_id-string"></a>
|
1073
|
-
##### base: `String`<a id="base-string"></a>
|
1074
|
-
##### quote: `String`<a id="quote-string"></a>
|
1075
|
-
#### 🔄 Return<a id="🔄-return"></a>
|
1076
|
-
|
1077
|
-
[TradingSearchCryptocurrencyPairInstruments200Response](./lib/snaptrade/models/trading_search_cryptocurrency_pair_instruments200_response.rb)
|
1078
|
-
|
1079
|
-
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
1080
|
-
|
1081
|
-
`/accounts/{accountId}/trading/instruments/cryptocurrencyPairs` `GET`
|
1082
|
-
|
1083
|
-
[🔙 **Back to Table of Contents**](#table-of-contents)
|
1084
|
-
|
1085
|
-
---
|
1086
|
-
|
1087
|
-
|
1088
1050
|
### `snaptrade.options.get_option_strategy`<a id="snaptradeoptionsget_option_strategy"></a>
|
1089
1051
|
|
1090
1052
|
Creates an option strategy object that will be used to place an option strategy order.
|
@@ -2390,6 +2352,44 @@ The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
|
|
2390
2352
|
---
|
2391
2353
|
|
2392
2354
|
|
2355
|
+
### `snaptrade.trading.search_cryptocurrency_pair_instruments`<a id="snaptradetradingsearch_cryptocurrency_pair_instruments"></a>
|
2356
|
+
|
2357
|
+
Searches cryptocurrency pairs instruments accessible to the specified account.
|
2358
|
+
|
2359
|
+
|
2360
|
+
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
2361
|
+
|
2362
|
+
```ruby
|
2363
|
+
result = snaptrade.trading.search_cryptocurrency_pair_instruments(
|
2364
|
+
user_id: "snaptrade-user-123",
|
2365
|
+
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
2366
|
+
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
2367
|
+
base: "BTC",
|
2368
|
+
quote: "USD",
|
2369
|
+
)
|
2370
|
+
p result
|
2371
|
+
```
|
2372
|
+
|
2373
|
+
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
2374
|
+
|
2375
|
+
##### user_id: `String`<a id="user_id-string"></a>
|
2376
|
+
##### user_secret: `String`<a id="user_secret-string"></a>
|
2377
|
+
##### account_id: `String`<a id="account_id-string"></a>
|
2378
|
+
##### base: `String`<a id="base-string"></a>
|
2379
|
+
##### quote: `String`<a id="quote-string"></a>
|
2380
|
+
#### 🔄 Return<a id="🔄-return"></a>
|
2381
|
+
|
2382
|
+
[TradingSearchCryptocurrencyPairInstruments200Response](./lib/snaptrade/models/trading_search_cryptocurrency_pair_instruments200_response.rb)
|
2383
|
+
|
2384
|
+
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
2385
|
+
|
2386
|
+
`/accounts/{accountId}/trading/instruments/cryptocurrencyPairs` `GET`
|
2387
|
+
|
2388
|
+
[🔙 **Back to Table of Contents**](#table-of-contents)
|
2389
|
+
|
2390
|
+
---
|
2391
|
+
|
2392
|
+
|
2393
2393
|
### `snaptrade.transactions_and_reporting.get_activities`<a id="snaptradetransactions_and_reportingget_activities"></a>
|
2394
2394
|

|
2395
2395
|
|
@@ -17,7 +17,7 @@ module SnapTrade
|
|
17
17
|
@api_client = api_client
|
18
18
|
end
|
19
19
|
|
20
|
-
# Cancel
|
20
|
+
# Cancel crypto order
|
21
21
|
#
|
22
22
|
# Cancels an order in the specified account.
|
23
23
|
#
|
@@ -31,7 +31,7 @@ module SnapTrade
|
|
31
31
|
data
|
32
32
|
end
|
33
33
|
|
34
|
-
# Cancel
|
34
|
+
# Cancel crypto order
|
35
35
|
#
|
36
36
|
# Cancels an order in the specified account.
|
37
37
|
#
|
@@ -44,7 +44,7 @@ module SnapTrade
|
|
44
44
|
cancel_order_with_http_info_impl(user_id, user_secret, account_id, brokerage_order_id, extra)
|
45
45
|
end
|
46
46
|
|
47
|
-
# Cancel
|
47
|
+
# Cancel crypto order
|
48
48
|
# Cancels an order in the specified account.
|
49
49
|
# @param user_id [String]
|
50
50
|
# @param user_secret [String]
|
@@ -57,7 +57,7 @@ module SnapTrade
|
|
57
57
|
data
|
58
58
|
end
|
59
59
|
|
60
|
-
# Cancel
|
60
|
+
# Cancel crypto order
|
61
61
|
# Cancels an order in the specified account.
|
62
62
|
# @param user_id [String]
|
63
63
|
# @param user_secret [String]
|
@@ -1220,7 +1220,7 @@ module SnapTrade
|
|
1220
1220
|
end
|
1221
1221
|
|
1222
1222
|
|
1223
|
-
# Place order
|
1223
|
+
# Place crypto order
|
1224
1224
|
#
|
1225
1225
|
# Places an order in the specified account.
|
1226
1226
|
# This endpoint does not compute the impact to the account balance from the order before submitting the order.
|
@@ -1255,7 +1255,7 @@ module SnapTrade
|
|
1255
1255
|
data
|
1256
1256
|
end
|
1257
1257
|
|
1258
|
-
# Place order
|
1258
|
+
# Place crypto order
|
1259
1259
|
#
|
1260
1260
|
# Places an order in the specified account.
|
1261
1261
|
# This endpoint does not compute the impact to the account balance from the order before submitting the order.
|
@@ -1289,7 +1289,7 @@ module SnapTrade
|
|
1289
1289
|
place_simple_order_with_http_info_impl(user_id, user_secret, account_id, simple_order_form, extra)
|
1290
1290
|
end
|
1291
1291
|
|
1292
|
-
# Place order
|
1292
|
+
# Place crypto order
|
1293
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
1294
|
# @param user_id [String]
|
1295
1295
|
# @param user_secret [String]
|
@@ -1302,7 +1302,7 @@ module SnapTrade
|
|
1302
1302
|
data
|
1303
1303
|
end
|
1304
1304
|
|
1305
|
-
# Place order
|
1305
|
+
# Place crypto order
|
1306
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
1307
|
# @param user_id [String]
|
1308
1308
|
# @param user_secret [String]
|
@@ -1378,7 +1378,7 @@ module SnapTrade
|
|
1378
1378
|
end
|
1379
1379
|
|
1380
1380
|
|
1381
|
-
# Preview order
|
1381
|
+
# Preview crypto order
|
1382
1382
|
#
|
1383
1383
|
# Previews an order using the specified account.
|
1384
1384
|
#
|
@@ -1412,7 +1412,7 @@ module SnapTrade
|
|
1412
1412
|
data
|
1413
1413
|
end
|
1414
1414
|
|
1415
|
-
# Preview order
|
1415
|
+
# Preview crypto order
|
1416
1416
|
#
|
1417
1417
|
# Previews an order using the specified account.
|
1418
1418
|
#
|
@@ -1445,7 +1445,7 @@ module SnapTrade
|
|
1445
1445
|
preview_simple_order_with_http_info_impl(user_id, user_secret, account_id, simple_order_form, extra)
|
1446
1446
|
end
|
1447
1447
|
|
1448
|
-
# Preview order
|
1448
|
+
# Preview crypto order
|
1449
1449
|
# Previews an order using the specified account.
|
1450
1450
|
# @param user_id [String]
|
1451
1451
|
# @param user_secret [String]
|
@@ -1458,7 +1458,7 @@ module SnapTrade
|
|
1458
1458
|
data
|
1459
1459
|
end
|
1460
1460
|
|
1461
|
-
# Preview order
|
1461
|
+
# Preview crypto order
|
1462
1462
|
# Previews an order using the specified account.
|
1463
1463
|
# @param user_id [String]
|
1464
1464
|
# @param user_secret [String]
|
@@ -1534,7 +1534,7 @@ module SnapTrade
|
|
1534
1534
|
end
|
1535
1535
|
|
1536
1536
|
|
1537
|
-
#
|
1537
|
+
# Replace crypto order
|
1538
1538
|
#
|
1539
1539
|
# Replaces an existing pending order with a new one. The way this works is brokerage dependent, but usually involves cancelling
|
1540
1540
|
# the existing order and placing a new one. The order's brokerage_order_id may or may not change, be sure to use the one
|
@@ -1567,7 +1567,7 @@ module SnapTrade
|
|
1567
1567
|
data
|
1568
1568
|
end
|
1569
1569
|
|
1570
|
-
#
|
1570
|
+
# Replace crypto order
|
1571
1571
|
#
|
1572
1572
|
# Replaces an existing pending order with a new one. The way this works is brokerage dependent, but usually involves cancelling
|
1573
1573
|
# the existing order and placing a new one. The order's brokerage_order_id may or may not change, be sure to use the one
|
@@ -1599,7 +1599,7 @@ module SnapTrade
|
|
1599
1599
|
replace_order_with_http_info_impl(account_id, brokerage_order_id, user_id, user_secret, manual_trade_replace_form, extra)
|
1600
1600
|
end
|
1601
1601
|
|
1602
|
-
#
|
1602
|
+
# Replace crypto order
|
1603
1603
|
# Replaces an existing pending order with a new one. The way this works is brokerage dependent, but usually involves cancelling the existing order and placing a new one. The order's brokerage_order_id may or may not change, be sure to use the one returned in the response going forward. Only supported on some brokerages
|
1604
1604
|
# @param account_id [String] The ID of the account to execute the trade on.
|
1605
1605
|
# @param brokerage_order_id [String] The Brokerage Order ID of the order to replace.
|
@@ -1613,7 +1613,7 @@ module SnapTrade
|
|
1613
1613
|
data
|
1614
1614
|
end
|
1615
1615
|
|
1616
|
-
#
|
1616
|
+
# Replace crypto order
|
1617
1617
|
# Replaces an existing pending order with a new one. The way this works is brokerage dependent, but usually involves cancelling the existing order and placing a new one. The order's brokerage_order_id may or may not change, be sure to use the one returned in the response going forward. Only supported on some brokerages
|
1618
1618
|
# @param account_id [String] The ID of the account to execute the trade on.
|
1619
1619
|
# @param brokerage_order_id [String] The Brokerage Order ID of the order to replace.
|
@@ -1692,6 +1692,123 @@ module SnapTrade
|
|
1692
1692
|
end
|
1693
1693
|
return data, status_code, headers, response
|
1694
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
|
1695
1812
|
end
|
1696
1813
|
|
1697
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)
|
@@ -28,7 +28,7 @@ describe 'TradingApi' do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
# unit tests for cancel_order
|
31
|
-
# Cancel
|
31
|
+
# Cancel crypto order
|
32
32
|
# Cancels an order in the specified account.
|
33
33
|
# @param user_id
|
34
34
|
# @param user_secret
|
@@ -162,7 +162,7 @@ describe 'TradingApi' do
|
|
162
162
|
end
|
163
163
|
|
164
164
|
# unit tests for place_simple_order
|
165
|
-
# Place order
|
165
|
+
# Place crypto order
|
166
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
167
|
# @param user_id
|
168
168
|
# @param user_secret
|
@@ -177,7 +177,7 @@ describe 'TradingApi' do
|
|
177
177
|
end
|
178
178
|
|
179
179
|
# unit tests for preview_simple_order
|
180
|
-
# Preview order
|
180
|
+
# Preview crypto order
|
181
181
|
# Previews an order using the specified account.
|
182
182
|
# @param user_id
|
183
183
|
# @param user_secret
|
@@ -192,7 +192,7 @@ describe 'TradingApi' do
|
|
192
192
|
end
|
193
193
|
|
194
194
|
# unit tests for replace_order
|
195
|
-
#
|
195
|
+
# Replace crypto order
|
196
196
|
# Replaces an existing pending order with a new one. The way this works is brokerage dependent, but usually involves cancelling the existing order and placing a new one. The order's brokerage_order_id may or may not change, be sure to use the one returned in the response going forward. Only supported on some brokerages
|
197
197
|
# @param account_id The ID of the account to execute the trade on.
|
198
198
|
# @param brokerage_order_id The Brokerage Order ID of the order to replace.
|
@@ -207,4 +207,20 @@ describe 'TradingApi' do
|
|
207
207
|
end
|
208
208
|
end
|
209
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
|
+
|
210
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.113
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SnapTrade
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-07-
|
11
|
+
date: 2025-07-08 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
|
@@ -1,139 +0,0 @@
|
|
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 'cgi'
|
11
|
-
|
12
|
-
module SnapTrade
|
13
|
-
class CryptoTradingApi
|
14
|
-
attr_accessor :api_client
|
15
|
-
|
16
|
-
def initialize(api_client = ApiClient.default)
|
17
|
-
@api_client = api_client
|
18
|
-
end
|
19
|
-
|
20
|
-
# Search cryptocurrency pairs instruments
|
21
|
-
#
|
22
|
-
# Searches cryptocurrency pairs instruments accessible to the specified account.
|
23
|
-
#
|
24
|
-
# @param user_id [String]
|
25
|
-
# @param user_secret [String]
|
26
|
-
# @param account_id [String]
|
27
|
-
# @param base [String]
|
28
|
-
# @param quote [String]
|
29
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
30
|
-
def search_cryptocurrency_pair_instruments(user_id:, user_secret:, account_id:, base: SENTINEL, quote: SENTINEL, extra: {})
|
31
|
-
extra[:base] = base if base != SENTINEL
|
32
|
-
extra[:quote] = quote if quote != SENTINEL
|
33
|
-
data, _status_code, _headers = search_cryptocurrency_pair_instruments_with_http_info_impl(user_id, user_secret, account_id, extra)
|
34
|
-
data
|
35
|
-
end
|
36
|
-
|
37
|
-
# Search cryptocurrency pairs instruments
|
38
|
-
#
|
39
|
-
# Searches cryptocurrency pairs instruments accessible to the specified account.
|
40
|
-
#
|
41
|
-
# @param user_id [String]
|
42
|
-
# @param user_secret [String]
|
43
|
-
# @param account_id [String]
|
44
|
-
# @param base [String]
|
45
|
-
# @param quote [String]
|
46
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
47
|
-
def search_cryptocurrency_pair_instruments_with_http_info(user_id:, user_secret:, account_id:, base: SENTINEL, quote: SENTINEL, extra: {})
|
48
|
-
extra[:base] = base if base != SENTINEL
|
49
|
-
extra[:quote] = quote if quote != SENTINEL
|
50
|
-
search_cryptocurrency_pair_instruments_with_http_info_impl(user_id, user_secret, account_id, extra)
|
51
|
-
end
|
52
|
-
|
53
|
-
# Search cryptocurrency pairs instruments
|
54
|
-
# Searches cryptocurrency pairs instruments accessible to the specified account.
|
55
|
-
# @param user_id [String]
|
56
|
-
# @param user_secret [String]
|
57
|
-
# @param account_id [String]
|
58
|
-
# @param [Hash] opts the optional parameters
|
59
|
-
# @option opts [String] :base
|
60
|
-
# @option opts [String] :quote
|
61
|
-
# @return [TradingSearchCryptocurrencyPairInstruments200Response]
|
62
|
-
private def search_cryptocurrency_pair_instruments_impl(user_id, user_secret, account_id, opts = {})
|
63
|
-
data, _status_code, _headers = search_cryptocurrency_pair_instruments_with_http_info(user_id, user_secret, account_id, opts)
|
64
|
-
data
|
65
|
-
end
|
66
|
-
|
67
|
-
# Search cryptocurrency pairs instruments
|
68
|
-
# Searches cryptocurrency pairs instruments accessible to the specified account.
|
69
|
-
# @param user_id [String]
|
70
|
-
# @param user_secret [String]
|
71
|
-
# @param account_id [String]
|
72
|
-
# @param [Hash] opts the optional parameters
|
73
|
-
# @option opts [String] :base
|
74
|
-
# @option opts [String] :quote
|
75
|
-
# @return [Array<(TradingSearchCryptocurrencyPairInstruments200Response, Integer, Hash)>] TradingSearchCryptocurrencyPairInstruments200Response data, response status code and response headers
|
76
|
-
private def search_cryptocurrency_pair_instruments_with_http_info_impl(user_id, user_secret, account_id, opts = {})
|
77
|
-
if @api_client.config.debugging
|
78
|
-
@api_client.config.logger.debug 'Calling API: CryptoTradingApi.search_cryptocurrency_pair_instruments ...'
|
79
|
-
end
|
80
|
-
# verify the required parameter 'user_id' is set
|
81
|
-
if @api_client.config.client_side_validation && user_id.nil?
|
82
|
-
fail ArgumentError, "Missing the required parameter 'user_id' when calling CryptoTradingApi.search_cryptocurrency_pair_instruments"
|
83
|
-
end
|
84
|
-
# verify the required parameter 'user_secret' is set
|
85
|
-
if @api_client.config.client_side_validation && user_secret.nil?
|
86
|
-
fail ArgumentError, "Missing the required parameter 'user_secret' when calling CryptoTradingApi.search_cryptocurrency_pair_instruments"
|
87
|
-
end
|
88
|
-
# verify the required parameter 'account_id' is set
|
89
|
-
if @api_client.config.client_side_validation && account_id.nil?
|
90
|
-
fail ArgumentError, "Missing the required parameter 'account_id' when calling CryptoTradingApi.search_cryptocurrency_pair_instruments"
|
91
|
-
end
|
92
|
-
# resource path
|
93
|
-
local_var_path = '/accounts/{accountId}/trading/instruments/cryptocurrencyPairs'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
|
94
|
-
|
95
|
-
# query parameters
|
96
|
-
query_params = opts[:query_params] || {}
|
97
|
-
query_params[:'userId'] = user_id
|
98
|
-
query_params[:'userSecret'] = user_secret
|
99
|
-
query_params[:'base'] = opts[:'base'] if !opts[:'base'].nil?
|
100
|
-
query_params[:'quote'] = opts[:'quote'] if !opts[:'quote'].nil?
|
101
|
-
|
102
|
-
# header parameters
|
103
|
-
header_params = opts[:header_params] || {}
|
104
|
-
# HTTP header 'Accept' (if needed)
|
105
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
106
|
-
|
107
|
-
# form parameters
|
108
|
-
form_params = opts[:form_params] || {}
|
109
|
-
|
110
|
-
# http body (model)
|
111
|
-
post_body = opts[:debug_body]
|
112
|
-
|
113
|
-
# return_type
|
114
|
-
return_type = opts[:debug_return_type] || 'TradingSearchCryptocurrencyPairInstruments200Response'
|
115
|
-
|
116
|
-
# auth_names
|
117
|
-
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
118
|
-
|
119
|
-
new_options = opts.merge(
|
120
|
-
:operation => :"CryptoTradingApi.search_cryptocurrency_pair_instruments",
|
121
|
-
:header_params => header_params,
|
122
|
-
:query_params => query_params,
|
123
|
-
:form_params => form_params,
|
124
|
-
:body => post_body,
|
125
|
-
:auth_names => auth_names,
|
126
|
-
:return_type => return_type
|
127
|
-
)
|
128
|
-
|
129
|
-
data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
|
130
|
-
if @api_client.config.debugging
|
131
|
-
@api_client.config.logger.debug "API called: CryptoTradingApi#search_cryptocurrency_pair_instruments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
132
|
-
end
|
133
|
-
return data, status_code, headers, response
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
# top-level client access to avoid having the user to insantiate their own API instances
|
138
|
-
CryptoTrading = CryptoTradingApi::new
|
139
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
#SnapTrade
|
3
|
-
|
4
|
-
#Connect brokerage accounts to your app for live positions and trading
|
5
|
-
|
6
|
-
The version of the OpenAPI document: 1.0.0
|
7
|
-
Contact: api@snaptrade.com
|
8
|
-
=end
|
9
|
-
|
10
|
-
require 'spec_helper'
|
11
|
-
require 'json'
|
12
|
-
|
13
|
-
# Unit tests for SnapTrade::CryptoTradingApi
|
14
|
-
describe 'CryptoTradingApi' do
|
15
|
-
before do
|
16
|
-
# run before each test
|
17
|
-
@api_instance = SnapTrade::CryptoTradingApi.new
|
18
|
-
end
|
19
|
-
|
20
|
-
after do
|
21
|
-
# run after each test
|
22
|
-
end
|
23
|
-
|
24
|
-
describe 'test an instance of CryptoTradingApi' do
|
25
|
-
it 'should create an instance of CryptoTradingApi' do
|
26
|
-
expect(@api_instance).to be_instance_of(SnapTrade::CryptoTradingApi)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
# unit tests for search_cryptocurrency_pair_instruments
|
31
|
-
# Search cryptocurrency pairs instruments
|
32
|
-
# Searches cryptocurrency pairs instruments accessible to the specified account.
|
33
|
-
# @param user_id
|
34
|
-
# @param user_secret
|
35
|
-
# @param account_id
|
36
|
-
# @param [Hash] opts the optional parameters
|
37
|
-
# @option opts [String] :base
|
38
|
-
# @option opts [String] :quote
|
39
|
-
# @return [TradingSearchCryptocurrencyPairInstruments200Response]
|
40
|
-
describe 'search_cryptocurrency_pair_instruments test' do
|
41
|
-
it 'should work' do
|
42
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
end
|