Python ctypes binding for the Orderflow C API
Project description
Orderflow Python Binding (orderflow-gregorian09)
Production-oriented Python wrapper over the stable Orderflow C ABI (of_ffi_c)
for orderflow analytics, signal generation, and health-aware ingestion pipelines.
System View
What You Get
- Runtime lifecycle control (
start,stop, context-managerwith Engine(...)) - Symbol stream subscriptions with optional callback listeners
- Poll-based processing plus push-style external ingest (
ingest_trade,ingest_book) - Snapshot retrieval (
book,analytics,signal,metrics) - External feed supervision (
stale,sequence,reconnect) via health APIs
Install
pip install orderflow-gregorian09
The Python wheel wraps the C ABI; it expects a compatible libof_ffi_c shared
library at runtime.
Native Library Resolution
Lookup order:
- Explicit
library_path=argument onEngine(...) ORDERFLOW_LIBRARY_PATHenvironment variable- Local debug build default (
target/debug/libof_ffi_c.*)
export ORDERFLOW_LIBRARY_PATH=/absolute/path/to/libof_ffi_c.so
Minimal Usage
from orderflow import DataQualityFlags, Engine, EngineConfig, Symbol, StreamKind
with Engine(EngineConfig(instance_id="py-client")) as eng:
sym = Symbol("CME", "ESM6", depth_levels=10)
eng.subscribe(sym, StreamKind.ANALYTICS)
eng.poll_once(DataQualityFlags.NONE)
print("analytics", eng.analytics_snapshot(sym))
print("metrics", eng.metrics_json())
External Feed Ingest Workflow
from orderflow import (
BookAction,
DataQualityFlags,
Engine,
EngineConfig,
ExternalFeedPolicy,
Side,
Symbol,
StreamKind,
)
sym = Symbol("CME", "ESM6", depth_levels=10)
with Engine(EngineConfig(instance_id="ext-feed")) as eng:
eng.subscribe(sym, StreamKind.HEALTH, callback=lambda ev: print("health", ev))
eng.configure_external_feed(
ExternalFeedPolicy(stale_after_ms=2_000, enforce_sequence=True)
)
eng.ingest_book(
sym, side=Side.BID, level=0, price=504900, size=20, action=BookAction.UPSERT
)
eng.ingest_trade(sym, price=505000, size=7, aggressor_side=Side.ASK)
eng.poll_once(DataQualityFlags.NONE)
print("signal", eng.signal_snapshot(sym))
API Surface
Engine: lifecycle, subscribe/unsubscribe, poll, ingest, snapshotsEngineConfig: runtime, persistence, audit, and retention settingsSymbol: venue + symbol + depth descriptorExternalFeedPolicy: stale and sequence policy for external data- constants:
StreamKind,Side,BookAction,DataQualityFlags
Operations Notes
subscribe(..., callback=None)is supported for polling-only flows.StreamKind.HEALTHemits transition-oriented health payloads.reset_symbol_session(symbol)clears per-session analytics/profile state.external_health_tick()re-evaluates stale/degraded status without ingest.
Learn More
- Handbook: https://github.com/gregorian-09/orderflow/tree/main/docs/handbook
- API reference: https://github.com/gregorian-09/orderflow/tree/main/docs/api
- Binding docs: https://github.com/gregorian-09/orderflow/tree/main/docs/bindings
- Changelog: https://github.com/gregorian-09/orderflow/blob/main/CHANGELOG.md
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file orderflow_gregorian09-0.1.4.tar.gz.
File metadata
- Download URL: orderflow_gregorian09-0.1.4.tar.gz
- Upload date:
- Size: 10.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d35edd47c4d7c639cd6c50b79de8e09ddd18c154330eaedaa333571760cc60d
|
|
| MD5 |
e611eff1c3f90f3892fe76c2bcb49d09
|
|
| BLAKE2b-256 |
f6799a1debac72c7f11c7677e0791771c45f3e068b08071b24a402c66fbd3cf6
|
File details
Details for the file orderflow_gregorian09-0.1.4-py3-none-any.whl.
File metadata
- Download URL: orderflow_gregorian09-0.1.4-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
abab16a9bd09abbacfe2e1d7f139079bfbde1c15662e5355b8c50e6d435ef6ab
|
|
| MD5 |
99b2515a6b6eeed60c064d35dc82b8ce
|
|
| BLAKE2b-256 |
23b65a3433e5f6e46a9ad361cb06fea9a45ece1bc779d6486ba1d6ff6339e508
|