Skip to content

Commit a438450

Browse files
committed
python regular invest
1 parent 07228dd commit a438450

File tree

1 file changed

+2
-3
lines changed
  • taiyangxue/regular_invest

1 file changed

+2
-3
lines changed

taiyangxue/regular_invest/app.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,14 @@ def dataStock(html):
9292

9393
def dataFormat(code, type_='fund', cycleDays=5, begin='2001-01-01'):
9494
rawdf = pd.read_excel('%s_%s.xlsx' % (type_, code))
95-
buydf = rawdf[rawdf.index % cycleDays==0] ## 选出定投时机
9695
# 选择对应的列
9796
if type_ == 'fund':
98-
buydf = buydf[['公布日期','单位净值']]
97+
buydf = rawdf[['公布日期','单位净值']]
9998
else:
10099
buydf = buydf[['日期','收盘价']]
101100
buydf.columns = ["日期","单价"]
102-
103101
buydf = buydf[buydf['日期']>=begin]
102+
buydf = buydf[buydf.index % cycleDays==0] # 选出定投时机
104103
return buydf
105104

106105
def show(buydf, amount=1000):

0 commit comments

Comments
 (0)