BitBotFactory / MikaLendingBot

Automated lending on Cryptocurrency exchanges Poloniex and Bitfinex
http://poloniexlendingbot.readthedocs.io/en/latest/index.html
MIT License
1.11k stars 344 forks source link

Bot is lending out more than maxtolend #237

Open utdrmac opened 7 years ago

utdrmac commented 7 years ago

I have maxtolend = 4 set in default.cfg. maxpercenttolend, maxtolendrate are both commented.

Expected Behavior: For the bot to strictly not lend more than 4 BTC

Actual behavior: screen shot 2017-02-17 at 8 53 41 am

rnevet commented 7 years ago

http://poloniexlendingbot.readthedocs.io/en/latest/configuration.html#max-to-be-lent you need to set maxtolendratein order for maxtolendto be used by the bot. Basically you set a rate that above it you are willing to lend, if you really don't want to lend just set a high rate.

utdrmac commented 7 years ago

Why can't maxtolend be used when the other settings are commented out? As if to create a blanket rule that says "no matter what, never lend out more than this much"

rnevet commented 7 years ago

It could, right now it doesn't... however, you can achieve this by setting a high maxtolendrate.

lexrms commented 7 years ago

I would like the bot to lend 90% of a given currency by keeping always a 10% reserve for any emergency. Do we have this feature? Is a good idea?

utdrmac commented 7 years ago

@lexrms That's what I'm trying to accomplish. @rnevet I guess I'm not understanding the logic behind maxtolendrate

rnevet commented 7 years ago
This feature group allows you to only lend a certain percentage of your total holding in a coin, until the lending rate suprasses a certain threshhold. Then it will lend at max capacity.

maxtolend is a raw number of how much you will lend of each coin whose lending rate is below maxtolendrate
rnevet commented 7 years ago

@lexrms try the following: maxtolend = 0 maxpercenttolend = 90 maxtolendrate = 5

This will lend only 90% of the specific coin unless lending rate is over 5% daily (which I think is impossible)

rnevet commented 7 years ago

@utdrmac does that solve your need as well?

utdrmac commented 7 years ago

Not really. It is still based on a percentage calculation. I'm looking for a hard stop number. ie: no matter what, never lend more than X coin. When maxtolend = X and the other two options are commented out, I would expect this behavior/logic.

rnevet commented 7 years ago

Try this: maxtolend = 4 maxpercenttolend = 0 maxtolendrate = 5

utdrmac commented 7 years ago

I've made this change. Testing it.

Evanito commented 7 years ago

We can add the logic where: If maxtolend or maxpercenttolend set but maxtolendrate not set, then never disable maxtolend.

rnevet commented 7 years ago

@Evanito we can, I would also look into which of those fields most be uncommented. I think right now "you can't set maxpercenttolend without having maxtolend set to 0. I don't like this dependency between both fields.

Evanito commented 7 years ago

Should it be whichever is higher/lower per cur? That seems like a decent idea.

rnevet commented 7 years ago

Would start with allowing either to be commented out. Then if both are set I would take the higher (also not breaking current config).

utdrmac commented 7 years ago

Still looking for a real fix on this:

Lent 4.0196 of 4.0000 (100.49%) Lendable

Have the following set:

maxtolend = 4
maxpercenttolend = 0
maxtolendrate = 5

maxtolend=X should always take highest precedence. I don't want more than 4 coin to ever be lent out.

rnevet commented 7 years ago

How did you achieve that? Are there loans at 5%?

utdrmac commented 7 years ago

Looks like the bot did create 2 lends for 30 days at 0.499%

utdrmac commented 7 years ago

@rnevet I've got TONS of these lines now in my bot:

2017-03-27 19:01:45 The Lower Rate found on BTC is 0.1262% vs conditional rate 5.0000%. Lending 0.00000000 of 0.05786153 Available

What does this mean? Seems that all 4 of my 4.0132BTC are lent out. Why is the bot continuing to look for more trades?

rnevet commented 7 years ago

That's exactly what it should do. The logs are saying it isn't making offers because the rate is lower than 5% and that you should have 0.05786153 available not lent. It's basically checking if the rate is over 5%, as it isn't the bot isn't placing offers over 4.

utdrmac commented 7 years ago

I'm not sure if I should close this out. It's been working with the config values specified in my previous comment but it still seems an awkward way to put a hard limit on how many BTC to lend out.

rnevet commented 7 years ago

Leave it open please, we can simplify the settings.

utdrmac commented 7 years ago

This issue has come up again after I added some more BTC to my polo account. I recently added 3 BTC to bring my total to 7 in my trading account. So, I adjusted my config to match:

maxtolend = 7
maxpercenttolend = 0
maxtolendrate = 5

But: Lent 7.0480 of 7.0480 (100.00%) is what is visible on bot page.

I don't want it to lend out more than 7. This is how I'm tracking my overall profit; any amount over 7 I consider to be profit. Also, if I wanted to protect my account and set this to 6, I would expect the behavior to be 'under no circumstances lend out more than 6 BTC'

rnevet commented 7 years ago

I'm also limiting my lent amount and not seeing an issue. Are you also using a custom config? could you share your config (without API keys)?

utdrmac commented 7 years ago

@rnevet My config: http://termbin.com/v0u7

rnevet commented 7 years ago

So I'm lending multiple coins, so I'm using the custom config in the end of the file like so: [BTC] minloansize = 0.01 mindailyrate = 0.01 maxactiveamount = 1 maxtolend = 7 maxpercenttolend = 0 maxtolendrate = 5

could you try that as well?

utdrmac commented 7 years ago

That's essentially the same config I have. I only had to change mindailyrate from 0.009 to 0.01 to match your config. I'm only lending 1 coin, BTC.

So it looks like it just took it a few days to stabilize. Says this now:

Lent 7.0000 of 7.0739 (98.96%) Total
Lent 7.0000 of 7.0000 (100.00%) Lendable

And lots of these:

2017-05-21 12:58:32 The Lower Rate found on BTC is 0.1749% vs conditional rate 5.0000%. Lending 0.00000000 of 0.07386617 Available
rnevet commented 7 years ago

@utdrmac Thanks! So now it is lending only 7 BTC, good.
Regarding the "lots of these", yeah that's how this feature is working at the moment.

Seems like a bug when using the general config