given a stock, show it's biggest downside move from day-to-day. see code below
def maximum_price_diff(pl):
# given a pricelist PL, determine the maximum one-day drop
# PL = [n]['date','close']
# assume the list is in date assending order
max_diff = {'date': None,
'max': 0}
for x in range(1, len(pl)):
today = pl[x]['close']
yesterday = pl[x-1]['close']
diff = today - yesterday
if diff < max_diff['max']:
max_diff['max'] = diff
max_diff['date'] = pl[x]['date']
# print(pl[x]['date'], yesterday, today, max_diff)
return(max_diff)
given a stock, show it's biggest downside move from day-to-day. see code below
and then to call it...