이 플러그인 중 가장 많이 판매되는 것은 바로 판매입니다.

저자:초목, 2020-03-20 14:09:21
태그:

한 번 구매하거나 한 번 판매하는 것을 점유하는 것은 시장에 영향을 미치지 않는 느린 배송 방법이기도 합니다. 이 전략에는 약간의 개선이 있습니다. 최소 거래량이나 정확도를 수동으로 변경할 수 있습니다. 구매: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)
    }
}

더 많은