Documentation
¶
Overview ¶
Package phoenix preloads Phoenix perpetuals market identity (symbol, asset_id, market_account) into prefetch.db.
Unlike every other prefetch package (pumpswap, pumpfun, kamino, ...), this does NOT discover markets live from the chain -- it just loads the same small, fixed market list `phoenix.json` used to carry directly (see market.go's fixedMarkets), skipping the subscribe/parse machinery entirely. That's a deliberate simplification: Phoenix has ~65 live markets and no edge-generator FilterEdges are needed to reach any of them (GlobalConfiguration is a fixed address that embeds PerpAssetMap's pubkey directly), so live discovery only trades a bit of code for automatically picking up new markets -- not worth it for now.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ProgramID = sgo.MustPublicKeyFromBase58("EtrnLzgbS7nMMy5fbD42kXiUzGg8XQzJ972Xtk1cjWih")
var Schema string
Functions ¶
func ExportJSON ¶
ExportJSON writes every tracked Phoenix market to path as a JSON array of {market_account, symbol, asset_id} objects (Market's own existing json tags, market_account base58-encoded via sgo.PublicKey's MarshalJSON) -- the same real query loadMarkets already runs for in-process use, reused verbatim, just so catscope-rust-bot's build.rs can read it from a file instead of opening prefetch.db directly (see that repo's build.rs doc comment on phoenix_market for why).
store.DB always migrates phoenix.Schema before any query runs, so (unlike build.rs's own defensive "table not found" fallback, which exists for older prefetch.db files that predate this schema) there is no "missing table" case to soften here -- an error from loadMarkets means something is actually wrong, not just "phoenix hasn't been fetched yet". An empty result (table exists, zero rows) still writes a valid empty JSON array, not an error.
Types ¶
type Market ¶
type Market struct {
MarketAccount sgo.PublicKey `json:"market_account"`
Symbol string `json:"symbol"`
AssetID uint32 `json:"asset_id"`
}
Market is one Phoenix perp market's identity -- just the fields catscope-rust-bot's PhoenixMarketRaw needs (live pricing/risk fields are fetched by the bot directly from PerpAssetMap at runtime, not cached here).
type Phoenix ¶
type Phoenix struct {
Markets []*Market
}
Phoenix holds markets loaded at startup.
func Create ¶
func Create(ctx context.Context, stateClient state.Client, db *sql.DB, maxSubscriptionCount int, force bool) (*Phoenix, error)
Create loads Phoenix's fixed market list (fixedMarkets) into db (phoenix_market). If db already has markets from a previous run, they're loaded back instead of re-inserting, unless force is true. ctx/stateClient/maxSubscriptionCount are accepted only to match every other prefetch package's Create signature (so cmd/download.go's dispatch doesn't need a special case) -- unused here since there's no live chain subscription.
type Query ¶
type Query struct {
// contains filtered or unexported fields
}
func CreateQuery ¶
CreateQuery prepares the top-markets statement against phoenix_market. Callers wrap the result as one dispatch case of a single, consolidated "get top pools" tool (see prefetch/prompttool.go) rather than exposing their own separate tool.
func (*Query) TopPools ¶
TopPools returns up to count phoenix_market rows, alphabetically by symbol, as a semicolon-joined "market=... symbol=..." list. Unlike the other DEXes' TopPools, this scans two columns internally since phoenix_market has no liquidity/balance data to rank by -- the external signature stays the same so the caller can dispatch to it identically.
Source Files
¶
- export.go
- market.go
- phoenix.go
- query.go
- schema.go
- store.go