cryptomarket-sdk 3.1.0 → 3.2.0
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/README.md +1 -1
- data/lib/cryptomarket/client.rb +95 -32
- data/lib/cryptomarket/credentials_factory.rb +10 -1
- data/lib/cryptomarket/http_manager.rb +8 -0
- data/lib/cryptomarket/websocket/trading_client.rb +5 -5
- data/lib/cryptomarket/websocket/wallet_client.rb +6 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3544bff57f393e4033ac3b721e140d369916e83483cf03f4aac7b730ab7a8792
|
4
|
+
data.tar.gz: 2a60685afc64ec389c9f0b9c04623de5ebb4984fd627d258c802f9907df48e0f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c75f1e68a8dc113eb7e9fd6889bbffe3027dbea4d271a554206d591b5e8b273bebc27f0e3d201d03ece6fc8b53a474009f422e39154cd0585fa4e6c5a50a7baa
|
7
|
+
data.tar.gz: ddab1680d4cf031c72ae645e2fbc0824b608e904779e8fe2b4aad795a069ea29839c271b2aacc25a3350ca88a118e2520005a3b712cb800711e3ff21d7a59af2
|
data/README.md
CHANGED
data/lib/cryptomarket/client.rb
CHANGED
@@ -39,36 +39,24 @@ module Cryptomarket
|
|
39
39
|
@http_manager.make_request(method: 'delete', endpoint: endpoint, params: params)
|
40
40
|
end
|
41
41
|
|
42
|
-
|
43
|
-
#
|
44
|
-
|
42
|
+
# Changes the user credentials used for authentication in calls
|
43
|
+
#
|
44
|
+
# ==== Params
|
45
|
+
# +String+ +api_key+:: The user public key used in new calls
|
46
|
+
# +String+ +api_secret+:: The user secret key used in new calls
|
45
47
|
|
46
|
-
|
48
|
+
def change_credentials(api_key:, api_secret:)
|
49
|
+
@http_manager.change_credentials(api_key: api_key, api_secret: api_secret)
|
50
|
+
end
|
47
51
|
|
48
|
-
#
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
alias get_orderbook_volume_by_symbol get_orderbook_volume
|
57
|
-
alias get_orderbook_volume_of_symbol get_orderbook_volume
|
58
|
-
alias get_candles_of_symbol get_candles_by_symbol
|
59
|
-
alias get_converted_candles_of_symbol get_converted_candles_by_symbol
|
60
|
-
# spot trading
|
61
|
-
alias get_spot_trading_balance_of_currency get_spot_trading_balance
|
62
|
-
alias get_spot_trading_balance_by_currency get_spot_trading_balance
|
63
|
-
alias get_all_trading_commissions get_all_trading_commission
|
64
|
-
alias get_trading_commission get_all_trading_commission
|
65
|
-
alias get_trading_commission_of_symbol get_trading_commission
|
66
|
-
alias get_trading_commission_by_symbol get_trading_commission
|
67
|
-
# wallet management
|
68
|
-
alias get_wallet_balance_of_currency get_wallet_balance
|
69
|
-
alias get_wallet_balance_by_currency get_wallet_balance
|
70
|
-
alias get_deposit_crypto_address_of_cyrrency get_deposit_crypto_address
|
71
|
-
alias get_deposit_crypto_address_by_cyrrency get_deposit_crypto_address
|
52
|
+
# Changes the window used in authenticated calls
|
53
|
+
#
|
54
|
+
# ==== Params
|
55
|
+
# +Integer+ +window+:: Acceptable time between request and server execution in millis
|
56
|
+
|
57
|
+
def change_window(window:)
|
58
|
+
@http_manager.change_window(window: window)
|
59
|
+
end
|
72
60
|
|
73
61
|
################
|
74
62
|
# public calls #
|
@@ -863,11 +851,25 @@ module Cryptomarket
|
|
863
851
|
# ==== Params
|
864
852
|
# +Array[]+ +fee_requests+:: the list of fee requests, each request is a Hash in the form {currency:"string", amount:"string", network_code:"optional string"}
|
865
853
|
|
866
|
-
def get_estimate_withdrawal_fees(fee_requests)
|
854
|
+
def get_estimate_withdrawal_fees(fee_requests:)
|
867
855
|
params = fee_requests
|
868
856
|
post('wallet/crypto/fees/estimate', params)
|
869
857
|
end
|
870
858
|
|
859
|
+
# Get an estimates for withdrawal fees of currencies
|
860
|
+
#
|
861
|
+
# Requires the "Payment information" API key Access Right
|
862
|
+
#
|
863
|
+
# https://api.exchange.cryptomkt.com/#bulk-estimate-withdrawal-fee
|
864
|
+
#
|
865
|
+
# ==== Params
|
866
|
+
# +Array[]+ +fee_requests+:: the list of fee requests, each request is a Hash in the form {currency:"string", amount:"string", network_code:"optional string"}
|
867
|
+
|
868
|
+
def get_bulk_estimate_withdrawal_fees(fee_requests:)
|
869
|
+
params = fee_requests
|
870
|
+
post('wallet/crypto/fee/estimate/bulk', params)
|
871
|
+
end
|
872
|
+
|
871
873
|
# Get an estimate of the withdrawal fee
|
872
874
|
#
|
873
875
|
# Requires the "Payment information" API key Access Right
|
@@ -883,6 +885,34 @@ module Cryptomarket
|
|
883
885
|
get('wallet/crypto/fee/estimate', params)['fee']
|
884
886
|
end
|
885
887
|
|
888
|
+
# # Get an estimates for deposit fees of currencies
|
889
|
+
# #
|
890
|
+
# # Requires the "Payment information" API key Access Right
|
891
|
+
# #
|
892
|
+
# # https://api.exchange.cryptomkt.com/#bulk-estimate-deposit-fee
|
893
|
+
# #
|
894
|
+
# # ==== Params
|
895
|
+
# # +Array[]+ +fee_requests+:: the list of fee requests, each request is a Hash in the form {currency:"string", amount:"string", network_code:"optional string"}
|
896
|
+
# def get_bulk_estimate_deposit_fees(fee_requests:)
|
897
|
+
# params = fee_requests
|
898
|
+
# post('wallet/crypto/fee/deposit/estimate/bulk', params)
|
899
|
+
# end
|
900
|
+
|
901
|
+
# # Get an estimate of the deposit fee
|
902
|
+
# #
|
903
|
+
# # Requires the "Payment information" API key Access Right
|
904
|
+
# #
|
905
|
+
# # https://api.exchange.cryptomkt.com/#estimate-deposit-fee
|
906
|
+
# #
|
907
|
+
# # ==== Params
|
908
|
+
# # +String+ +currency+:: the currency code for deposit
|
909
|
+
# # +float+ +amount+:: the expected deposit amount
|
910
|
+
|
911
|
+
# def get_estimate_deposit_fee(currency:, amount:, network_code: nil)
|
912
|
+
# params = { amount: amount, currency: currency, network_code: network_code }
|
913
|
+
# get('wallet/crypto/fee/deposit/estimate', params)['fee']
|
914
|
+
# end
|
915
|
+
|
886
916
|
# Converts between currencies
|
887
917
|
# Successful response to the request does not necessarily mean the resulting transaction got executed immediately. It has to be processed first and may eventually be rolled back
|
888
918
|
# To see whether a transaction has been finalized, call #get_transaction
|
@@ -986,9 +1016,9 @@ module Cryptomarket
|
|
986
1016
|
# +Array[String]+ +statuses+:: Optional. List of statuses to query. valid subtypes are: 'CREATED', 'PENDING', 'FAILED', 'SUCCESS' and 'ROLLED_BACK'
|
987
1017
|
# +Array[String]+ +currencies+:: Optional. Currency codes of the transactions to fetch
|
988
1018
|
# +Array[String]+ +networks+:: Optional. Network codes of the transactions to fetch
|
989
|
-
# +String+ +order_by+:: Optional. sorting parameter.'created_at'
|
990
|
-
# +String+ +from+:: Optional. Interval initial value
|
991
|
-
# +String+ +till+:: Optional. Interval end value
|
1019
|
+
# +String+ +order_by+:: Optional. sorting parameter.'created_at', 'updated_at', 'last_activity_at' 'or 'id'.
|
1020
|
+
# +String+ +from+:: Optional. Optional. Interval initial value (inclusive). The value type depends on order_by
|
1021
|
+
# +String+ +till+:: Optional. Interval end value (inclusive). The value type depends on order_BY
|
992
1022
|
# +String+ +id_from+:: Optional. Interval initial value when ordering by id. Min is 0
|
993
1023
|
# +String+ +id_till+:: Optional. Interval end value when ordering by id. Min is 0
|
994
1024
|
# +String+ +sort+:: Optional. Sort direction. 'ASC' or 'DESC'. Default is 'DESC'
|
@@ -1238,5 +1268,38 @@ module Cryptomarket
|
|
1238
1268
|
"sub-account/crypto/address/#{sub_account_id}/#{currency}"
|
1239
1269
|
)['result']['address']
|
1240
1270
|
end
|
1271
|
+
|
1272
|
+
###########
|
1273
|
+
# aliases #
|
1274
|
+
###########
|
1275
|
+
|
1276
|
+
# market data
|
1277
|
+
alias get_ticker_by_symbol get_ticker
|
1278
|
+
alias get_ticker_of_symbol get_ticker
|
1279
|
+
alias get_ticker_price_by_symbol get_ticker_price
|
1280
|
+
alias get_ticker_price_of_symbol get_ticker_price
|
1281
|
+
alias get_trades_of_symbol get_trades_by_symbol
|
1282
|
+
alias get_orderbook_by_symbol get_orderbook
|
1283
|
+
alias get_orderbook_of_symbol get_orderbook
|
1284
|
+
alias get_orderbook_volume_by_symbol get_orderbook_volume
|
1285
|
+
alias get_orderbook_volume_of_symbol get_orderbook_volume
|
1286
|
+
alias get_candles_of_symbol get_candles_by_symbol
|
1287
|
+
alias get_converted_candles_of_symbol get_converted_candles_by_symbol
|
1288
|
+
|
1289
|
+
# spot trading
|
1290
|
+
alias get_spot_trading_balance_of_currency get_spot_trading_balance
|
1291
|
+
alias get_spot_trading_balance_by_currency get_spot_trading_balance
|
1292
|
+
alias get_all_trading_commissions get_all_trading_commission
|
1293
|
+
alias get_trading_commissions get_all_trading_commission
|
1294
|
+
alias get_trading_commission_of_symbol get_trading_commission
|
1295
|
+
alias get_trading_commission_by_symbol get_trading_commission
|
1296
|
+
|
1297
|
+
# wallet management
|
1298
|
+
alias get_wallet_balance_of_currency get_wallet_balance
|
1299
|
+
alias get_wallet_balance_by_currency get_wallet_balance
|
1300
|
+
alias get_deposit_crypto_address_of_cyrrency get_deposit_crypto_address
|
1301
|
+
alias get_deposit_crypto_address_by_cyrrency get_deposit_crypto_address
|
1241
1302
|
end
|
1242
1303
|
end
|
1304
|
+
|
1305
|
+
# rubocop:enable Layout/LineLength
|
@@ -18,6 +18,15 @@ module Cryptomarket
|
|
18
18
|
@window = window
|
19
19
|
end
|
20
20
|
|
21
|
+
def change_credentials(api_key:, api_secret:)
|
22
|
+
@api_key = api_key
|
23
|
+
@api_secret = api_secret
|
24
|
+
end
|
25
|
+
|
26
|
+
def change_window(window:)
|
27
|
+
@window = window
|
28
|
+
end
|
29
|
+
|
21
30
|
def get_credential(http_method, method, params)
|
22
31
|
timestamp = DateTime.now.strftime('%Q')
|
23
32
|
msg = build_credential_message(http_method, method, timestamp, params)
|
@@ -37,7 +46,7 @@ module Cryptomarket
|
|
37
46
|
not_post_params(http_method, params)
|
38
47
|
end
|
39
48
|
msg += timestamp
|
40
|
-
msg += @window unless @window.nil?
|
49
|
+
msg += @window.to_s unless @window.nil?
|
41
50
|
msg
|
42
51
|
end
|
43
52
|
|
@@ -37,6 +37,14 @@ module Cryptomarket
|
|
37
37
|
)
|
38
38
|
end
|
39
39
|
|
40
|
+
def change_credentials(api_key:, api_secret:)
|
41
|
+
@credential_factory.change_credentials(api_key: api_key, api_secret: api_secret)
|
42
|
+
end
|
43
|
+
|
44
|
+
def change_window(window:)
|
45
|
+
@credential_factory.change_window(window: window)
|
46
|
+
end
|
47
|
+
|
40
48
|
def make_request(method:, endpoint:, params: nil, public: false)
|
41
49
|
uri = URI(@@API_URL + @@API_VERSION + endpoint)
|
42
50
|
payload = build_payload(params)
|
@@ -35,11 +35,6 @@ module Cryptomarket
|
|
35
35
|
'spot_balance' => [balances, Args::NotificationType::SNAPSHOT] }
|
36
36
|
end
|
37
37
|
|
38
|
-
alias get_spot_trading_balance_of_currency get_spot_trading_balance
|
39
|
-
alias get_spot_trading_balance_by_currency get_spot_trading_balance
|
40
|
-
alias get_spot_commission_of_symbol get_spot_commission
|
41
|
-
alias get_spot_commission_by_symbol get_spot_commission
|
42
|
-
|
43
38
|
# subscribe to a feed of execution reports of the user's orders
|
44
39
|
#
|
45
40
|
# https://api.exchange.cryptomkt.com/#socket-spot-trading
|
@@ -274,6 +269,11 @@ module Cryptomarket
|
|
274
269
|
def get_spot_commission(symbol:, callback:)
|
275
270
|
request('spot_fee', callback, { symbol: symbol })
|
276
271
|
end
|
272
|
+
|
273
|
+
alias get_spot_trading_balance_of_currency get_spot_trading_balance
|
274
|
+
alias get_spot_trading_balance_by_currency get_spot_trading_balance
|
275
|
+
alias get_spot_commission_of_symbol get_spot_commission
|
276
|
+
alias get_spot_commission_by_symbol get_spot_commission
|
277
277
|
end
|
278
278
|
end
|
279
279
|
end
|
@@ -37,9 +37,6 @@ module Cryptomarket
|
|
37
37
|
'wallet_balance_update' => [balance, Args::NotificationType::UPDATE] }
|
38
38
|
end
|
39
39
|
|
40
|
-
alias get_wallet_balance_of_currency get_wallet_balance
|
41
|
-
alias get_wallet_balance_by_currency get_wallet_balance
|
42
|
-
|
43
40
|
# A transaction notification occurs each time a transaction has been changed, such as creating a transaction, updating the pending state (e.g., the hash assigned) or completing a transaction
|
44
41
|
#
|
45
42
|
# https://api.exchange.cryptomkt.com/#subscribe-to-transactions
|
@@ -148,11 +145,11 @@ module Cryptomarket
|
|
148
145
|
# +Array[String]+ +subtyes+:: Optional. List of subtypes to query. valid subtypes are: 'UNCLASSIFIED', 'BLOCKCHAIN', 'AIRDROP', 'AFFILIATE', 'STAKING', 'BUY_CRYPTO', 'OFFCHAIN', 'FIAT', 'SUB_ACCOUNT', 'WALLET_TO_SPOT', 'SPOT_TO_WALLET', 'WALLET_TO_DERIVATIVES', 'DERIVATIVES_TO_WALLET', 'CHAIN_SWITCH_FROM', 'CHAIN_SWITCH_TO' and 'INSTANT_EXCHANGE'
|
149
146
|
# +Array[String]+ +statuses+:: Optional. List of statuses to query. valid subtypes are: 'CREATED', 'PENDING', 'FAILED', 'SUCCESS' and 'ROLLED_BACK'
|
150
147
|
# +Array[String] +currencies+:: Optional. List of currencies ids.
|
151
|
-
# +String+ +from+:: Optional. Interval initial value
|
152
|
-
# +String+ +till+:: Optional. Interval end value
|
148
|
+
# +String+ +from+:: Optional. Optional. Interval initial value (inclusive). The value type depends on order_by
|
149
|
+
# +String+ +till+:: Optional. Interval end value (inclusive). The value type depends on order_by
|
153
150
|
# +String+ +id_from+:: Optional. Interval initial value when ordering by id. Min is 0
|
154
151
|
# +String+ +id_till+:: Optional. Interval end value when ordering by id. Min is 0
|
155
|
-
# +String+ +order_by+:: Optional. sorting parameter.'created_at'
|
152
|
+
# +String+ +order_by+:: Optional. sorting parameter.'created_at', 'updated_at', 'last_activity_at' 'or 'id'.
|
156
153
|
# +String+ +sort+:: Optional. Sort direction. 'ASC' or 'DESC'. Default is 'DESC'
|
157
154
|
# +Integer+ +limit+:: Optional. Transactions per query. Defaul is 100. Max is 1_000
|
158
155
|
# +Integer+ +offset+:: Optional. Default is 0. Max is 100_000
|
@@ -168,6 +165,9 @@ module Cryptomarket
|
|
168
165
|
limit: limit, offset: offset, group_transactions: group_transactions
|
169
166
|
})
|
170
167
|
end
|
168
|
+
|
169
|
+
alias get_wallet_balance_of_currency get_wallet_balance
|
170
|
+
alias get_wallet_balance_by_currency get_wallet_balance
|
171
171
|
end
|
172
172
|
end
|
173
173
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cryptomarket-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- T. Ismael Verdugo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|