chezFIX Documentation - Limni Trading

chezFIX Documentation

chezFIX is a WebSocket-based FIX trading API service that provides automated logon and buy-side trading capabilities for equities and options.

Key Features: Real-time order management, comprehensive security, rate limiting, and support for both equities and options trading.
Important: Always verify the supported FIX tags and values with your counterparty broker or exchange.

Quick Start

WebSocket Connection

Connect to chezFIX using WebSocket protocol for real-time trading.

Basic WebSocket Connection
Minimal standalone chezFIX WebSocket connection example
import asyncio
import websockets
import json

async def main():
    url = "wss://simulator.chezfix.limnitrading.com/v1/ws"
    async with websockets.connect(url) as ws:
        # Send a status request
        status_request = {
            "MsgType": "UF",
            "UserRequestType": "1",
            "Username": "YOUR_API_KEY",
            "UserStatus": "1",
            "Text": "Status request"
        }
        await ws.send(json.dumps(status_request))
        print("Status request sent.")

        # Receive and print one message
        response = await ws.recv()
        print("Received:", response)

if __name__ == "__main__":
    asyncio.run(main())

Authentication

Authenticate with chezFIX using your API key via FIX Logon message.

Authentication with API Key
Authenticate using FIX Logon message with your API key
import asyncio
import websockets
import json

async def main():
    url = "wss://simulator.chezfix.limnitrading.com/v1/ws"
    async with websockets.connect(url) as ws:
        # Authenticate with API key
        logon_message = {
            "MsgType": "A",  # Logon
            "Username": "your_client_id",
            "Password": "your_api_key",
            "HeartBtInt": "30",
            "ResetSeqNumFlag": "Y"
        }
        await ws.send(json.dumps(logon_message))
        
        # Receive authentication response
        response = await ws.recv()
        print("Authentication response:", response)
        
        # Now you can send trading messages
        order = {
            "MsgType": "D",
            "ClOrdID": "ORDER_123",
            "Symbol": "AAPL",
            "Side": "1",
            "OrderQty": 100,
            "OrdType": "2",
            "Price": 150.00,
            "TimeInForce": "0"
        }
        await ws.send(json.dumps(order))
        
        # Receive order response
        response = await ws.recv()
        print("Order response:", response)

if __name__ == "__main__":
    asyncio.run(main())

Order Management

Send and manage trading orders through the WebSocket API.

New Order Single
Send a new limit order for equities
import asyncio
import websockets
import json
from datetime import datetime

async def main():
    url = "wss://simulator.chezfix.limnitrading.com/v1/ws"
    async with websockets.connect(url) as ws:
        # Authenticate first
        logon_message = {
            "MsgType": "A",
            "Username": "your_client_id",
            "Password": "your_api_key",
            "HeartBtInt": "30",
            "ResetSeqNumFlag": "Y"
        }
        await ws.send(json.dumps(logon_message))
        await ws.recv()  # Wait for logon response
        
        # Send new order
        cl_ord_id = f"ORDER_{int(datetime.utcnow().timestamp())}"
        order = {
            "MsgType": "D",  # New Order Single
            "ClOrdID": cl_ord_id,
            "Symbol": "AAPL",
            "Side": "1",  # 1=Buy
            "OrderQty": 100,
            "OrdType": "2",  # 2=Limit
            "TimeInForce": "0",  # 0=Day
            "Price": 150.00,
            "TransactTime": datetime.utcnow().isoformat(),
            "ExDestination": "NASDAQ"
        }
        await ws.send(json.dumps(order))
        print("Order sent:", order)
        
        response = await ws.recv()
        print("Received:", response)

if __name__ == "__main__":
    asyncio.run(main())

Message Types

New Order Single (D)

Send new trading orders for equities and options.

