ctubio / Krypto-trading-bot

Self-hosted crypto trading bot (automated high frequency market making) written in C++
https://127.0.0.1:3000
Other
3.37k stars 824 forks source link

Option to include taker volume in quotes #937

Open nonkreon opened 5 years ago

nonkreon commented 5 years ago

Hiyaaa. I don't know if I'm the only one stupid enough to configure the bot to always sideline for the wild ride we been xperiencing over the last two months, but can we include the market taker order volumes in quoting? that way we can identify if a whale with insider trading ifo is pushing the price in a direction. So instead of just raw price, we can include how much trade actually took place at that price to see if it's a hollow or full trades?

ctubio commented 5 years ago

im not sure that i understand what you miss :S

in the UI, the most-right table of market taker trades, have the following columns time, price, qty, side; whew qty is the "volume" you are referring, nope?

maybe you are using a exchnage without data in this table? in what exchange are you having this issue¿ thanks''

nonkreon commented 5 years ago

hi carles, I was actually talking about the quoting engine, or the automatic position management engine. I was saying could we use anything other than ewma of closing price, something that includes the volume such as volume candles, to identify quick but steady changes in price caused by high volume takers from the market, like the ones we been experiencing since april 1st. instead of following steady trends the price just jumps in a few minutes and the current quoting mode cannot identify this and, say BTCUSD is 7800 and K gives orders to buy at 7200. I'm attaching a picture of the latest example we experienced a few hours ago. A war that lasted for half an hour broke out and the price was abruptly changed, then the whalebearpimps disappeared, In the current "EWMA" pricing model K cannot identify between these high volume jumps and the candles from periods during which market is steady without anybody actually buying or selling anything. image Like EWMA places more weight on the later candles, right? can we also have an option to place more weight on candles with high volume?

ctubio commented 5 years ago

morning nonkreon'¡ im not very inspired lately :P i will need to reread it a few more times (or or or to speedup things maybe please consider to include a detailed functional description for dummy programmers :D that never fails xD)

appreciate your patience'¡ hope i can understand soOn this new protection you mean

:koala: not inspired lately cos lately i have still the focus in the structure of the app, not in increasing the features of the quoting engine yet until the structure is lovely done (multi-exchange, single-UI, easy-extensible quoting engine iz the focuz now :S anyway this will take me long so adding a few features meanwhile should be doable if the features are clearly known in detail :D)

nonkreon commented 5 years ago

of course miamigo, I won't be mad because you put it off, this is your money making machine and I'm just giving you some ideas to improve it and not doing the hard work myself :smile: let's just discuss with everybody what would be a good approach for something like this when the time is right

the simplest way I can think of is the volume candle approach, instead of tracking the time we can track the amount traded. This is like bwSize but for executed orders: we make a quote engine where every price point corresponds to instead of 1 period, 1 BTC, so every time orders adding up to 1BTC is bought or sold in the market we take their weighted average by price paid and make a price point of it.

Let me give a exaggeratedly simple example, assume we set candle threshold to 1BTC whalebearpimps are sleeping: 00:00 some people market bought 0.1 BTC at 7900 00:01 some other people market bought 0.1 BTC at 7910 00:02 some other people market bought 0.1 BTC at 7920 ... 00:09 some other people bought 0.1 BTC at 7990 => Threshold achieved, get new price quote at 7900x0.1+7910x0.1+...+7990x0.1=7945 USD/BTC Note that this is independent of time, we only calculated one price quote for a 9 minute period. Now let's say whalebearpimps wake up at 00:10 00:10 one whalebearpimp market sold 1 BTC, 0.1 at 7990, 0.2 at 7980, 0.3 at 7970, 0.4 at 7960 => threshold achieved, get new price quote at 7990x0.1+7980x0.2+7970x0.3+7960x0.4= 7970 USD/BTC. Add to sequence of price quotes. 00:11 another whalebearpimp sold 1 BTC, 0.5 at 7950, 0.5 at 7940 => threshold achieved, get new price quote at 7950x0.5+7940x0.5= 7945 USD/BTC.

So you see, we have identified the jump in volume (2 data points in 2 minutes compared to 1 data point in the previous 9 minutes) and we identified the lack of volume in the bull trap setup as opposed to the rising price estimate we initially had with the current EWMA estimator.

what do y'all think?