zvtvz / zvt

modular quant framework.
https://zvt.readthedocs.io/en/latest/
MIT License
3.13k stars 856 forks source link

从3月31日版本升级到4月最新的版本,出现结构异常 #68

Closed wisfern closed 4 years ago

wisfern commented 4 years ago

AttributeError: 'Stock' object has no attribute 'industries'

请问,是否有如下东西: 1、模型升级的sql文件 2、migration脚本?

如东财,有一段更数账务数据,会遇到判断这个票是什么类型的东西,更新后的代码就没有这个归属关系,导致跑数异常 def get_company_type(stock_domain: StockDetail): industries = stock_domain.industries.split(',') if ('银行' in industries) or ('信托' in industries): return CompanyType.yinhang if '保险' in industries: return CompanyType.baoxian if '证券' in industries: return CompanyType.quanshang return CompanyType.qiye

def company_type_flag(security_item): try: company_type = get_company_type(security_item)

    if company_type == CompanyType.qiye:
        return "4"
    if company_type == CompanyType.quanshang:
        return "1"
    if company_type == CompanyType.baoxian:
        return "2"
    if company_type == CompanyType.yinhang:
        return "3"
except Exception as e:
    logger.exception(f"id{security_item.code}-{security_item.industries}", e)

param = {
    "color": "w",
    "fc": get_fc(security_item)
}

resp = requests.post('https://emh5.eastmoney.com/api/CaiWuFenXi/GetCompanyType', json=param)

ct = resp.json().get('Result').get('CompanyType')

logger.warning("{} not catching company type:{}".format(security_item, ct))

return ct
wisfern commented 4 years ago

看了最新的文档,貌似现在没有查询资产标的所归属的板块api,只能直接查询domain中的BlockStock?

foolcage commented 4 years ago

看了最新的文档,貌似现在没有查询资产标的所归属的板块api,只能直接查询domain中的BlockStock?

嗯 组合(BasePortfolio)目前有一个函数叫get_stocks,用于获取Block,Index,Etf里面包含的个股

反过来,个股属于哪些板块,目前只能从BlockStock里面查询。

foolcage commented 4 years ago

1、模型升级的sql文件 2、migration脚本

目前最大的改动就是去掉之前 Stock 和 组合 的关系,需要删掉之前的meta库,重新更新一下。 其他的没有变。

wisfern commented 4 years ago

好的