fhqvst / avanza

A JavaScript client for the unofficial Avanza API
MIT License
229 stars 59 forks source link

Check if order is completed. #65

Closed JakobWestergarden closed 2 years ago

JakobWestergarden commented 2 years ago

After reading through the API documentation and doing some testing on my own, i still don't see if there is a function to check if one of your orders is still on the market or has been sold/bought. Right now i am using editOrder and check if i get an error message with info that order is no longer on market, but is there a better way to do this without having to edit the order and just getting the info on whether the order is completed or not?

fhqvst commented 2 years ago

You should be able to subscribe to Avanza.ORDERS, like so:

avanza.subscribe(Avanza.ORDERS, (orders) => {
  console.log('Received order update:', orders)
})
JakobWestergarden commented 2 years ago

You should be able to subscribe to Avanza.ORDERS, like so:

avanza.subscribe(Avanza.ORDERS, (orders) => {
  console.log('Received order update:', orders)
})

Thanks, that's exactly what i was looking for!