저는 다음 코드를 사용해서 재검토했습니다. def CalculateMA(n,record): sumMA = 0 for i in range(n): sumMA += record[-(i+1)][“Close”] return sumMA/n
def SimpleMAStrategy(status): account = exchange.GetAccount() ticker = exchange.GetTicker() record = exchange.GetRecords(RecordsTime) MAFast = CalculateMA(MAFastN,record) MASlow = CalculateMA(MASlowN,record) balance = account[“Balance”] stocks = account[“Stocks”] Log ((“현재 지분액은:”, account[“Stocks”], “현재 잔액은:”, account[“Balance”]) currSell1Price = ticker[“Sell”] if (MAFast >= MASlow and status == 0): id = exchange.Buy(-1, balance*rate/ticker[“Sell”]) status = 1 if (MAFast <= MASlow and status == 1): id = exchange.Sell(-1, stocks) status = 0 return status
status = 0 while(true): status = SimpleMAStrategy(status) Sleep(3000)
재검토에서 항상 출력되는 현재 보유량은: 3.89e-07 현재 잔액은: 19999.166986677. 재검토에서 exchange.GetAccount은 항상 구성 매개 변수에서 설정된 정보만을 반환합니까?