Commit 89400317 by Lawrence

Barrier

parent 9f3880c0
Showing with 5 additions and 2 deletions
historical_stock_prices.csv
stocks/*
.idea/*
\ No newline at end of file
......@@ -48,12 +48,13 @@ def main():
av_gain_dict[i["ticker"]] += float(i["open"]) - prev_price_dict[i["ticker"]][LEN_PREV - 1]
count_dict[i["ticker"]] += 1
if len(prev_price_dict[i["ticker"]]) >= LEN_PREV:
if len(prev_price_dict[i["ticker"]]) > LEN_PREV:
prev_price_dict[i["ticker"]].pop(0)
prev_price_dict[i["ticker"]].append(float(i["open"]))
for i in av_gain_turn_dict:
writer.writerow([i, av_gain_pos_dict[i] / count_pos_dict[i], av_gain_turn_dict[i] / count_turn_dict[i], av_gain_dict[i] / count_dict[i]])
if count_pos_dict[i] > 0 and count_turn_dict[i] > 0 and count_dict[i] > 0:
writer.writerow([i, av_gain_pos_dict[i] / count_pos_dict[i], av_gain_turn_dict[i] / count_turn_dict[i], av_gain_dict[i] / count_dict[i]])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment