Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Solana DEX Trading Analytics — Ruslan Coefficient Framework

Proprietary quantitative analytics tool for Solana memecoin trading. Built to overcome the analytical limitations of existing platforms (e.g. GMGN) that deliberately restrict depth of on-chain data access.


🧠 Core Idea

Most copy-trading tools let you follow wallets blindly. This tool asks a different question:

"Given a trader's historical ROI distribution, what is the statistically optimal take-profit threshold P that maximises expected PnL per trade — accounting for fees, spread, and probability of achievement?"*

The answer is the Ruslan Coefficient.


📐 Ruslan Coefficient

Ruslan Coefficient = (P* / 100 + 1) × WinRate(P*)

Where:

  • P* — optimal take-profit threshold (%), found via 1,000-iteration bootstrapped CV
  • WinRate(P)* — proportion of historical trades where max post-entry price ≥ P*

Interpretation:

Value Signal
> 1.44 ✅ Profitable signal — trade recommended
1.0 – 1.44 ⚠️ Marginal — depends on fee structure
< 1.0 ❌ Unprofitable after fees

🔬 Methodology

Step 1 — Trader Pre-filtering

  • Source: top-300 Solana wallets by Early-Bird trade profile
  • Manual exclusion of sniper bots (high gas, sub-block entry) — technically unreplicable
  • Target profile: wallets entering within first 10–30 minutes of token launch

Step 2 — On-chain Data Collection (BitQuery API)

For each target wallet and each token traded:

  • first_buy_price_usd — price at first buy (ascending block time)
  • highest_post_purchase_usd — max price achieved after first buy
  • ROI with 3% spread: (max_price × 0.97) / (entry_price × 1.03) - 1

Step 3 — Bootstrapped Statistical Validation

1,000 iterations:
  → Shuffle dataset
  → Split: 70% train / 30% validation
  → For each P in grid [30, 400]:
      E[PnL] = WinRate(P) × NetWin(P) + (1-WinRate(P)) × NetLoss
  → Record optimal P* per iteration
→ Output: median P* across 1,000 iterations

Step 4 — Fee-adjusted Expected PnL

fees = GAS_FEE_BUY + GAS_FEE_SELL + 2 × (tx_size × PLATFORM_FEE_PCT)
net_win  = (P/100) × tx_size - fees
net_loss = -tx_size - fees
E[tx] = WinRate × net_win + (1 - WinRate) × net_loss

Step 5 — Execution

  • Trade signals filtered by Ruslan Coefficient > 1.44
  • Execution via Trojan Telegram Bot on Solana

📊 Results

  • Dataset: top 300 Early-Bird Solana traders, 2,000+ token events
  • Ruslan Coefficient threshold: > 1.44 → profitable
  • ROI improvement: >200% vs classical copy-trading in top-performing cases
  • Spread model: 3% buy-side + 3% sell-side (conservative real-world estimate)

🗂️ Repository Structure

solana-trading-analytics/
├── solana_dex_analysis.ipynb   ← Main notebook (clean, no secrets)
├── src/
│   └── analysis.py             ← Core functions as importable module
├── data/
│   └── sample_roi.csv          ← Sample ROI dataset (anonymised)
├── assets/
│   ├── ruslan_coefficient.png  ← Methodology diagram
│   └── roi_distribution.png    ← Sample output chart
├── requirements.txt
├── .env.example                ← Template — copy to .env and fill in
├── .gitignore
└── README.md

⚙️ Setup & Usage

1. Clone & install

git clone https://github.com/ruslankarymov/solana-trading-analytics.git
cd solana-trading-analytics
pip install -r requirements.txt

2. Configure credentials

cp .env.example .env
# Edit .env — add your BitQuery API key and target wallet address

3. Run

# Option A: Jupyter Notebook
jupyter notebook solana_dex_analysis.ipynb

# Option B: Google Colab
# Click the "Open in Colab" badge above, then set secrets in Colab

🔑 Environment Variables

Variable Description
BITQUERY_API_KEY Your BitQuery Bearer token (streaming.bitquery.io)
TARGET_WALLET Solana wallet address to analyse

Never commit your .env file. It is excluded by .gitignore.


🛠️ Tech Stack

Layer Tools
Data Collection BitQuery GraphQL API, Helius API
Data Processing Python, Pandas, NumPy
Statistical Model Custom bootstrapping (1,000 iterations)
Visualisation Matplotlib, Seaborn
Execution Trojan Telegram Bot
Runtime Google Colab, Jupyter

📈 Sample Output

======================================================================
COMPREHENSIVE P* ANALYSIS ACROSS INTERVALS: Dataset 1 (Solana signals)
======================================================================

--- Top 5 P Intervals by Ruslan Coefficient ---

Interval [30, 67]:
  Median P*:   44.0
  WinRate:     68.3%
  Ruslan Coefficient: 0.9747   ← below threshold

Interval [68, 105]:
  Median P*:   85.0
  WinRate:     54.1%
  Ruslan Coefficient: 1.0009

Interval [143, 180]:
  Median P*:   150.0
  WinRate:     51.2%
  Ruslan Coefficient: 1.2800

Interval [218, 255]:
  Median P*:   220.0
  WinRate:     42.8%
  Ruslan Coefficient: 1.3696

✅ Best interval: P* = 220%, WinRate = 42.8%, RC = 1.3696

⚠️ Disclaimer

This tool is for research and educational purposes only. Cryptocurrency trading involves significant financial risk. Past performance of any wallet or strategy does not guarantee future results.


👤 Author

Ruslan Karymov — Data & BI Analyst | Quantitative Analytics | DeFi Research


Part of a broader analytical framework for Solana DeFi trading strategy research.

About

Solana DEX trading analytics in Python - bootstrapped selection of optimal take-profit thresholds, validated over 1,000 iterations on a 70/30 split.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages