Spot Iceberg Entrust Comprar Plugin

Study Trade-aided Iceberg
Data de criação: 2020-03-20 16:37:02 última modificação: 2020-03-24 10:50:51
cópia: 40 Cliques: 2718
3
focar em
1444
Seguidores

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

A compra por encomenda de icebergs, dividindo as encomendas em pequenas compras de M, para evitar choques no mercado, é uma boa estratégia de aprendizagem de negociação de quantidade de bitcoin para iniciantes. O plug-in pode ser iniciado em um terminal de negociação com um toque, sem cobrança de taxas, facilitando a negociação manual. Mais informações: https://www.fmz.com/digest-topic/5051

Código-fonte da estratégia
function main(){
    var initAccount = _C(exchange.GetAccount)
    while(true){
        var account = _C(exchange.GetAccount)
        var dealAmount = account.Stocks - initAccount.Stocks
        var ticker = _C(exchange.GetTicker)
        if(BUYAMOUNT - dealAmount >= BUYSIZE){
            var id = exchange.Buy(ticker.Sell, BUYSIZE)
            Sleep(INTERVAL*1000)
            if(id){
                exchange.CancelOrder(id) // May cause error log when the order is completed, which is all right.
            }else{
                throw 'buy error'
            }
        }else{
            account = _C(exchange.GetAccount)
            var avgCost = (initAccount.Balance - account.Balance)/(account.Stocks - initAccount.Stocks)
            return 'Iceberg order to buy is done, avg cost is '+avgCost
        }
        
    }
}