GatBasics.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:Python-Quant 作者: saberxxy 项目源码 文件源码
def getCompany():
    """code ??, name ??, industry ????, area ??, pe ???, outstanding ????(?), totals ???(?),
    totalAssets ???(?), liquidAssets ????, fixedAssets ????, reserved ???, reservedPerShare ?????,
    esp ????, bvps ????, pb ???, timeToMarket ????, undp ????, perundp ?????, rev ????(%),
    profit ????(%), gpr ???(%), npr ????(%), holders ???? """
    try:
        basics = ts.get_stock_basics()
        index = list(basics.index)  #????
        name = list(basics.name)  #????
        industry = list(basics.industry)  #????
        indexLen = len(index)

        cur1 = conn.cursor()
        cur1.execute("DROP TABLE IF EXISTS basics;")  #????????????
        sqlCreate = """create table basics
                       (b_id int comment '??',
                       b_index varchar(100) comment '????',
                       b_name varchar(100) comment '????',
                       b_industry varchar(100) comment '????',
                       PRIMARY key(b_id))"""
        cur1.execute(sqlCreate)

        for i in range(0, indexLen):
            print (i+1, index[i], name[i], industry[i])

            cur1.execute(
                "INSERT INTO basics(b_id, b_index, b_name, b_industry) "
                "VALUES('%d', '%s', '%s', '%s');"
                 % (i+1, index[i], name[i], industry[i]))

        cur1.execute('commit;')
        print ('?????')
    except Exception:
        pass
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号