I have market data of the orders describing the limit order book distribution at each time instant and I'd like to plot it like a kind of heatmap similar to the one of the BookMap Software. Currently my data are stored in a pandas dataframe like the following:
df.head()
date type price amount
0 1618417260072 b 0.144202 9.3675
1 1618417260072 b 0.144201 18.1250
2 1618417260072 b 0.143937 4.6692
3 1618417260072 b 0.143898 253.2957
4 1618417260072 b 0.143896 2607.5407
df.tail()
date type price amount
2793578 1618531145215 a 0.158781 5.9798
2793579 1618531145215 a 0.158782 28.8190
2793580 1618531145215 a 0.158795 4.6692
2793581 1618531145215 a 0.158938 3.9173
2793582 1618531145215 a 0.158950 2.4963
The dataframe is time-ordered, meaning I have the first timestamp with first the buy orders and secondly the sell orders with their respective price-level and amount, then I have the second timestamp with buy then sell and so on... To summarize the way I want it plotted is: x= time axis y= price axis z= volume axis (through heatmap or increasing width of the line meaning higher volume in order) and in this chart I'd like to see the information of each price level of the dataframe.