Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import csv
- from decimal import Decimal
- def cvstolist(filename):
- price =[]
- quant = []
- with open( filename, 'r') as csvf:
- csvobj = csv.reader(csvf)
- for row in csvobj:
- yield row[0], row[1]
- chosenloss = 4
- for price,quant in cvstolist("input.csv"):
- perc1 = (Decimal(price) /100)
- losspercoin = Decimal(chosenloss)/Decimal(quant)
- print('lossprcoin = {}'.format(losspercoin))
- exitpricechosenloss = Decimal(price) - Decimal(losspercoin)
- print('exitpricechosenloss = {}'.format(exitpricechosenloss))
- print('perc1 = {}'.format(perc1))
- percchosenlosspercoin = exitpricechosenloss / perc1
Add Comment
Please, Sign In to add comment