zoukankan      html  css  js  c++  java
  • ts

    __version__ = '0.7.4'
    __author__ = 'Jimmy Liu'
    """
    for trading data
    """
    from tushare.stock.trading import (get_hist_data, get_tick_data,
                                       get_today_all, get_realtime_quotes,
                                       get_h_data, get_today_ticks,
                                       get_index, get_hists,
                                       get_k_data,
                                       get_sina_dd)
    
    """
    for trading data
    """
    from tushare.stock.fundamental import (get_stock_basics, get_report_data,
                                           get_profit_data,
                                           get_operation_data, get_growth_data,
                                           get_debtpaying_data, get_cashflow_data,
                                           get_balance_sheet, get_profit_statement, get_cash_flow)
    
    """
    for macro data
    """
    from tushare.stock.macro import (get_gdp_year, get_gdp_quarter,
                                     get_gdp_for, get_gdp_pull,
                                     get_gdp_contrib, get_cpi,
                                     get_ppi, get_deposit_rate,
                                     get_loan_rate, get_rrr,
                                     get_money_supply, get_money_supply_bal,
                                     get_gold_and_foreign_reserves)
    
    """
    for classifying data
    """
    from tushare.stock.classifying import (get_industry_classified, get_concept_classified,
                                           get_area_classified, get_gem_classified,
                                           get_sme_classified, get_st_classified,
                                           get_hs300s, get_sz50s, get_zz500s,
                                           get_terminated, get_suspended)
    
    """
    for macro data
    """
    from tushare.stock.newsevent import (get_latest_news, latest_content,
                                         get_notices, notice_content,
                                         guba_sina)
    
    """
    for reference
    """
    from tushare.stock.reference import (profit_data, forecast_data,
                                         xsg_data, fund_holdings,
                                         new_stocks, sh_margins,
                                         sh_margin_details,
                                         sz_margins, sz_margin_details,
                                         top10_holders)
    
    """
    for shibor
    """
    from tushare.stock.shibor import (shibor_data, shibor_quote_data,
                                      shibor_ma_data, lpr_data,
                                      lpr_ma_data)
    
    """
    for LHB
    """
    from tushare.stock.billboard import (top_list, cap_tops, broker_tops,
                                         inst_tops, inst_detail)
    
    
    """
    for utils
    """
    from tushare.util.dateu import (trade_cal, is_holiday)
    
    
    """
    for DataYes Token
    """
    from tushare.util.upass import (set_token, get_token, get_broker,
                                    set_broker, remove_broker)
    
    from tushare.datayes.api import *
    
    from tushare.internet.boxoffice import (realtime_boxoffice, day_boxoffice,
                                            day_cinema, month_boxoffice)
    
    """
    for fund data
    """
    from tushare.fund.nav import (get_nav_open, get_nav_close, get_nav_grading,
                                  get_nav_history, get_fund_info)
    
    """
    for trader API
    """
    from tushare.trader.trader import TraderAPI
    
    
    """
    for futures API
    """
    from tushare.futures.intlfutures import (get_intlfuture)
    
    
    from tushare.stock.globals import (global_realtime)
    
    
    from tushare.util.mailmerge import (MailMerge)

    交易数据

    • 历史行情数据 
    • 复权历史数据
    • 实时行情数据
    • 历史分笔数据
    • 实时报价数据
    • 当日历史分笔
    • 大盘指数列表
    • 大单交易数据
    • 历史行情数据
    • ts.get_hist_data('600848') #一次性获取全部日k线数据
    • ts.get_hist_data('600848', ktype='W') #获取周k线数据
      ts.get_hist_data('600848', ktype='M') #获取月k线数据
      ts.get_hist_data('600848', ktype='5') #获取5分钟k线数据
      ts.get_hist_data('600848', ktype='15') #获取15分钟k线数据
      ts.get_hist_data('600848', ktype='30') #获取30分钟k线数据
      ts.get_hist_data('600848', ktype='60') #获取60分钟k线数据
      ts.get_hist_data('sh')#获取上证指数k线数据,其它参数与个股一致,下同
      ts.get_hist_data('sz')#获取深圳成指k线数据
      ts.get_hist_data('hs300')#获取沪深300指数k线数据
      ts.get_hist_data('sz50')#获取上证50指数k线数据
      ts.get_hist_data('zxb')#获取中小板指数k线数据
      ts.get_hist_data('cyb')#获取创业板指数k线数据
    •  
    • 复权历史数据
    • df = ts.get_stock_basics()
      date = df.ix['600848']['timeToMarket'] #上市日期YYYYMMDD
    ts.get_h_data('002337') #前复权
    ts.get_h_data('002337', autype='hfq') #后复权
    ts.get_h_data('002337', autype=None) #不复权
    ts.get_h_data('002337', start='2015-01-01', end='2015-03-16') #两个日期之间的前复权数据
    
    ts.get_h_data('399106', index=True) #深圳综合指数

     

    • 实时行情数据
    • ts.get_today_all()
    • 历史分笔数据
    • df = ts.get_tick_data('600848',date='2014-01-09')
      df.head(10)
    • 实时报价数据
    • df = ts.get_realtime_quotes('000581') #Single stock symbol
      df[['code','name','price','bid','ask','volume','amount','time']]
    • #symbols from a list
      ts.get_realtime_quotes(['600848','000980','000981'])
      #from a Series
      ts.get_realtime_quotes(df['code'].tail(10))  #一次获取10个股票的实时分笔数据
    • #上证指数
      ts.get_realtime_quotes('sh')
      #上证指数 深圳成指 沪深300指数 上证50 中小板 创业板
      ts.get_realtime_quotes(['sh','sz','hs300','sz50','zxb','cyb'])
      #或者混搭
      ts.get_realtime_quotes(['sh','600848'])
    • 
      
    • 当日历史分笔
    • df = ts.get_today_ticks('601333')
      df.head(10)
    • 大盘指数列表
    • df = ts.get_index()
    • 大单交易数据
    df = ts.get_sina_dd('600848', date='2015-12-24') #默认400手
    #df = ts.get_sina_dd('600848', date='2015-12-24', vol=500)  #指定大于等于500手的数据

    股票分类数据

    行业分类   ts.get_industry_classified()
    概念分类   ts.get_concept_classified()
    地域分类   ts.get_area_classified()
    中小板分类   ts.get_sme_classified()
    创业板分类   ts.get_gem_classified()
    风险警示板分类   ts.get_st_classified()
    沪深300成份股及权重   ts.get_hs300s()
    上证50成份股    ts.get_sz50s()
    中证500成份股   ts.get_zz500s()
    终止上市股票列表   ts.get_terminated()
    暂停上市股票列表   ts.get_suspended()

  • 相关阅读:
    【Linux】VMware及VirtualBox网络配置
    【Linux】VirtualBox安装ubuntu排错LowGraphic
    【Hadoop】Win7上搭建Hadoop开发环境,方法一
    【JAVA】配置JAVA环境变量,安装Eclipse
    Eureka自我保护机制
    zookeeper代替eureka作为SpringCloud的服务注册中心
    mybatisplus代码生成器
    条件构造器 EntityWrapper (重要)
    idea 常用快捷键
    MybatisPlus的通用 CRUD
  • 原文地址:https://www.cnblogs.com/ttrrpp/p/6699361.html
Copyright © 2011-2022 走看看