-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
hitbtc withdraw
github-actions[bot] edited this page Jun 24, 2026
·
2 revisions
// @NO_AUTO_TRANSPILE
import ccxt from '../../js/ccxt.js';
import ololog from 'ololog';
const log = ololog.configure({ locate: false });
require('ansicolor').nice;
const getPositiveAccounts = function (balance) {
const result = {};
Object.keys(balance)
.filter(currency => balance[currency] && (balance[currency] > 0))
.forEach(currency => {
result[currency] = balance[currency];
});
return result;
};
(async () => {
// instantiate the exchange
let exchange = new ccxt.hitbtc({
"apiKey": "YOUR_API_KEY",
"secret": "YOUR_SECRET",
});
try {
let tradingBalance = await exchange.fetchBalance();
let accountBalance = await exchange.fetchBalance({ type: 'account' });
log.cyan('Trading balance:', getPositiveAccounts(tradingBalance.total));
log.magenta('Account balance:', getPositiveAccounts(accountBalance.total));
// withdraw
let withdraw = await exchange.withdraw('ETH', 0.01, '0x811DCfeb6dC0b9ed825808B6B060Ca469b83fB81');
// output the result
log(exchange.name.green, 'withdraw', withdraw);
}
catch (e) {
if (e instanceof ccxt.DDoSProtection || e.message.includes('ECONNRESET')) {
log.bright.yellow('[DDoS Protection] ' + e.message);
}
else if (e instanceof ccxt.RequestTimeout) {
log.bright.yellow('[Request Timeout] ' + e.message);
}
else if (e instanceof ccxt.AuthenticationError) {
log.bright.yellow('[Authentication Error] ' + e.message);
}
else if (e instanceof ccxt.ExchangeNotAvailable) {
log.bright.yellow('[Exchange Not Available Error] ' + e.message);
}
else if (e instanceof ccxt.ExchangeError) {
log.bright.yellow('[Exchange Error] ' + e.message);
}
else if (e instanceof ccxt.NetworkError) {
log.bright.yellow('[Network Error] ' + e.message);
}
else {
throw e;
}
}
})();(If the page is not being rendered for you, you can refer to the mirror at https://docs.ccxt.com/)
- Install
- Examples
- Manual
- CCXT Pro
- Contributing
- Supported Exchanges
- Exchanges By Country
- API Spec By Method
- FAQ
- Changelog
- Awesome
- API Spec by Exchange
- alpaca
- apex
- aster
- backpack
- bigone
- binance
- bingx
- bit2c
- bitbank
- bitbns
- bitfinex
- bitflyer
- bitget
- bithumb
- bitmex
- bitopro
- bitrue
- bitso
- bitstamp
- bitteam
- bittrade
- bitvavo
- blockchaincom
- blofin
- btcbox
- btcmarkets
- btcturk
- btse
- bullish
- bybit
- bydfi
- cex
- coinbase
- coinbaseexchange
- coinbaseinternational
- coincheck
- coinex
- coinmate
- coinone
- coinsph
- coinspot
- cryptocom
- cryptomus
- deepcoin
- delta
- deribit
- derive
- digifinex
- dydx
- extended
- foxbit
- gate
- gemini
- grvt
- hashkey
- hibachi
- hitbtc
- hollaex
- htx
- hyperliquid
- independentreserve
- indodax
- kraken
- krakenfutures
- kucoin
- kucoinfutures
- latoken
- lbank
- lighter
- luno
- mercado
- mexc
- modetrade
- mudrex
- nado
- ndax
- okx
- onetrading
- p2b
- pacifica
- paradex
- paymium
- phemex
- poloniex
- revolutx
- tokocrypto
- toobit
- upbit
- weex
- whitebit
- woo
- woofipro
- xt
- zaif
- zebpay
- API Spec by Prediction Exchange