[' Program to pull Gold and Silver Price data from the internet
' The program starts at 8:00am each day, and runs for 10 hours
' The program will capture data at 5 minute intervals, and store the data to disk
' The disk file is open and closed as each cycle occurs
'
' This is version 9 of the program
' Program property of Mike Lawson
'
WIDTH 80, 60 '80 columns & 60 rows DIM FullDate$
(120), AuPrice$
(120), AgPrice$
(120) _TITLE "Date Time Web Pull ver 09 by Mike Lawson" '
FileName$ = NewDate$ + "WebPull.txt"
'
TimeRecheck:
IF HHMM$
<> "08:00" GOTO TimeRecheck
'rerun:
loop2:
loop3:
'
n = 1
loop1:
IF n
= 3 THEN AuPrice$
(N1
) = MID$(TextLine$
(n
), 26, 7) IF n
= 4 THEN AgPrice$
(N1
) = MID$(TextLine$
(n
), 26, 5) n = n + 1
finish:
'
day$
= STR$(D
) ' eliminate any leading zeros CASE 1: Moon$
= "January" CASE 2: Moon$
= "February" CASE 9: Moon$
= "September" CASE 10: Moon$
= "October" CASE 11: Moon$
= "November" CASE 12: Moon$
= "December" PRINT WeekDay$
(M
, D
, Y
) + ", " + Moon$
+ day$
+ ", " + year$
+ SPACE$(3); Clock$
+ SPACE$(3);
FullDate$
(N1
) = WeekDay$
(M
, D
, Y
) + " " + Moon$
+ day$
+ " " + year$
+ SPACE$(3) + Clock$
'
'Output data to disk
'
AgDelta
= VAL(AgPrice$
(N1
)) - VAL(AgPrice$
(1)): AuDelta
= VAL(AuPrice$
(N1
)) - VAL(AuPrice$
(1)) _TITLE "Date Time Web Pull ver 09 by Mike Lawson " + "Silver " + STR$(AgDelta
) + " Gold " + STR$(AuDelta
) WRITE #1, FullDate$
(N1
), AuPrice$
(N1
), AgPrice$
(N1
) loop4:
'GOTO loop2
'GOTO rerun
' --------------------
' Functions go here
' --------------------
' Weekday formatting function
IF M
< 3 THEN M
= M
+ 12: Y
= Y
- 1 'add 12 to Jan - Feb month, -1 year C
= Y \
100: Y
= Y
MOD 100 'split century and year number S1 = (C \ 4) - (2 * C) - 1 'century leap
S2 = (5 * Y) \ 4 '4 year leap
S3 = 26 * (M + 1) \ 10 'days in months
WkDay
= (S1
+ S2
+ S3
+ D
) MOD 7 'weekday total remainder IF WkDay
< 0 THEN WkDay
= WkDay
+ 7 'Adjust negative results to 0 to 6 CASE 3: day$
= "Wednesday" CASE 4: day$
= "Thursday" CASE 6: day$
= "Saturday" WeekDay$ = day$
' Clock formatting function
Clock$ = hour$ + min$ + ampm$