-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
1 changed file
with
29 additions
and
2 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,12 +4,15 @@ | |
email: [email protected] | ||
create_dt: 2019/10/29 15:01 | ||
""" | ||
import os | ||
import shutil | ||
|
||
from . import envs | ||
from . import ai | ||
from . import utils | ||
from . import traders | ||
from . import sensors | ||
from . import aphorism | ||
|
||
from .analyze import CZSC | ||
from .traders.advanced import CzscAdvancedTrader | ||
from .utils.ta import SMA, EMA, MACD, KDJ | ||
|
@@ -21,6 +24,30 @@ | |
__date__ = "20220404" | ||
|
||
print(f"欢迎使用CZSC!当前版本标识为 {__version__}@{__date__}\n") | ||
|
||
aphorism.print_one() | ||
|
||
home_path = os.path.join(os.path.expanduser("~"), '.czsc') | ||
os.makedirs(home_path, exist_ok=True) | ||
|
||
|
||
def get_dir_size(path): | ||
"""获取目录大小,单位:Bytes""" | ||
total = 0 | ||
with os.scandir(path) as it: | ||
for entry in it: | ||
if entry.is_file(): | ||
total += entry.stat().st_size | ||
elif entry.is_dir(): | ||
total += get_dir_size(entry.path) | ||
return total | ||
|
||
|
||
if get_dir_size(home_path) > pow(1024, 3) and envs.get_verbose(): | ||
print(f"{home_path} 目录缓存超过1GB,请适当清理。调用 empty_cache_path 可以直接清空缓存") | ||
|
||
|
||
def empty_cache_path(): | ||
shutil.rmtree(home_path) | ||
os.makedirs(home_path, exist_ok=False) | ||
print(f"已清空缓存文件夹:{home_path}") | ||
|