#!/usr/bin/env bash MONTH=$(date +%b) FILENAME=$(curl -sq https://www.hkex.com.hk/eng/stat/dmstat/dayrpt/dmreport8.htm | grep -A5 'Day Trading Session' | tail -1 | cut -d\" -f2) echo "* HSI options big player positions" > /tmp/msg echo "3000 support | 4000 strong support | 5000 iron | 6000 steel" >> /tmp/msg echo "" >> /tmp/msg links2 -dump "https://www.hkex.com.hk/eng/stat/dmstat/dayrpt/$FILENAME" \ | head -190 | egrep '^\ [A-Z]*\-.*[CP].*' | awk '{if ($21 > 2500) print $1,$2,$3,$21,$NF}' >> /tmp/msg echo "" >> /tmp/msg echo "* HSIF position day end" >> /tmp/msg mkdir -p /tmp/hsif-tmp FILENAME="DTOP_F_$(date +%Y%m%d).zip" wget -O /tmp/hsif-tmp/$FILENAME "https://www.hkex.com.hk/eng/stat/dmstat/oi/$FILENAME" unzip -qq -d /tmp/hsif-tmp/ /tmp/hsif-tmp/$FILENAME cat /tmp/hsif-tmp/*dtop_f_hkcc_fut_dtl_hsi.rpt | grep ^HSI | head -1 | awk '{print $2,"Gross: ",$4,"Net: ",$5,"Change: ", $6}' >> /tmp/msg rm -rf /tmp/hsif-tmp mailx -s "HSI options 大戶位 / HSI future day end / $(date +%x)" -- xpk@headdesk.me,maggie.cmk@gmail.com < /tmp/msg # mailx -s "HSI options 大戶位 $(date +%x)" -- xpk@headdesk.me < /tmp/msg rm -f /tmp/msg