Skip to content

Commit

Permalink
1)unify exports 2)add resources
Browse files Browse the repository at this point in the history
  • Loading branch information
foolcage committed Jun 13, 2024
1 parent 2d4ead0 commit 74e605b
Show file tree
Hide file tree
Showing 147 changed files with 872 additions and 634 deletions.
2 changes: 1 addition & 1 deletion examples/data_runner/actor_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

from apscheduler.schedulers.background import BackgroundScheduler

from zvt.utils.recorder_utils import run_data_recorder
from zvt import init_log
from zvt.domain import (
StockInstitutionalInvestorHolder,
StockTopTenFreeHolder,
StockActorSummary,
)
from zvt.utils.recorder_utils import run_data_recorder

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,6 @@

from apscheduler.schedulers.background import BackgroundScheduler

from zvt.utils.recorder_utils import run_data_recorder
from zvt import init_log
from zvt.domain import (
Stock,
Expand All @@ -13,6 +12,7 @@
IncomeStatement,
CashFlowStatement,
)
from zvt.utils.recorder_utils import run_data_recorder

logger = logging.getLogger(__name__)

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,10 +3,10 @@

from apscheduler.schedulers.background import BackgroundScheduler

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
from zvt.utils.recorder_utils import run_data_recorder

logger = logging.getLogger(__name__)

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,9 +3,9 @@

from apscheduler.schedulers.background import BackgroundScheduler

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

logger = logging.getLogger(__name__)

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,6 @@

from apscheduler.schedulers.background import BackgroundScheduler

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 All @@ -23,6 +22,7 @@
)
from zvt.informer import EmailInformer
from zvt.utils import current_date
from zvt.utils.recorder_utils import run_data_recorder

logger = logging.getLogger(__name__)

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

from apscheduler.schedulers.background import BackgroundScheduler

from zvt.utils.recorder_utils import run_data_recorder
from zvt import init_log
from zvt.domain import *
from zvt.utils.recorder_utils import run_data_recorder

logger = logging.getLogger(__name__)

Expand Down
7 changes: 4 additions & 3 deletions examples/data_runner/trading_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@
from apscheduler.schedulers.background import BackgroundScheduler
from sqlalchemy import or_, and_

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
from zvt.api.kdata import get_latest_kdata_date
from zvt.api.selector import get_big_players
from zvt.domain import (
DragonAndTiger,
Stock1dHfqKdata,
)
from zvt.informer import EmailInformer
from zvt.utils import date_time_by_interval, current_date, to_pd_timestamp
from zvt.utils.recorder_utils import run_data_recorder
from zvt.utils.time_utils import date_time_by_interval, current_date, to_pd_timestamp

logger = logging.getLogger(__name__)

Expand Down
4 changes: 2 additions & 2 deletions examples/factors/boll_factor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import pandas as pd
from ta.volatility import BollingerBands

from zvt.contract.factor import *
from zvt.factors import TechnicalFactor
from zvt.contract.factor import Transformer
from zvt.factors.technical_factor import TechnicalFactor


class BollTransformer(Transformer):
Expand Down
2 changes: 1 addition & 1 deletion examples/factors/fundamental_selector.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
from zvt.domain import BalanceSheet
from zvt.factors.fundamental import GoodCompanyFactor
from zvt.factors.fundamental.finance_factor import GoodCompanyFactor
from zvt.factors.target_selector import TargetSelector


Expand Down
2 changes: 1 addition & 1 deletion examples/factors/tech_factor.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from zvt.contract import AdjustType, TradableEntity, IntervalLevel
from zvt.contract.factor import Transformer, Accumulator
from zvt.domain import Stock
from zvt.factors import MacdFactor
from zvt.factors.macd.macd_factor import MacdFactor
from zvt.factors.transformers import CrossMaTransformer


Expand Down
2 changes: 1 addition & 1 deletion examples/intent/intent.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
from zvt.api.intent import compare
from zvt.domain import Indexus1dKdata, Index, Indexus, Index1dKdata, Currency, Currency1dKdata
from zvt.domain import Indexus1dKdata, Index, Indexus, Index1dKdata, Currency1dKdata
from zvt.domain import TreasuryYield


