Cleaning up what is kept in repository so that its not copied to server.

user: john
branch 'default'
changed .hgignore
This commit is contained in:
john
2023-05-14 10:37:32 -04:00
parent c76cec1a73
commit 5f5d025d72
3 changed files with 1 additions and 72 deletions

View File

@@ -4,4 +4,4 @@ bin/
lib/ lib/
.idea/ .idea/
__pycache__/ __pycache__/
pyvenv.cfg

View File

@@ -1,68 +0,0 @@
'''''''take in the csv file of transactions'''
import datetime
from decimal import *
import csv
from calendar import monthrange
def main():
getcontext().prec=10
open_balance = Decimal("-24521.81")
interest_rate = Decimal("8.00")/Decimal("100.00")/Decimal("365.00")
year = 2021
start_date = datetime.date(year, 1, 1)
end_date = datetime.date(year, 12, 31)+datetime.timedelta(1)
days_in_year = (end_date - start_date).days
print ("Days in year: %d" % days_in_year)
balances = [Decimal('0.00')] * days_in_year
interest_invoices = [Decimal('0.00')] * 12
with open("/Users/john/Downloads/query_result.csv") as f:
reader = csv.DictReader(f)
for row in reader:
print(row)
year = row['year']
month = row['month']
day = row['day']
amount = row['position (USD)']
date_val = datetime.date(int(year), int(month), int(day))
day_of_year = date_val.toordinal() - datetime.date(date_val.year, 1, 1).toordinal() + 1
print("Record created for day of year %d" % day_of_year)
print("%s - %s - %s: %s " % (year, month, day, amount))
balances[day_of_year] = balances[day_of_year] + Decimal(amount)
current_balance = open_balance
day_being_processed = 1
accumlated_interest = Decimal('0.000000')
while (day_being_processed <= days_in_year):
print("Day of year: %d" % day_being_processed)
#calculate the day's balance
current_balance = current_balance + balances[day_being_processed-1]
balances[day_being_processed-1] = current_balance
#accummulate the day's interest
todays_interest = current_balance * interest_rate
accumlated_interest = accumlated_interest + todays_interest
#check if this is the last day of the month, if it is do the transition stuff
current_month = datetime.date.fromordinal(start_date.toordinal()+day_being_processed-1).month
next_month = datetime.date.fromordinal(start_date.toordinal()+day_being_processed).month
print("Current Month: %d Next_month: %d" % (current_month, next_month ))
if (current_month != next_month):
interest_invoices[current_month-1] = accumlated_interest.quantize(Decimal('.01'))
current_balance = current_balance + accumlated_interest
accumlated_interest = Decimal('0.00')
day_being_processed = day_being_processed + 1
i=0
while (i<12):
print ("%d: %s" %(i+1, interest_invoices[i]) )
i = i +1
if __name__ == '__main__':
main()

View File

@@ -1,3 +0,0 @@
home = /opt/local/bin
include-system-site-packages = false
version = 3.10.7