From 8210e5ee00940791df5c6487956fa35431662afc Mon Sep 17 00:00:00 2001 From: foolcage <5533061@qq.com> Date: Mon, 4 Jan 2021 20:03:07 +0800 Subject: [PATCH] 1) move portfolio to contract schema 2) add fund entity --- zvt/contract/__init__.py | 5 +- zvt/contract/schema.py | 69 ++++++++++++++++++- zvt/domain/meta/fund.py | 50 ++++++++++++++ zvt/domain/meta/stock_meta.py | 66 +++--------------- zvt/recorders/joinquant/__init__.py | 5 -- zvt/recorders/joinquant/common.py | 14 ++-- .../joinquant/fundamental/__init__.py | 5 +- .../fundamental/etf_valuation_recorder.py | 2 +- .../joinquant_margin_trading_recorder.py | 2 +- .../fundamental/stock_valuation_recorder.py | 2 +- zvt/recorders/joinquant/meta/__init__.py | 7 +- .../meta/china_fund_meta_recorder.py | 65 +++++++++++++++++ .../meta/china_stock_meta_recorder.py | 2 +- .../meta/stock_trade_day_recorder.py | 2 +- zvt/recorders/joinquant/misc/__init__.py | 1 - .../misc/joinquant_hk_holder_recorder.py | 2 +- .../joinquant_index_money_flow_recorder.py | 2 +- .../joinquant_stock_money_flow_recorder.py | 2 +- zvt/recorders/joinquant/overall/__init__.py | 3 - .../overall/cross_market_recorder.py | 2 +- .../overall/margin_trading_recorder.py | 2 +- .../overall/stock_summary_recorder.py | 2 +- zvt/recorders/joinquant/quotes/__init__.py | 3 +- .../quotes/jq_index_kdata_recorder.py | 2 +- .../quotes/jq_stock_kdata_recorder.py | 2 +- 25 files changed, 225 insertions(+), 94 deletions(-) create mode 100644 zvt/domain/meta/fund.py create mode 100644 zvt/recorders/joinquant/meta/china_fund_meta_recorder.py diff --git a/zvt/contract/__init__.py b/zvt/contract/__init__.py index d151f6c7..f63238ab 100644 --- a/zvt/contract/__init__.py +++ b/zvt/contract/__init__.py @@ -108,6 +108,7 @@ class AdjustType(enum.Enum): from . import zvt_context -from .schema import Mixin, NormalMixin, EntityMixin, NormalEntityMixin +from .schema import Mixin, NormalMixin, EntityMixin, NormalEntityMixin, PortfolioStock, Portfolio, PortfolioStockHistory -__all__ = ['IntervalLevel', 'Mixin', 'NormalMixin', 'EntityMixin', 'NormalEntityMixin', 'zvt_context', 'AdjustType'] +__all__ = ['IntervalLevel', 'Mixin', 'NormalMixin', 'EntityMixin', 'NormalEntityMixin', 'zvt_context', 'AdjustType', + 'Portfolio', 'PortfolioStock', 'PortfolioStockHistory'] diff --git a/zvt/contract/schema.py b/zvt/contract/schema.py index 63e9279c..40d4b29a 100644 --- a/zvt/contract/schema.py +++ b/zvt/contract/schema.py @@ -4,11 +4,11 @@ from typing import List, Union import pandas as pd -from sqlalchemy import Column, String, DateTime +from sqlalchemy import Column, String, DateTime, Float from sqlalchemy.orm import Session from zvt.contract import IntervalLevel -from zvt.utils.time_utils import date_and_time, is_same_time +from zvt.utils.time_utils import date_and_time, is_same_time, now_pd_timestamp class Mixin(object): @@ -178,11 +178,30 @@ class NormalMixin(Mixin): updated_timestamp = Column(DateTime) +class Player(Mixin): + # 参与者类型 + player_type = Column(String(length=64)) + # 所属国家 + country = Column(String(length=32)) + # 编码 + code = Column(String(length=64)) + # 名字 + name = Column(String(length=128)) + + class EntityMixin(Mixin): + # 标的类型 entity_type = Column(String(length=64)) + # 所属交易所 exchange = Column(String(length=32)) + # 编码 code = Column(String(length=64)) + # 名字 name = Column(String(length=128)) + # 上市日 + list_date = Column(DateTime) + # 退市日 + end_date = Column(DateTime) @classmethod def get_trading_dates(cls, start_date=None, end_date=None): @@ -286,3 +305,49 @@ class NormalEntityMixin(EntityMixin): created_timestamp = Column(DateTime, default=pd.Timestamp.now()) # the record updated time in db, some recorder would check it for whether need to refresh updated_timestamp = Column(DateTime) + + +class Portfolio(EntityMixin): + @classmethod + def get_stocks(cls, + code=None, codes=None, ids=None, timestamp=now_pd_timestamp(), provider=None): + """ + + :param code: portfolio(etf/block/index...) code + :param codes: portfolio(etf/block/index...) codes + :param timestamp: + :param provider: + :return: + """ + from zvt.contract.api import get_schema_by_name + schema_str = f'{cls.__name__}Stock' + portfolio_stock = get_schema_by_name(schema_str) + return portfolio_stock.query_data(provider=provider, code=code, codes=codes, timestamp=timestamp, ids=ids) + + +# 组合(Etf,Index,Block)和个股(Stock)的关系 应该继承自该类 +# 该基础类可以这样理解: +# entity为组合本身,其包含了stock这种entity,timestamp为持仓日期,从py的"你知道你在干啥"的哲学出发,不加任何约束 +class PortfolioStock(EntityMixin): + stock_id = Column(String) + stock_code = Column(String(length=64)) + stock_name = Column(String(length=128)) + + +# 支持时间变化,报告期标的调整 +class PortfolioStockHistory(PortfolioStock): + # 报告期,season1,half_year,season3,year + report_period = Column(String(length=32)) + # 3-31,6-30,9-30,12-31 + report_date = Column(DateTime) + + # 占净值比例 + proportion = Column(Float) + # 持有股票的数量 + shares = Column(Float) + # 持有股票的市值 + market_cap = Column(Float) + + +__all__ = ['EntityMixin', 'Mixin', 'NormalMixin', 'NormalEntityMixin', 'Portfolio', 'PortfolioStock', + 'PortfolioStockHistory'] diff --git a/zvt/domain/meta/fund.py b/zvt/domain/meta/fund.py new file mode 100644 index 00000000..0c06e725 --- /dev/null +++ b/zvt/domain/meta/fund.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +from sqlalchemy import Column, String, Integer +from sqlalchemy.ext.declarative import declarative_base + +from zvt.contract import EntityMixin, PortfolioStockHistory +from zvt.contract.register import register_entity, register_schema + +FundMetaBase = declarative_base() + + +# 个股 +@register_entity(entity_type='fund') +class Fund(FundMetaBase, EntityMixin): + __tablename__ = 'fund' + # 基金管理人 + advisor = Column(String(length=100)) + # 基金托管人 + trustee = Column(String(length=100)) + + # 编码 基金运作方式 + # 401001 开放式基金 + # 401002 封闭式基金 + # 401003 QDII + # 401004 FOF + # 401005 ETF + # 401006 LOF + # 基金运作方式编码 + operate_mode_id = Column(Integer) + # 基金运作方式 + operate_mode = Column(String(length=32)) + + # 编码 基金类别 + # 402001 股票型 + # 402002 货币型 + # 402003 债券型 + # 402004 混合型 + # 402005 基金型 + # 402006 贵金属 + # 402007 封闭式 + # 投资标的类型编码 + underlying_asset_type_id = Column(Integer) + # 投资标的类型 + underlying_asset_type = Column(String(length=32)) + + +class FundStock(FundMetaBase, PortfolioStockHistory): + __tablename__ = 'fund_stock' + + +register_schema(providers=['joinquant'], db_name='fund_meta', schema_base=FundMetaBase) diff --git a/zvt/domain/meta/stock_meta.py b/zvt/domain/meta/stock_meta.py index 8a2e9a03..a251fb8f 100644 --- a/zvt/domain/meta/stock_meta.py +++ b/zvt/domain/meta/stock_meta.py @@ -5,43 +5,21 @@ from zvt.contract import EntityMixin from zvt.contract.register import register_schema, register_entity +from zvt.contract.schema import Portfolio, PortfolioStock, PortfolioStockHistory from zvt.utils.time_utils import now_pd_timestamp StockMetaBase = declarative_base() -class BaseSecurity(EntityMixin): - # 上市日 - list_date = Column(DateTime) - # 退市日 - end_date = Column(DateTime) - - -class BasePortfolio(BaseSecurity): - @classmethod - def get_stocks(cls, - code=None, codes=None, ids=None, timestamp=now_pd_timestamp(), provider=None): - """ - - :param code: portfolio(etf/block/index...) code - :param codes: portfolio(etf/block/index...) codes - :param timestamp: - :param provider: - :return: - """ - portfolio_stock: BasePortfolioStock = eval(f'{cls.__name__}Stock') - return portfolio_stock.query_data(provider=provider, code=code, codes=codes, ids=ids) - - # 个股 @register_entity(entity_type='stock') -class Stock(StockMetaBase, BaseSecurity): +class Stock(StockMetaBase, EntityMixin): __tablename__ = 'stock' # 板块 @register_entity(entity_type='block') -class Block(StockMetaBase, BasePortfolio): +class Block(StockMetaBase, Portfolio): __tablename__ = 'block' # 板块类型,行业(industry),概念(concept) @@ -50,7 +28,7 @@ class Block(StockMetaBase, BasePortfolio): # 指数 @register_entity(entity_type='index') -class Index(StockMetaBase, BasePortfolio): +class Index(StockMetaBase, Portfolio): __tablename__ = 'index' # 发布商 @@ -63,7 +41,7 @@ class Index(StockMetaBase, BasePortfolio): # etf @register_entity(entity_type='etf') -class Etf(StockMetaBase, BasePortfolio): +class Etf(StockMetaBase, Portfolio): __tablename__ = 'etf' category = Column(String(length=64)) @@ -73,45 +51,21 @@ def get_stocks(cls, code=None, codes=None, ids=None, timestamp=now_pd_timestamp( return get_etf_stocks(code=code, codes=codes, ids=ids, timestamp=timestamp, provider=provider) -# 组合(Etf,Index,Block)和个股(Stock)的关系 应该继承自该类 -# 该基础类可以这样理解: -# entity为组合本身,其包含了stock这种entity,timestamp为持仓日期,从py的"你知道你在干啥"的哲学出发,不加任何约束 -class BasePortfolioStock(EntityMixin): - stock_id = Column(String) - stock_code = Column(String(length=64)) - stock_name = Column(String(length=128)) - - -# 支持时间变化,报告期标的调整 -class BasePortfolioStockHistory(BasePortfolioStock): - # 报告期,season1,half_year,season3,year - report_period = Column(String(length=32)) - # 3-31,6-30,9-30,12-31 - report_date = Column(DateTime) - - # 占净值比例 - proportion = Column(Float) - # 持有股票的数量 - shares = Column(Float) - # 持有股票的市值 - market_cap = Column(Float) - - -class BlockStock(StockMetaBase, BasePortfolioStock): +class BlockStock(StockMetaBase, PortfolioStock): __tablename__ = 'block_stock' -class IndexStock(StockMetaBase, BasePortfolioStockHistory): +class IndexStock(StockMetaBase, PortfolioStockHistory): __tablename__ = 'index_stock' -class EtfStock(StockMetaBase, BasePortfolioStockHistory): +class EtfStock(StockMetaBase, PortfolioStockHistory): __tablename__ = 'etf_stock' # 个股详情 @register_entity(entity_type='stock_detail') -class StockDetail(StockMetaBase, BaseSecurity): +class StockDetail(StockMetaBase, EntityMixin): __tablename__ = 'stock_detail' industries = Column(String) @@ -141,4 +95,4 @@ class StockDetail(StockMetaBase, BaseSecurity): schema_base=StockMetaBase) # the __all__ is generated -__all__ = ['BaseSecurity', 'BasePortfolio', 'Stock', 'Block', 'Index', 'Etf', 'BasePortfolioStock', 'BasePortfolioStockHistory', 'BlockStock', 'IndexStock', 'EtfStock', 'StockDetail'] \ No newline at end of file +__all__ = ['Stock', 'Block', 'Index', 'Etf', 'BlockStock', 'IndexStock', 'EtfStock', 'StockDetail'] diff --git a/zvt/recorders/joinquant/__init__.py b/zvt/recorders/joinquant/__init__.py index 7790c917..969efda5 100644 --- a/zvt/recorders/joinquant/__init__.py +++ b/zvt/recorders/joinquant/__init__.py @@ -1,9 +1,4 @@ # -*- coding: utf-8 -*- -from zvt.recorders.joinquant.fundamental import * -from zvt.recorders.joinquant.meta import * -from zvt.recorders.joinquant.misc import * -from zvt.recorders.joinquant.overall import * -from zvt.recorders.joinquant.quotes import * # the __all__ is generated __all__ = [] diff --git a/zvt/recorders/joinquant/common.py b/zvt/recorders/joinquant/common.py index 74b42ee2..5eb818f4 100644 --- a/zvt/recorders/joinquant/common.py +++ b/zvt/recorders/joinquant/common.py @@ -28,10 +28,14 @@ def to_jq_entity_id(security_item): def to_entity_id(jq_code: str, entity_type): - code, exchange = jq_code.split('.') - if exchange == 'XSHG': - exchange = 'sh' - elif exchange == 'XSHE': + try: + code, exchange = jq_code.split('.') + if exchange == 'XSHG': + exchange = 'sh' + elif exchange == 'XSHE': + exchange = 'sz' + except: + code = jq_code exchange = 'sz' return f'{entity_type}_{exchange}_{code}' @@ -51,5 +55,7 @@ def jq_to_report_period(jq_report_type): if jq_report_type == '年度': return ReportPeriod.year.value assert False + + # the __all__ is generated __all__ = ['to_jq_trading_level', 'to_jq_entity_id', 'to_entity_id', 'jq_to_report_period'] \ No newline at end of file diff --git a/zvt/recorders/joinquant/fundamental/__init__.py b/zvt/recorders/joinquant/fundamental/__init__.py index 5968e53c..f8663686 100644 --- a/zvt/recorders/joinquant/fundamental/__init__.py +++ b/zvt/recorders/joinquant/fundamental/__init__.py @@ -1,8 +1,5 @@ # -*- coding: utf-8 -*- - -from zvt.recorders.joinquant.fundamental.etf_valuation_recorder import * -from zvt.recorders.joinquant.fundamental.stock_valuation_recorder import * -from zvt.recorders.joinquant.fundamental.joinquant_margin_trading_recorder import *# the __all__ is generated +# the __all__ is generated __all__ = [] # __init__.py structure: diff --git a/zvt/recorders/joinquant/fundamental/etf_valuation_recorder.py b/zvt/recorders/joinquant/fundamental/etf_valuation_recorder.py index d18eef7f..5b4db702 100644 --- a/zvt/recorders/joinquant/fundamental/etf_valuation_recorder.py +++ b/zvt/recorders/joinquant/fundamental/etf_valuation_recorder.py @@ -116,4 +116,4 @@ def record(self, entity, start, end, size, timestamps): # 上证50 JqChinaEtfValuationRecorder(codes=['512290']).run() # the __all__ is generated -__all__ = ['JqChinaEtfValuationRecorder'] +__all__ = ['JqChinaEtfValuationRecorder'] \ No newline at end of file diff --git a/zvt/recorders/joinquant/fundamental/joinquant_margin_trading_recorder.py b/zvt/recorders/joinquant/fundamental/joinquant_margin_trading_recorder.py index 84344d2e..39eac368 100644 --- a/zvt/recorders/joinquant/fundamental/joinquant_margin_trading_recorder.py +++ b/zvt/recorders/joinquant/fundamental/joinquant_margin_trading_recorder.py @@ -47,4 +47,4 @@ def record(self, entity, start, end, size, timestamps): if __name__ == '__main__': MarginTradingRecorder(codes=['000004']).run() # the __all__ is generated -__all__ = ['MarginTradingRecorder'] +__all__ = ['MarginTradingRecorder'] \ No newline at end of file diff --git a/zvt/recorders/joinquant/fundamental/stock_valuation_recorder.py b/zvt/recorders/joinquant/fundamental/stock_valuation_recorder.py index 8f262bf5..18beea38 100644 --- a/zvt/recorders/joinquant/fundamental/stock_valuation_recorder.py +++ b/zvt/recorders/joinquant/fundamental/stock_valuation_recorder.py @@ -67,4 +67,4 @@ def record(self, entity, start, end, size, timestamps): JqChinaStockValuationRecorder(entity_ids=['stock_sh_600000'], force_update=True).run() # the __all__ is generated -__all__ = ['JqChinaStockValuationRecorder'] +__all__ = ['JqChinaStockValuationRecorder'] \ No newline at end of file diff --git a/zvt/recorders/joinquant/meta/__init__.py b/zvt/recorders/joinquant/meta/__init__.py index 76ad9e9e..7298b976 100644 --- a/zvt/recorders/joinquant/meta/__init__.py +++ b/zvt/recorders/joinquant/meta/__init__.py @@ -1,6 +1,4 @@ # -*- coding: utf-8 -*- -from zvt.recorders.joinquant.meta.china_stock_meta_recorder import * -from zvt.recorders.joinquant.meta.stock_trade_day_recorder import * # the __all__ is generated __all__ = [] @@ -8,6 +6,11 @@ # common code of the package # export interface in __all__ which contains __all__ of its sub modules +# import all from submodule china_fund_meta_recorder +from .china_fund_meta_recorder import * +from .china_fund_meta_recorder import __all__ as _china_fund_meta_recorder_all +__all__ += _china_fund_meta_recorder_all + # import all from submodule china_stock_meta_recorder from .china_stock_meta_recorder import * from .china_stock_meta_recorder import __all__ as _china_stock_meta_recorder_all diff --git a/zvt/recorders/joinquant/meta/china_fund_meta_recorder.py b/zvt/recorders/joinquant/meta/china_fund_meta_recorder.py new file mode 100644 index 00000000..818f66c4 --- /dev/null +++ b/zvt/recorders/joinquant/meta/china_fund_meta_recorder.py @@ -0,0 +1,65 @@ +# -*- coding: utf-8 -*- +import pandas as pd +from jqdatapy.api import run_query + +from zvt.contract.api import df_to_db +from zvt.contract.recorder import Recorder +from zvt.domain.meta.fund import Fund +from zvt.recorders.joinquant.common import to_entity_id +from zvt.utils.pd_utils import pd_is_not_null +from zvt.utils.time_utils import to_time_str, next_date, now_pd_timestamp, is_same_date + + +class JqChinaFundRecorder(Recorder): + data_schema = Fund + + def run(self): + # 按不同类别抓取 + # 编码 基金运作方式 + # 401001 开放式基金 + # 401002 封闭式基金 + # 401003 QDII + # 401004 FOF + # 401005 ETF + # 401006 LOF + for operate_mode_id in (401001, 401002, 401005): + year_count = 2 + while True: + latest = Fund.query_data(filters=[Fund.operate_mode_id == operate_mode_id], order=Fund.timestamp.desc(), + limit=1, return_type='domain') + start_timestamp = '2000-01-01' + if latest: + start_timestamp = latest[0].timestamp + + end_timestamp = min(next_date(start_timestamp, 365 * year_count), now_pd_timestamp()) + + df = run_query(table='finance.FUND_MAIN_INFO', + conditions=f'operate_mode_id#=#{operate_mode_id}&start_date#>=#{to_time_str(start_timestamp)}&start_date#<=#{to_time_str(end_timestamp)}', + parse_dates=['start_date', 'end_date'], + dtype={'main_code': str}) + if not pd_is_not_null(df) or (df['start_date'].max().year < end_timestamp.year): + year_count = year_count + 1 + + if pd_is_not_null(df): + df.rename(columns={'start_date': 'timestamp'}, inplace=True) + df['timestamp'] = pd.to_datetime(df['timestamp']) + df['list_date'] = df['timestamp'] + df['end_date'] = pd.to_datetime(df['end_date']) + + df['code'] = df['main_code'] + df['entity_id'] = df['code'].apply(lambda x: to_entity_id(entity_type='fund', jq_code=x)) + df['id'] = df['entity_id'] + df['entity_type'] = 'fund' + df['exchange'] = 'sz' + df_to_db(df, data_schema=Fund, provider=self.provider, force_update=self.force_update) + self.logger.info( + f'persist fund {operate_mode_id} list success {start_timestamp} to {end_timestamp}') + + if is_same_date(end_timestamp, now_pd_timestamp()): + break + + +if __name__ == '__main__': + JqChinaFundRecorder().run() +# the __all__ is generated +__all__ = ['JqChinaFundRecorder'] \ No newline at end of file diff --git a/zvt/recorders/joinquant/meta/china_stock_meta_recorder.py b/zvt/recorders/joinquant/meta/china_stock_meta_recorder.py index 35f75b55..75769105 100644 --- a/zvt/recorders/joinquant/meta/china_stock_meta_recorder.py +++ b/zvt/recorders/joinquant/meta/china_stock_meta_recorder.py @@ -115,4 +115,4 @@ def record(self, entity, start, end, size, timestamps): # JqChinaEtfRecorder().run() JqChinaStockEtfPortfolioRecorder(codes=['510050']).run() # the __all__ is generated -__all__ = ['BaseJqChinaMetaRecorder', 'JqChinaStockRecorder', 'JqChinaEtfRecorder', 'JqChinaStockEtfPortfolioRecorder'] +__all__ = ['BaseJqChinaMetaRecorder', 'JqChinaStockRecorder', 'JqChinaEtfRecorder', 'JqChinaStockEtfPortfolioRecorder'] \ No newline at end of file diff --git a/zvt/recorders/joinquant/meta/stock_trade_day_recorder.py b/zvt/recorders/joinquant/meta/stock_trade_day_recorder.py index a9381edf..449713d5 100644 --- a/zvt/recorders/joinquant/meta/stock_trade_day_recorder.py +++ b/zvt/recorders/joinquant/meta/stock_trade_day_recorder.py @@ -38,4 +38,4 @@ def record(self, entity, start, end, size, timestamps): r = StockTradeDayRecorder() r.run() # the __all__ is generated -__all__ = ['StockTradeDayRecorder'] +__all__ = ['StockTradeDayRecorder'] \ No newline at end of file diff --git a/zvt/recorders/joinquant/misc/__init__.py b/zvt/recorders/joinquant/misc/__init__.py index 66c43153..14fa4edc 100644 --- a/zvt/recorders/joinquant/misc/__init__.py +++ b/zvt/recorders/joinquant/misc/__init__.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- -from zvt.recorders.joinquant.misc.joinquant_hk_holder_recorder import * # the __all__ is generated __all__ = [] diff --git a/zvt/recorders/joinquant/misc/joinquant_hk_holder_recorder.py b/zvt/recorders/joinquant/misc/joinquant_hk_holder_recorder.py index 3a9afe12..9d4d274d 100644 --- a/zvt/recorders/joinquant/misc/joinquant_hk_holder_recorder.py +++ b/zvt/recorders/joinquant/misc/joinquant_hk_holder_recorder.py @@ -84,4 +84,4 @@ def record(self, entity, start, end, size, timestamps): if __name__ == '__main__': JoinquantHkHolderRecorder(sleeping_time=10).run() # the __all__ is generated -__all__ = ['JoinquantHkHolderRecorder'] +__all__ = ['JoinquantHkHolderRecorder'] \ No newline at end of file diff --git a/zvt/recorders/joinquant/misc/joinquant_index_money_flow_recorder.py b/zvt/recorders/joinquant/misc/joinquant_index_money_flow_recorder.py index 3e22e8af..87853ef3 100644 --- a/zvt/recorders/joinquant/misc/joinquant_index_money_flow_recorder.py +++ b/zvt/recorders/joinquant/misc/joinquant_index_money_flow_recorder.py @@ -78,4 +78,4 @@ def record(self, entity, start, end, size, timestamps): if __name__ == '__main__': JoinquantIndexMoneyFlowRecorder(start_timestamp='2020-12-01').run() # the __all__ is generated -__all__ = ['JoinquantIndexMoneyFlowRecorder'] +__all__ = ['JoinquantIndexMoneyFlowRecorder'] \ No newline at end of file diff --git a/zvt/recorders/joinquant/misc/joinquant_stock_money_flow_recorder.py b/zvt/recorders/joinquant/misc/joinquant_stock_money_flow_recorder.py index 5ad3a36f..48e63086 100644 --- a/zvt/recorders/joinquant/misc/joinquant_stock_money_flow_recorder.py +++ b/zvt/recorders/joinquant/misc/joinquant_stock_money_flow_recorder.py @@ -117,4 +117,4 @@ def generate_kdata_id(se): if __name__ == '__main__': JoinquantStockMoneyFlowRecorder(codes=['000578']).run() # the __all__ is generated -__all__ = ['JoinquantStockMoneyFlowRecorder'] +__all__ = ['JoinquantStockMoneyFlowRecorder'] \ No newline at end of file diff --git a/zvt/recorders/joinquant/overall/__init__.py b/zvt/recorders/joinquant/overall/__init__.py index 9776fb50..119d3132 100644 --- a/zvt/recorders/joinquant/overall/__init__.py +++ b/zvt/recorders/joinquant/overall/__init__.py @@ -1,7 +1,4 @@ # -*- coding: utf-8 -*- -from zvt.recorders.joinquant.overall.cross_market_recorder import * -from zvt.recorders.joinquant.overall.margin_trading_recorder import * -from zvt.recorders.joinquant.overall.stock_summary_recorder import * # the __all__ is generated __all__ = [] diff --git a/zvt/recorders/joinquant/overall/cross_market_recorder.py b/zvt/recorders/joinquant/overall/cross_market_recorder.py index 186855d9..de2bc7d2 100644 --- a/zvt/recorders/joinquant/overall/cross_market_recorder.py +++ b/zvt/recorders/joinquant/overall/cross_market_recorder.py @@ -65,4 +65,4 @@ def get_data_map(self): if __name__ == '__main__': CrossMarketSummaryRecorder(batch_size=30).run() # the __all__ is generated -__all__ = ['CrossMarketSummaryRecorder'] +__all__ = ['CrossMarketSummaryRecorder'] \ No newline at end of file diff --git a/zvt/recorders/joinquant/overall/margin_trading_recorder.py b/zvt/recorders/joinquant/overall/margin_trading_recorder.py index d9d24612..c651a086 100644 --- a/zvt/recorders/joinquant/overall/margin_trading_recorder.py +++ b/zvt/recorders/joinquant/overall/margin_trading_recorder.py @@ -65,4 +65,4 @@ def get_data_map(self): if __name__ == '__main__': MarginTradingSummaryRecorder(batch_size=30).run() # the __all__ is generated -__all__ = ['MarginTradingSummaryRecorder'] +__all__ = ['MarginTradingSummaryRecorder'] \ No newline at end of file diff --git a/zvt/recorders/joinquant/overall/stock_summary_recorder.py b/zvt/recorders/joinquant/overall/stock_summary_recorder.py index 39a8a60b..6b94e884 100644 --- a/zvt/recorders/joinquant/overall/stock_summary_recorder.py +++ b/zvt/recorders/joinquant/overall/stock_summary_recorder.py @@ -76,4 +76,4 @@ def get_data_map(self): if __name__ == '__main__': StockSummaryRecorder(batch_size=30).run() # the __all__ is generated -__all__ = ['StockSummaryRecorder'] +__all__ = ['StockSummaryRecorder'] \ No newline at end of file diff --git a/zvt/recorders/joinquant/quotes/__init__.py b/zvt/recorders/joinquant/quotes/__init__.py index eb0d7434..75f35537 100644 --- a/zvt/recorders/joinquant/quotes/__init__.py +++ b/zvt/recorders/joinquant/quotes/__init__.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- -from zvt.recorders.joinquant.quotes.jq_stock_kdata_recorder import * -from zvt.recorders.joinquant.quotes.jq_index_kdata_recorder import *# the __all__ is generated +# the __all__ is generated __all__ = [] # __init__.py structure: diff --git a/zvt/recorders/joinquant/quotes/jq_index_kdata_recorder.py b/zvt/recorders/joinquant/quotes/jq_index_kdata_recorder.py index 6b0a487c..66b450a9 100644 --- a/zvt/recorders/joinquant/quotes/jq_index_kdata_recorder.py +++ b/zvt/recorders/joinquant/quotes/jq_index_kdata_recorder.py @@ -115,4 +115,4 @@ def generate_kdata_id(se): print(get_kdata(entity_id='index_sz_000001', limit=10)) # the __all__ is generated -__all__ = ['JqChinaIndexKdataRecorder'] +__all__ = ['JqChinaIndexKdataRecorder'] \ No newline at end of file diff --git a/zvt/recorders/joinquant/quotes/jq_stock_kdata_recorder.py b/zvt/recorders/joinquant/quotes/jq_stock_kdata_recorder.py index 7812aa1f..53f7296c 100644 --- a/zvt/recorders/joinquant/quotes/jq_stock_kdata_recorder.py +++ b/zvt/recorders/joinquant/quotes/jq_stock_kdata_recorder.py @@ -154,4 +154,4 @@ def generate_kdata_id(se): print(get_kdata(entity_id='stock_sz_000001', limit=10, order=Stock1dHfqKdata.timestamp.desc(), adjust_type=AdjustType.hfq)) # the __all__ is generated -__all__ = ['JqChinaStockKdataRecorder'] +__all__ = ['JqChinaStockKdataRecorder'] \ No newline at end of file