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 823 forks source link

quoting seems odd #41

Closed teddytomas closed 7 years ago

teddytomas commented 7 years ago

Hi,

I've finally resolved my local issues and am trading. I'm noticing a few things and not sure if its expected or not. One thing right now: the fair value is displayed as 2611.9 (BBO). My width is 0.9. However the bid is posted at 2610 not 2611. Attached is screenshot. If 0.9 is pct then it should be 0.009*2611.9 = 23.5, which is even further away.

image

Also, I was going to do some analysis of market data vs where quotes were placed, check latency, analyse profits on trades etc. Is there a report already built ? If not I will start investigating it.

cheers

Camille92 commented 7 years ago

Hi @applett ,

As you did not check %w? 0.9 is not in percentage.

You're using Mid so it should be -> "Mid - Set our bid quote at FV - width / 2 and ask quote at FV + width / 2". https://github.com/ctubio/Krypto-trading-bot/blob/master/MANUAL.md So it should be around 2611.45.

However, as you're using bw? K tries not to let hollows in the book so it should have been at 2611.1 or 2611. (Above or equal to best order after 2611.45.)

So I see 2 possible explanation: Either, 2611.0 order just arrive in the market and K did not have time to adjust. Either, there is indeed an error somewhere.

Is that happening often?

teddytomas commented 7 years ago

Hi, the quote is rarely exactly FV +/- width, even with the bw? off. It could be gui synchronization I guess.

How quickly is the FV recalculated ? it looks like it is every price tick from the quoting-engine code. Does that also trigger K's quotes to re-publish every tick ?

Reason I'm asking is that I've seen the gui refresh the FV, but not the quote for several intervals and I'm wondering if there is some kind of throttle on the quote publishing.

Camille92 commented 7 years ago

Oh yes you have a "Delay UI" of 5 seconds, meaning the UI is updated only every 5 seconds.

Try to put 0 and see if the problem persists.

FV is recalculated instantly so about the time for your server to get market data and you can manage them, under 1ms when you get market data.

For the quote it should be as fast (but with a little bit more calculation) and you have the limit by the API + the exchange + distance (You can't just send new order every 0.5 ms haha when your ping is 50ms).

teddytomas commented 7 years ago

Thanks camille,

I had realized about the gui timer being non zero - however when I notice it is when persists after many refreshes (it could still be a display issue I guess). Its not too frequent.

I'm running the server on ec2, with gui local - setting to 0 for any period of time may max out the server! The orders stop cancelling when you click the stop button.

Anyway, its not the biggest problem I'm facing right now. I'm still trying to get it to trade profitably! do you have any settings you prefer ?

Cheers

On 4 July 2017 at 15:05, Camille92 notifications@github.com wrote:

Oh yes you have a "Delay UI" of 5 seconds, meaning the UI is updated only every 5 seconds.

Try to put 0 and see if the problem persists.

FV is recalculated instantly so about the time for your server to get market data and you can manage them, under 1ms when you get market data.

For the quote it should be as fast (but with a little bit more calculation) and you have the limit by the API + the exchange + distance (You can't just send new order every 0.5 ms haha when your ping is 50ms).

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ctubio/Krypto-trading-bot/issues/41#issuecomment-312886598, or mute the thread https://github.com/notifications/unsubscribe-auth/ABUyxCIu4ithkzTnFEg9aWhHQ4l473YOks5sKka3gaJpZM4ONDS9 .

Camille92 commented 7 years ago

Hi well, maybe @ctubio will have a look at that.

Setting 0 for looking at the bot 5/10 minute should not be an issue ;).

Concerning profitability: I go for top, PingPong, Boomerang or Ak-47.

Regarding your settings, I recommend you to use stdev with BB ( a Cool feature I proposed and Carles implemented :) ) and maybe reduce the number of trade per second.

And finally, use ewma classic or 3 ewma for defining TBP because the market is very volatile. It's important to ride the market at the same time as doing market making.

Best,

teddytomas commented 7 years ago

