dutu / poloLender

Free, open source, high performance bot for lending funds on Poloniex exchange
https://github.com/dutu/poloLender
Other
160 stars 47 forks source link

Non optimal trade has happened #30

Closed avoloshko closed 7 years ago

avoloshko commented 7 years ago

I am curious about the algorithm which decides the best rate. Attached is a screenshot.

screen shot 2017-05-09 at 10 18 56 pm

Thanks!

dutu commented 7 years ago

Would you please send the bot console log

avoloshko commented 7 years ago

@dutu, I am afraid, there is no much information there and the lines have gone. There were the same lines you can see on the screenshot. Moreover, there was DDoS attack at that time. The average rate was around 0.2%, but sometimes other lenders (probably bots) tried to lend small pieces for 0.05% and, it seems to me, PoloTrader tried to overtake them and lent 30 LTC for 0.049%.

dutu commented 7 years ago

@avoloshko, reason for asking for logs was to confirm the bot was the one offering the loan, and check the timestamp on when the loan was offered and the average loan holding time. Anyway, I found similar occurrence of the situation in my own logs.

It shows that at that time, the average loan holding time was relatively small (~45 minutes), in which case falling back to a low rate after few minutes is the wanted behavior; i.e. which such low holding time it's probabilistic more profitable to lend at lower rates than to wait for higher rates. The mathematical calculation gives the waiting time based on the average holding time. At first look it may be counterintuitive to figure out how short time we should wait in case of low average holding times (of course we are talking "average" and "probability", hence exceptions as in your example above can happen).

On the opposite side, when the average holding time is relatively long, the bot will wait longer for higher rates as it would be more profitable. This situation can also be counterintuitive and please see issue "Not lowering offered rates for several hours" https://github.com/dutu/poloLender/issues/32, in which case alht was +8h and the user had the feeling the bot is waiting for too long for higher rates.

Taking the average loan holding time into calculation is the one main characteristic of this lending algorithm and where its power and profitability are. This is also what it differentiates it from other lending bots.

Hope this makes sense.