API Documentation
Connect to Paper Broker using the Python API client and trade via the FIX 4.4 protocol
Downloads
Download the Python client package and example scripts to get started quickly.
FIX Protocol Connection
Paper Broker uses QuickFIX with the FIX 4.4 protocol standard for reliable, low-latency trading connections. FIX (Financial Information eXchange) is the industry-standard messaging protocol used by financial institutions worldwide.
What is FIX 4.4?
FIX 4.4 is a widely adopted version of the FIX protocol that provides:
- Standardized messaging for order entry, execution reports, and market data
- Session management with logon, logout, and heartbeat mechanisms
- Message validation and error handling
- High reliability with message sequencing and recovery
- Flexibility to support various order types and trading scenarios
We strongly encourage you to read the official FIX 4.4 specification to understand the protocol in depth. This will help you use the API more effectively and troubleshoot any issues.
Python API Client
The PaperBrokerClient provides an event-based interface to interact with the Paper Broker system.
It handles FIX session management, order placement, and market data subscription.
Installation
pip install paperbroker_client-0.2.1-py3-none-any.whl
Quick Start
# Create client with connection parameters
client = PaperBrokerClient(
default_sub_account="D1",
username="your_username",
password="your_password",
rest_base_url="http://localhost:9090",
socket_connect_host="localhost",
socket_connect_port=5001,
sender_comp_id="your-FIX",
target_comp_id="SERVER",
)
# Subscribe to events
client.on("fix:logon", lambda session_id, **kw: print(f"✅ Logged in: {session_id}"))
# Connect to FIX server
client.connect()
# Wait for logon
if client.wait_until_logged_on(timeout=10):
# Get account info
cash = client.get_cash_balance()
print(f"💰 Available: {cash.get('remainCash', 0):,.0f} VND")
Examples
Download and explore these examples to learn how to use the Paper Broker API:
Additional Resources
Explore these resources to learn more about FIX protocol:
- FIX 4.4 Official Dictionary - Complete message and field reference
- FIX Trading Community - Official FIX protocol organization
- QuickFIX Engine - Open-source FIX engine documentation