fhqvst / avanza

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

Check if market is open #63

Closed JakobWestergarden closed 3 years ago

JakobWestergarden commented 3 years ago

Is there any function to check if the market is open for an instrument or a market as a whole? I know we can get tradable dates, and otherwise use Date() to see if the market should be open, but this seems like a suboptimal solution since we might have halfdays and other unforeseen problems. Is there any function in the api which just returns if an instrument can have orders placed on it?

ausrasul commented 3 years ago

I import this schedule once a year and never had a problem.

https://www.avanza.se/aktier/oppettider-handelskalender.html

JakobWestergarden commented 3 years ago

I import this schedule once a year and never had a problem.

https://www.avanza.se/aktier/oppettider-handelskalender.html

thank you! Is there an api function which can do this automatically or you manually import it?

ausrasul commented 3 years ago

I don’t know. Let me know if you find out.

fhqvst commented 3 years ago

IIRC, Avanza show no information about trading halts in the app, so for that you'd have to rely on another API, maybe subscribe to some Twitter account, or use this screen: https://www.nasdaqtrader.com/trader.aspx?id=TradeHalts.

For half-days etc. on the other hand, I do think there's usually a banner at the top of the app UI, meaning we should be able to read that. Would require a bit of digging but nothing major.