• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python fundamental.get_stock_basics函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tushare.stock.fundamental.get_stock_basics函数的典型用法代码示例。如果您正苦于以下问题:Python get_stock_basics函数的具体用法?Python get_stock_basics怎么用?Python get_stock_basics使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_stock_basics函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: get_area_classified

def get_area_classified():
    """
        获取地域分类数据
    Return
    --------
    DataFrame
        code :股票代码
        name :股票名称
        area :地域名称
    """
    df = fd.get_stock_basics()
    df = df[['name', 'area']]
    df.reset_index(level=0, inplace=True)
    df = df.sort('area').reset_index(drop=True)
    return df
开发者ID:Esmidth,项目名称:AnacondaBackup,代码行数:15,代码来源:classifying.py


示例2: get_gem_classified

def get_gem_classified():
    """
        获取创业板股票
    Return
    --------
    DataFrame
        code :股票代码
        name :股票名称
    """
    df = fd.get_stock_basics()
    df.reset_index(level=0, inplace=True)
    df = df[ct.FOR_CLASSIFY_B_COLS]
    df = df.ix[df.code.str[0] == '3']
    df = df.sort('code').reset_index(drop=True)
    return df
开发者ID:Esmidth,项目名称:AnacondaBackup,代码行数:15,代码来源:classifying.py


示例3: get_sme_classified

def get_sme_classified(file_path=None):
    """
        获取中小板股票
    Return
    --------
    DataFrame
        code :股票代码
        name :股票名称
    """
    df = fd.get_stock_basics(file_path)
    df.reset_index(level=0, inplace=True)
    df = df[ct.FOR_CLASSIFY_B_COLS]
    df = df.ix[df.code.str[0:3] == '002']
    df = df.sort('code').reset_index(drop=True)
    return df 
开发者ID:renzhexigua,项目名称:tushare,代码行数:15,代码来源:classifying.py


示例4: get_st_classified

def get_st_classified():
    """
        获取风险警示板股票
    Return
    --------
    DataFrame
        code :股票代码
        name :股票名称
    """
    df = fd.get_stock_basics()
    df.reset_index(level=0, inplace=True)
    df = df[ct.FOR_CLASSIFY_B_COLS]
    df = df.ix[df.name.str.contains('ST')]
    df = df.sort('code').reset_index(drop=True)
    return df 
开发者ID:Esmidth,项目名称:AnacondaBackup,代码行数:15,代码来源:classifying.py


示例5: get_sme_classified

def get_sme_classified():
    """
        获取中小板股票
    Return
    --------
    DataFrame
        code :股票代码
        name :股票名称
    """
    df = fd.get_stock_basics()
    df.reset_index(level=0, inplace=True)
    df = df[ct.FOR_CLASSIFY_B_COLS]
    df = df.ix[df.code.str[0:3] == "002"]
    df = df.sort("code").reset_index(drop=True)
    return df
开发者ID:xyicheng,项目名称:tushare,代码行数:15,代码来源:classifying.py


示例6: get_hs300s

def get_hs300s():
    """
    获取沪深300当前成份股及所占权重
    Return
    --------
    DataFrame
        code :股票代码
        name :股票名称
        date :日期
        weight:权重
    """
    from tushare.stock.fundamental import get_stock_basics
    try:
        wt = pd.read_excel(ct.HS300_CLASSIFY_URL_FTP%(ct.P_TYPE['ftp'], ct.DOMAINS['idxip'], 
                                                  ct.PAGES['hs300w']), parse_cols=[0, 3, 6])
        wt.columns = ct.FOR_CLASSIFY_W_COLS
        wt['code'] = wt['code'].map(lambda x :str(x).zfill(6))
        df = get_stock_basics()[['name']]
        df = df.reset_index()
        return pd.merge(df,wt)
    except Exception as er:
        print(str(er))
开发者ID:FeihuaLiu,项目名称:chinese-stock-Financial-Index,代码行数:22,代码来源:classifying.py


示例7: get_zz500s

def get_zz500s():
    """
    获取中证500成份股
    Return
    --------
    DataFrame
        code :股票代码
        name :股票名称
    """
    from tushare.stock.fundamental import get_stock_basics
    try:
#         df = pd.read_excel(ct.HS300_CLASSIFY_URL_FTP%(ct.P_TYPE['ftp'], ct.DOMAINS['idxip'], 
#                                                   ct.PAGES['zz500b']), parse_cols=[0,1])
#         df.columns = ct.FOR_CLASSIFY_B_COLS
#         df['code'] = df['code'].map(lambda x :str(x).zfill(6))
        wt = pd.read_excel(ct.HS300_CLASSIFY_URL_FTP%(ct.P_TYPE['ftp'], ct.DOMAINS['idxip'], 
                                                   ct.PAGES['zz500wt']), parse_cols=[0, 3, 6])
        wt.columns = ct.FOR_CLASSIFY_W_COLS
        wt['code'] = wt['code'].map(lambda x :str(x).zfill(6))
        df = get_stock_basics()[['name']]
        df = df.reset_index()
        return pd.merge(df,wt)
    except Exception as er:
        print(str(er)) 
开发者ID:FeihuaLiu,项目名称:chinese-stock-Financial-Index,代码行数:24,代码来源:classifying.py


示例8: test_get_stock_basics

 def test_get_stock_basics(self):
     print(fd.get_stock_basics())
