c9s / bbgo

The modern cryptocurrency trading bot framework written in Go.
https://bbgo.finance
GNU Affero General Public License v3.0
1.2k stars 291 forks source link

Trading non-USDT pairs. #298

Open arthurwolf opened 2 years ago

arthurwolf commented 2 years ago

What happens if I want to trade non-USDT pairs? Like, trading ETH-BTC for example?

The PNL report presumes we are trading USDT (or even just USD?) Reading the code, I can even see places where there are things that look like if ( [...] == "USDT" ) so no other possible pairing is possible apparently.

Is there some recommendation on how to handle trading non-USDT pairs?

Thanks!

tony1223 commented 2 years ago

I used it to trade with XRPBTC , it seems working , only seems weird in the report part.

zenixls2 commented 2 years ago

for stable coin pairs, should have no big influence.

arthurwolf commented 2 years ago

so, the big issue with grid trading, is if the asset/crypto increases in price (and over a year, it statistically tends to do that a lot historically), the grid will sell all of the crypto, and you end the week with USDT.

And so, if instead of grid trading, you had just bought/held the crypto, you would have made more profit.

One solution to this, is to trade crypto/crypto pairs, like ETH/BTC. This way, no matter what, at the end of the trading period, you have crypto, so if crypto "in general" increases, you are not missing out on that increase.

This way, grid trading is the same as holding BTC+ETH, except on top of that, you are making money using the grids.

The issue I'm meeting is, currently, the code is clearly presuming that one of the assets is USDT, if I try to run this using BTC-ETH (or some other pair), the PNL will be messed up.

Any chance this could get fixed?

have it consider we are trading two assets, and in the report, for everything, give the value in asset, and give the value in USDT? so if I trade BTC-ETH, in the PNL, it gives me the beginning value (in usdt) of both BTC and ETH, and the end value (in usdt) of both BTC and ETH?

And if the pair I'm trading happens to have USDT as one of the pair (like BTC-USDT), then it does the same thing, it just doesn't have to convert one of the pair into USDT as it's already USDT

c9s commented 2 years ago

Hi @arthurwolf @zenixls2 implemented the high precision, it's already in the main branch, you can check it out