Expand Down
4 changes: 2 additions & 2 deletions examples/migration.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
from datetime import datetime
from typing import Any, Dict
from typing import Dict

from pydantic import BaseModel, ConfigDict, Json
from pydantic import BaseModel, ConfigDict
from sqlalchemy import Column, String, JSON
from sqlalchemy.orm import declarative_base

Expand Down
5 changes: 3 additions & 2 deletions examples/query_snippet.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# -*- coding: utf-8 -*-
from zvt.contract import Exchange
from sqlalchemy import func

from zvt.api.selector import get_entity_ids_by_filter
from zvt.contract import Exchange
from zvt.domain import Stock, BlockStock
from zvt.recorders.em import em_api
from zvt.tag import StockTags
from sqlalchemy import func


def query_json():
Expand Down
5 changes: 2 additions & 3 deletions examples/report_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@
from examples.tag_utils import group_stocks_by_tag, get_main_line_tags, get_main_line_hidden_tags
from examples.utils import msg_group_stocks_by_topic
from zvt import zvt_config
from zvt.api import get_top_volume_entities, TopType
from zvt.api.kdata import get_latest_kdata_date, get_kdata_schema, default_adjust_type
from zvt.api.selector import get_limit_up_stocks
from zvt.api.stats import get_top_performance_entities_by_periods
from zvt.api.stats import get_top_performance_entities_by_periods, get_top_volume_entities, TopType
from zvt.contract import IntervalLevel
from zvt.contract.api import get_entities, get_entity_schema
from zvt.contract.factor import Factor, TargetType
from zvt.domain import StockNews
from zvt.informer import EmailInformer
from zvt.utils import date_time_by_interval
from zvt.informer.inform_utils import add_to_eastmoney
from zvt.utils.time_utils import date_time_by_interval

logger = logging.getLogger("__name__")

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

from sqlalchemy import or_

from zvt.api import float_to_pct_str
from zvt.api.utils import float_to_pct_str
from zvt.contract import ActorType
from zvt.domain import FinanceFactor, BalanceSheet, IncomeStatement, Stock, StockActorSummary
from zvt.utils.pd_utils import pd_is_not_null
Expand Down
2 changes: 1 addition & 1 deletion examples/reports/report_bull.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from examples.factors.tech_factor import BullAndUpFactor
from examples.report_utils import report_targets
from zvt import init_log
from zvt.api import get_latest_kdata_date
from zvt.api.kdata import get_latest_kdata_date
from zvt.api.selector import get_middle_and_big_stock
from zvt.contract import AdjustType
from zvt.informer import EmailInformer
Expand Down
2 changes: 1 addition & 1 deletion examples/reports/report_core_compay.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
from zvt.contract.api import get_entities
from zvt.domain import Stock
from zvt.factors.target_selector import TargetSelector
from zvt.informer.informer import EmailInformer
from zvt.informer.inform_utils import add_to_eastmoney
from zvt.informer.informer import EmailInformer
from zvt.utils.time_utils import now_pd_timestamp, to_time_str

logger = logging.getLogger(__name__)
Expand Down
4 changes: 2 additions & 2 deletions examples/reports/report_tops.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

from examples.report_utils import report_top_entities, inform
from zvt import init_log
from zvt.api.stats import TopType, get_latest_kdata_date
from zvt.contract import AdjustType
from zvt.api import TopType, get_latest_kdata_date
from zvt.domain import Block, BlockCategory
from zvt.factors.top_stocks import compute_top_stocks, get_top_stocks
from zvt.factors.top_stocks import get_top_stocks
from zvt.informer import EmailInformer

logger = logging.getLogger(__name__)
Expand Down
3 changes: 1 addition & 2 deletions examples/reports/report_vol_up.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# -*- coding: utf-8 -*-
import logging

from zvt.factors.ma import VolumeUpMaFactor
from apscheduler.schedulers.background import BackgroundScheduler

from examples.report_utils import report_targets, inform
from zvt import init_log
from zvt.api.kdata import get_latest_kdata_date
from zvt.api.selector import get_mini_and_small_stock, get_middle_and_big_stock
from zvt.contract import AdjustType
from zvt.factors import VolumeUpMaFactor
from zvt.factors.top_stocks import get_top_stocks
from zvt.informer import EmailInformer

