askmike / gekko

A bitcoin trading bot written in node - https://gekko.wizb.it/
MIT License
10.06k stars 3.95k forks source link

Limit amount for Buying #484

Closed totomaze closed 5 years ago

totomaze commented 7 years ago

Hi, Is there any plugin to limit the buying order? Imagine I am trading 3 pairs (BTC/USDT, ETH/USDT, LTC/USDT), I would like to limit the amount when buying for each of this pairs in order to avoid putting all the amount available in one Asset.

Example I have 100 USDT and I would like to limit the amount for buying BTC to 45 USDT ETH to 30 USDT LTC to 25 USDT

An Idea a bit more complex will be to specify a percentage of the total value of the portfolio per pair Example: Percentage limit/pair BTC 45% ETH 30% LTC 25% Value Portfolio = 60+45+30 = 135USD portfolio composition : USD = 60 BTC=0.071428 @630USDT = 45 LTC=7.894736 @3.8 = 30 ETH=0

Limit USDT/pair after evaluation BTCE 60.75 ETH 40.5 LTC 33.75

If a trade to buy is triggered for ETH/USD the maximun amount to buy will be 40.5 USDT If a trade to buy is triggered for LTC/USD the maximun amount to buy will be 3.75 USDT If a trade to buy is triggered for BTC/USD the maximun amount to buy will be 0.75 USDT

Maybe it could be a new plugin limitTrader with the following parameter: // if maxMethod==currency, maxValue represent the amount in the currency // if maxMethod==portfolio, maxValue represent the percentage of the total value of the portfolio maxMethod : "currency"|"portfolio" maxValue : 45

Thanks for your work, gekko is a good piece of code, I will try to contribute if I find some free time!

askmike commented 7 years ago

I thought I responded here..

The thing about limited trading is that this can be very confusing and still dangerous: If you limit Gekko to trade with 1% of your 100BTC portfolio, and your strat advices poorly a few times an hour I'm pretty sure you'll drain your account by way more than 1% (by only doing trading 1% of the portfolio).

I'm looking over #450. Would that do what you want?

totomaze commented 7 years ago

Yeah the #450 could be the start of a solution. If we can have the choice of amount or percentage and have the choice to limit only sell or buy or both it will be a very good start

My idea was more for people using multiple pairs in order to prevent to have all the funds in one asset and miss the opportunity to buy another asset.

1% with a bad strategy is better than 100% with bad strategy. At least the loss is slower.

If I am right gekko never do an order twice in the same direction so that's a good point with this solution. (no BUY, BUY, SELL,BUY, SELL, SELL)

7flash commented 7 years ago

Can you explain why you decide don't do an order twice in the same direction? How about an "Martingale way"?

askmike commented 7 years ago

@7flash Martingale is a betting/gambling technique of reinvisting in case of losses. You cannot order twice in the same direction because:

If you start out with 100 USD and 0 BTC. At some point you buy BTC for all your 100 USD and you now have: 0 USD and 0.1 BTC. In no case does it ever make sense to buy again, because you have 0 USD (until you sell again that is).

greenbigfrog commented 6 years ago

@askmike can most likely be closed (duplicate of other issues)

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. If you feel this is very a important issue please reach out the maintainer of this project directly via e-mail: gekko at mvr dot me.