Free Python 2.7 Script - Compounding Daily Interest with Daily Recurring Deposits for Crypto-Lending Earning Predictions

View this thread on: d.buzz | hive.blog | peakd.com | ecency.com
·@technium·
0.000 HBD
Free Python 2.7 Script - Compounding Daily Interest with Daily Recurring Deposits for Crypto-Lending Earning Predictions
Hi all, I wrote a powerful little script that acts as a quick calculator that will determine how much money you should end up with (and other information), should you lend X @ Y rate, with a daily compounding feature inspired by Poloniex, which varies between 0-2day minimum time-frames for margin lending. In the future, may update to change the compounding feature, but most on the web already accommodate long-term, long-compounding period loan earnings, so this is a bit more unique to the crypto-space.

If you have questions, or need a video, let me know here and I will try to help you out. Edit: Seems like the code here displays without indentation, which is very important, if indents don't copy over, you can use this PasteBin link with full Syntax Highlighting : http://pastebin.com/SLgyArfJ

<b> You need Python 2.7 installed, save everything below the line into a .py file, changing variables as you see fit. </b>
<hr>

<code>__author__ = 'Technium Unlimited'
import decimal
from decimal import Decimal
decimal.getcontext().prec = 8
#Change Variables Principal, dailyInterestRate, lengthOfDays, & dailyDeposit as needed
principal = Decimal(0.90500)
dailyInterestRate = Decimal(0.00023)
lengthOfDays = Decimal(365.00)
dailyDeposit = Decimal(0.01)
def loopRecurringDeposits(P, I, L, R):
    accumulatedAmount = P
    totalRecurringDeposits = Decimal(0.0)
    totalWithoutRecurrance = P * ((Decimal(1.0) + I) ** L)
    totalEarnedWithoutRecurrance = totalWithoutRecurrance - P
    print " "
    print "~~~Make Bitcoin Great Again!!~~~"
    print " "
    print " "
    x = 0
    while x <= int(L):
        p = Decimal(accumulatedAmount) + R
        accumulatedAmount = p * ((Decimal(1.0) + Decimal(I)) ** Decimal(1.0))
        totalRecurringDeposits = totalRecurringDeposits + R
        x = x + 1
    earnedInterest = accumulatedAmount - P - totalRecurringDeposits
    print "Initial Principal Was: " + str(float(P)) + "BTC"
    print " "
    print "Total Accumulated Without Recurring Deposits (just compound interest): " + str(totalWithoutRecurrance) + "BTC"
    print "Total Earned Without Recurring Deposits (just compounding interest): " + str(totalEarnedWithoutRecurrance) + "BTC"
    print " "
    print "Total Recurring Deposit Amount: " + str(totalRecurringDeposits) + "BTC"
    print "Total Accumulated: " + str(accumulatedAmount) + "BTC"
    print "Total Earned (with any recurring deposits interest incl): " + str(earnedInterest) + "BTC"
    print getDollarValue(earnedInterest, Decimal(915.00))
def getDollarValue(btcAmount, dollarRate):
    return btcAmount * dollarRate
loopRecurringDeposits(principal, dailyInterestRate, lengthOfDays, dailyDeposit)
</code>
👍 , , , , , , , , , , , , , , , , ,