Very simple, just for learn. Code is best annotation.
হিমশৈল কমান্ড ক্রয়, অর্ডারকে ছোট ছোট M ক্রয়ে বিভক্ত করা, বাজারকে ধাক্কা না দেওয়া, বিটকয়েনের পরিমাণগত ট্রেডিংয়ের জন্য একটি ভাল এবং সহজ শিক্ষণ কৌশল
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)
Log('Iceberg order to buy is done, avg cost is ', avgCost) // including fee cost
return
}
}
}