raydium

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package raydium preloads Raydium AMM v4 trading pools.

Index

Constants

This section is empty.

Variables

View Source
var ProgramID = sgo.MustPublicKeyFromBase58("675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8")

Functions

func Create

func Create(
	parentCtx context.Context,
	stateClient state.Client,
	db *sql.DB,
	maxSubscriptionCount int,
	force bool,
	mintTracker *mintinfo.Tracker,
	mDownload map[string]struct{},
) error

Create downloads Raydium pool data from the on-chain state service and writes it to db (if non-nil). Each sub-package writes accounts to the database inline via CommitStart/CommitFinish as they stream in. If force is true, each sub-package re-fetches even if its tables are already populated, instead of skipping.

func PrintSummary added in v0.4.16

func PrintSummary(db *sql.DB, w io.Writer) error

PrintSummary writes a human-readable summary of the pools stored in db to w, including the top 10 pools by liquidity.

Types

type Loader added in v0.4.16

type Loader struct {
	// contains filtered or unexported fields
}

Loader is a prefetch.StaticLoader that snapshots the live raydium.db (already populated in place by Create, via amm/clmm/cpmm's CommitStart/ CommitFinish transactions) out to the wasm build's target directory.

func NewLoader added in v0.4.16

func NewLoader(db *sql.DB) *Loader

NewLoader wraps the already-open raydium database for use as a StaticLoader.

func (*Loader) Args added in v0.4.16

func (l *Loader) Args(args []string) ([]string, error)

func (*Loader) Env added in v0.4.16

func (l *Loader) Env(mEnv map[string]string) error

type PoolSummary added in v0.4.16

type PoolSummary struct {
	Pubkey    sgo.PublicKey
	Program   string
	Liquidity uint64
}

PoolSummary is a unified, cross-program view of a single pool used for ranking. Liquidity is the sum of both vault balances in raw token units (no decimals or price normalization applied), so it is only a rough proxy for comparing pools that trade different token pairs.

type Raydium

type Raydium struct {
	Amm  *amm.Configuration  `json:"amm"`
	Clmm *clmm.Configuration `json:"clmm"`
	Cpmm *cpmm.Configuration `json:"cpmm"`
}

Raydium holds all AMM v4 pools loaded at startup.

func (*Raydium) String added in v0.4.16

func (raydium *Raydium) String() string

type Stats added in v0.4.16

type Stats struct {
	AmmCount  int
	CpmmCount int
	ClmmCount int
	// Top10 holds up to 10 pools with the highest Liquidity across all
	// three programs, sorted descending.
	Top10 []PoolSummary
}

Stats is a count-based summary of the pools currently stored in a database.

func Summarize added in v0.4.16

func Summarize(db *sql.DB) (*Stats, error)

Summarize reads every downloaded pool from db and returns pool counts per program plus the top 10 pools by liquidity across all three programs.

Source Files

  • loader.go
  • print.go
  • raydium.go

Directories

Path Synopsis
Package amm tracks amm
Package amm tracks amm
Package clmm tracks clmm
Package clmm tracks clmm
Package cpmm tracks cpmm
Package cpmm tracks cpmm

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL