KO-9 / node-trading212

NodeJS Trading212 Unofficial API
19 stars 3 forks source link

Market order sell #7

Closed mrgithub closed 3 years ago

mrgithub commented 3 years ago

When will this be implemented?

mrgithub commented 3 years ago

Ok I worked it out. Set the price to null and the orderType to "MARKET",

'

Restsell

Place SELL order



//Place limit sell of 5 $GME @ $50
let ticker = "GME_US_EQ";
let orderType = "MARKET";     <---
let stopPrice = null;                 <---
let limitPrice = "50";
let quantity = -5;
let timeValidity = "DAY";
trading212.placeOrder(ticker, orderType, stopPrice, limitPrice, quantity, timeValidity);
//If order fails
trading212.on('order-failture', (data) {
  //Axios error
});
//If order succeeds
trading212.on('account', (data) => {
  //data.orders
  //data.positions
  //console.log(data);
});
'