簡単で 学ぶために コードが一番いいのは注釈です
アイス山委託販売,小銭分けて注文を販売し,市場の衝撃を避けるのは,Bitcoin量化取引の簡単な入門の良い学習戦略です.
function main(){ var initAccount = _C(exchange.GetAccount) if (initAccount.Stocks < SELLAMOUNT){ throw 'check your account amount to sell' } while(true){ var account = _C(exchange.GetAccount) var dealAmount = initAccount.Stocks - account.Stocks var ticker = _C(exchange.GetTicker) if(SELLAMOUNT - dealAmount > SELLSIZE){ var id = exchange.Sell(ticker.Buy, SELLSIZE) Sleep(INTERVAL*1000) if(id){ exchange.CancelOrder(id) // May cause error log when the order is completed, which is all right. }else{ throw 'sell error' } }else{ account = _C(exchange.GetAccount) var avgCost = (account.Balance - initAccount.Balance)/(initAccount.Stocks - account.Stocks) Log('Iceberg order to sell is done, avg price is ', avgCost) // including fee cost return } } }
小草初心者のための選択肢,プログラム化取引は,完全な戦略を完了するだけでなく,氷山のような小さな機能も委託することができます.