aboutsummaryrefslogtreecommitdiffstats
path: root/awklib/eg/network
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2018-05-27 23:14:49 +0300
committerArnold D. Robbins <arnold@skeeve.com>2018-05-27 23:14:49 +0300
commit25b0b016e33315857b299fbacf7c17e3d35a9e4f (patch)
tree0ca540185be200904a21a116a8de2afd14cec64b /awklib/eg/network
parente4c4d7bdb58cc90d8397a5d7d72d03974ad6a5fb (diff)
parenta9df82701a087b45b4c6991fb0c20f6911c278ad (diff)
downloadegawk-25b0b016e33315857b299fbacf7c17e3d35a9e4f.tar.gz
egawk-25b0b016e33315857b299fbacf7c17e3d35a9e4f.tar.bz2
egawk-25b0b016e33315857b299fbacf7c17e3d35a9e4f.zip
Merge branch 'master' into feature/fix-comments
Diffstat (limited to 'awklib/eg/network')
-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 = ","