Expand Down
7 changes: 4 additions & 3 deletions examples/research/top_dragon_tiger.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@

import pandas as pd

from zvt.api import get_top_performance_by_month
from zvt.api.selector import get_players
from zvt.api.stats import get_top_performance_by_month
from zvt.contract import TradableEntity, IntervalLevel, AdjustType
from zvt.contract.factor import Transformer, Accumulator
from zvt.domain import Stock
from zvt.factors import TechnicalFactor
from zvt.utils import pd_is_not_null, pre_month_start_date, date_time_by_interval
from zvt.factors.technical_factor import TechnicalFactor
from zvt.utils.pd_utils import pd_is_not_null
from zvt.utils.time_utils import pre_month_start_date, date_time_by_interval


def top_dragon_and_tiger(data_provider="em", start_timestamp="2021-01-01", end_timestamp="2022-01-01"):
Expand Down
4 changes: 2 additions & 2 deletions examples/research/top_tags.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from zvt.api import get_top_performance_by_month
from zvt.api.stats import get_top_performance_by_month
from zvt.domain import Stock1dHfqKdata
from zvt.utils import date_time_by_interval, month_end_date, is_same_date
from zvt.utils.time_utils import date_time_by_interval, month_end_date, is_same_date


# 每月涨幅前30,市值90%分布在100亿以下
Expand Down
3 changes: 1 addition & 2 deletions examples/tag_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
import os
from collections import Counter

from zvt.api import china_stock_code_to_id, get_china_exchange

from zvt.api.utils import china_stock_code_to_id, get_china_exchange
from zvt.domain import BlockStock, Block, Stock, LimitUpInfo


Expand Down
2 changes: 1 addition & 1 deletion examples/trader/follow_ii_trader.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import pandas as pd

from zvt.api import get_recent_report_date
from zvt.api.utils import get_recent_report_date
from zvt.contract import ActorType, AdjustType
from zvt.domain import StockActorSummary, Stock1dKdata, Stock
from zvt.trader import StockTrader
Expand Down
6 changes: 3 additions & 3 deletions examples/trader/keep_run_trader.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# -*- coding: utf-8 -*-
import logging

from zvt.api import get_top_volume_entities
from zvt.api.stats import get_top_fund_holding_stocks
from zvt.trader.trader_info_api import clear_trader
from zvt.api.stats import get_top_volume_entities
from zvt.contract import IntervalLevel
from zvt.factors import GoldCrossFactor, BullFactor
from zvt.factors.macd.macd_factor import BullFactor
from zvt.trader import StockTrader
from zvt.trader.trader_info_api import clear_trader
from zvt.utils.time_utils import split_time_interval, date_time_by_interval

logger = logging.getLogger(__name__)
Expand Down
4 changes: 2 additions & 2 deletions examples/trader/ma_trader.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from zvt.contract import IntervalLevel
from zvt.factors import CrossMaFactor
from zvt.factors.macd import BullFactor
from zvt.factors.ma.ma_factor import CrossMaFactor
from zvt.factors.macd.macd_factor import BullFactor

from zvt.trader.trader import StockTrader

Expand Down
4 changes: 2 additions & 2 deletions examples/trader/macd_day_trader.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@

from zvt.contract import IntervalLevel
from zvt.contract.factor import Factor
from zvt.factors import GoldCrossFactor
from zvt.factors.macd.macd_factor import GoldCrossFactor
from zvt.trader import TradingSignal
from zvt.trader.trader import StockTrader

# 依赖数据
# data_schema: Stock1dHfqKdata
# provider: joinquant
from zvt.utils import date_time_by_interval
from zvt.utils.time_utils import date_time_by_interval


class MacdDayTrader(StockTrader):
Expand Down
2 changes: 1 addition & 1 deletion examples/trader/macd_week_and_day_trader.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing import List, Tuple

from zvt.contract import IntervalLevel
from zvt.factors import GoldCrossFactor
from zvt.factors.macd.macd_factor import GoldCrossFactor
from zvt.trader.trader import StockTrader


Expand Down
Loading

0 comments on commit 74e605b

Please sign in to comment.