askmike / bitstamp

Bitstamp REST API wrapper
81 stars 54 forks source link

How to use buy_limit without limit price #32

Closed tuloski closed 7 years ago

tuloski commented 7 years ago

Hello, I see in the following code:

Bitstamp.prototype.buy = function(market, amount, price, limit_price, callback) {
  this._post(market, 'buy', callback, {
    amount: amount,
    price: price,
    limit_price: limit_price
  });
}

that the buy (and sell) API calls have a limit_price field, which is optional. I'm a little noob on js, but how can I do a buy order without putting the "limit_price" arg? Can I just do "privateBitstamp.buy('btcusd', amount, price, console.log);"? Will the limit_price not be used in that case?

askmike commented 7 years ago

You can pass undefined, which will strip out the limit_price and not send it at all (that stripping happens here)