Discussing the article: "Zero-Copy Tick Streaming (Part 2) : Reading MetaTrader 5 Ticks into Python and Benchmarking the Result"
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Check out the new article: Zero-Copy Tick Streaming (Part 2) : Reading MetaTrader 5 Ticks into Python and Benchmarking the Result.
Moving live tick data from MetaTrader 5 into Python without unnecessary copying or per-tick object creation requires more than shared memory. The Python reader must interpret the existing memory layout correctly, access it safely while MetaTrader 5 continues writing, and expose the data in a form that analytical libraries can use directly.
Part 1 of this series built the MetaTrader 5 half of that bridge: an Expert Advisor that writes live ticks directly into shared memory using Apache Arrow's columnar physical layout. A lock-free seqlock protects the data so that a fast writer and a slower reader can operate without exposing inconsistent snapshots. This implementation was verified independently using a diagnostic script that wrote real tick history through the bridge and printed the resulting values. The Python reader, however, had not yet been implemented.
This article completes the Python side. We reconstruct the actual ArrowArray and ArrowSchema C structures from the Apache Arrow specification using ctypes, point their buffer fields directly to offsets within a memory-mapped file, and pass them to pyarrow. The result is a RecordBatch created without copying, parsing, or boxing individual tick values into Python objects. We then verify the performance advantage with a self-contained, runnable benchmark that compares zero-copy import against a conventional struct.unpack loop across increasing batch sizes.
Author: Adedayo David Gbadebo