Merayapi pengumuman Binance tentang penghapusan mata uang

Penulis:Kebaikan, Dibuat: 2019-02-20 11:28:46, Diperbarui:

Tujuan strategi:

Pada tanggal 15 Februari, Binance mengumumkan pengumuman lepas landas dari CLOAK, MOD, SALT, SUB, WINGS. Setelah pengumuman, mata uang yang terlibat langsung mulai turun, umumnya turun 15% dalam satu jam, dengan semakin banyak pengguna mengetahui berita, penurunan terus berlanjut dan tidak ada rebound, dan telah turun setengah sejauh ini.

Strategi ini berjalan di platform perdagangan kuantitatif FMZ (sebelumnya BotVS).

Ide:

Merayapi halaman pengumuman keamanan Binance dan mengamati informasi dari dua waktu pengumuman terdekat. Format spesifiknya adalah Binance akan menghapus daftar CLOAK, MOD, SALT, SUB, WINGS, Binance akan menghapus daftar BCN, CHAT, ICN, TRIG.

Strategi ini akan menggunakan will delist sebagai kata kunci untuk merayapi pengumuman rilis baru, tentu saja, tidak mengesampingkan format pemberitahuan perubahan Binance, Anda dapat merujuk pada strategi ini untuk meningkatkan. Karena tugas crawler terlalu sederhana, itu akan ditulis dalam JavaScript sederhana. Setelah merayapi mata uang delist, informasi akun akan diperiksa. Jika ada mata uang delist, itu akan dijual dengan harga lebih rendah. Jika ada pesanan yang belum selesai, itu akan dibatalkan terlebih dahulu. Sampai penjualan koin yang tersisa terjual sepenuhnya.

Kode merangkak:

var html = HttpQuery('https://support.binance.com/hc/zh-cn/sections/115000202591-%E6%9C%80%E6%96%B0%E5%85%AC%E5%91%8A')//Announcement page
html = html.slice(html.indexOf('article-list'),html.indexOf('pagination')) // Article list section
if(html.indexOf('will delist')>0){
    if(html.slice(html.indexOf('will delist')+3,html.indexOf('</a>')) != title){ //crawl only the first delist information
        var title = html.slice(html.indexOf('delist')+3,html.indexOf('</a>'))
        var downList = title.split('、')
        Log('New announcement is detected, the currency will be delist:', title, '@')//WeChat push release announcement
    }
}

Undur kode perintah:

function cancellOrder(){
    var openOrders = exchange.IO('api', 'GET', '/api/v3/openOrders')//Get all unexecuted orders
    for (var i=0; i<openOrders.length; i++){
        var order = openOrders[i];
        for (var j=0;j<downList.length;j++){
            if(order.symbol.startsWith(downList[j])){
                var currency = downList[j] + '_' + order.symbol.slice(downList[j].length);
                Log('There is a delist currency order exist, revoked', currency)
                exchange.IO("currency", currency)//To revoke a order, you need the trading pair information, so you must first switch to the trading pair.
                exchange.CancelOrder(order.orderId)
            }
        }
    }
}

Kode rekening cek:

function checkAccount(){
    var done = false
    while(!done){
        account = _C(exchange.GetAccount)
        done = true
        for (var i=0; i<account.Info.balances.length; i++){
            if(downList.indexOf(account.Info.balances[i].asset)>-1 && parseFloat(account.Info.balances[i].free)>pairInfo[account.Info.balances[i].asset+'BTC'].minQty){
                Log('delist currency will be emptied', account.Info.balances[i].asset)
                sellAll(account.Info.balances[i].asset, parseFloat(account.Info.balances[i].free))
                done = false
            }
        }
        Sleep(1000)
    }
    Log('Sale completed')
}

Kode pesanan:

var exchangeInfo = JSON.parse(HttpQuery('https://api.binance.com/api/v1/exchangeInfo'))
var pairInfo = {}  //Trading pair information, storing transaction progress, minimum trading volume and other related information, placing order will needed
if(exchangeInfo){
    for (var i=0; i<exchangeInfo.symbols.length; i++){
        var info = exchangeInfo.symbols[i];
        pairInfo[info.symbol] = {minQty:parseFloat(info.filters[2].minQty),tickerSize:parseFloat(info.filters[0].tickSize), 
            stepSize:parseFloat(info.filters[2].stepSize), minNotional:parseFloat(info.filters[3].minNotional)}
    }
}else{
    Log('Failed to get transaction information')
}
function sellAll(coin, free){
    var symbol = coin + 'BTC'
    exchange.IO("currency", coin+'_BTC') //switching trading pair
    var ticker = _C(exchange.GetTicker)
    var sellPrice = _N(ticker.Buy*0.7, parseInt((Math.log10(1.1/pairInfo[symbol].tickerSize))))
    var sellAmount = _N(free, parseInt((Math.log10(1.1/pairInfo[symbol].stepSize))))
    if (sellAmount > pairInfo[symbol].minQty && sellPrice*sellAmount > pairInfo[symbol].minNotional){
        exchange.Sell(sellPrice, sellAmount, symbol)
    }
}

Singkatnya:

Kode di atas hanya untuk demonstrasi, kode lengkap dapat ditemukan diFMZ.COM. Halaman pengumuman dapat dijelajahi sekali dalam satu menit, yang akan memiliki cukup waktu untuk menjual sebelum pengguna biasa.

Namun mungkin ada beberapa masalah, seperti crawling yang diblokir, perubahan format pengumuman, dan sebagainya. Jika mata uang tidak ada di Binance, Anda juga dapat merujuk strategi ini ke bursa lain.


Lebih banyak