> Name 爬取币安公告自动出售将要下架币crawl-Binance-announcements-and-sell-Delist-coin > Author 小草 > Strategy Description 爬取币安公告页面,观察近两次的下架信息,具体格式为“Binance将下架CLOAK、MOD、SALT、SUB、WINGS”、“Binance将下架BCN,CHAT,ICN,TRIG”。 爬虫将以“将下架”为关键词爬取新的下架公告,当然不排除币安更改公告格式,可参考此策略加以完善。由于爬虫任务过于简单,将用简单的JavaScript编写。爬取到下架币后,将检查账户信息,如果存在下架币,以较低的价格全部卖出,如果存在未完成订单,先撤销。直到将所持有的下架币完全卖出。 具体分析,参考帖子:https://zhuanlan.zhihu.com/p/57012933 > Source (javascript) ``` javascript var exchangeInfo = JSON.parse(HttpQuery('https://api.binance.com/api/v1/exchangeInfo')) var pairInfo = {} var downList = [] if(exchangeInfo){ for (var i=0; i pairInfo[symbol].minQty && sellPrice*sellAmount > pairInfo[symbol].minNotional){ var id = exchange.Sell(sellPrice, sellAmount, symbol) exchange.CancelOrder(order.orderId) } } function cancellOrder(){ var openOrders = exchange.IO('api', 'GET', '/api/v3/openOrders') for (var i=0; i-1 && parseFloat(account.Info.balances[i].free)>pairInfo[account.Info.balances[i].asset+'BTC'].minQty){ Log('this coin will be dumped', account.Info.balances[i].asset) sellAll(account.Info.balances[i].asset, parseFloat(account.Info.balances[i].free)) done = false } } Sleep(1000) } Log('sell done') } function main() { var title = '' while(true){ var html = HttpQuery('https://support.binance.com/hc/en-us/sections/115000202591-Latest-News') html = html.slice(html.indexOf('Delist '),html.length) if(html){ if(html.slice(7,html.indexOf('')) != title){ title = html.slice(7,html.indexOf('')) downList = html.slice(7,html.indexOf('')).replace(' and ', ',').split(',') Log('new announcement,will delist:', downList) cancellOrder() checkAccount() }else{ Log('new announcement was not found') } }else{ Log('web spider wrong') } Sleep(60*1000) } } ``` > Detail https://www.fmz.com/strategy/137450 > Last Modified 2019-07-03 16:16:39