Skip to content

Commit

Permalink
fix: change window
Browse files Browse the repository at this point in the history
test: change window, change credentials
  • Loading branch information
Insmael committed Jun 11, 2024
1 parent 7f1fbdc commit 77f5025
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 8 deletions.
10 changes: 5 additions & 5 deletions lib/cryptomarket/websocket/trading_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@ def build_subscription_hash
'spot_balance' => [balances, Args::NotificationType::SNAPSHOT] }
end

alias get_spot_trading_balance_of_currency get_spot_trading_balance
alias get_spot_trading_balance_by_currency get_spot_trading_balance
alias get_spot_commission_of_symbol get_spot_commission
alias get_spot_commission_by_symbol get_spot_commission

# subscribe to a feed of execution reports of the user's orders
#
# https://api.exchange.cryptomkt.com/#socket-spot-trading
Expand Down Expand Up @@ -274,6 +269,11 @@ def get_spot_commissions(callback:)
def get_spot_commission(symbol:, callback:)
request('spot_fee', callback, { symbol: symbol })
end

alias get_spot_trading_balance_of_currency get_spot_trading_balance
alias get_spot_trading_balance_by_currency get_spot_trading_balance
alias get_spot_commission_of_symbol get_spot_commission
alias get_spot_commission_by_symbol get_spot_commission
end
end
end
6 changes: 3 additions & 3 deletions lib/cryptomarket/websocket/wallet_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ def build_subscription_hash
'wallet_balance_update' => [balance, Args::NotificationType::UPDATE] }
end

alias get_wallet_balance_of_currency get_wallet_balance
alias get_wallet_balance_by_currency get_wallet_balance

# 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
#
# https://api.exchange.cryptomkt.com/#subscribe-to-transactions
Expand Down Expand Up @@ -168,6 +165,9 @@ def get_transactions( # rubocop:disable Metrics/ParameterLists
limit: limit, offset: offset, group_transactions: group_transactions
})
end

alias get_wallet_balance_of_currency get_wallet_balance
alias get_wallet_balance_by_currency get_wallet_balance
end
end
end
11 changes: 11 additions & 0 deletions tests/rest/wallet_management.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,17 @@ def test_get_transaction_history
))
end

def test_get_transaction_history_with_params
result = @client.get_transaction_history(
order_by: 'CREATED_AT', sort: 'DESC', limit: 100, offset: 1, from: '1614815872000'
)
assert(!result.empty?)
assert(good_list(
->(transaction) do Check.good_transaction(transaction) end,
result
))
end

def test_get_transaction
transaction_list = @client.get_transaction_history
first_transaction_id = transaction_list[0]['native']['tx_id']
Expand Down
10 changes: 10 additions & 0 deletions tests/websocket/wallet_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
require_relative '../checks'
require_relative '../checker_generator'

# test class for wallet client
class TestWSWalletClient < Test::Unit::TestCase
def setup
@wsclient = Cryptomarket::Websocket::WalletClient.new api_key: KeyLoader.api_key, api_secret: KeyLoader.api_secret
Expand Down Expand Up @@ -43,4 +44,13 @@ def test_get_transactions
sleep(2)
assert(@veredict_checker.good_veredict?, @veredict_checker.err_msg)
end

def test_get_transactions_with_params
@wsclient.get_transactions(
callback: gen_check_result_list_callback(WSCheck.good_transaction, @veredict_checker),
order_by: 'CREATED_AT', sort: 'DESC', limit: 100, offset: 1, from: '1614815872000'
)
sleep(2)
assert(@veredict_checker.good_veredict?, @veredict_checker.err_msg)
end
end

0 comments on commit 77f5025

Please sign in to comment.