WebSocket Engine API
Connecting to the Engine API
The AlgoMesh engine runs locally on your machine and communicates over WebSockets. You can hook directly into the execution engine by connecting a custom client to the local WebSocket server at ws://localhost:52000/connect.
Pipeline through GUI
Learn how to drag-and-drop logic gates to build complex multi-timeframe strategies without coding.
Listening for Strategy Signals
When a visual strategy running on your local engine triggers a buy or sell, it broadcasts a STRATEGY_SIGNAL payload. By listening to this feed, you can log trades, build custom dashboards, or bridge AlgoMesh to external messaging apps like Telegram or Discord.
The STRATEGY_SIGNAL Payload
When an order triggers, the JSON object received from the socket looks like this:
{
"type": "STRATEGY_SIGNAL",
"action": "BUY",
"price": 64320.50,
"amount": 0.05,
"sizeType": "percent",
"orderType": "Market",
"symbol": "BTCUSDT",
"strategyName": "BTC_Momentum_Scalp",
"tradeType": "live",
"status": "EXECUTED"
}
Example Implementations
Here are examples of how to connect to the AlgoMesh engine in various languages.
import asyncio import websockets import jsonasync function listen_to_algomesh(): uri = "ws://localhost:52000/connect" print(f"Connecting to AlgoMesh Engine at {uri}")
async with websockets.connect(uri) as websocket: print("Connected! Listening for strategy signals...") while True: try: response = await websocket.recv() payload = json.loads(response) if payload.get("type") == "STRATEGY_SIGNAL": print(f"[{payload['action']}] {payload['symbol']} | " f"Price: {payload['price']} | " f"Qty: {payload['amount']} | " f"Strategy: {payload['strategyName']}") except websockets.ConnectionClosed: print("Connection to AlgoMesh was closed.") break
asyncio.run(listen_to_algomesh())