async-execution-da
Async execution layer for futures trading, built on top of a broker-provided Python SDK.
This project provides an async-first, production-oriented wrapper around a proprietary futures trading API, focusing on order execution, account queries, and event-driven workflows.
🚦 Project Status
- Status: Active development
- Stability: Used in live / paper trading environments by the author
- Python: 3.10 (tested)
- License: MIT
✨ What This Project Is
async-execution-da is an asynchronous execution layer designed for:
- Futures / derivatives trading systems
- Quantitative trading infrastructure
- Event-driven execution engines
- Developers who need non-blocking broker interactions
It wraps a broker-provided synchronous SDK and adds:
- Async connection & login flows
- Deterministic account mapping
- Structured capital queries
- Robust order helpers (market / limit / stop)
- Local
OrderBookfor order ID reconciliation - Async event queue for broker callbacks
🚫 What This Project Is NOT
- ❌ A trading strategy or signal generator
- ❌ A backtesting framework
- ❌ A broker SDK
- ❌ A replacement for risk management
This project focuses strictly on execution and broker interaction.
⚠️ Important Notice (Proprietary Dependency)
This project does NOT include or redistribute any proprietary broker SDKs.
You must obtain and install the broker-provided Python package (pyda) separately.
Reasons:
- The broker SDK is not open-source
- It is not published on PyPI
- Redistribution may violate broker licensing terms
This repository only contains original open-source code written by the author.
📦 Requirements
-
Python 3.10+ (3.11 not yet supported)
-
Broker SDK providing:
pyda.apipyda.api.td_constant
ℹ️ If
pydais not installed, importing execution APIs will raise a clearImportErrorexplaining the missing dependency.
📥 Installation
Option 1: Editable install (recommended for development)
pip install -e .
Option 2: Install directly from GitHub
pip install git+https://github.com/Reece-Lu/async-execution-da.git
⚠️ Ensure the broker SDK is installed before running the code.
🚀 Quickstart
import asyncio
from async_execution_da.api_layer.future_api import EnhancedFutureApi
async def main():
api = EnhancedFutureApi(
userid="YOUR_USER",
password="YOUR_PASS",
author_code="YOUR_AUTH",
computer_name="M3Server",
software_name="M3Algo",
software_version="1.0",
tag50="TAG",
address="HOST:PORT",
heartbeat=180,
symbol="ES2603",
exchange="CME",
)
await api.connect_and_login_with_accounts()
account_no = api.getAccountNo("USD")
print("Account No:", account_no)
usd_info = await api.query_account("USD")
if usd_info:
print("Available Funds:", usd_info.TodayTradableFund)
asyncio.run(main())
🧩 Core Usage
Connect & Login
await api.connect_and_login_with_accounts()
Query Account / Capital
usd_info = await api.query_account("USD")
if usd_info:
print(usd_info.FundAccountNo, usd_info.TodayRealtimeBalance)
Place Orders
Limit Order
result = await api.limit_order(
local_no="11080745123456_entry",
side="buy",
price=4510.25,
volume=2,
)
Market Order
result = await api.market_order(
local_no="11080745123456_market",
side="sell",
volume=2,
)
Stop-Limit Order
result = await api.stop_limit_order(
local_no="11080745123456_stoplimit",
side="buy",
trigger_price=4500.0,
price=4501.0,
volume=2,
)
Stop-Market Order
result = await api.stop_market_order(
local_no="11080745123456_stopmarket",
side="sell",
trigger_price=4515.0,
volume=2,
)
Query & Manage Orders
orders = await api.query_order()
active = await api.query_active_orders()
Cancel Orders
await api.cancel_order_async("LOCAL_NO")
await api.cancel_all_active("USD")
Modify Orders
await api.modify_order_async(
local_id="LOCAL_NO",
side="buy",
new_volume=3,
orig_volume=2,
order_type=4,
new_trigger_price=5805.25,
orig_trigger_price=5900.25,
)
Close Open Positions
await api.check_and_close_positions()
📡 Events & Callbacks
Broker callbacks are converted into async events and published to event_queue.
async def event_listener(api):
while True:
evt = await api.event_queue.get()
print("EVENT:", evt)
This allows non-blocking, event-driven execution logic.
📘 OrderBook
OrderBook maintains a local mapping between:
local_nosystem_noorder_no
This is critical for:
- Reliable order cancellation
- Order state reconciliation
- Handling async broker callbacks
🗺️ Roadmap
- Better type hints and dataclasses
- Explicit order state machine
- Retry & reconnect policies
- Structured logging hooks
- Unit tests with mocked broker SDK
⚖️ License
MIT License
⚠️ Disclaimer
This project is an independent open-source wrapper.
It is not affiliated with, endorsed by, or supported by any broker or trading venue.
All proprietary SDKs, APIs, and trademarks remain the property of their respective owners.
Metadata
Release files for async-execution-da 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| async_execution_da-0.1.0.tar.gz | 22.1 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| async_execution_da-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 44.8 kB
Release files / async_execution_da-0.1.0.tar.gz
| Download URL | async_execution_da-0.1.0.tar.gz |
|---|---|
| Size | 22.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0dbf0a9f6d8cef36bdd341f572d21cfa169142310cd45d05e87f3d4b75164df6
|
|
BLAKE2b-256 checksum How to use checksums |
88a919e9207d0312f5ea6de766c1419001f20e9680c644f7501f4477b9550dfb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 8, 2026.
Transparency logRelease files / async_execution_da-0.1.0-py3-none-any.whl
| Download URL | async_execution_da-0.1.0-py3-none-any.whl |
|---|---|
| Size | 22.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
da17bf1026be96f55dc34d4cefff49005fe03888a2ed6d2b1d2a7f0e2e885059
|
|
BLAKE2b-256 checksum How to use checksums |
2fd1f405b2084f6c145a0c55dc02f1b6fd40d3a3121d252cb6c64160d21e9958
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 8, 2026.
Transparency logSecurity for async-execution-da 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for async_execution_da-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 8, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.