Very simple, just for learn. Code is best annotation.
빙산 위탁 구매, 작은 M 구매로 주문을 분할하여 시장을 충격에서 피하는 것은 비트코인의 양적 거래에 대한 간단한 학습 전략입니다. 플러그인은 트레이딩 터미널에서 클릭 한 번으로 시작할 수 있으며, 수수료가 부과되지 않고 수동 거래가 편리하다. 자세한 내용은 https://www.fmz.com/digest-topic/5051
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
}
}
}