'''backtest
start: 2019-07-01 00:00:00
end: 2020-01-03 00:00:00
period: 1m
exchanges: [{"eid":"OKEX","currency":"BTC_USDT"}]'''
importjson#参数
beginPrice = 5000 #网格区间开始价格
endPrice = 8000 #网格区间结束价格
distance = 20 #每个网格节点的价格距离
pointProfit = 50 #每个网格节点的利润差价
amount = 0.01 #每个网格节点的挂单量
minBalance = 300 #账户最小资金余额(买入时)
#全局变量
arrNet =[]
arrMsg=[]
acc=Nonedef findOrder (orderId, NumOfTimes, ordersList =[]) :for j inrange(NumOfTimes) :
orders=Noneif len(ordersList) ==0:
orders=_C(exchange.GetOrders)else:
orders=ordersListfor i inrange(len(orders)):if orderId == orders[i]["Id"]:returnTrue
Sleep(1000)returnFalsedefcancelOrder (price, orderType) :
orders=_C(exchange.GetOrders)for i inrange(len(