Administrator
2025-05-12 82e8474625d9af933d6ab5825b43f6a248005010
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from strategy.strategy_variable import StockVariables
 
if __name__ == "__main__":
    global_dict = {'x': 10}
    codes = ""
    with open("低吸脚本.py", mode='r', encoding='utf-8') as f:
        lines = f.readlines()
        codes = "\n".join(lines)
    # 注释掉里面的import与变量
    codes = codes.replace("from ", "#from ").replace("sv = ", "#sv =  ")
 
    stock_variables = StockVariables()
    stock_variables.当前价 = 10.23
    stock_variables.昨日最高价 = 10.00
    global_dict = {
        "sv": stock_variables}
    exec(codes, global_dict)
    print(global_dict['compute_result'])