Documentation
¶
Overview ¶
Package orca preloads Orca Whirlpool trading pools.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ProgramID = sgo.MustPublicKeyFromBase58("whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc") CheckPoolID = sgo.MustPublicKeyFromBase58("Czfq3xZZDmsdGdUyrNLtRhGc47cXcZtLG4crryfu44zE") CheckConfigID = sgo.MustPublicKeyFromBase58("2LecshUwdy9xi7meFgHtFJQNSKk4KdTrcpvaB56dP2NQ") )
Functions ¶
This section is empty.
Types ¶
type Orca ¶
type Orca struct {
Pools []*Whirlpool
// contains filtered or unexported fields
}
Orca holds all Whirlpool pools loaded at startup.
func Create ¶
func Create(ctx context.Context, stateClient state.Client, workingDir string, maxSubscriptionCount int) (*Orca, error)
Create queries the graph at depth 2 from the Orca program ID (program → WhirlpoolConfig → Whirlpool) and parses every pool account found.
type PoolConfiguration ¶
type PoolConfiguration struct {
List []*WhirlpoolConfiguration `json:"list"`
}
type Whirlpool ¶
type Whirlpool struct {
Pubkey sgo.PublicKey
TokenMintA sgo.PublicKey
TokenMintB sgo.PublicKey
VaultA sgo.PublicKey
VaultB sgo.PublicKey
SqrtPriceHi uint64 // high 64 bits of Q64.64 sqrt price
SqrtPriceLo uint64 // low 64 bits of Q64.64 sqrt price
LiquidityLo uint64 // low 64 bits of active liquidity u128
LiquidityHi uint64 // high 64 bits of active liquidity u128
TickCurrentIndex int32
TickSpacing uint16
FeeRate uint16 // hundredths of a basis point (3000 = 0.3%)
}
Whirlpool is the parsed state of an Orca Whirlpool concentrated-liquidity pool.
func (*Whirlpool) FeeBps ¶
FeeBps returns the fee in basis points.
func (*Whirlpool) LiquidityUsd ¶ added in v0.4.14
func (w *Whirlpool) LiquidityUsd(prices map[sgo.PublicKey]float64, decimals map[sgo.PublicKey]uint8) float64
LiquidityUsd returns a rough USD estimate of active liquidity using virtual reserves derived from the pool's active liquidity L and sqrt price.
virtualA = L / sqrt_price (raw units of token A) virtualB = L * sqrt_price (raw units of token B)
prices maps each mint to its USD price per human-readable token unit. decimals maps each mint to the number of decimal places (e.g. USDC → 6).
func (*Whirlpool) SpotPrice ¶
SpotPrice returns token_b raw units per token_a raw unit.
Source Files
¶
- download.go
- event.go
- liquidity.go
- loader.go
- orca.go
- print.go
- whirlpool.go