forked from waditu/czsc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
34 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,10 +4,10 @@ | |
from .utils.ta import SMA, EMA, MACD, KDJ | ||
from .data.jq import JqCzscTrader | ||
|
||
__version__ = "0.7.6" | ||
__version__ = "0.7.7" | ||
__author__ = "zengbin93" | ||
__email__ = "[email protected]" | ||
__date__ = "20210902" | ||
__date__ = "20210923" | ||
|
||
print(f"欢迎使用CZSC!当前版本标识为 {__version__}@{__date__}") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,14 +4,15 @@ | |
email: [email protected] | ||
create_dt: 2021/6/25 18:52 | ||
""" | ||
|
||
import os | ||
import pandas as pd | ||
import tushare as ts | ||
from datetime import datetime, timedelta | ||
from typing import List | ||
from ..analyze import CzscTrader, RawBar, KlineGenerator | ||
from ..signals import get_default_signals | ||
from ..enum import Freq | ||
from ..utils.cache import home_path | ||
|
||
|
||
# 数据频度 :支持分钟(min)/日(D)/周(W)/月(M)K线,其中1min表示1分钟(类推1/5/15/30/60分钟)。 | ||
|
@@ -20,13 +21,28 @@ | |
Freq.F60: "60min", Freq.D: 'D', Freq.W: "W", Freq.M: "M"} | ||
freq_cn_map = {"1分钟": Freq.F1, "5分钟": Freq.F5, "15分钟": Freq.F15, "30分钟": Freq.F30, | ||
"60分钟": Freq.F60, "日线": Freq.D} | ||
|
||
exchanges = { | ||
"SSE": "上交所", | ||
"SZSE": "深交所", | ||
"CFFEX": "中金所", | ||
"SHFE": "上期所", | ||
"CZCE": "郑商所", | ||
"DCE": "大商所", | ||
"INE": "能源", | ||
"IB": "银行间", | ||
"XHKG": "港交所" | ||
} | ||
|
||
dt_fmt = "%Y-%m-%d %H:%M:%S" | ||
date_fmt = "%Y%m%d" | ||
|
||
pro = ts.pro_api() | ||
|
||
def get_trade_cal(): | ||
file_cal = os.path.join(home_path, "trade_cal.csv") | ||
for k, v in exchanges.items(): | ||
df = pro.trade_cal(exchange=k, start_date='19700101', end_date='20211231') | ||
|
||
|
||
def format_kline(kline: pd.DataFrame, freq: Freq) -> List[RawBar]: | ||
"""Tushare K线数据转换 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters