#!/usr/local/bin/tops -s /usr/local/tops/sys -u /opt/mytops/usr/

# File eod1tch, July 2010
# Run tradingcharts.com too.

# File eod1, October 2004

# End of day collection of pit data

#-----------------------------------------------------------------------
    
   usrpath "mget.v" + source
   keys? not IF LOG-FILE set_sysout THEN

   ontheweb 
   IF " eod1: skipping pit end of day collection" . nl
      exit 
   THEN

   "/tmp" chdir

   inline: bcSAVE ( --- ) \ save bc data at end of day
      [ mpath time GMT>LA ctime 1st quote strchop
        sysdate drop intstr ".dat" cat cat "FILE" book
      ]
      " bcSAVE: begin " date + . nl
      bcEOD any? not
      IF 10 idle
         bcEOD any? not
         IF " bcSAVE: two attempts failed" ersys "" THEN
      THEN

      any?
      IF FILE file? IF FILE FILE ".old" + fcopy THEN
         (hT) FILE save " bcSAVE: file saved " date + . nl
      ELSE
         " bcSAVE: failed " date + . nl
      THEN
   end
\  bcSAVE Do not run
  
 \ tcCOLLECT "bcSAVE" "FILE" yank -ext "_tch.dat" + save
   tcCOLLECT "bcSAVE" "FILE" yank save
      " tcCOLLECT: file saved " date + . nl
  
   no catmsg "snd.v" source 2 TING (qFile)
   (qFile) dup remote_wavPlayq 
   " eod1: playing sound file " . dup . sp date . nl
   (qFile) deleteif

   " eod1: ending" . nl

   exit
