Skip to content

Commit

Permalink
1)qmt tick and stats 2)tag and trading utils
Browse files Browse the repository at this point in the history
  • Loading branch information
foolcage committed May 26, 2024
1 parent 95a2950 commit 957bca0
Show file tree
Hide file tree
Showing 161 changed files with 38,985 additions and 1,562 deletions.
8 changes: 8 additions & 0 deletions api-tests/create_stock_pool_info.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
POST http://127.0.0.1:8090/api/work/create_stock_pool_info
accept: application/json
Content-Type: application/json

{
"stock_pool_name": "核心资产",
"stock_pool_type": "custom"
}
10 changes: 10 additions & 0 deletions api-tests/create_stock_pools.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
POST http://127.0.0.1:8090/api/work/create_stock_pools
accept: application/json
Content-Type: application/json

{
"stock_pool_name": "核心资产",
"entity_ids": [
"stock_sh_600519"
]
}
5 changes: 5 additions & 0 deletions api-tests/factor/get_factors.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
GET http://127.0.0.1:8090/api/factor/get_factors
accept: application/json



11 changes: 11 additions & 0 deletions api-tests/factor/query_factor_result.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
POST http://127.0.0.1:8090/api/factor/query_factor_result
accept: application/json
Content-Type: application/json


{
"entity_ids": [
"stock_sz_300133"
],
"factor_name": "LiveOrDeadFactor"
}
11 changes: 11 additions & 0 deletions api-tests/factor/query_kdata.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
POST http://127.0.0.1:8090/api/factor/query_kdata
accept: application/json
Content-Type: application/json


{
"entity_ids": [
"stock_sz_002085",
"stock_sz_300133"
]
}
5 changes: 5 additions & 0 deletions api-tests/get_stock_pool_info.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
GET http://127.0.0.1:8090/api/work/get_stock_pool_info
accept: application/json



5 changes: 5 additions & 0 deletions api-tests/get_stock_pools.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
GET http://127.0.0.1:8090/api/work/get_stock_pools?stock_pool_name=main_line
accept: application/json



15 changes: 15 additions & 0 deletions api-tests/tag/build_stock_tags.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
POST http://127.0.0.1:8090/api/work/build_stock_tags
accept: application/json
Content-Type: application/json

[
{
"entity_id": "stock_sz_002085",
"name": "万丰奥威",
"main_tag": "低空经济",
"main_tag_reason": "2023年12月27日回复称,公司钻石eDA40纯电动飞机已成功首飞;eVTOL项目已联动海外钻石技术开发团队,在绿色、智能、垂直起降等方面的设计体现未来领域应用场景。",
"sub_tag": "低空经济",
"sub_tag_reason": "2023年12月27日回复称,公司钻石eDA40纯电动飞机已成功首飞;eVTOL项目已联动海外钻石技术开发团队,在绿色、智能、垂直起降等方面的设计体现未来领域应用场景。",
"active_hidden_tags": null
}
]
8 changes: 8 additions & 0 deletions api-tests/tag/create_hidden_tag_info.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
POST http://127.0.0.1:8090/api/work/create_hidden_tag_info
accept: application/json
Content-Type: application/json

{
"tag": "中字头",
"tag_reason": "央企,国资委控股"
}
8 changes: 8 additions & 0 deletions api-tests/tag/create_main_tag_info.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
POST http://127.0.0.1:8090/api/work/create_main_tag_info
accept: application/json
Content-Type: application/json

{
"tag": "未知",
"tag_reason": "行业定位不清晰"
}
8 changes: 8 additions & 0 deletions api-tests/tag/create_sub_tag_info.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
POST http://127.0.0.1:8090/api/work/create_sub_tag_info
accept: application/json
Content-Type: application/json

{
"tag": "低空经济",
"tag_reason": "低空经济是飞行器和各种产业形态的融合,例如\"无人机+配送\"\"直升机或evto载人飞行\"\"无人机+应急救援\"\"无人机+工业场景巡检\""
}
4 changes: 4 additions & 0 deletions api-tests/tag/get_hidden_tag_info.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
GET http://127.0.0.1:8090/api/work/get_hidden_tag_info
accept: application/json


4 changes: 4 additions & 0 deletions api-tests/tag/get_main_tag_info.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
GET http://127.0.0.1:8090/api/work/get_main_tag_info
accept: application/json


4 changes: 4 additions & 0 deletions api-tests/tag/get_sub_tag_info.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
GET http://127.0.0.1:8090/api/work/get_sub_tag_info
accept: application/json


12 changes: 12 additions & 0 deletions api-tests/tag/query_simple_stock_tags.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
POST http://127.0.0.1:8090/api/work/query_simple_stock_tags
accept: application/json
Content-Type: application/json


{
"entity_ids": [
"stock_sz_002085",
"stock_sz_000099",
"stock_sz_002130"
]
}
7 changes: 7 additions & 0 deletions api-tests/tag/query_stock_tag_stats.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
POST http://127.0.0.1:8090/api/work/query_stock_tag_stats
accept: application/json
Content-Type: application/json

{
"stock_pool_name": "main_line"
}
12 changes: 12 additions & 0 deletions api-tests/tag/query_stock_tags.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
POST http://127.0.0.1:8090/api/work/query_stock_tags
accept: application/json
Content-Type: application/json


