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

Notification for closed loan #321

Open vmsh0 opened 7 years ago

vmsh0 commented 7 years ago

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.

utdrmac commented 7 years ago

@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 ?

vmsh0 commented 7 years ago

@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!

rnevet commented 7 years ago

@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.

vmsh0 commented 7 years ago

@rnevet Ah, thank you!

rnevet commented 7 years ago

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

rnevet commented 7 years ago

@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.

vmsh0 commented 7 years ago

@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 :)

rnevet commented 7 years ago

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. :)

vmsh0 commented 7 years ago

@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.

melo52 commented 7 years ago

I wold also like to see this feature

vmsh0 commented 7 years ago

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

rnevet commented 7 years ago

@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.