Type/to search
0
Follow
0
Followers
while true 实盘只循环了一次是什么意思?
Help
Created 2021-01-16 17:12:02  
 1
 1472

其他都没问题, 回测正常, 实盘中只运行一次就结束了, 代码如下。
import time
import json

params = {
"arrBasePrice": [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1],
}

def process(index):
global params #定义全局变量
ticker = _C(e.GetTicker) #获取价格信息
def main():
global params

for i in range(len(exchanges)) :
params["acc"].append(_C(exchanges[i].GetAccount))
params["arrTick"].append(_C(exchanges[i].GetTicker))
exchanges[i].SetPrecision(params["arrPricePrecision"][i], params["arrAmountPrecision"][i])

for key in params :
if len(params[key]) < len(exchanges):
Log(len(params[key]), len(exchanges))
raise "params error!"

while True:
for i in range(len(exchanges)):
process(exchanges[i], i)

代码框架大概就是这样的。 实盘只运行了一次, 没有重复获取, 运行一次, 的具体次数, 是
arrBasePrice 后面字符长度的次数。

Related Recommendations
Comment
All comments (1)

    没有报错会重复执行,另外策略需要休眠时间

    6 years ago
  • 1
Forums
PINE Language
Get the app
iPhone Download
© 2015 - ∞ INVENTOR PTE LTD (SG)