Very simple, just for learn. Code is best annotation.
La venta por encargo de icebergs, que divide los pedidos en pequeñas cantidades para evitar impactos en el mercado, es una buena estrategia para aprender a comerciar con Bitcoin de forma simple y cuantitativa. El complemento se puede iniciar en el terminal de negociación con un solo toque, sin cargo, para facilitar la negociación manual. Más información: 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
}
}
}