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

Support for minimum lend rate #5

Closed denravonska closed 8 years ago

denravonska commented 8 years ago

It would be neat if we could set a minimum lend rate on a per-coin basis. For example, right now XMR lends for 0.015% so it would be more profitable for me to stop offer XMR loans, trade my coins into BTC and offer BTC loans at 0.056%.

I guess you can kill the bot, reconfigure the coin max lend to 0 and then restart it, but it's quite the hassle. Instead, it would be easier if we can set a minimum and handle the exchange and coin transitions manually.

denravonska commented 8 years ago

I will commit a proposal fix for this later today.

dutu commented 8 years ago

Thanks you for this PR, @denravonska .

Did you mange to test this commit? I see a few places config.offerMinRate[currency] / 100.0, but the config.offerMinRate[currency] seems to be a string.

Can you please doublecheck?

dutu commented 8 years ago

@denravonska , can you check if a simple way to implement this feature would be by:

  1. introduce a new variable offerMaxAmount and set it initially to config.offerMaxAmount
  2. when checking if an loan offer should be posted or not, use variable offerMaxAmount instead of config.offerMaxAmount`
  3. before posting an offer, check if bestReturnRate is less than minRate then set offerMaxAmount to 0 else set offerMaxAmount to config.offerMaxAmount
denravonska commented 8 years ago

You mean piggy back on the offerMax checks? Right now I have changed it to be an explicit check for the min rate in postOffers:

// Do not offer loans the the best return rate is less than the specified min rate. minRate = new Big(config.offerMinRate[currency]); if (minRate.ne(0) && minRate.div(100).gt(advisorInfo[currency].bestReturnRate)) { return callback(null); }

I think it's wise to keep them separated.

However, I can only cancel but not create loan offers at the moment:

notice: createLoanOffer: Invalid API key/secret pair.

I have double checked and even created a new API key. Strange.

dutu commented 8 years ago

Thanks for the PR.

The feature has been added in version 0.5.0