Skip to content Search Apps Documentation Source Content Run Reset Eval Playground File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

market.gno

0.87 Kb · 19 lines
 1package lastcall
 2
 3// Market hours. US equities don't trade 24/7, and a stock can gap over a weekend
 4// or overnight while positions are frozen. The off-chain updater (price bot) pushes
 5// the real market status each cycle; the desk only accepts NEW perp opens while the
 6// market is open — opening a leveraged position against a stale, closed-market price
 7// is the gap-risk trap. Closing and liquidating stay allowed so no one is trapped,
 8// and spot stays available (1:1 mint/burn at the reference, no leverage).
 9
10var marketOpen = true // default open until the updater pushes the real status
11
12// SetMarketOpen is pushed by the off-chain updater (bot) from the live market state.
13func SetMarketOpen(cur realm, open bool) {
14	assertUpdater(cur)
15	marketOpen = open
16}
17
18// IsMarketOpen reports whether the desk is accepting new perp opens.
19func IsMarketOpen() bool { return marketOpen }