MCPcopy Create free account
hub / github.com/Py-Ec/solana-arbitrage-bot

github.com/Py-Ec/solana-arbitrage-bot @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
304 symbols 612 edges 58 files ⚖ MIT 60 documented · 20% updated 2y ago★ 592 open issues

Browse by type

Functions 241 Types & classes 63
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

solana arbitrage bot

happy searching :)

layout

  • client/: off-chain arbitrage bot code
  • program/: on-chain swap program
  • pools/: dex pool metadata
  • onchain-data/: analysis of other arbitrage swaps
  • mainnet-fork/: fork mainnet account states to test swap input/output estimates

each folder contains a corresponding README.md which explains how it works

dexs supported

  • serum
  • aldrin
  • saber
  • mercurial
  • orca

other notes

  • we use rust unit tests (with mainnet forking) to ensure our swap quotes are correct (quoted swap amount = actual swap amount)
  • to figure out how to interface with each dex (most dont have rust sdks or even public ts sdks) we reverse engineer how to interact with them through the jupiter-swap sdk (analyzing the npm package folder bc its also not public)
  • in the client we use a brute-force approach to find arb opportunities instead of negative cycle algos bc its much faster and can find all opportunities
  • we also dont calculate the optimal swap input amount for each arb bc its faster to spam multiple decreasing amounts and let the largest one land (this is what the winner of the arbitrage opportunities was doing - eg, send tx with input size N, N/2, N/4, ...)
  • why do we need an on-chain swap program? checkout this post out -- if you swap from A -> B -> C you might get more/less of B than expected which effects the swap instruction to C

why share this alpha

the life of a lone searcher is a lonely one where you cant share what you find or share your code - while working on this project i realized this is not what im about and thus i open source

Extension points exported contracts — how you extend this code

browse all types & interfaces →

Core symbols most depended-on inside this repo

browse all functions →

Shape

Method 134
Function 107
Class 48
Enum 11
Interface 4

Languages

Rust94%
TypeScript6%

Modules by API surface

client/src/pool_utils/constant_product.rs22 symbols
client/src/pool_utils/stable.rs18 symbols
program/programs/tmp/src/swaps/serum.rs17 symbols
client/src/pool_utils/offset.rs17 symbols
client/src/pool_utils/serum.rs16 symbols
client/src/pool_utils/constant_price.rs16 symbols
client/src/pool_utils/calculator.rs16 symbols
client/src/pool_utils/base.rs16 symbols
program/programs/tmp/src/lib.rs14 symbols
client/src/serialize/token.rs14 symbols
client/src/pools/serum.rs14 symbols
client/src/pool_utils/fees.rs12 symbols

For agents

$ claude mcp add solana-arbitrage-bot \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page