212 lines
7.0 KiB
HTML
212 lines
7.0 KiB
HTML
<!doctype html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||
<title>Professional Drift Trading Stack (Own Solana RPC + Own DLOB)</title>
|
||
<style>
|
||
:root { color-scheme: light dark; }
|
||
body {
|
||
font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
|
||
line-height: 1.5;
|
||
margin: 0;
|
||
padding: 32px 20px;
|
||
max-width: 980px;
|
||
margin-inline: auto;
|
||
}
|
||
header { margin-bottom: 24px; }
|
||
h1 { font-size: 1.6rem; margin: 0 0 8px; }
|
||
.subtitle { opacity: 0.85; margin: 0; }
|
||
.card {
|
||
border: 1px solid rgba(127,127,127,0.35);
|
||
border-radius: 14px;
|
||
padding: 18px 18px;
|
||
margin: 14px 0;
|
||
background: rgba(127,127,127,0.05);
|
||
}
|
||
h2 { font-size: 1.2rem; margin: 0 0 10px; }
|
||
h3 { font-size: 1.05rem; margin: 14px 0 8px; }
|
||
ul { margin: 8px 0 0 18px; }
|
||
li { margin: 6px 0; }
|
||
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
|
||
.note {
|
||
border-left: 4px solid rgba(127,127,127,0.55);
|
||
padding: 10px 12px;
|
||
margin: 10px 0 0;
|
||
background: rgba(127,127,127,0.07);
|
||
border-radius: 10px;
|
||
}
|
||
.pill {
|
||
display: inline-block;
|
||
padding: 2px 10px;
|
||
border: 1px solid rgba(127,127,127,0.35);
|
||
border-radius: 999px;
|
||
font-size: 0.85rem;
|
||
opacity: 0.9;
|
||
}
|
||
</style>
|
||
</head>
|
||
|
||
<body>
|
||
<header>
|
||
<h1>Professional Drift Trading Stack</h1>
|
||
<p class="subtitle">
|
||
Own Solana RPC + Own Drift DLOB (Orderbook). Main rule:
|
||
<strong>keep the RPC box lean</strong>, put “trading services” on your second VPS.
|
||
<span class="pill">Target: min 10 markets</span>
|
||
</p>
|
||
</header>
|
||
|
||
<section class="card">
|
||
<h2>Overview</h2>
|
||
<p>
|
||
Yes — you can build a professional Drift trading stack with your own Solana RPC + your own DLOB,
|
||
but you’ll want a few supporting services around them. The main rule:
|
||
keep the RPC box lean, put “trading services” on your second VPS.
|
||
</p>
|
||
</section>
|
||
|
||
<section class="card">
|
||
<h2>On the Solana RPC server (dedicated) — keep it lean</h2>
|
||
|
||
<h3>Must-have</h3>
|
||
<ul>
|
||
<li>
|
||
<strong>Solana validator/RPC node</strong><br />
|
||
The base RPC your whole stack reads from / sends transactions through.
|
||
</li>
|
||
<li>
|
||
<strong>WireGuard</strong><br />
|
||
So RPC is reachable only privately (your second VPS + your admin).
|
||
</li>
|
||
<li>
|
||
<strong>Firewall (nftables/ufw)</strong><br />
|
||
Block RPC ports on public NIC; allow them only on WireGuard.
|
||
</li>
|
||
<li>
|
||
<strong>Time sync (chrony)</strong><br />
|
||
For stable networking, logs, and trading timestamps.
|
||
</li>
|
||
<li>
|
||
<strong>Monitoring exporters</strong>
|
||
<ul>
|
||
<li><strong>node_exporter</strong> (CPU/RAM/disk/iowait/network)</li>
|
||
<li><strong>solana-exporter</strong> (RPC/validator health via RPC)</li>
|
||
</ul>
|
||
</li>
|
||
<li>
|
||
<strong>Log + disk hygiene</strong>
|
||
<ul>
|
||
<li>logrotate/journald limits</li>
|
||
<li>NVMe health (smartmontools/nvme-cli)</li>
|
||
<li>alerts on disk filling / iowait</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
|
||
<h3>Optional but “pro”</h3>
|
||
<ul>
|
||
<li>
|
||
<strong>Geyser streaming (Yellowstone gRPC plugin)</strong><br />
|
||
This gives ultra-low-latency streams of accounts/tx/slots compared to polling RPC.
|
||
Useful if you build your own real-time analytics pipeline.
|
||
<div class="note">
|
||
For Drift specifically, you can run without Geyser at the beginning,
|
||
but it’s the next step when you want “faster-than-RPC” feeds.
|
||
</div>
|
||
</li>
|
||
</ul>
|
||
</section>
|
||
|
||
<section class="card">
|
||
<h2>On the second VPS (your trading / app box) — where “pro trading” lives</h2>
|
||
|
||
<h3>Must-have</h3>
|
||
<ul>
|
||
<li>
|
||
<strong>Drift DLOB server (self-hosted)</strong><br />
|
||
This maintains the Drift decentralized orderbook view “fresh off your RPC” and exposes
|
||
REST + WS + gRPC/polling, plus health/metrics.
|
||
</li>
|
||
<li>
|
||
<strong>(Optional but common) Drift Gateway</strong><br />
|
||
A self-hosted API gateway to interact with Drift; handy for standardized API endpoints
|
||
around trading / market info.
|
||
</li>
|
||
<li>
|
||
<strong>Cache (Redis)</strong><br />
|
||
Cache top-of-book, funding, oracle snapshots, risk checks; protects your DLOB + RPC
|
||
from bursty bot load.
|
||
</li>
|
||
<li>
|
||
<strong>Metrics + dashboards</strong><br />
|
||
Prometheus + Grafana + Alertmanager
|
||
<div class="note">
|
||
Keep Grafana off the validator box; common ops guidance is to separate monitoring UI for safety.
|
||
</div>
|
||
</li>
|
||
<li>
|
||
<strong>Your trading services</strong>
|
||
<ul>
|
||
<li>strategy engine(s)</li>
|
||
<li>execution service (transaction builder/sender)</li>
|
||
<li>risk service (position limits, kill-switch, circuit breakers)</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
|
||
<h3>Optional, depending on how “institutional” you want</h3>
|
||
<ul>
|
||
<li>
|
||
<strong>Database (Postgres/Timescale)</strong><br />
|
||
Persist fills, order events, PnL series, backtesting datasets.
|
||
</li>
|
||
<li>
|
||
<strong>Message bus (NATS/Kafka/Redis Streams)</strong><br />
|
||
Decouple ingestion (orderbook/events) from strategies/execution.
|
||
</li>
|
||
</ul>
|
||
</section>
|
||
|
||
<section class="card">
|
||
<h2>Cost model (since you asked “cost per request”)</h2>
|
||
<p>
|
||
With your own RPC, there is no per-request billing. The “cost” is:
|
||
</p>
|
||
<ul>
|
||
<li>fixed monthly servers (your €149/m + the second VPS),</li>
|
||
<li>and capacity (CPU/RAM/NVMe/bandwidth) consumed by:
|
||
<ul>
|
||
<li>DLOB syncing from RPC,</li>
|
||
<li>number of WS subscriptions,</li>
|
||
<li>how many markets you track.</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
<p class="note">
|
||
DLOB exists specifically to reduce RPC load by serving orderbook/trade views to clients
|
||
instead of every client rebuilding it from chain.
|
||
</p>
|
||
</section>
|
||
|
||
<section class="card">
|
||
<h2>Minimal “pro” starting set (recommended)</h2>
|
||
<ul>
|
||
<li><strong>RPC box:</strong> Solana RPC + WireGuard + firewall + node_exporter + solana-exporter</li>
|
||
<li><strong>App VPS:</strong> DLOB server + Redis + Prometheus/Grafana + your bot services</li>
|
||
</ul>
|
||
<p class="note">
|
||
For <strong>min 10 markets</strong>, expect the first scaling pressure to come from
|
||
continuous streaming + decoding + caching (DLOB + Redis + your strategy/execution),
|
||
and from your RPC’s WS load. Next step after the minimal set is usually:
|
||
better streaming (Geyser) or more RAM/NVMe depending on bottleneck.
|
||
</p>
|
||
</section>
|
||
|
||
<footer style="opacity:.75; margin-top: 22px;">
|
||
<small>Saved as HTML — you can paste this into a file like <code>drift-stack.html</code>.</small>
|
||
</footer>
|
||
</body>
|
||
</html>
|
||
|