https://github.com/humancyyborg/raydium_swap
Raydium swap with Python
https://github.com/humancyyborg/raydium_swap
Last synced: about 2 months ago
JSON representation
Raydium swap with Python
- Host: GitHub
- URL: https://github.com/humancyyborg/raydium_swap
- Owner: Humancyyborg
- Created: 2024-11-23T23:35:43.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-11-24T01:46:19.000Z (6 months ago)
- Last Synced: 2025-01-30T13:41:36.641Z (4 months ago)
- Language: Python
- Size: 55.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# raydium_py
Python library to trade on Raydium.
Updated: 11/11/2024
Clone the repo, and add your Private Key (Base58 string) and RPC to the config.py.
**If you can - please support my work and donate to: G7Usqa5m88APsheG7N3X2SanRArWJye5BvzZ1f2mWsv3**
### Contact
My services are for **hire**. Contact me if you need help integrating the code into your own project.
I am not your personal tech support. READ THE FAQS.
Telegram: @https://t.me/humancybborg
### FAQS
**What format should my private key be in?**
The private key should be in the base58 string format, not bytes.
**Why are my transactions being dropped?**
You get what you pay for. Don't use the main-net RPC, just spend the money for Helius or Quick Node.
**How do I change the fee?**
Modify the UNIT_BUDGET and UNIT_PRICE in the config.py.
**Why is this failing for USDC pairs?**
This code only works for SOL pairs.
**Why are there "no pool keys found"?**
IF YOU ARE USING A FREE TIER RPC, THIS REPO WILL NOT WORK FOR YOU. FREE TIER RPCS DO NOT ALLOW GET_ACCOUNT_INFO_PARSED().
**Does this code work on devnet?**
No.
### Examples
```
from raydium import buy
from utils import get_pair_address# Buy Example
token_address = "7GCihgDB8fe6KNjn2MYtkzZcRjQy3t9GHdC8uHYmW2hr" # POPCAT
pair_address = get_pair_address(token_address)
sol_in = .1
slippage = 5
buy(pair_address, sol_in, slippage)
``````
from raydium import sell
from utils import get_pair_address# Sell Example
token_address = "7GCihgDB8fe6KNjn2MYtkzZcRjQy3t9GHdC8uHYmW2hr" # POPCAT
pair_address = get_pair_address(token_address)
percentage = 100
slippage = 5
sell(pair_address, percentage, slippage)
```