Example #1
0
def mkTradeStat():
    data = w.wset("mkttradestatsec", "startdate=" + tradedate(365)[0],
                  "enddate=" + tradedate(0)[1], "sectorid=a001010100000000")
    df = pd.DataFrame(data.Data, index=data.Fields, columns=data.Codes).T
    df = df.sort_values(by='date', ascending=False)
    print(df.head())
    return df
Example #2
0
def marketScaleStat():
    data = w.wset("marketscalestatisticbywind",
                  "reporttype=y1;startdate=" + tradedate(90)[0],
                  "enddate=" + tradedate(0)[1])
    df = pd.DataFrame(data.Data, index=data.Fields, columns=data.Codes).T
    print(df.head())
    return df
Example #3
0
def blockTradeRecord():
    data = w.wset("blocktraderecord", "startdate=" + tradedate(20)[0],
                  "enddate=" + tradedate(20)[1], "sectorid=a001010100000000")
    df = pd.DataFrame(data=data.Data, index=data.Fields, columns=data.Codes).T
    df = df.sort_values(by='trade_date', ascending=False)
    #print(df.head(30))
    return df
Example #4
0
def iForecast(code,
              startdate=tradedate(180)[0],
              year=datetime.strptime(tradedate(0)[1], "%Y-%m-%d").year):
    data = w.wset("institutionforecasts", "year=" + str(year),
                  "startdate=" + startdate, "windcode=" + code, "orgname=all")
    #print(data)
    df = pd.DataFrame(data.Data, index=data.Fields, columns=data.Codes).T
    #print(df.head())
    df = df.sort_values(by='last_rating_date', ascending=False)
    return df
Example #5
0
def stockWest(code,
              startdate=tradedate(180)[0],
              year=datetime.strptime(tradedate(0)[1], "%Y-%m-%d").year):
    data = w.wset(
        "stockwest", "startdate=" + startdate, "windcode=" + code,
        "orgname=全部",
        "field=date,organization,researcher,epsa0,epse1,epse2,epse3,netprofita0,netprofite1,netprofite2,netprofite3,incomea0,incomee1,incomee2,incomee3"
    )
    #print(data)
    df = pd.DataFrame(data.Data, index=data.Fields, columns=data.Codes).T
    df = df.sort_values(by='date', ascending=False)
    return df
Example #6
0
def valucationWind(stocklists):
    rm._write_msg('[Getting Data:]')
    df_V = pd.DataFrame()
    for code in stocklists:
        rm._write_inprogress()
        # sec_status,trade_code,
        data = w.wsd(code, "windcode,sec_name, close, ev,pe_ttm,val_pe_deducted_ttm,pe_lyr,pb_lf,pcf_ocflyr,west_eps_FY1,west_eps_FY2,estpe_FY1,estpe_FY2, estpeg_FTM,estpeg_FY1, industry_sw,concept",
                     tradedate(0)[0], tradedate(0)[1], "index=4;industryType=3")
        df = pd.DataFrame(data.Data, columns=data.Codes, index=data.Fields).T
        #df['ev'] = df['ev']/1.0E+8
        df_V = pd.concat([df_V, df])
        df_V = df_V.sort_values(by='INDUSTRY_SW')
    #df_V.to_excel("D:/Stock/tushare/stocklists.xlsx", sheet_name = tradedate(0)[-1])
    #rm._play_wav()
    print(len(df_V))
    return df_V
Example #7
0
def dfToExcel(df, filename, sheet_name=tradedate(0)[-1]):
    df.to_excel("D:/Stock/wind/" + str(filename) + ".xlsx", sheet_name)
    print(" df save to {} .".format(filename))
Example #8
0
def companyScopeView():
    data = w.wset("companyscopegeneralview", "enddate=" + tradedate(0)[1],
                  "year=2016", "sectorid=a001010100000000")
    df = pd.DataFrame(data=data.Data, index=data.Fields, columns=data.Codes).T
    print(df.head())
    return df
Example #9
0
def dfToExcel(df, filename):
    df.to_excel("D:/Stock/wind/" + str(filename) + ".xlsx",
                sheet_name=tradedate(0)[-1])
    print(" df to_excel filename .")
    pass
Example #10
0
def indScaleStat():
    data = w.wset("indscalestatbywind",
                  "industrytype=证监会行业;enddate=" + tradedate(0)[1])
    df = pd.DataFrame(data.Data, index=data.Fields, columns=data.Codes).T
    print(df.head())
    return df
Example #11
0
# test scripts in project


import pandas as pd 


from WindPy import w 
w.start()

from windpyplus.utils.tradedate import tradedate
from windpyplus.fundamental.performanceExpress import performance_express
from windpyplus.fundamental.financialReport import financial_report
from windpyplus.stockSector.StockSector import allAstock

allstocks = list(allAstock().index.values)
print(allstocks)
print(tradedate())
#print(performance_express(allstocks))
#print(financial_report(allstocks))
Example #12
0
def Concept(stocklists):
    data = w.wss(stocklists, "sec_name,concept",
                 "tradeDate=" + tradedate(0)[1])
    df = pd.DataFrame(data.Data, columns=data.Codes, index=data.Fields).T
    return df
Example #13
0
def Industry(stocklists):
    data = w.wss(stocklists,
                 "sec_name,industry_gics,industry_citic,industry_sw",
                 "industryType=1;tradeDate=" + tradedate(0)[1])
    df = pd.DataFrame(data.Data, columns=data.Codes, index=data.Fields).T
    return df