Skip to content

Commit

Permalink
Use concept main_tag mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
foolcage committed Apr 27, 2024
1 parent 3c17234 commit d54a8f0
Show file tree
Hide file tree
Showing 28 changed files with 731 additions and 820 deletions.
14 changes: 2 additions & 12 deletions examples/data_runner/actor_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,13 @@

from apscheduler.schedulers.background import BackgroundScheduler

from examples.recorder_utils import run_data_recorder
from examples.utils import add_to_eastmoney
from zvt import init_log, zvt_config
from zvt.utils.recorder_utils import run_data_recorder
from zvt import init_log
from zvt.domain import (
Stock,
Stock1dHfqKdata,
Stockhk,
Stockhk1dHfqKdata,
Block,
Block1dKdata,
BlockCategory,
StockInstitutionalInvestorHolder,
StockTopTenFreeHolder,
StockActorSummary,
)
from zvt.informer import EmailInformer
from zvt.utils import date_time_by_interval, current_date

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion examples/data_runner/finance_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from apscheduler.schedulers.background import BackgroundScheduler

from examples.recorder_utils import run_data_recorder
from zvt.utils.recorder_utils import run_data_recorder
from zvt import init_log
from zvt.domain import (
Stock,
Expand Down
2 changes: 1 addition & 1 deletion examples/data_runner/index_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from apscheduler.schedulers.background import BackgroundScheduler

from examples.recorder_utils import run_data_recorder
from zvt.utils.recorder_utils import run_data_recorder
from zvt import init_log
from zvt.consts import IMPORTANT_INDEX
from zvt.domain import Index, Index1dKdata, IndexStock
Expand Down
2 changes: 1 addition & 1 deletion examples/data_runner/joinquant_fund_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from apscheduler.schedulers.background import BackgroundScheduler

from examples.recorder_utils import run_data_recorder
from zvt.utils.recorder_utils import run_data_recorder
from zvt import init_log
from zvt.domain import Fund, FundStock, StockValuation

Expand Down
2 changes: 1 addition & 1 deletion examples/data_runner/joinquant_kdata_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from apscheduler.schedulers.background import BackgroundScheduler

from examples.recorder_utils import run_data_recorder
from zvt.utils.recorder_utils import run_data_recorder
from zvt import init_log
from zvt.domain import Stock, Stock1dHfqKdata

Expand Down
2 changes: 1 addition & 1 deletion examples/data_runner/kdata_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from apscheduler.schedulers.background import BackgroundScheduler

from examples.recorder_utils import run_data_recorder
from zvt.utils.recorder_utils import run_data_recorder
from examples.report_utils import inform
from examples.utils import get_hot_topics
from zvt import init_log, zvt_config
Expand Down
6 changes: 2 additions & 4 deletions examples/data_runner/sina_data_runner.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
# -*- coding: utf-8 -*-
import logging
import time

from apscheduler.schedulers.background import BackgroundScheduler

from examples.recorder_utils import run_data_recorder
from zvt import init_log, zvt_config
from zvt.utils.recorder_utils import run_data_recorder
from zvt import init_log
from zvt.domain import *
from zvt.informer.informer import EmailInformer

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion examples/data_runner/trading_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from apscheduler.schedulers.background import BackgroundScheduler
from sqlalchemy import or_, and_

from examples.recorder_utils import run_data_recorder
from zvt.utils.recorder_utils import run_data_recorder
from examples.report_utils import inform
from zvt import init_log
from zvt.api import get_big_players, get_latest_kdata_date
Expand Down
2 changes: 1 addition & 1 deletion examples/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
zvt >= 0.10.1
apscheduler >= 3.4.0
eastmoneypy == 0.1.4
eastmoneypy == 0.1.5
tabulate>=0.8.8
ta
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ dash-bootstrap-components==1.3.1
dash_daq==0.5.0
scikit-learn==1.2.1
fastapi==0.110.0
fastapi-pagination==0.12.23
fastapi-pagination==0.12.23
apscheduler==3.10.4
5 changes: 4 additions & 1 deletion scripts/prepare_recent_data.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
from examples.recorder_utils import run_data_recorder
from zvt.tag.tag_models import ActivateSubTagsModel
from zvt.tag.tag_service import activate_sub_tags
from zvt.utils.recorder_utils import run_data_recorder
from zvt.api.selector import get_entity_ids_by_filter
from zvt.domain import StockEvents, BlockStock
from zvt.tag import StockAutoTagger
Expand Down Expand Up @@ -32,3 +34,4 @@
)

StockAutoTagger().tag()
# activate_sub_tags(ActivateSubTagsModel(sub_tags=["低空经济", "跨境支付"]))
2 changes: 1 addition & 1 deletion scripts/qmt_runner.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from examples.recorder_utils import run_data_recorder
from zvt.utils.recorder_utils import run_data_recorder
from zvt.api.selector import get_entity_ids_by_filter
from zvt.domain import Stock1dHfqKdata

Expand Down
4 changes: 2 additions & 2 deletions scripts/report_stock_by_tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ def report_vol_up_stocks(main_line_tags):
# 放入股票池
build_system_stock_pools()

build_stock_pool_tag_stats(stock_pool_name="main_line", force_rebuild_latest=True)
build_stock_pool_tag_stats(stock_pool_name="vol_up", force_rebuild_latest=True)
build_stock_pool_tag_stats(stock_pool_name="main_line")
build_stock_pool_tag_stats(stock_pool_name="vol_up")

main_line_tags = report_main_line_stocks()
logger.info(f"mainline is :{main_line_tags}")
Expand Down
8 changes: 4 additions & 4 deletions src/zvt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,10 @@ def old_db_to_provider_dir(data_path):
import zvt.recorders as zvt_recorders
import zvt.factors as zvt_factors

try:
import zvt.recorders.qmt.quotes.qmt_kdata_recorder as qmt_kdata_recorde
except Exception as e:
logger.warning("QMT need run in Windows!", e)
# try:
# import zvt.recorders.qmt.quotes.qmt_kdata_recorder as qmt_kdata_recorde
# except Exception as e:
# logger.warning("QMT need run in Windows!", e)


__all__ = ["zvt_env", "zvt_config", "init_log", "init_env", "init_config", "__version__"]
5 changes: 3 additions & 2 deletions src/zvt/sched/sched.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
from apscheduler.jobstores.sqlalchemy import SQLAlchemyJobStore
from apscheduler.schedulers.background import BackgroundScheduler

from zvt import zvt_env
from zvt import ZVT_HOME

jobs_db_path = os.path.join(ZVT_HOME, "jobs.db")

jobs_db_path = os.path.join(zvt_env["data_path"], "jobs.db")

jobstores = {"default": SQLAlchemyJobStore(url=f"sqlite:///{jobs_db_path}")}

Expand Down
2 changes: 2 additions & 0 deletions src/zvt/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
from zvt.rest.work import work_router
from fastapi.middleware.cors import CORSMiddleware

from zvt.sched.sched import zvt_scheduler

app = FastAPI()

origins = ["*"]
Expand Down
Loading

0 comments on commit d54a8f0

Please sign in to comment.