For those of you in the trenches, I offer ye this tool ⚔️
This is a plotting tool designed to help visualize financial market data 📈 and trading system behavior 🤖 on the smallest timescales 🔎.
As all things in life, when it comes to financial microstructure: the devil 😈 is in the details
Built using Chaco 🌮
See the illustrated example for a deep dive into what this plotting tool can uncover 🔎.
⚠️ Disclaimer- ✨Features
- 🧠Illustrated Example
- 🧪Test It Out Right Now
- 🗺️Plots Legend
- 💸Free Advice
- ✏️Data Schema
- 🤔What is "Market Microstructure"?
- 🛞Installation
- 📜Reqs
- 𓊍To Do
- Citation
- License
There is no α here. This is just a fancy wrapper on top of an open-source plotting package.
You should B.Y.O.A (Bring Your Own Alpha).
However...for the trained eye 👁️, this simple type of visualization can be immensely helpful.
Here are some useful features to take note of 🥁:
- ✨Plot multiple 🤹, asynchronous (unsampled) microstructure elements together on the sample plot: order book quotes, trades, orders, order acks, fills etc etc
- ✨Analyze events on seconds, milliseconds, microseconds, nanoseconds 🕳️ : zoom 🔎 in on the most granular time unit available to microstructure behavior
- ✨All axes are 🔗linked : 🔎 zoom in on one product, see what's happening in all others at that same timestamp
To show why a tool like this might be useful, here is an example motivated from things seen in the wild.
Note: This data was painstakingly created by hand 🤌 to appear quasi-realistic. I am not an artist 🧑🎨 nor is this real 🌎 data.
See the legend 👇 to understand the plots further.
After installing the package either via pip or via setup.py, run this quick line to see this in action right now:
bash examples/example_1/plot_example.sh
or
python examples/example_1/plot_example.py
Right-click 🖱️ to zoom in on different parts of the plot to see what is happening on smaller and smaller timescales 🔎. Consult the legend or illustrated example for more clarity on how to interpret the plots.
Here is a complete legend of everything the plotter can visualize.
- Don't log in prod ✏️ (unless logging isn't occuring on the hot path).
- Make sure the timestamps are from ⏰ synchronized clocks ⏰ (better if geosync'd/GPS) with enough precision, otherwise these plots will be uninformative or misleading. If you don't trust others' timestamps, do your own capture.
- This plotter is memory intensive 🧠. Don't try to plot too much at once.
This plotting module expects a specific data schema.
For the uninitiated, here is a ⏰ 30 second primer ⏰ on market microstructure.
You can install the repo using pip directly:
pip install git+https://github.com/will-thompson-k/microstructure-plotter
Alternatively you can use the setup.py.
Python 3.7+ recommended.
Here are the package requirements (found in requirements.txt)
- chaco==5.1.0
- enable==5.3.1
- traits==6.4.1
- traitsui==7.4.2
- pandas==1.3.5
- pyqt
- add more order types: modifies, equity order types, etc.
- add "decision boundary" of model: bid/ask edges, etc.
- unit tests
@misc{microstructure-plotter,
author = {Thompson, Will},
url = {https://github.com/will-thompson-k/microstructure-plotter},
year = {2023}
}
MIT