aboutsummaryrefslogtreecommitdiffstats
path: root/awklib/eg/network/stoxpred.awk
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2018-05-27 23:14:14 +0300
committerArnold D. Robbins <arnold@skeeve.com>2018-05-27 23:14:14 +0300
commita9df82701a087b45b4c6991fb0c20f6911c278ad (patch)
treeddc1ae7cc962003964ac211ac9dd9353fc3691fb /awklib/eg/network/stoxpred.awk
parent94916f2066cc45507ac9605dfc897f63eb3f0ea0 (diff)
parent29f1563294ac1ab19aa252f3fd5fca94c4f88516 (diff)
downloadegawk-a9df82701a087b45b4c6991fb0c20f6911c278ad.tar.gz
egawk-a9df82701a087b45b4c6991fb0c20f6911c278ad.tar.bz2
egawk-a9df82701a087b45b4c6991fb0c20f6911c278ad.zip
Merge branch 'gawk-4.2-stable'
Diffstat (limited to 'awklib/eg/network/stoxpred.awk')
-rw-r--r--awklib/eg/network/stoxpred.awk29
1 files changed, 29 insertions, 0 deletions
diff --git a/awklib/eg/network/stoxpred.awk b/awklib/eg/network/stoxpred.awk
index 62744c14..aa1fbe9f 100644
--- a/awklib/eg/network/stoxpred.awk
+++ b/awklib/eg/network/stoxpred.awk
@@ -1,3 +1,32 @@
+BEGIN {
+ Init()
+ ReadQuotes()
+ CleanUp()
+ Prediction()
+ Report()
+ SendMail()
+}
+function Init() {
+ if (ARGC != 1) {
+ print "STOXPRED - daily stock share prediction"
+ print "IN:\n no parameters, nothing on stdin"
+ print "PARAM:\n -v Proxy=MyProxy -v ProxyPort=80"
+ print "OUT:\n commented predictions as email"
+ print "JK 09.10.2000"
+ exit
+ }
+ # Remember ticker symbols from Dow Jones Industrial Index
+ StockCount = split("AA GE JNJ MSFT AXP GM JPM PG BA HD KO \
+ SBC C HON MCD T CAT HWP MMM UTX DD IBM MO WMT DIS INTC \
+ MRK XOM EK IP", name);
+ # Remember the current date as the end of the time series
+ day = strftime("%d")
+ month = strftime("%m")
+ year = strftime("%Y")
+ if (Proxy == "") Proxy = "chart.yahoo.com"
+ if (ProxyPort == 0) ProxyPort = 80
+ YahooData = "/inet/tcp/0/" Proxy "/" ProxyPort
+}
function ReadQuotes() {
# Retrieve historical data for each ticker symbol
FS = ","