"買ったり売ったり"を常に占めることは,市場への影響が少ない,遅い出荷の方法でもある.この戦略には,最小取引量や精度を手動で変更できるいくつかの改善点もある. 購入する:https://www.fmz.com/strategy/191582売る:https://www.fmz.com/strategy/191730
このプラグインは,取引端末のキーボードで起動し,手動取引を容易にするための手数料がかからない.詳細は:https://www.fmz.com/digest-topic/5051
function GetPrecision(){ var precision = {price:0, amount:0} var depth = exchange.GetDepth() for(var i=0;i<depth.Asks.length;i++){ var amountPrecision = depth.Asks[i].Amount.toString().indexOf('.') > -1 ? depth.Asks[i].Amount.toString().split('.')[1].length : 0 precision.amount = Math.max(precision.amount,amountPrecision) var pricePrecision = depth.Asks[i].Price.toString().indexOf('.') > -1 ? depth.Asks[i].Price.toString().split('.')[1].length : 0 precision.price = Math.max(precision.price,pricePrecision) } return precision } function main(){ var initAccount = exchange.GetAccount() if(!initAccount){return '无法获取账户信息'} var precision = GetPrecision() var sellPrice = 0 var lastId = 0 var done = false while(true){ var account = _C(exchange.GetAccount) var dealAmount = - account.Stocks + initAccount.Stocks var ticker = _C(exchange.GetTicker) if(SellAmount - dealAmount > 1/Math.pow(10,precision.amount) && ticker.Sell < sellPrice){ if(lastId){exchange.CancelOrder(lastId)} var id = exchange.Sell(ticker.Sell, _N(SellAmount - dealAmount,precision.amount)) if(id){ lastId = id }else{ done = true } } if(BuyAmount - dealAmount <= 1/Math.pow(10,precision.amount)){done = true} if(done){ var avgCost = (-initAccount.Balance + account.Balance)/dealAmount return 'order is done, avg cost is ' + avgCost // including fee cost } Sleep(Intervel*1000) } }