pmaji / crypto-whale-watching-app

Python Dash app that tracks whale activity in cryptocurrency markets.
MIT License
605 stars 137 forks source link

Order Book chart #20

Closed theimo1221 closed 6 years ago

theimo1221 commented 6 years ago

Hello,

in my Opinion it would be nice to see the total size of order-book by a line in the background. Due to the fact, we already have the data, it would be little problematic.

I just have the problem I´m not familiar with Plotty....

Thanks and Greets

Theimo

Edit: Needed Tasks:

pmaji commented 6 years ago

Hey @theimo1221 ! First of all major props to you for the pull requests. I REALLY appreciate the work you've put in already. I'll review all of your PRs sometime tomorrow (I'm going to go crash now because in my timezone it is the middle of the night).

As to your question though, can you clarify what you mean exactly by order-book size? Are you talking about the present market price or the daily volume in orders, or something else entirely? Once I know what you mean I can look into solving it in the visualization.

Looking forward to working with you more in the future on this :)

theimo1221 commented 6 years ago

Thanks for quick reply, I really appreciate the concept and idea you have.

Mean something like this

Don´t know how to exactly call it^^

theimo1221 commented 6 years ago

Data sum up should be working. (#32) Will see results when plotty code is changed

pmaji commented 6 years ago

Ok @theimo1221, I think I understand kind of what you are going for here, but I want to be sure I understand. Are you thinking of showing the total volume in the same form as the screenshot you shared but just BEHIND the present bubble view, or are you just hoping to show the numbers?

I think I could pretty easily display the TOTAL volume (i.e. the daily volume shown on GDAX) and that won't add too much of a computation because it can be brought in using code similar to what I wrote below. I like that idea because then I could throw this onto the graph in a text object of sorts that tracks the daily volume in each chart. Let me know if that would fulfill what you were hoping for as well.

mp = public_client.get_product_ticker(product_id='ETH-USD') mp['volume']

theimo1221 commented 6 years ago

I´d imagine showing it behind the bubbles. And I don´t mean the daily or total volume. I just mean the sum of current OrderBook Volume from current Price to Current*(1+ Range) in some steps, as already written in #32.

Something with an tooltip like "To raise ETH-USD to 940$ you´d need to buy 1200 ETH")

theimo1221 commented 6 years ago

I mean the depth chart, as shown in helpfile now ;-)

pmaji commented 6 years ago

This visual here is actually more complicated than originally thought. Making note that the issue is not forgotten but will take some time to solve because stacking an area plot over the present scatter.go does not work as easily as I had hoped.

pmaji commented 6 years ago

Issue closed given that it has now been added to the Plotly code and integrated into the README. Could use a few more explanatory comments but it runs perfectly well.

theimo1221 commented 6 years ago

@pmaji you accidently closed the wrong issue

pmaji commented 6 years ago

We can keep this thread live for the exploration of the depth chart overlay idea. I'm still not certain as the simplicity of its integration (and I'm also not sure it will be visually seamless because the axes are inverted when compared to GDAX's and most depth-charts) but we can at least explore it.

mifunetoshiro commented 6 years ago

There is a depth chart on cryptowat.ch where the axes are the same: https://i.imgur.com/HfvqEFb.png

theimo1221 commented 6 years ago

Yes, I had seen quite some rotated once aswell.

Will work on this this maybe the next days

mifunetoshiro commented 6 years ago

Maybe instead of (trying to) overlaying it on/behind the Plotly graph, add the depth chart separately on the left or right side of it. It would look good I think.

pmaji commented 6 years ago

Good idea @mifunetoshiro ; agreed.

theimo1221 commented 6 years ago

I will try both ways but taking even more space away makes graph look less good

pmaji commented 6 years ago

I see what you're saying @theimo1221; any space we take away from the main plots is a pain, but I think given the present chart dimensions, the actual overlay of the depth chart will look VERY funky. I have a hunch that the best way to do it will be to include a small depth chart (maybe 1/5 the size of the main whale chart at most) to the left of the main view, and then just sync the axes, but feel free to try the overlay if you wish.

mifunetoshiro commented 6 years ago

I found this if it's helpful: https://www.amcharts.com/demos/live-order-book-depth-chart/

mifunetoshiro commented 6 years ago

Here's a simpler one in Plotly: https://plot.ly/%7Ebenaapp/23/limited-order-book/

pmaji commented 6 years ago

Thanks @mifunetoshiro ; I know the mechanics of the chart creation itself are quite easy, it's just a question of return on investment computationally. We would be adding to the number of calculations needed and expanding granularity as well. I'm testing variants of it locally, but so far nothing I am happy with as I don't find the gain of having it to outweigh the cumbersome nature of the addition presently. I'll keep looking into it.

mifunetoshiro commented 6 years ago

I see. I tried overlaying just the orders >= minVolume and it's pretty ugly: https://i.imgur.com/ErCU1TB.png

theimo1221 commented 6 years ago

image @mifunetoshiro please insert pictures directly and not over imgur I´ll give it a try aswell

theimo1221 commented 6 years ago

This is how my solution would look like with current axis: image

But just if you zoom out you can see it correctly:

image

In my opinion this is a good way to show how the overall influence of the whales are in comparision to total order book.

This is how my solution looks like with adjusted axis:

image

@pmaji The calculation of data points had already been in the code, and the amount of additional data is marginal.

mifunetoshiro commented 6 years ago

I really like your solution @theimo1221, good job. Would it be possible to add total price worth, e.g.: "1658.5 ETH (from 274 orders) down to 532.49$ worth 893,820.59$" or would that take too much computation?

theimo1221 commented 6 years ago

@mifunetoshiro Thanks! The cumulative cost is a little bit problematic.... I mean we have the total ETH but we can´t just take the price average, we would have to calculate it order by order wich takes really much computation... Personally I prefer not giving any number over giving a false number!

mifunetoshiro commented 6 years ago

Ah, I see. I implemented this for myself and it's not a problem because I only use 3 tickers, but when I tried with all 12, it didn't even load the plots. 8 plots was the limit for me xD