开发者ID:1FENQI,项目名称:tushare,代码行数:2,代码来源:fund_test.py


示例9: bar2h5

def bar2h5(market='', date='', freq='D', asset='E', filepath=''):
    cons = get_apis()
    stks = get_stock_basics()
    fname = "%s%s%sbar%s.h5"%(filepath, market, date, freq)
    store = pd.HDFStore(fname, "a")
    if market in ['SH', 'SZ']:
        if market == 'SH':
            stks = stks.ix[stks.index.str[0]=='6', :]
        elif market == 'SZ':
            stks = stks.ix[stks.index.str[0]!='6', :]
        else:
            stks = ''
        market = 1 if market == 'SH' else 0
        for stk in stks.index:
            symbol = '%s.SH'%stk
            if 'min' in freq:
                df = bar(stk, conn=cons, start_date=date, end_date=date, freq=freq, 
                             market=market, asset=asset)
                df['Time'] = df.index
                df['Time'] = df['Time'].apply(get_dt_time) 
                df.index = df['Time']
                df.drop(['code','Time'], axis = 1, inplace=True)    
                df.rename(columns={'open':'OPEN'}, inplace=True) 
                df.rename(columns={'close':'CLOSE'}, inplace=True)
                df.rename(columns={'low':'LOW'}, inplace=True)
                df.rename(columns={'high':'HIGH'}, inplace=True)
                df.rename(columns={'vol':'VOLUME'}, inplace=True) 
                df.rename(columns={'amount':'TURNOVER'}, inplace=True) 
                df.loc[:,'HIGH'] =  df.loc[:,'HIGH'].astype("int64")
                df.loc[:,'LOW'] =  df.loc[:,'LOW'].astype("int64")
                df.loc[:,'OPEN'] =  df.loc[:,'OPEN'].astype("int64")
                df.loc[:,'CLOSE'] =  df.loc[:,'CLOSE'].astype("int64")
                df.loc[:,'VOLUME'] =  df.loc[:,'VOLUME'].astype("int64")
                df.loc[:,'TURNOVER'] =  df.loc[:,'TURNOVER'].astype("int64")    
                df.loc[:,'OPEN'] *= 10000   
                df.loc[:,'CLOSE'] *= 10000    
                df.loc[:,'HIGH'] *= 10000    
                df.loc[:,'LOW'] *= 10000
                df.loc[:,'ASKPRICE1']  = 0
                df.loc[:,'ASKPRICE2']  = 0
                df.loc[:,'ASKPRICE3']  = 0
                df.loc[:,'ASKPRICE4']  = 0
                df.loc[:,'ASKPRICE5']  = 0
                df.loc[:,'ASKPRICE6']  = 0
                df.loc[:,'ASKPRICE7']  = 0
                df.loc[:,'ASKPRICE8']  = 0
                df.loc[:,'ASKPRICE9']  = 0
                df.loc[:,'ASKPRICE10'] = 0    
                df.loc[:,'BIDPRICE1']  = 0
                df.loc[:,'BIDPRICE2']  = 0
                df.loc[:,'BIDPRICE3']  = 0
                df.loc[:,'BIDPRICE4']  = 0
                df.loc[:,'BIDPRICE5']  = 0
                df.loc[:,'BIDPRICE6']  = 0
                df.loc[:,'BIDPRICE7']  = 0
                df.loc[:,'BIDPRICE8']  = 0
                df.loc[:,'BIDPRICE9']  = 0
                df.loc[:,'BIDPRICE10'] = 0    
                df.loc[:,'ASKVOL1']  = 0
                df.loc[:,'ASKVOL2']  = 0
                df.loc[:,'ASKVOL3']  = 0
                df.loc[:,'ASKVOL4']  = 0
                df.loc[:,'ASKVOL5']  = 0
                df.loc[:,'ASKVOL6']  = 0
                df.loc[:,'ASKVOL7']  = 0
                df.loc[:,'ASKVOL8']  = 0
                df.loc[:,'ASKVOL9']  = 0
                df.loc[:,'ASKVOL10'] = 0    
                df.loc[:,'BIDVOL1']  = 0
                df.loc[:,'BIDVOL2']  = 0
                df.loc[:,'BIDVOL3']  = 0
                df.loc[:,'BIDVOL4']  = 0
                df.loc[:,'BIDVOL5']  = 0
                df.loc[:,'BIDVOL6']  = 0
                df.loc[:,'BIDVOL7']  = 0
                df.loc[:,'BIDVOL8']  = 0
                df.loc[:,'BIDVOL9']  = 0
                df.loc[:,'BIDVOL10'] = 0    
                df.loc[:,'VWAP'] = 0.0
                df.loc[:,'VOL30']=0.0
                df.loc[:,'TOTAL_VOLUME']=0.0
                df.loc[:,'TOTAL_TURNOVER']=0.0
                df.loc[:,'INTEREST']=0.0
                print(df)
#             if market == 1 and stk[0] == '6':
#                 df = bar(stk, conn=cons, start_date=date, end_date=date, freq=freq, market=market, asset=asset)
                
            store[symbol] = df
    
    store.close()
    close_apis(cons)
开发者ID:peterz3g,项目名称:tushare,代码行数:91,代码来源:trading.py



注:本文中的tushare.stock.fundamental.get_stock_basics函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python macro_vars.random函数代码示例发布时间:2022-05-27
下一篇:
Python cons._write_head函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap