feat ipo
This commit is contained in:
@@ -1,5 +1,17 @@
|
||||
from .calc import calc_buy_volume, trading_time
|
||||
from .lockfile import is_lock, write_lockfile
|
||||
from .market import market_allow_open, status
|
||||
from .signal import SignalItem, SignalResult, fetch_signal, init_signals
|
||||
|
||||
__all__ = ["calc_buy_volume", "trading_time", "market_allow_open", "status", "SignalItem", "SignalResult", "fetch_signal", "init_signals"]
|
||||
__all__ = [
|
||||
"calc_buy_volume",
|
||||
"trading_time",
|
||||
"is_lock",
|
||||
"write_lockfile",
|
||||
"market_allow_open",
|
||||
"status",
|
||||
"SignalItem",
|
||||
"SignalResult",
|
||||
"fetch_signal",
|
||||
"init_signals",
|
||||
]
|
||||
|
||||
18
py-client/libs/lockfile.py
Normal file
18
py-client/libs/lockfile.py
Normal file
@@ -0,0 +1,18 @@
|
||||
"""简单的文件锁标记工具。"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from os import PathLike
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def is_lock(file_path: str | PathLike[str]) -> bool:
|
||||
"""判断指定的锁文件是否存在。"""
|
||||
return Path(file_path).is_file()
|
||||
|
||||
|
||||
def write_lockfile(file_path: str | PathLike[str]) -> None:
|
||||
"""创建锁文件;父目录不存在时自动创建。"""
|
||||
path = Path(file_path)
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
path.write_text("LOCK", encoding="utf-8")
|
||||
Reference in New Issue
Block a user