anmatika / poloniex-api

a client for consuming poloniex api https://poloniex.com/support/api/.
12 stars 4 forks source link

Error when buying #3

Closed lukasz-kaniowski closed 7 years ago

lukasz-kaniowski commented 7 years ago

I'm getting body: '{"error":"Total must be at least 0.0001."}' } error every time when I'm trying to buy. here is the code snippet

tradingApi.buy('BTC_DGB', 130, 0.000005).then(console.log).catch(console.log)

I've tested the same amount with https://github.com/premasagar/poloniex.js and it works fine.

Any ideas?

anmatika commented 7 years ago

Hi, buy method parameter is an object, please call it as below:

tradingApi.buy({
    currencyPair: 'BTC_DGB',
    amount: 130,
    rate: 0.000005
  }).then(msg => console.log(msg.body))
    .catch(err => console.log(err))

I updated the readme accordingly.

lukasz-kaniowski commented 7 years ago

sure it is, I'm blind sometimes. thanks for reply.

anmatika commented 7 years ago

it's okay, thanks.