Regarding market making and Ewma, I was trying to do more standard risk neutral market making (I would prefer 0 tbp...) and just earn spread. But like you say market moves are too big. You cannot have a 0 position and go short, so I guess stuck with riding the market as you say.

Thanks for the tips. I'll give them a go... but it feels a bit like position based trading rather than market making! :-)

Cheers

On 4 Jul 2017 15:57, "Camille92" notifications@github.com wrote:

Hi well, maybe @ctubio https://github.com/ctubio will have a look at that.

Setting 0 for looking at the bot 5/10 minute should not be an issue ;).

Concerning profitability: I go for top, PingPong, Boomerang or Ak-47.

Regarding your settings, I recommend you to use stdev with BB ( a Cool feature I proposed and Carles implemented :) ) and maybe reduce the number of trade per second.

And finally, use ewma classic or 3 ewma for defining TBP because the market is very volatile. It's important to ride the market at the same time as doing market making.

Best,

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ctubio/Krypto-trading-bot/issues/41#issuecomment-312898395, or mute the thread https://github.com/notifications/unsubscribe-auth/ABUyxO0FWNKrlmlFTy7M4JT6_uthinj-ks5sKlLAgaJpZM4ONDS9 .

Camille92 commented 7 years ago

Yes for sure, this bot is not ONLY a market maker bot.

If you read the main theories on market making you earn by selling to the uninformed traders (the ones that are wrong about where the market will go) and lose by selling to the informed traders.

And there are mathematically more informed traders than uninformed so you're always going to fight those informed traders that find in you a good exit.

Having a strategy to estimate where the market is going is necessary for consistent results. Or if you're stack is small enough (as it seems) trying to be more "hardcore" in your market making settings.

IE: selling 40,50 or even 100% at a time and hoping that you'll match uninformed traders quicker than informed traders make the market move.

You call also try a strategy with the BB and a high number (1200 periods and factor 1.5-2.2), and 5/10% of the stack. That should let you ride the short waves that happen all the time in the market. (I haven't tried it).

ctubio commented 7 years ago

awesome infos Camille'¡ many thanks for sharing :dancer:

@applett sorry i see all is answered by now? or do you still have any technical question? (the app is still under development so feel free to report any issue that you consider important to be changed/resolved) thanks'¡

Camille92 commented 7 years ago

Oh, I just thought about that @applett you should be careful about your width setting.

Given the number of BTC I see in your screenshot and the time you've been using K, I assume you still pay high maker fees at Bitfinex like 0.1 or 0.08. If I'm right and it's the case you should NOT have such a small width setting because you're going to lose money on every trade.

You should look for making at least 2X the maker fees you're paying to make a profit!! So with current market price, you need to have a minimum of $5-6 between your buying and selling price.

Everything above 5.2 is going to be a profit for you and everything under is a loss (assuming you pay the 0.1% fee)!

It's a pain in the ass to build up your volume at Bitfinex, you have to pay a total of $2000 in fees before having the 0% maker fees, but after it's paradise. :)

teddytomas commented 7 years ago

Hi,

I have more questions, but will try and find the answers myself.

Many thanks for the info, and for developing the app!

cheers

On 4 July 2017 at 18:13, Carles Tubio notifications@github.com wrote:

awesome infos Camille'¡ many thanks for sharing 💃

@applett https://github.com/applett sorry i see all is answered by now? or do you still have any technical question? (the app is still under development so feel free to report any issue that you consider important to be changed/resolved) thanks'¡

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ctubio/Krypto-trading-bot/issues/41#issuecomment-312921643, or mute the thread https://github.com/notifications/unsubscribe-auth/ABUyxBnewwNsGBTTK6s8bCF5JHYyyiIwks5sKnKmgaJpZM4ONDS9 .

teddytomas commented 7 years ago

just seen the comment about fees. Yeah, I've been aware of that, but had my facts wrong. I thought you got maker fees by posting outside the bbo. WIll have to do some more research because that is a killer for how I want to do it!