Skip to content

Commit 77f5025

Browse files
committed
fix: change window
test: change window, change credentials
1 parent 7f1fbdc commit 77f5025

File tree

4 files changed

+29
-8
lines changed

4 files changed

+29
-8
lines changed

lib/cryptomarket/websocket/trading_client.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,6 @@ def build_subscription_hash
3535
'spot_balance' => [balances, Args::NotificationType::SNAPSHOT] }
3636
end
3737

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-
4338
# subscribe to a feed of execution reports of the user's orders
4439
#
4540
# https://api.exchange.cryptomkt.com/#socket-spot-trading
@@ -274,6 +269,11 @@ def get_spot_commissions(callback:)
274269
def get_spot_commission(symbol:, callback:)
275270
request('spot_fee', callback, { symbol: symbol })
276271
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
277277
end
278278
end
279279
end

lib/cryptomarket/websocket/wallet_client.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ def build_subscription_hash
3737
'wallet_balance_update' => [balance, Args::NotificationType::UPDATE] }
3838
end
3939

40-
alias get_wallet_balance_of_currency get_wallet_balance
41-
alias get_wallet_balance_by_currency get_wallet_balance
42-
4340
# 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
4441
#
4542
# https://api.exchange.cryptomkt.com/#subscribe-to-transactions
@@ -168,6 +165,9 @@ def get_transactions( # rubocop:disable Metrics/ParameterLists
168165
limit: limit, offset: offset, group_transactions: group_transactions
169166
})
170167
end
168+
169+
alias get_wallet_balance_of_currency get_wallet_balance
170+
alias get_wallet_balance_by_currency get_wallet_balance
171171
end
172172
end
173173
end

tests/rest/wallet_management.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,17 @@ def test_get_transaction_history
103103
))
104104
end
105105

106+
def test_get_transaction_history_with_params
107+
result = @client.get_transaction_history(
108+
order_by: 'CREATED_AT', sort: 'DESC', limit: 100, offset: 1, from: '1614815872000'
109+
)
110+
assert(!result.empty?)
111+
assert(good_list(
112+
->(transaction) do Check.good_transaction(transaction) end,
113+
result
114+
))
115+
end
116+
106117
def test_get_transaction
107118
transaction_list = @client.get_transaction_history
108119
first_transaction_id = transaction_list[0]['native']['tx_id']

tests/websocket/wallet_client.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
require_relative '../checks'
77
require_relative '../checker_generator'
88

9+
# test class for wallet client
910
class TestWSWalletClient < Test::Unit::TestCase
1011
def setup
1112
@wsclient = Cryptomarket::Websocket::WalletClient.new api_key: KeyLoader.api_key, api_secret: KeyLoader.api_secret
@@ -43,4 +44,13 @@ def test_get_transactions
4344
sleep(2)
4445
assert(@veredict_checker.good_veredict?, @veredict_checker.err_msg)
4546
end
47+
48+
def test_get_transactions_with_params
49+
@wsclient.get_transactions(
50+
callback: gen_check_result_list_callback(WSCheck.good_transaction, @veredict_checker),
51+
order_by: 'CREATED_AT', sort: 'DESC', limit: 100, offset: 1, from: '1614815872000'
52+
)
53+
sleep(2)
54+
assert(@veredict_checker.good_veredict?, @veredict_checker.err_msg)
55+
end
4656
end

0 commit comments

Comments
 (0)