A high-performance, WebSocket-based Market Making bot for the StandX Perpetual Exchange.
Built with Python asyncio for low-latency order execution and real-time state management.
- Grid Strategy: Automatically places buy/sell orders around the market price to capture spread.
- WebSocket Streaming: Uses StandX's real-time
MarketandTradingWebSocket streams. - Robust Authentication: Supports Ed25519 Signing with secure internal handling of API Keys (Base58/Base64 support).
- Latency Monitoring: Includes tools to test connectivity to StandX servers from your deployment env.
- Safety Watchdogs:
- System Watchdog: Detects if the data feed freezes and alerts you.
- Position Monitor: (
start_monitor.py) Independent process to alert (Sound + Telegram) if a position is held too long (e.g. > 30s), indicating network or logic hang.
- Telegram Integration: Sends alerts and errors directly to your Telegram.
main.py: Entry point for the trading bot.strategy/: Contains the Grid Trading logic (StandXMarketMaker).protocol/: Handles WebSocket connections (ws_client.py) and Authentication (auth.py).check_latency.py: Tool to test network speed to StandX.start_monitor.py: Independent safety monitor.debug_key.py: Utility to verify your API Key format.
-
Clone the repository:
git clone https://github.com/ziayuan/StandXMM-WS.git cd StandXMM-WS -
Set up Python Environment:
python3 -m venv venv source venv/bin/activate pip install -r requirements.txt -
Configure Secrets: Copy the example config:
cp .env.example .env
Edit
.envand fill in your StandX API Key/Secret and Telegram details. -
Adjust Strategy: Edit
config.yamlto set your targetsymbol,quantity, and grid parameters (spread,step).
./run.sh
# OR manually:
source venv/bin/activate
python main.pyCheck if your server has a stable connection to StandX.
python check_latency.pyRun this in a separate terminal or process. It acts as a "Dead Man's Switch" alarm.
python start_monitor.pyThis software is for educational purposes only. Market making involves significant risk. Use at your own risk. The authors are not responsible for any financial losses incurred.