Spot Iceberg Entrust Sell 플러그인

Study Trade-aided Iceberg
생성 날짜: 2020-03-20 16:38:52 마지막으로 수정됨: 2020-03-24 10:50:43
복사: 31 클릭수: 2692
3
집중하다
1444
수행원

Very simple, just for learn. Code is best annotation.

빙산 위탁 판매, 주문을 작은 부분으로 판매, 시장 충격을 피하기, 좋은 간단한 입문 비트 코인 양적 거래 학습 전략 플러그인은 트레이딩 터미널에서 클릭 한 번으로 시작할 수 있으며, 수수료가 부과되지 않고 수동 거래가 편리하다. 자세한 내용은 https://www.fmz.com/digest-topic/5051

전략 소스 코드
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)
            return 'Iceberg order to sell is done, avg price is ' + avgCost
            
        }
    }
}