Hello,
I'm trying to work out how i return the average price based on volume and buy order.
1. I want to buy 1 bitcoin
2. Add each of the volume to get 1 bitcoin
3. Return average price based on the volume up to 1
Expected result based on the data example beloq: If I buy 1 Bitcoin, I would need to buy from 3 different places in the order book in the volume column (0.42, 0.18 and reminder from the 18.7). So therefore, the average price would be 8944.90.
What formula can I use to calculate this based on me changing my buy order? E.g The same as above but for 2 Bitcoin.
Thanks in advance.
Data example
Buy order: 1 Bitcoin
Price Volume (Bitcoin)
8944.8 0.426146
8944.91 0.187818
8945 18.741518
8945.33 0.05
8946 1
8946.96 0.001644
8948 4.773755
8948.15 0.01242
8948.33 0.018924
Bookmarks