Skip to content

MarketStatus

This interface can tell if equity markets are currently open, partially open, or closed. This feature is only applicable to equities markets (stocks) as crypto markets trade 24/7.

MarketStatus.get

Returns the current open status of the market (U.S. only)

status description
UNKNOWN Failed to determine status for some reason.
FULL_DAY Normal trading day (9:30 AM - 4:00 PM EST)
PARTIAL_1PM Early closing trading day (9:30 AM - 1:00 PM EST)
AFTER_HOURS After market trading (4:00 PM - 7:00 PM EST)
BEFORE_HOURS Pre-market hour (6:00 AM? - 9:30 AM)
CLOSED Markets are currently closed.
CLOSED_WEEKEND Markets are closed for the weekend.
status = MarketStatus.get()
Log.info("Market status: {}" . format(status))
var status = MarketStatus.get();
Log.info("Market status: " + status);

MarketStatus.isMarketOpen

Convenience function to test if the market is open for trading or closed (for whatever reason).

result description
true Market is currently open and we can trade.
false Market is currently closed. It could be for any reason, we cannot trade.
if MarketStatus.isMarketOpen()
  # do some trading
  pass
if (MarketStatus.isMarketOpen()) {
    //do some trading
}