Documentation
¶
Overview ¶
Package drift preloads Drift v2 SpotMarket accounts (global market data only -- User, the per-wallet position account, is not fetched here since there is no bounded set to bulk-load, and PerpMarket is skipped since it has no mint/vault of its own -- perp markets settle in the program's quote asset).
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DiscSpotMarket = [8]byte{100, 177, 8, 107, 168, 65, 65, 39}
Discriminator for the Anchor SpotMarket account type.
var (
ProgramID = sgo.MustPublicKeyFromBase58("dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH")
)
var Schema string
Functions ¶
func ExportJSON ¶
ExportJSON writes every tracked Drift spot market to path as a JSON array of SpotMarket values (its own existing json tags) -- the same real query loadSpotMarkets already runs for in-process use, reused verbatim, so catscope-rust-bot's build.rs can read this file instead of opening prefetch.db directly.
Types ¶
type Drift ¶
type Drift struct {
SpotMarkets []*SpotMarket
// contains filtered or unexported fields
}
Drift holds all Drift v2 SpotMarket accounts loaded at startup.
func Create ¶
Create queries the Drift v2 program at depth 1 (program → spot market) and collects all spot market accounts, persisting results to db (drift_spot_market). If db already has spot markets from a previous run, they're loaded back instead of re-fetching, unless force is true.
func (*Drift) Find ¶
func (d *Drift) Find(marketID sgo.PublicKey) *SpotMarket
Find looks up a spot market by its pubkey.
Source Files
¶
- drift.go
- event.go
- export.go
- print.go
- schema.go
- spot_market.go
- store.go