Last active
April 3, 2019 10:17
-
-
Save you-think-you-are-special/a4f95415caf1514fe5c1b613f13181a1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// exchange btc to eth | |
// trx - transaction from db | |
let hitbtc = new ccxt.hitbtc(); | |
hitbtc.apiKey = ''; | |
hitbtc.secret = ''; | |
// check balance | |
const balance = await hitbtc.fetchBalance(); | |
// balance >= trx.amountFrom check in btc | |
// exchange process | |
await hitbtc.paymentPostTransferToTrading({ | |
'amount': trx.amountFrom, | |
'currency_code': 'btc', | |
}); | |
await hitbtc.create_market_buy_order('BTC/ETH', trx.amountTo, {'trading_agreement': 'agree'}); | |
await hitbtc.paymentPostTransferToMain({ | |
'amount': trx.amountTo, | |
'currency_code': 'eth', | |
}); | |
// sending process | |
await hitbtc.withdraw('eth', trx.amountTo, trx.payoutAddress) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment