leq6c / soldexpy

Experimental Python toolkit to work with Raydium
39 stars 22 forks source link

Solana Raydium Experiment

This is an experimental Python toolkit to work with Raydium Liquidity Pool V4 by using only Solana RPC. You can swap tokens, get price and even get the lp locked ratio by simulating transaction.

Disclaimer

This is written just for research purpose and it may contain old or unsafe way. Keep this code here as a reference only.

Features

*Only supports the pool that has SOL as the base or quote token.

Example

# load private key
keypair = Keypair.from_bytes(base58.b58decode(PRIVATE_KEY))
# configure rpc client
client = Client("https://api.mainnet-beta.solana.com")

# get pool
pool = RaydiumPool(client, "AVs9TA4nWDzfPJE9gGVNJMVhcQy3V9PGazuz33BfG2RA")
# initialize Swap
swap = Swap(client, pool)

# buy
swap.buy(1.0, 0.1, keypair)

Development

Testing

pytest