【发布时间】:2021-06-08 16:22:27
【问题描述】:
我制定了一个简单的交易策略,每 30 秒执行一次。我在函数中定义了策略:
def strategy():
# strategy
time.sleep(30)
print(f'The Result from the Trade is: {result}')
然后我通过一个while循环运行它:
while True:
strategy()
这绝对不是最好的实现,但它只适用于测试策略。它向我展示了每笔交易的结果。但是,我想让它运行一整天,并将每笔交易的结果累积并存储在一个变量中,这样我就有了一整天所有交易的最终结果。
我一直在研究如何实现这一点,但我找不到任何适合我现有结构的东西。有人可以帮忙吗?
【问题讨论】:
标签: python python-3.x while-loop algorithmic-trading