Equities Order
Market order for equities
{
  "MsgType": "D",
  "ClOrdID": "ORDER_1234567890",
  "Symbol": "AAPL",
  "Side": "1",
  "OrderQty": 100,
  "OrdType": "1",
  "TimeInForce": "0",
  "TransactTime": "2024-03-20T10:00:00.000Z"
}
Options Order (Pro Tier)
Call option order
{
  "MsgType": "D",
  "ClOrdID": "OPTION_1234567890",
  "Symbol": "AAPL",
  "SecurityType": "OPT",
  "MaturityDate": "20241220",
  "StrikePrice": "150.00",
  "PutOrCall": "1",
  "ContractMultiplier": "100",
  "Side": "1",
  "OrderQty": 10,
  "OrdType": "2",
  "Price": "5.50",
  "TimeInForce": "0",
  "TransactTime": "2024-03-20T10:00:00.000Z"
}

Order Cancel Request (F)

Cancel existing orders.

Cancel Order
Cancel an existing order
{
  "MsgType": "F",
  "ClOrdID": "CANCEL_1234567890",
  "OrigClOrdID": "ORDER_1234567890",
  "Symbol": "AAPL",
  "Side": "1",
  "TransactTime": "2024-03-20T10:00:00.000Z"
}

Order Cancel/Replace Request (G)

Modify existing orders.

Replace Order
Modify an existing order
{
  "MsgType": "G",
  "ClOrdID": "REPLACE_1234567890",
  "OrigClOrdID": "ORDER_1234567890",
  "Symbol": "AAPL",
  "Side": "1",
  "OrderQty": 200,
  "Price": 151.00,
  "OrdType": "2",
  "TimeInForce": "0",
  "TransactTime": "2024-03-20T10:00:00.000Z"
}

Execution Report (8)

Receive execution confirmations and status updates.

Fill Response
Complete fill execution report
{
  "MsgType": "8",
  "ClOrdID": "ORDER_1234567890",
  "OrderID": "ORDER_1234567890",
  "ExecID": "EXEC_1234567890",
  "ExecType": "F",
  "OrdStatus": "2",
  "Symbol": "AAPL",
  "Side": "1",
  "LastShares": "100",
  "LastPx": "150.00",
  "CumQty": "100",
  "LeavesQty": "0",
  "AvgPx": "150.00",
  "TransactTime": "2024-03-20T10:00:01.000Z"
}

Security & Rate Limiting

Rate Limiting

chezFIX implements tier-based rate limiting to ensure fair usage and prevent abuse.

Rate Limit Handling
Handle rate limit responses gracefully
import asyncio
import websockets
import json
import time

async def main():
    url = "wss://simulator.chezfix.limnitrading.com/v1/ws"
    async with websockets.connect(url) as ws:
        # Authenticate first
        logon_message = {
            "MsgType": "A",
            "Username": "your_client_id",
            "Password": "your_api_key",
            "HeartBtInt": "30",
            "ResetSeqNumFlag": "Y"
        }
        await ws.send(json.dumps(logon_message))
        await ws.recv()  # Wait for logon response
        
        # Send multiple orders with rate limit handling
        for i in range(15):
            order = {
                "MsgType": "D",
                "ClOrdID": f"ORDER_{i}",
                "Symbol": "AAPL",
                "Side": "1",
                "OrderQty": 10,
                "OrdType": "2",
                "Price": 150.00,
                "TimeInForce": "0"
            }
            await ws.send(json.dumps(order))
            
            response = await ws.recv()
            response_data = json.loads(response)
            
            if response_data.get("Text") == "Rate limit exceeded":
                print(f"Rate limit hit after {i+1} messages")
                # Wait before retrying
                await asyncio.sleep(1)
            else:
                print(f"Order {i+1} processed successfully")
            
            # Small delay to avoid hitting rate limits
            await asyncio.sleep(0.1)

if __name__ == "__main__":
    asyncio.run(main())

Permissions

chezFIX uses granular permission control based on security types and client tiers.

Permission Description Required Tier
equities Stock trading Demo
options Options trading Pro
futures Futures trading Enterprise

Pricing Tiers

Choose the right plan for your trading needs.

Demo

Free
  • 10 messages/second
  • 3 concurrent connections
  • Equities only
  • Basic support

Enterprise

Custom
  • 1000+ messages/second
  • 50+ concurrent connections
  • All security types
  • Dedicated support

Support

Get help with chezFIX integration and usage.

Contact Information