Keyboard Shortcuts
ctrl + shift + ? :
Show all keyboard shortcuts
ctrl + g :
Navigate to a group
ctrl + shift + f :
Find
ctrl + / :
Quick actions
esc to dismiss
Likes
Search
Re: Upcoming stock earnings dates
souqmate
Thanks for the link, rwk and Robert.
toggle quoted message
Show quoted text
Below are the one-liners to scrape Yahoo calendars on linux; cut 'n paste in your xterm (tcsh). European stocks appear in earnings.csv (since 2011), confCalls.csv (since 2013), in surprises.csv (since 2011), not in splits.csv nor ipo.csv. No Japanese stocks, as ramdukof bemoans; any hint welcome! Files with history (confCalls.csv, earnings.csv, ipo.csv, splits.csv, surprises.csv, marcro.csv) are readily available for 7 days at Good luck souqMate. ----------------------- # Earnings: since 19990401 (old format prior 20001031); header: "# Company,Symbol,Time (NY, or Before/After Mkt)" foreach d (19990401 19990402 ... 20130712) wget -q -O - " | sed -n '/>Conference</,/^colspan/H; ${x;s,\n, ,g; s,<td,\n<td,g; p}' | awk 'NR>1 && !(/colspan/)' | sed 's,<[^>]*>,,g; s, , ,g; s,&,\&,g; s/,//g' | awk '{l=NR%4; if(l==1) printf "'$d',"; if(l>0 && l<3) printf $0","; if(l==3){t=""; if(/Before/) t="Before"; if(/After/) t="After"; if(/ET/){split($1,a,":"); if(/pm/) a[1]+=12; t=a[1]":"a[2]} print t}}' >>! earnings.csv end # Conf Calls: since 20111014; header: "# Date,Time (NY),Symbol(if several: separated by blanks),Event" foreach d (20111014 20111015 ... 20130712) wget -q -O - " | sed -n '/>Access</,/size=1/H; ${x;s,\n, ,g; s,<td,\n<td,g; p}' | awk 'NR>1' | sed 's,<[^>]*>,,g; s, , ,g; s,&,\&,g; s/,//g' | awk '{l=NR%4; if(l==1){split($1,a,":"); if(/pm/) a[1]+=12; t=sprintf("%02d:%02d",a[1],a[2]); printf '$d'","t","} if(l==2) printf $0","; if(l==3) print $0}' >>! confCalls.csv end # Surprises, since 20021209; header: "# Date,Company,Symbol,Surprise (%),Reported EPS,Consensus EPS" foreach d (20021209 20021210 ... 20130712) wget -q -O - " | sed 's,</tr><tr,</tr>\n<tr,g; s,&,\&,g; s/,//g' | awk '/^<tr.*td><td$/,/^nowrap/{gsub(/^align/,"<align",$0); gsub(/td$/,"td>",$0); gsub(/<[^>]*>/,"",$0); print}' | awk '{l=NR%7; if(l==1) printf "'$d',"; if(l>0 && l<5) printf $0","; if(l==5) print $0}' >>! surprises.csv end # splits, since Jan 2000; header: "# Payable,Ex Date,Company,Symbol,Optionable?,Ratio,Announced" foreach y (00 01 02 03 04 05 06 07 08 09 10 11 12 13) foreach m (1 2 3 4 5 6 7 8 9 10 11 12) wget -q -O - " | grep ^noshade | sed 's,</table.*,,g; s,<tr,\n<tr,g; s,<td,\n<td,g; s,<[^>]*>,,g; s/,//g; s,&,\&,g; s, *,,g' | grep -v ^noshade | awk 'BEGIN{m["Jan"]=1;m["Feb"]=2;m["Mar"]=3;m["Apr"]=4;m["May"]=5;m["Jun"]=6;m["Jul"]=7;m["Aug"]=8;m["Sep"]=9;m["Oct"]=10;m["Nov"]=11;m["Dec"]=12} {l=NR%9; if(l==2||l==3||l==8){y=2000+'$y'; if(l==3) M=m[$1]; if(l==8 && m[$1]>M) y--; if(NF>0) $0=sprintf("%s%02d%02d",y,m[$1],$2)} if(l>1 && l<8) printf $0","; if(l==8) print $0}' >>! splits.csv end end # IPO pricings, since Jan 1998; header: "# OfferDate,Company,Symbol,SharesOffered[mln],ProposedPric[$],InitialPrice[$]" foreach y (98 99 00 01 02 03 04 05 06 07 08 09 10 11 12 13) foreach m (jan feb mar apr may jun jul aug sep oct nov dec) wget -q -O - " | sed 's,</TR>,</TR>\n,g' | grep '^<tr><td align' | sed 's,<td,\n<td,g; s,>M<,><,g; s,<[^>]*>,,g; s/,//g; s,\$,,g' | awk 'BEGIN{m["Jan"]=1;m["Feb"]=2;m["Mar"]=3;m["Apr"]=4;m["May"]=5;m["Jun"]=6;m["Jul"]=7;m["Aug"]=8;m["Sep"]=9;m["Oct"]=10;m["Nov"]=11;m["Dec"]=12} {l=NR%8; if(l==2){split($1,a,"-"); y=(a[3]>90? 1900:2000)+a[3]; $0=sprintf("%04d%02d%02d",y,m[a[2]],a[1])} if(l>1 && l<7) printf $0","; if(l==7) print $0}' >>! ipo.csv end end # macro-economy, since 20010102; header: "# date,time(NY),indicator,For,Actual,BriefingForecast,Expect,Prior,RevisedFrom" awk 'BEGIN{for(i=2001;i<2013;i++) for(j=1;j<53;j++) printf "%s%02d\n",i,j}' > ! /tmp/i foreach i ( `cat /tmp/i` ) wget -q -O - " | sed -n '/^From/,/^href/{s,<tr,\n<tr,g; s,More in-depth.*$,,; s,<[^<]*>, ,g; s, bcf,bcf,g; p}' | awk 'BEGIN{m["Jan"]=1;m["Feb"]=2;m["Mar"]=3;m["Apr"]=4;m["May"]=5;m["Jun"]=6;m["Jul"]=7;m["Aug"]=8;m["Sep"]=9;m["Oct"]=10;m["Nov"]=11;m["Dec"]=12} !(/^From|^href/){yr=substr('$i',1,4); d=sprintf("%s%02d%02d",yr,m[$1],$2); split($3,a,":"); hr=a[1]; mi=a[2]; if($4=="PM") hr+=12; t=sprintf("%02d%02d",hr,mi); txt=$5; for(n=6;n<NF-5;n++) txt=txt" "$n; OFS=","; print d,t,txt,$(NF-5),$(NF-4),$(NF-3),$(NF-2),$(NF-1),$NF}' >> macro.csv end # caution: prior 20120323, times are wrong: apply UTC2EST twice and subtract 3 hrs to get NY time. Corrected in the uploaded file. Corrections: 20090422 20090121 have Crude Oil at 1030 instead of 1035; and over 20080604-20081231 have it at 1035; over 2005-2010 can find Crude Oil on Wed and subsequent Thu (when holidays; discard Wed entry). Uploaded file is actually in tsv; change to csv: sed 's/,//g; s/\t/,/g' macro.tsv > macro.csv --- In TWSAPI@..., "rwk2095" <r@...> wrote:
|
to navigate to use esc to dismiss