Permalink
Browse files

formatting shtuffs

  • Loading branch information...
1 parent 62f9e83 commit 43044b9b49cd8652aa489732bbf2257f6e783157 Elizabeth Anne Bartos committed Nov 16, 2012
Showing with 774 additions and 92 deletions.
  1. +2 −2 plot_stock.pl
  2. +119 −0 plot_stock.pl~
  3. +12 −2 portfolio.css
  4. +134 −0 portfolio.css~
  5. +145 −88 portfolio.pl
  6. +349 −0 portfolio.pl~
  7. +13 −0 user.pm
View
@@ -13,8 +13,8 @@
BEGIN {
$ENV{PORTF_DBMS}="oracle";
$ENV{PORTF_DB}="cs339";
- $ENV{PORTF_DBUSER}="sjd842";
- $ENV{PORTF_DBPASS}="z5kathUG6";
+ $ENV{PORTF_DBUSER}="eab879";
+ $ENV{PORTF_DBPASS}="w67iYahH";
unless ($ENV{BEGIN_BLOCK}) {
use Cwd;
View
@@ -0,0 +1,119 @@
+#!/usr/bin/perl -w
+
+
+use strict;
+use CGI qw(:standard);
+use DBI;
+use Time::ParseDate;
+use Date::Parse;
+use Date::Format;
+use user;
+use File::Copy;
+
+BEGIN {
+ $ENV{PORTF_DBMS}="oracle";
+ $ENV{PORTF_DB}="cs339";
+ $ENV{PORTF_DBUSER}="sjd842";
+ $ENV{PORTF_DBPASS}="z5kathUG6";
+
+ unless ($ENV{BEGIN_BLOCK}) {
+ use Cwd;
+ $ENV{ORACLE_BASE}="/raid/oracle11g/app/oracle/product/11.2.0.1.0";
+ $ENV{ORACLE_HOME}=$ENV{ORACLE_BASE}."/db_1";
+ $ENV{ORACLE_SID}="CS339";
+ $ENV{LD_LIBRARY_PATH}=$ENV{ORACLE_HOME}."/lib";
+ $ENV{BEGIN_BLOCK} = 1;
+ $ENV{GDFONTPATH}="/usr/share/fonts/liberation";
+ $ENV{GNUPLOT_DEFAULT_GDFONT}="LiberationSans-Regular";
+ exec 'env',cwd().'/'.$0,@ARGV;
+ }
+};
+
+use stock_data_access;
+
+my $type = param('type');
+my $symbol = param('symbol');
+my $start = param('start');
+my $end = param('end');
+
+if (defined(param('start'))) {
+ $start = str2time(param('start'));
+} else {
+ $start = 0;
+}
+
+if (defined(param('end'))) {
+ $end = str2time(param('end'));
+} else {
+ $end = time;
+}
+
+if (!defined($type)) {
+ $type = 'plot';
+}
+
+my $sqlString = "";
+$sqlString .= "SELECT timestamp, close FROM ".GetStockPrefix()."StocksDaily ";
+$sqlString .= " WHERE symbol=rpad(:1,16) AND timestamp BETWEEN :2 AND :3";
+$sqlString .= " UNION ";
+$sqlString .= "SELECT timestamp, close FROM $netID.newstocksdaily ";
+$sqlString .= " WHERE symbol=rpad(:1,16) AND timestamp BETWEEN :2 AND :3";
+my @rows;
+eval {
+ @rows = ExecStockSQL("2D",$sqlString,$symbol, $start, $end);
+};
+my $error = $@;
+
+if ($type eq "plot") {
+ print header(-type => 'image/png', -expires => '-1h' );
+ if (@rows != 0) {
+# This is how to drive gnuplot to produce a plot
+# The basic idea is that we are going to send it commands and data
+# at stdin, and it will print the graph for us to stdout
+#
+#
+ open(GNUPLOT,"| gnuplot") or die "Cannot run gnuplot";
+
+ print GNUPLOT "set term png\n"; # we want it to produce a PNG
+ print GNUPLOT "set output\n"; # output the PNG to stdout
+ print GNUPLOT "set xdata time\n";
+ print GNUPLOT "set timefmt \"%s\"\n";
+ if ($end - $start > 9000000) {
+ print GNUPLOT "set format x \"\%m/\%y\"\n";
+ } else {
+ print GNUPLOT "set format x \"\%m/\%d/\%y\"\n";
+ }
+ print GNUPLOT "plot '-' using 1:2 with linespoints\n"; # feed it data to plot
+ foreach my $r (@rows) {
+ print GNUPLOT $r->[0], "\t", $r->[1], "\n";
+ }
+ print GNUPLOT "e\n"; # end of data
+
+#
+# Here gnuplot will print the image content
+#
+
+ close(GNUPLOT);
+ } else {
+ binmode STDOUT;
+ copy "./nodata.png", \*STDOUT;
+ }
+} else {
+ print header(-type => 'text/html', -expires => '-1h' );
+ print start_html;
+ print "<table border=1>";
+ print th(["Date", "Price"]);
+ foreach my $r (@rows) {
+ print Tr(
+ td([
+ time2str("%D", $r->[0]),
+ $r->[1]
+ ]),
+ ), "\n";
+ }
+ print "</table>";
+ print end_html;
+}
+
+
+
View
@@ -29,14 +29,21 @@ body {
}
+.returnToPorts { float: left; padding-left: 10px; }
+
.sidebar {
float: right;
display: block;
- width: 350px;
+ width: 30%; /*350px;*/
height: 100%;
margin-right: 20px;
}
-.action-btn { width : 240px; }
+
+.main {float: left; width: 65%; }
+.action-btn {
+ width : 240px;
+ font-weight: bold;
+}
.container {
float: left;
@@ -92,6 +99,9 @@ input[type=text] {
width: 55px;
}
+
+td { padding: 4px }
+th { padding: 4px }
/*.portfolio-summary {
border: 4px double red;
width: 350px;
View
@@ -0,0 +1,134 @@
+
+/* from bootstrap */
+body {
+ margin: 0;
+
+ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
+ font-size: 14px;
+ line-height: 20px;
+ color: #333333;
+ background-color: #ffffff;
+}
+
+.navbar {
+ width: 100%;
+ text-align: right;
+ min-height: 30px;
+ background-color: lightblue;
+
+ display: block;
+ padding-right: 25px;
+ vertical-align: center;
+ /*margin-top: 15px;
+ margin-bottom: 15px;
+ margin-left: 0px;
+ margin-right: 15px;*/
+}
+
+.portfolio-actions {
+
+}
+
+.returnToPorts { float: left; padding-left: 10px; }
+
+.sidebar {
+ float: right;
+ display: block;
+ width: 30%; /*350px;*/
+ height: 100%;
+ margin-right: 20px;
+}
+
+.main {float: left; width: 65%; }
+.action-btn { width : 240px; font-weight: bold; }
+
+.container {
+ float: left;
+ padding: 15px;
+ margin: 0px;
+ /*float: left;
+ display: block;*/
+
+}
+
+h1 { font-size: 18px; color: black; }
+h2 { font-size: 14px; color: darkblue; line-height: 14px; }
+h3 { font-size: 13px; color: indigo; }
+
+hr {width: 50%; color: #333; }
+
+.stockName {
+ font-weight: bold;
+ color: turquoise;
+ padding-right: 50px;
+}
+
+.stockSymbol {
+ padding-right: 50px;
+
+ display: inline-block;
+}
+
+.numShares {
+ width: 200px;
+ display: inline-block;
+
+}
+
+.stockPast {
+ width: 200px;
+ display: inline-block;
+
+}
+
+.stockPredict {
+ width: 300px;
+ display: inline-block;
+}
+
+input[type=number] {
+ height: 30px;
+ width: 55px;
+}
+
+input[type=text] {
+ height: 30px;
+ width: 55px;
+}
+
+
+td { padding: 4px }
+th { padding: 4px }
+/*.portfolio-summary {
+ border: 4px double red;
+ width: 350px;
+ display: inline-block;
+ float: right;
+ }*/
+
+
+/*
+ #stock-holding-info {
+ height: 400px;
+ width: 400px;
+ border: 1px solid hotpink;
+ float: right;
+ margin: 50px;
+ }*/
+
+
+/*
+ p {
+ margin-top: 15px;
+ . margin-bottom: 15px;
+ margin-left: 0px;
+ margin-right: 15px;
+ .
+ p {
+ display: block;
+ -webkit-margin-before: 1em;
+ -webkit-margin-after: 1em;
+ -webkit-margin-start: 0px;
+ -webkit-margin-end: 0px;
+ }
+ */
Oops, something went wrong.

0 comments on commit 43044b9

Please sign in to comment.