박하늘

stockdata.py : clarify code

1 import FinanceDataReader as fdr 1 import FinanceDataReader as fdr
2 -import numpy as np
3 import pandas as pd 2 import pandas as pd
4 3
4 +
5 def basicinform(input): 5 def basicinform(input):
6 - stocks = pd.read_csv('stockcodename.csv',index_col=0) 6 + stocks = pd.read_csv('stockcodename.csv', index_col=0)
7 symbol = '' 7 symbol = ''
8 - for i in enumerate(stocks.Name) : 8 + for i in enumerate(stocks.Name):
9 if i[1] == input: 9 if i[1] == input:
10 symbol = (stocks.iloc[i[0]].Symbol) 10 symbol = (stocks.iloc[i[0]].Symbol)
11 break 11 break
...@@ -16,8 +16,9 @@ def basicinform(input): ...@@ -16,8 +16,9 @@ def basicinform(input):
16 price = df.Close.iloc[-1] 16 price = df.Close.iloc[-1]
17 ror = ror_df[-1] 17 ror = ror_df[-1]
18 18
19 - value = {"현재가": price , 19 + value = {
20 - "거래랑": volume , 20 + "현재가": price,
21 - "전일 대비 수익률:" : ror 21 + "거래랑": volume,
22 + "전일 대비 수익률:": ror
22 } 23 }
23 return value 24 return value
......