Skip to content

Commit bee6564

Browse files
committed
update
1 parent 188e239 commit bee6564

22 files changed

+32
-28
lines changed

README.MD

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# 安装
66

77
```bash
8-
pip install hive-c
8+
pip install hived-c
99
# or
1010
pip install git+https://github.com/ctpbee/hive
1111
```
@@ -32,7 +32,7 @@ pip install git+https://github.com/ctpbee/hive
3232
3. 执行下面的命令(可以根据参数解析自己做更改)
3333

3434
```bash
35-
hive --name hive --path ./data --ff csv --cf config.json --rd 127.0.0.1:6379 --tick_save true --dispatch true
35+
hived --name hived --path ./data --ff csv --cf config.json --rd 127.0.0.1:6379 --tick_save true --dispatch true
3636
```
3737

3838
### 如果自己定义订阅指定行情

examples/atk.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
from types import FunctionType
77
from datetime import time
88

9-
from hive import Hive
10-
from hive.task import LoopTask, OnceTask
9+
from hived import Hive
10+
from hived.task import LoopTask, OnceTask
1111

1212
import atexit
1313

-247 Bytes
Binary file not shown.
-1.62 KB
Binary file not shown.

hive/__pycache__/log.cpython-37.pyc

-402 Bytes
Binary file not shown.

hive/__pycache__/log.cpython-39.pyc

-398 Bytes
Binary file not shown.

hive/__pycache__/main.cpython-37.pyc

-2.72 KB
Binary file not shown.

hive/__pycache__/main.cpython-39.pyc

-2.05 KB
Binary file not shown.

hive/__pycache__/task.cpython-37.pyc

-2.67 KB
Binary file not shown.

hive/__pycache__/task.cpython-39.pyc

-3.66 KB
Binary file not shown.
File renamed without changes.

hive/cmd.py renamed to hived/cmd.py

+10-5
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
import click
88

9-
from hive.log import logger
10-
from hive.main import Hive
11-
from hive.src.task import DataUpdateTask, CleanDataTask
9+
from hived.log import logger
10+
from hived.main import Hive
11+
from hived.src.task import DataUpdateTask, CleanDataTask
1212

1313
bool_map = {"false": False, "true": True}
1414

@@ -21,7 +21,7 @@ def fix_bool(name):
2121

2222

2323
@click.command()
24-
@click.option("--name", default="hive", prompt="hive")
24+
@click.option("--name", default="hived", prompt="hived")
2525
@click.option("--path", help="the dirname of file_save_path", default="./")
2626
@click.option("--ff", help="format of file", default="csv")
2727
@click.option("--cf", help="config of file", default="config.json")
@@ -31,11 +31,16 @@ def fix_bool(name):
3131
@click.option("--config_path", default="", help="config file path ")
3232
def run_command(name, path, ff, cf, rd, dispatch, tick_save, config_path):
3333
if os.path.exists(config_path):
34+
logger.info("当前检测到配置文件 读取参数")
3435
if not config_path.endswith(".json"):
3536
raise FileNotFoundError("当前配置文件不是json格式")
3637
with open(config_path, "r") as f:
37-
config = json.load(f)
38+
try:
39+
config = json.load(f)
40+
except json.decoder.JSONDecodeError:
41+
raise json.decoder.JSONDecodeError("json格式不合法")
3842
else:
43+
logger.info("当前未检测到配置文件 读取参数")
3944
if ff not in ["csv", "parquet", "h5"]:
4045
raise TypeError("错误的文件导出格式 请检查你的ff参数")
4146
dispatch = fix_bool(dispatch)
File renamed without changes.

hive/log.py renamed to hived/log.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import logging
22

3-
logger = logging.Logger(name="hive")
3+
logger = logging.Logger(name="hived")
44
formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
55
ch = logging.StreamHandler()
66
ch.setLevel(logging.INFO)

hive/main.py renamed to hived/main.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
from datetime import datetime
22
from time import sleep
33

4-
from hive.config import Config
5-
from hive.log import logger
6-
from hive.task import Task
4+
from hived.config import Config
5+
from hived.log import logger
6+
from hived.task import Task
77

88

99
class Hive(object):

hive/src/__init__.py renamed to hived/src/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from hive.src.task import DataUpdateTask, CleanDataTask
2-
from hive import Hive
1+
from hived.src.task import DataUpdateTask, CleanDataTask
2+
from hived import Hive
33

44

55
class Terminal:
File renamed without changes.

hive/src/func.py renamed to hived/src/func.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
from ctpbee.constant import *
77

88
from redis import Redis
9-
from hive.src.obj import Message
10-
from hive import logger
11-
from hive.src.env import RD_CONTRACT_NAME
9+
from hived.src.obj import Message
10+
from hived import logger
11+
from hived.src.env import RD_CONTRACT_NAME
1212

1313

1414
class WorkBench(CtpbeeApi):

hive/src/obj.py renamed to hived/src/obj.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from ctpbee.constant import OrderData, Entity, ContractData, TradeData, CancelRequest, OrderRequest, TickData
77

8-
from hive.src.env import DATA_TYPE_KEY, DATA_FIELD
8+
from hived.src.env import DATA_TYPE_KEY, DATA_FIELD
99
from ctpbee import dumps, loads
1010

1111

hive/src/task.py renamed to hived/src/task.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
from ctpbee import hickey
44
from ctpbee.date import trade_dates
55

6-
from hive import LoopTask, OnceTask
7-
from hive.src.env import FILE_CLEAN_TIME
8-
from hive.src.func import record_data, clean_data_from_redis
6+
from hived import LoopTask, OnceTask
7+
from hived.src.env import FILE_CLEAN_TIME
8+
from hived.src.func import record_data, clean_data_from_redis
99

1010

1111
class DataUpdateTask(LoopTask):
1212
def __init__(self, **kwargs):
1313
super().__init__("数据录制")
1414
interface = kwargs.get("interface", "ctp")
15-
front = kwargs.get("front", 300)
15+
front = kwargs.get("front", 600)
1616
for i, v in hickey.open_trading[interface].items():
1717
setattr(hickey, i, hickey.add_seconds(getattr(hickey, i), front))
1818

File renamed without changes.

setup.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from setuptools import setup
22

3-
pkgs = ["hive", "hive.src"]
3+
pkgs = ["hived", "hived.src"]
44

55
install_requires = ["ctpbee", "redis", "click", "pandas"]
66
setup(
@@ -13,8 +13,8 @@
1313
license="Apache2",
1414
packages=pkgs,
1515
install_requires=install_requires,
16-
platforms=["Linux", "Windows"],
17-
package_dir={"hive": "hive"},
16+
platforms=["Linux", "Windows", "MacOS"],
17+
package_dir={"hived": "hived"},
1818
zip_safe=False,
1919
include_package_data=True,
2020
ext_modules=[],
@@ -27,7 +27,6 @@
2727
"Programming Language :: Python :: 3.8",
2828
"Programming Language :: Python :: 3.9",
2929
"Programming Language :: Python :: 3.10",
30-
"Programming Language :: Python :: 3.11",
3130
],
32-
entry_points={"console_scripts": ["hive = hive:run_command"]},
31+
entry_points={"console_scripts": ["hived = hived:run_command"]},
3332
)

0 commit comments

Comments
 (0)