From d26ebdc175e93ded506ad650d1202cf3b7dc1160 Mon Sep 17 00:00:00 2001 From: zengbin93 Date: Tue, 2 Jun 2020 16:27:59 +0800 Subject: [PATCH] =?UTF-8?q?0.3.5=20=E6=AD=A3=E5=BC=8F=E6=9B=B4=E5=90=8D?= =?UTF-8?q?=E4=B8=BA=E2=80=9C=E7=BC=A0=E4=B8=AD=E8=AF=B4=E7=A6=85=EF=BC=88?= =?UTF-8?q?czsc=EF=BC=89=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 9 ++++++--- {chan => czsc}/__init__.py | 2 +- {chan => czsc}/analyze.py | 2 +- {chan => czsc}/solid.py | 0 {chan => czsc}/ta.py | 0 {chan => czsc}/utils.py | 2 +- examples/combine_with_goldminer.py | 4 ++-- examples/combine_with_tushare.py | 4 ++-- examples/jq_monitor.py | 2 +- examples/trade_simulator.py | 8 ++++---- examples/xd_end/make_data.py | 4 ++-- requirements.txt | 3 ++- setup.py | 18 +++++++++--------- test/test_analyze.py | 8 ++++---- test/test_solid.py | 11 +++-------- 15 files changed, 38 insertions(+), 39 deletions(-) rename {chan => czsc}/__init__.py (94%) rename {chan => czsc}/analyze.py (99%) rename {chan => czsc}/solid.py (100%) rename {chan => czsc}/ta.py (100%) rename {chan => czsc}/utils.py (99%) diff --git a/README.md b/README.md index 8faeaa4..0c35549 100644 --- a/README.md +++ b/README.md @@ -6,11 +6,14 @@ ## 安装 -Pypi上已经存在一个名为chan的库,以致于这个库没法上传到Pypi。 - 执行以下代码直接从github安装: ``` -pip install git+git://github.com/zengbin93/chan.git -U +pip install git+git://github.com/zengbin93/czsc.git -U +``` + +执行以下代码从 pypi 安装: +``` +pip install czsc -U -i ``` ## K线数据样例 diff --git a/chan/__init__.py b/czsc/__init__.py similarity index 94% rename from chan/__init__.py rename to czsc/__init__.py index 082dad7..7474434 100644 --- a/chan/__init__.py +++ b/czsc/__init__.py @@ -7,7 +7,7 @@ from .solid import SolidAnalyze from .solid import is_in_tolerance, is_first_buy, is_first_sell, is_second_buy, \ is_second_sell, is_third_buy, is_third_sell, is_xd_buy, is_xd_sell -__version__ = "0.3.4" +__version__ = "0.3.5" __author__ = "zengbin93" __email__ = "zeng_bin8888@163.com" diff --git a/chan/analyze.py b/czsc/analyze.py similarity index 99% rename from chan/analyze.py rename to czsc/analyze.py index 89f0e71..82c225d 100644 --- a/chan/analyze.py +++ b/czsc/analyze.py @@ -176,7 +176,7 @@ class KlineAnalyze(object): self.__update_kline() def __repr__(self): - return "" % (self.symbol, self.start_dt, self.end_dt) + return "" % (self.symbol, self.start_dt, self.end_dt) @staticmethod def _preprocess(kline): diff --git a/chan/solid.py b/czsc/solid.py similarity index 100% rename from chan/solid.py rename to czsc/solid.py diff --git a/chan/ta.py b/czsc/ta.py similarity index 100% rename from chan/ta.py rename to czsc/ta.py diff --git a/chan/utils.py b/czsc/utils.py similarity index 99% rename from chan/utils.py rename to czsc/utils.py index 1f3a380..a00c7dc 100644 --- a/chan/utils.py +++ b/czsc/utils.py @@ -11,7 +11,7 @@ import matplotlib.pyplot as plt from .ta import macd -def plot_kline(ka, bs=None, file_html="chan.html", width="1400px", height="680px"): +def plot_kline(ka, bs=None, file_html="kline.html", width="1400px", height="680px"): """ :param ka: KlineAnalyze diff --git a/examples/combine_with_goldminer.py b/examples/combine_with_goldminer.py index c1fa596..31757cd 100644 --- a/examples/combine_with_goldminer.py +++ b/examples/combine_with_goldminer.py @@ -1,6 +1,6 @@ # coding: utf-8 """ -结合掘金的数据使用 chan 进行缠论技术分析 +结合掘金的数据使用 czsc 进行缠论技术分析 author: zengbin93 email: zeng_bin8888@163.com @@ -10,7 +10,7 @@ date: 2020-02-02 from gm.api import * from datetime import datetime -from chan import KlineAnalyze, SolidAnalyze +from czsc import KlineAnalyze, SolidAnalyze # 在这里设置你的掘金token,用于获取数据 set_token("your gm token") diff --git a/examples/combine_with_tushare.py b/examples/combine_with_tushare.py index 146efe6..6ccfb75 100644 --- a/examples/combine_with_tushare.py +++ b/examples/combine_with_tushare.py @@ -1,6 +1,6 @@ # coding: utf-8 """ -结合 tushare.pro 的数据使用 chan 进行缠论技术分析 +结合 tushare.pro 的数据使用 czsc 进行缠论技术分析 author: zengbin93 email: zeng_bin8888@163.com @@ -10,7 +10,7 @@ date: 2020-02-02 import tushare as ts from datetime import datetime, timedelta -from chan import KlineAnalyze, SolidAnalyze +from czsc import KlineAnalyze, SolidAnalyze # 首次使用,需要在这里设置你的 tushare token,用于获取数据;在同一台机器上,tushare token 只需要设置一次 # 没有 token,到 https://tushare.pro/register?reg=7 注册获取 diff --git a/examples/jq_monitor.py b/examples/jq_monitor.py index b336ec8..09bfd70 100644 --- a/examples/jq_monitor.py +++ b/examples/jq_monitor.py @@ -7,7 +7,7 @@ import time import pandas as pd from datetime import datetime from apscheduler.schedulers.blocking import BlockingScheduler -from chan import SolidAnalyze +from czsc import SolidAnalyze # 企业微信群聊机器人 web hook hook = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=******" diff --git a/examples/trade_simulator.py b/examples/trade_simulator.py index bae86a3..826aaae 100644 --- a/examples/trade_simulator.py +++ b/examples/trade_simulator.py @@ -3,8 +3,8 @@ 交易模拟器,用于研究单标的的买卖点变化过程 """ -import chan -print(chan.__version__) +import czsc +print(czsc.__version__) import os import time @@ -13,8 +13,8 @@ import pandas as pd from copy import deepcopy import tushare as ts from datetime import datetime, timedelta -from chan import SolidAnalyze, KlineAnalyze -from chan import plot_kline +from czsc import SolidAnalyze, KlineAnalyze +from czsc import plot_kline # 首次使用,需要在这里设置你的 tushare token,用于获取数据;在同一台机器上,tushare token 只需要设置一次 diff --git a/examples/xd_end/make_data.py b/examples/xd_end/make_data.py index 7d5e585..1a9a1d0 100644 --- a/examples/xd_end/make_data.py +++ b/examples/xd_end/make_data.py @@ -7,8 +7,8 @@ from copy import deepcopy from datetime import timedelta, datetime from cobra.data.kline import kline_simulator, get_kline from cobra.data.basic import is_trade_day -from chan import SolidAnalyze, KlineAnalyze -from chan.analyze import is_macd_cross +from czsc import SolidAnalyze, KlineAnalyze +from czsc.analyze import is_macd_cross data_path = "./data" if not os.path.exists(data_path): diff --git a/requirements.txt b/requirements.txt index 5f7eecc..a7b88a7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,4 +3,5 @@ mplfinance tqdm pandas tushare -git+git://github.com/zengbin93/cobra.git \ No newline at end of file +git+git://github.com/zengbin93/cobra.git +matplotlib diff --git a/setup.py b/setup.py index cf22c8c..767df83 100644 --- a/setup.py +++ b/setup.py @@ -1,21 +1,21 @@ # coding: utf-8 from setuptools import setup, find_packages -import chan +import czsc setup( - name="chan", - version=chan.__version__, - author=chan.__author__, - author_email=chan.__email__, + name="czsc", + version=czsc.__version__, + author=czsc.__author__, + author_email=czsc.__email__, keywords=["缠论", "技术分析", "A股", "期货"], - description="缠论技术分析工具", - long_description="缠论技术分析工具", + description="缠中说禅技术分析工具", + long_description="缠中说禅技术分析工具,源自 http://blog.sina.com.cn/chzhshch", license="MIT", - url="https://github.com/zengbin93/chan", + url="https://github.com/zengbin93/czsc", packages=find_packages(exclude=['test', 'images', 'docs']), include_package_data=True, - install_requires=["pandas", "pyecharts", "mplfinance", "tushare"], + install_requires=["pandas", "pyecharts", "mplfinance", "tushare", "matplotlib"], classifiers=[ 'License :: OSI Approved :: Apache Software License', diff --git a/test/test_analyze.py b/test/test_analyze.py index 96616aa..3749d81 100644 --- a/test/test_analyze.py +++ b/test/test_analyze.py @@ -3,11 +3,11 @@ import sys from cobra.data.kline import get_kline sys.path.insert(0, '.') sys.path.insert(0, '..') -import chan -from chan import KlineAnalyze -from chan.analyze import is_bei_chi +import czsc +from czsc import KlineAnalyze +from czsc.analyze import is_bei_chi -print(chan.__version__) +print(czsc.__version__) def test_bei_chi(): diff --git a/test/test_solid.py b/test/test_solid.py index 69cda37..6e20636 100644 --- a/test/test_solid.py +++ b/test/test_solid.py @@ -3,9 +3,9 @@ import sys from cobra.data.kline import get_klines sys.path.insert(0, '.') sys.path.insert(0, '..') -import chan -from chan.solid import SolidAnalyze, nested_intervals, is_in_tolerance -print(chan.__version__) +import czsc +from czsc.solid import SolidAnalyze, is_in_tolerance +print(czsc.__version__) def test_in_tolerance(): @@ -22,11 +22,6 @@ def test_solid_analyze(): klines = get_klines(ts_code, end_date='2020-04-03 14:00:00', asset='I', freqs='1min,5min,30min,D') sa = SolidAnalyze(klines) - ka = sa.kas['30分钟'] - ka1 = sa.kas['日线'] - ka2 = sa.kas['5分钟'] - print(nested_intervals(ka, ka1, ka2)) - # for func in [sa.is_first_buy, sa.is_first_sell, sa.is_second_buy, sa.is_second_sell, # sa.is_third_buy, sa.is_third_sell, sa.is_xd_buy, sa.is_xd_sell]: # for freq in ['1分钟', '5分钟', '30分钟']: -- GitLab