Krypto-trading-bot icon indicating copy to clipboard operation
Krypto-trading-bot copied to clipboard

Value Limit

Open CooleRnax opened this issue 5 years ago • 15 comments

Problem: Currently running multiple bots with different symbols on single account doesn't work correctly. Wallet-limit doesn't solve this problem so we need new limits.

This feature should allow to:

  • Limit max account value to BASE currency
  • Limit max account value to QUOTE currency

Ideally this features should be available from GUI without restarting the bot.

CooleRnax avatar Mar 18 '19 11:03 CooleRnax

:koala: so remove --wallet-limit argument and replace it by 2 new quoting parameters

ctubio avatar Mar 18 '19 12:03 ctubio

I can't believe I didn't see this issue. I've just implemented this for myself over the past two days. Work seems to be stable over today, but still testing to see if balance diverges from reality after lots of changes. I'll reopen PR.

EDIT: PR does not implement gui adjustment

xloem avatar Mar 30 '19 22:03 xloem

i just don't understand why is not working correctly currently

with a single param, if you have 6 BTC, and you are trading BTC/EUC, BTC/ETH and BTC/XRP, you can setup all 3 bots with --wallet-limit=2

in this case, each bot will be allowed to trade up to 2 BTC, that is, if price of BTC in EUR is 100, you may start with BTC=2 and EUR=0, and after a few trades end up with BTC=0 and EUR=200.

otherwise, if we have 2 param, i need to know the price of the BTC in EUR to set the --wallet-limit-quote, as well as the price of ETH and XRP.. and also that price to calculate the limit is not a fixed value, it changes over time.

soo, if you ask me, it makes more sense to just set --wallet-limit, to define your wallet capacity, than recalculating manually prices nonstop (that can be done by the app in realtime)

in other words, i dont think that is a good idea to define the wallet limit as X dollars and X houses and X cars and X televisions; i just wanna define it as X dollars because is called "base" currency for a reason (because is what your economy is based at, called also accounting currency or reporting currency; is the monetary unit used to report transactions/profit/losses/limits and any other financial statement).

anyway i try hard to understand your point of view :S please if you consider explain your problem with other words cos i already forgot what we talk on irc and here we only have "doesn't work correctly"

thanks for your time'¡!

ctubio avatar May 19 '19 00:05 ctubio

@ctubio My first idea was % based limit. This way manual adjustments over time are not needed. But unfortunately, you rejected it.

So I came up with not so elegant solution as base and quote limits. As periodic manual adjustments are needed I suggest gui variable.

The main thing here is that we are limiting VALUE, not just BASE currency. This way each bot behave as independent instance, this is very useful when you use % based settings in the bot.

When I trade for example BTC/USD LTC/USD ETH/USD, I value my account in USD, not ETH. So I take all USD split it by 3, and get 3 independent instance. That's why BASE limit is not good for my case.

CooleRnax avatar May 19 '19 00:05 CooleRnax

many thanks'' let me reread https://github.com/ctubio/Krypto-trading-bot/issues/883 to see if i can understand this "% based limit", otherwise will go for the 2 param solution

:koala: related PR at https://github.com/ctubio/Krypto-trading-bot/pull/913

ctubio avatar May 19 '19 02:05 ctubio

yea i think we will discard https://github.com/ctubio/Krypto-trading-bot/issues/883 cos not only needs to read all wallets from all currencies (a doable thing that requires 1 call in most exchanges) but also need to know the fair values of all currencies to know the total final amount where to apply the % for each wallet (that is, too many calls :S)

let me merge #913 with lil mods to allow editable limits from the UI instead of from params

hope you agree'¡

ctubio avatar May 19 '19 15:05 ctubio

@ctubio From my point of view it is not too hard to implement. You can use ccxt library, it has unified api calls across all exchanges. And every N minutes send 2 requests. Get balance - single request Get all tickers at once - single request Do some calculations That's it

CooleRnax avatar May 19 '19 15:05 CooleRnax

iSee, instead of fair values from market levels, just read the tickers xD ok letme rethink cos then we have again a single call :D

ctubio avatar May 19 '19 15:05 ctubio

@ctubio The only problem I see, if we will run a lot of bot from single ip or single api key, we might face api rate limiting if we call too often or at the same time. So we will need error handling and N minutes as adjustable variable to do less calls if needed.

CooleRnax avatar May 19 '19 15:05 CooleRnax

soo.. in the UI, you wanna have 1 more quoting parameter? named "wallet %" (or similar) on each bot?

and since all bots known the total funds, just apply the % value like a limit for that bot?

like if we have 10 BTC, and 100 EUR and 100 ETH, and tickers in both markets are 100, we have in total:

  • or 30 BTC
  • or 300 EUR . or 300 ETH

so for market BTC/EUR, if % is set to 33%, the max values could be:

  • or 10 BTC and 0 EUR; or 5 BTC and 50 EUR; or 0 BTC and 100 EUR

for market BTC/ETH, if % is set to 10%, the max values could be:

  • or 3 BTC and 0 EUR; or 1 BTC and 20 ETH; or 0 BTC and 30 ETH

with the consideration that the quote currency if possible cannot be limited, for example if we have again 10 BTC and 100 EUR and 100 ETH, if limit is 50%, we will have a wallet in BTC/EUR of 5 BTC and 100 EUR (cos what we attempt to reduce first is the base currency)

do you agree? or you were thinking in more than 1 new quoting parameter? (i hope not xD)

about api calls noworry cos we are already getting this data and ignoring it i think in most exchanges. otherwise i will test/fix or reconsider as always the deletion of dummy exchanges :D

ctubio avatar May 19 '19 15:05 ctubio

Everything seems fine! Single quoting parameter is even better, if you can handle everything under the hood.

CooleRnax avatar May 19 '19 15:05 CooleRnax

coOl'' :koala: many thanks for insist on this'' (i will use that feature sure :D hope for it soOn)

ctubio avatar May 19 '19 15:05 ctubio

@ctubio doing my best thanks for maintaining and developing such a great bot!

CooleRnax avatar May 19 '19 15:05 CooleRnax

btw if possible can you share what exhange/s are you using? i will try hard to not delete them xD

ctubio avatar May 19 '19 15:05 ctubio

@ctubio pmed you in irc

CooleRnax avatar May 19 '19 16:05 CooleRnax