加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main_service.py 1.23 KB
一键复制 编辑 原始数据 按行查看 历史
SleepySoft 提交于 2023-05-20 10:44 . Add logging redirection.
import logging
import os
import time
import traceback
from StockAnalysisSystem.core.config import Config
from StockAnalysisSystem.core.Utility.log import logging_config, logging_test
# ----------------------------------------------------------------------------------------------------------------------
def init_sas(work_path: str, config: Config or None) -> bool:
try:
print('Init StockAnalysisSystem...')
from StockAnalysisSystem.interface.interface_local import LocalInterface
__sas_interface = LocalInterface()
__sas_interface.if_init(project_path=work_path, config=config)
print('Init StockAnalysisSystem Complete.')
return True
except Exception as e:
print(str(e))
print(str(traceback.format_exc()))
print('Init StockAnalysisSystem Fail')
return False
finally:
pass
def main():
logging_config()
logging_test()
if not init_sas(os.getcwd(), None):
exit(1)
while True:
# TODO: Add something?
time.sleep(1)
if __name__ == '__main__':
try:
main()
except Exception as e:
print('Error =>', e)
print('Error =>', traceback.format_exc())
exit()
finally:
pass
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化