Sokongan untuk platform berbilang untuk penempatan, berapa banyak wang yang dijual berapa wang yang dijual
function cancelAllOrders() { var orders = null; while (!(orders = exchange.GetOrders())) { Sleep(Interval); } if (orders.length > 0) { for (var j = 0; j < orders.length; j++) { exchange.CancelOrder(orders[j].Id); if (j < (orders.length-1)) { Sleep(2000); } } } } function sellAll() { cancelAllOrders(); var initAccount = _C(exchange.GetAccount); Log(exchange.GetName(), exchange.GetCurrency(), initAccount); if (initAccount.Stocks == 0) { Log("空仓"); return; } var remaind = initAccount.Stocks - KeepStock; var account = initAccount; while (remaind >= 0.001) { var ticker = _C(exchange.GetTicker); exchange.Sell(ticker.Buy - SlidePrice, remaind); Sleep(RetryInterval * 1000); cancelAllOrders(); account = _C(exchange.GetAccount); remaind = account.Stocks - KeepStock; } Log("平均卖出价", (account.Balance - initAccount.Balance) / (initAccount.Stocks - account.Stocks)); Log(account); } function main() { for (var i = 0; i < exchanges.length; i++) { exchange = exchanges[i]; sellAll(); } }