{
"entity_ids": [
"stock_sz_000099",
"stock_sz_002085",
"stock_sz_001696"
]
}
17 changes: 17 additions & 0 deletions api-tests/tag/set_stock_tags.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
POST http://127.0.0.1:8090/api/work/set_stock_tags
accept: application/json
Content-Type: application/json

{
"entity_id": "stock_sz_001366",
"name": "播恩集团",
"main_tag": "医药",
"main_tag_reason": "合成生物概念",
"main_tags": {
"农业": "来自行业:农牧饲渔"
},
"sub_tag": "生物医药",
"sub_tag_reason": "合成生物概念",
"sub_tags": null,
"active_hidden_tags": null
}
1 change: 1 addition & 0 deletions api-tests/test.http
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

8 changes: 8 additions & 0 deletions api-tests/trading/build_query_stock_quote_setting.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
POST http://127.0.0.1:8090/api/trading/build_query_stock_quote_setting
accept: application/json
Content-Type: application/json

{
"stock_pool_name": "main_line",
"main_tags": ["低空经济","新能源"]
}
13 changes: 13 additions & 0 deletions api-tests/trading/build_trading_plan.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
POST http://127.0.0.1:8090/api/trading/build_trading_plan
accept: application/json
Content-Type: application/json

{
"stock_id": "stock_sz_300133",
"trading_date": "2024-04-23",
"expected_open_pct": 0.02,
"buy_price": 6.9,
"sell_price": null,
"trading_reason": "主线",
"trading_signal_type": "open_long"
}
5 changes: 5 additions & 0 deletions api-tests/trading/get_current_trading_plan.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
GET http://127.0.0.1:8090/api/trading/get_current_trading_plan
accept: application/json



5 changes: 5 additions & 0 deletions api-tests/trading/get_future_trading_plan.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
GET http://127.0.0.1:8090/api/trading/get_future_trading_plan
accept: application/json



5 changes: 5 additions & 0 deletions api-tests/trading/get_query_stock_quote_setting.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
GET http://127.0.0.1:8090/api/trading/get_query_stock_quote_setting
accept: application/json



10 changes: 10 additions & 0 deletions api-tests/trading/query_stock_quotes.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
POST http://127.0.0.1:8090/api/trading/query_stock_quotes
accept: application/json
Content-Type: application/json

{
"main_tag": "低空经济",
"stock_pool_name": "vol_up",
"limit": 500,
"order_by_field": "change_pct"
}
12 changes: 12 additions & 0 deletions api-tests/trading/query_trading_plan.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
POST http://127.0.0.1:8090/api/trading/query_trading_plan
accept: application/json
Content-Type: application/json

{
"time_range": {
"relative_time_range": {
"interval": -30,
"time_unit": "day"
}
}
}
2 changes: 1 addition & 1 deletion docs/source/data/data_concepts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ pre adjusted(qfq), post adjusted(hfq), or not adjusted(bfq).

In order to be compatible with historical data, the qfq is an exception, {adjust_type} is left empty

The pre defined kdata schema could be found in :py:mod:`~.zvt.domain.quotes`, it's seperated by
The pre defined kdata schema could be found in :py:mod:`~.zvt.domain.quotes`, it's separated by
entity_schema, level, and adjust type.

e.g. Stock1dHfqKdata means China Stock daily hfq quotes.
Expand Down
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 next_date, 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
22 changes: 3 additions & 19 deletions 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 All @@ -19,9 +19,7 @@
Index,
Index1dKdata,
StockNews,
StockEvents,
LimitUpInfo,
BlockStock,
)
from zvt.informer import EmailInformer
from zvt.utils import current_date
Expand All @@ -47,21 +45,6 @@ def record_stock_news(data_provider="em"):
)


def record_stock_events(data_provider="em"):
normal_stock_ids = get_entity_ids_by_filter(
provider="em", ignore_delist=True, ignore_st=False, ignore_new_stock=False
)

run_data_recorder(
entity_ids=normal_stock_ids,
day_data=True,
domain=StockEvents,
data_provider=data_provider,
force_update=False,
sleeping_time=0.01,
)


def report_limit_up():
latest_data = LimitUpInfo.query_data(order=LimitUpInfo.timestamp.desc(), limit=1, return_type="domain")
timestamp = latest_data[0].timestamp
Expand Down Expand Up @@ -100,7 +83,7 @@ def report_hot_topics():


@sched.scheduled_job("cron", hour=15, minute=30, day_of_week="mon-fri")
def record_stock_data(data_provider="em", entity_provider="em", sleeping_time=0.2):
def record_stock_data(data_provider="em", entity_provider="em", sleeping_time=0):
email_action = EmailInformer()
# 涨停数据
run_data_recorder(domain=LimitUpInfo, data_provider=None, force_update=False)
Expand Down Expand Up @@ -167,6 +150,7 @@ def record_stock_data(data_provider="em", entity_provider="em", sleeping_time=0.
entity_provider=entity_provider,
day_data=True,
sleeping_time=sleeping_time,
return_unfinished=True,
)


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
Loading

0 comments on commit 957bca0

Please sign in to comment.