nothingisdead / npm-kraken-api

[DEPRECATED] NodeJS Client Library for the Kraken (kraken.com) API
Other
412 stars 190 forks source link

Selling USDT for ETH #67

Open BronacusAmmon opened 4 years ago

BronacusAmmon commented 4 years ago

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); })();

kroitor commented 4 years ago

@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.

BronacusAmmon commented 4 years ago

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

kroitor commented 4 years ago

@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).

BronacusAmmon commented 4 years ago

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

tuxun commented 2 years ago

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

dscotese commented 1 month ago

The maintainer is no longer maintaining this repo. I forked it to https://github.com/dscotese/kraka-djs so that I could add CancellAll, which I have done.