orca

package
v0.4.7 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package orca preloads Orca Whirlpool trading pools.

Index

Constants

This section is empty.

Variables

View Source
var (
	ProgramID     = sgo.MustPublicKeyFromBase58("whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc")
	CheckPoolID   = sgo.MustPublicKeyFromBase58("Czfq3xZZDmsdGdUyrNLtRhGc47cXcZtLG4crryfu44zE")
	CheckConfigID = sgo.MustPublicKeyFromBase58("2LecshUwdy9xi7meFgHtFJQNSKk4KdTrcpvaB56dP2NQ")
)
View Source
var (
	DiscriminatorWhirlpool = [8]uint8{63, 149, 209, 12, 225, 128, 99, 9}
	DiscriminatorTickArray = [8]uint8{69, 97, 189, 190, 110, 7, 66, 187}
)

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) (*Orca, error)

Create queries the graph at depth 2 from the Orca program ID (program → WhirlpoolConfig → Whirlpool) and parses every pool account found.

func (*Orca) Args

func (orca *Orca) Args(args []string) ([]string, error)

func (*Orca) Env

func (orca *Orca) Env(mEnv map[string]string) error

func (*Orca) Find

func (orca *Orca) Find(poolID sgo.PublicKey) *Whirlpool

func (*Orca) Load

func (orca *Orca) Load(targetDirectory string, tp *trading.TradingPair) error

Load put in files that can be statically compiled into the wasm bot

func (*Orca) String

func (orca *Orca) String() string

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
	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

func (w *Whirlpool) FeeBps() uint16

FeeBps returns the fee in basis points.

func (*Whirlpool) SpotPrice

func (w *Whirlpool) SpotPrice() float64

SpotPrice returns token_b raw units per token_a raw unit.

func (*Whirlpool) String

func (w *Whirlpool) String() string

type WhirlpoolConfiguration

type WhirlpoolConfiguration struct {
	Pubkey sgo.PublicKey `json:"pubkey"`
	MintA  sgo.PublicKey `json:"mint_a"`
	MintB  sgo.PublicKey `json:"mint_b"`
}

Source Files

  • loader.go
  • orca.go
  • print.go
  • whirlpool.go

Jump to

Keyboard shortcuts

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