High-Frequency & Algorithmic Trading
API Keys & Bot Auth
Connect external algorithmic market making bots and trading strategies via low-latency REST and WebSocket channels using HMAC SHA-256 signed headers.
Create New API Key
Active API Keys
| Label | API Key | Permissions | Created | Action |
|---|---|---|---|---|
| No active API keys found. Generate one above to connect an algo bot. | ||||
Python Algorithmic Trading Example (HMAC Auth)
import time, hmac, hashlib, requests
API_KEY = "cross_key_..."
API_SECRET = "cross_sec_..."
BASE_URL = "http://localhost:3001/api"
def place_order(symbol, side, size, price, leverage=20):
timestamp = str(int(time.time() * 1000))
body = {"symbol": symbol, "side": side, "size": size, "price": price, "leverage": leverage}
payload = timestamp + str(body)
signature = hmac.new(API_SECRET.encode(), payload.encode(), hashlib.sha256).hexdigest()
headers = {
"X-CROSSHAIR-KEY": API_KEY,
"X-CROSSHAIR-SIGNATURE": signature,
"X-CROSSHAIR-TIMESTAMP": timestamp,
"Content-Type": "application/json"
}
return requests.post(f"{BASE_URL}/orders", json=body, headers=headers).json()