npm-kraken-api icon indicating copy to clipboard operation
npm-kraken-api copied to clipboard

Selling USDT for ETH

Open BronacusAmmon opened this issue 5 years ago • 6 comments

Hello I've gotten the script working for buying USDT with ETH but when I try and sell the USDT for ETH I get insufficient funds error, even though I am sure I have more USDT than the 3 it would require for this test to submit an order, does anyone have suggestions?

const KrakenClient = require('kraken-api'); const kraken = new KrakenClient(key, secret); var vend = "sell"; var volume = 0.2; var price = 15; (async () => { // Get Ticker Info //var value = await kraken.api('AddOrder', { pair : 'ETHUSDT', type : ${type}, orderType: 'limit', price: ${price}, volume : ${volume}}); var value = await kraken.api('AddOrder', { pair : 'ETHUSDT', type : ${vend}, ordertype: 'limit', price: ${price}, volume: ${volume} }); var arrays = JSON.stringify(value); console.log(arrays); })();

BronacusAmmon avatar Apr 14 '20 15:04 BronacusAmmon

@MallyxTheZealous current price for ETH is around $160. If you set $15 – that's too big of a discrepancy between your price and the actual price. If you really want to spend $3 (and want your order to be closed in some short time), you should set price = near current price (say, 160), and amount (volume) = 3 / 160 = 0.01875. Apart from that it could be related to min limits for the order size. You might want to reach out to Kraken techsupport for an answer then.

kroitor avatar Apr 14 '20 16:04 kroitor

Thanks @kroitor, I'll try changing the price, I don't want to actually fill this order I'm just trying to make sure it works. Still getting insufficient funds at 0.2 for 155, but I have 50 USDT in the account so I think its something else

BronacusAmmon avatar Apr 14 '20 16:04 BronacusAmmon

@MallyxTheZealous hold on, you can't sell USDT with the ETH/USDT market. You can only buy ETH (for USDT) and sell ETH (for USDT).

Therefore if you have USDT – you can buy ETH, but if you don't have ETH – you can't sell ETH. And you're trying to sell ETH, so, you should be checking your ETH balance, not the USDT balance.

If your ETH balance is zero and you're selling ETH – that's insufficient funds to sell (cannot sell more ETH than you have).

kroitor avatar Apr 14 '20 16:04 kroitor

I just checked the tickers you were absolutely right I had gotten the base currencies reversed, thank you for your help

BronacusAmmon avatar Apr 14 '20 16:04 BronacusAmmon

Hello, there, nice discussion, I'm glad to see the problem is solved :+1:
Should "we" close the issue? and tag it? It would help the maintainer @BronacusAmmon

tuxun avatar Jan 10 '22 04:01 tuxun