-
-
Save adxrgh/3c4614f9ad12f390cd12c35f479188f2 to your computer and use it in GitHub Desktop.
[get a buntch of data from wind]#tags:input,wind,收益曲线,plot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import WindPy | |
from WindPy import * | |
import pandas as pd | |
from pandas import DataFrame | |
w.start() | |
all_data={} | |
a=w.weqs('tp') | |
for ticker in a.Data[0]: | |
all_data[ticker]=w.wsd(ticker,'close','20170101') | |
price=DataFrame({tic:data.Data[0] for tic,data in all_data.items()},index=all_data[next(iter(all_data))].Times) # next (iter(my_dict))get firt key of a dict | |
syzs=(1+price.pct_change()).cumprod() | |
syzs.iloc[0,:]=1 | |
syzs.plot() | |
sy=syzs.resample('W',how='last').pct_change() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment