MikaLendingBot icon indicating copy to clipboard operation
MikaLendingBot copied to clipboard

Notification for closed loan

Open vmsh0 opened this issue 8 years ago • 12 comments

Hello,

I'd basically like to get notified not only when a loan is created ("notify_new_loans" setting) but also when a loan is closed. This is because I'd like to gather statistics on the duration of loans and interest earned on each single loan.

I apologize if this feature already exists but I can't seem to find it anywhere.

vmsh0 avatar May 06 '17 17:05 vmsh0

@streamholder As a side question to someone uninformed, myself, how is interest calculated exactly? Is it the rate per hour? per day? Profit off interest is calculated by $AMT_LENT * $RATE * $SECONDS_LENT ?

utdrmac avatar May 07 '17 02:05 utdrmac

@utdrmac Matthew, I was trying to figure that out just now. One of my last loans for 0.02358426 BTC at 0.1785% lasted about 10 hours, and yielded 0.00001457 BTC of interest. With this data I honestly could not figure out the formula. For one, no matter what I plug into it, the compounding interest formula doesn't give the correct result. I'm gonna send an inquiry to the Poloniex guys, in the meanwhile feel free to use my data to figure it out!

vmsh0 avatar May 07 '17 08:05 vmsh0

@streamholder @utdrmac 0.02358426 * 0.1785% * (10/24) * 0.85 = 0.00001490967436875 $Loan x $DailyRate x $Days x $15%PoloFee

Your loan lasted for 9.772 hours. :)

Poloniex doesn't compound interest, I asked.

rnevet avatar May 07 '17 08:05 rnevet

@rnevet Ah, thank you!

vmsh0 avatar May 07 '17 09:05 vmsh0

a side side note, we have a gitter channel where these type of questions can be discussed, ;) https://gitter.im/Mikadily/poloniexlendingbot

rnevet avatar May 07 '17 09:05 rnevet

@streamholder Why not directly query the API for loan history for your statistics? much easier then collecting it through the bot and notifications, no? returnLendingHistory should give you all the information you are looking for, you could also download a CSV from Polo website.

rnevet avatar May 07 '17 21:05 rnevet

@rnevet Well, the bot already has a notification system. Without the loan-made-by-bot filtering this would be pretty easy to implement (stateful, but a single timestamp/id should be enough), so I figured it could make for a good addition. I'll try to get it working decently, then I'll send a PR and the final decision will of course be yours :)

vmsh0 avatar May 07 '17 21:05 vmsh0

I'm not against just wondering why run this through a notification system at all? Don't forget you need to update the configuration and documentation. :)

rnevet avatar May 07 '17 21:05 rnevet

@rnevet It just makes sense to me that my stats script would just listen to notification for all the information it needs instead of polling Poloniex with a different API key. I understand it's a egoistic argument, but I can imagine there's other people in the world that could be doing something similar to what I'm doing 😂 I just think that keeping all the API client code in one place is a better solution.

vmsh0 avatar May 08 '17 07:05 vmsh0

I wold also like to see this feature

melo52 avatar Jun 11 '17 23:06 melo52

It's not abandoned, I just got busy. I'll try to work on this asap.

vmsh0 avatar Jun 12 '17 06:06 vmsh0

@streamholder We introduced a new Plugin mechanism that should make it easier to implement new features (not part of the core lending)... you can see the AccountStats example. If you need pointers ping me on Slack.

rnevet avatar Jun 12 '17 09:06 rnevet