1 |
dpavlin |
1.1 |
#!/bin/sh |
2 |
|
|
|
3 |
|
|
tmp=/var/tmp/stock4gp |
4 |
dpavlin |
1.2 |
dir=/data/corp/esi |
5 |
dpavlin |
1.1 |
|
6 |
dpavlin |
1.4 |
psql -t -A -F " " corp -c "set datestyle='german' ; select date(date),min(current),avg(current),max(current),type,count(*) from stocks group by date(date),type order by type,date(date)" -o $tmp |
7 |
dpavlin |
1.1 |
cat $tmp | grep -i lse > $tmp-lse |
8 |
|
|
cat $tmp | grep -i ftse > $tmp-ftse |
9 |
|
|
|
10 |
|
|
gnuplot -persist << EOF |
11 |
|
|
set terminal png color |
12 |
dpavlin |
1.2 |
set output '$dir/out.png' |
13 |
dpavlin |
1.1 |
set noclip points |
14 |
|
|
set clip one |
15 |
|
|
set noclip two |
16 |
|
|
set bar 1.000000 |
17 |
|
|
set border 31 lt -1 lw 1.000 |
18 |
|
|
set xdata time |
19 |
|
|
set ydata |
20 |
|
|
set zdata |
21 |
|
|
set x2data |
22 |
|
|
set y2data |
23 |
|
|
set boxwidth |
24 |
|
|
set dummy x,y |
25 |
|
|
set format x "%d.%m" |
26 |
|
|
set format y "%g" |
27 |
|
|
set format x2 "%g" |
28 |
|
|
set format y2 "%g" |
29 |
|
|
set format z "%g" |
30 |
|
|
set angles radians |
31 |
|
|
set nogrid |
32 |
|
|
set key title "" |
33 |
|
|
set key right top Right noreverse box linetype -2 linewidth 1.000 samplen 4 spacing 1 width 0 |
34 |
|
|
set nolabel |
35 |
|
|
set noarrow |
36 |
|
|
set nolinestyle |
37 |
|
|
set nologscale |
38 |
|
|
set offsets 0, 0, 0, 0 |
39 |
|
|
set pointsize 1 |
40 |
|
|
set encoding default |
41 |
|
|
set nopolar |
42 |
|
|
set noparametric |
43 |
|
|
set view 60, 30, 1, 1 |
44 |
|
|
set samples 100, 100 |
45 |
|
|
set isosamples 10, 10 |
46 |
|
|
set surface |
47 |
|
|
set nocontour |
48 |
|
|
set clabel '%8.3g' |
49 |
|
|
set mapping cartesian |
50 |
|
|
set nohidden3d |
51 |
|
|
set cntrparam order 4 |
52 |
|
|
set cntrparam linear |
53 |
|
|
set cntrparam levels auto 5 |
54 |
|
|
set cntrparam points 5 |
55 |
|
|
set size ratio 0 1,1 |
56 |
|
|
set origin 0,0 |
57 |
|
|
set data style points |
58 |
|
|
set function style lines |
59 |
|
|
set xzeroaxis lt -2 lw 1.000 |
60 |
|
|
set x2zeroaxis lt -2 lw 1.000 |
61 |
|
|
set yzeroaxis lt -2 lw 1.000 |
62 |
|
|
set y2zeroaxis lt -2 lw 1.000 |
63 |
|
|
set tics in |
64 |
|
|
set ticslevel 0.5 |
65 |
|
|
set ticscale 1 0.5 |
66 |
|
|
set mxtics default |
67 |
|
|
set mytics default |
68 |
|
|
set mx2tics default |
69 |
|
|
set my2tics default |
70 |
|
|
set xtics border mirror norotate autofreq |
71 |
|
|
set ytics border mirror norotate autofreq |
72 |
|
|
set ztics border nomirror norotate autofreq |
73 |
|
|
set nox2tics |
74 |
|
|
set noy2tics |
75 |
|
|
set title "" 0.000000,0.000000 "" |
76 |
|
|
set timestamp "" bottom norotate 0.000000,0.000000 "" |
77 |
|
|
set rrange [ * : * ] noreverse nowriteback # (currently [-0.00000:10.0000] ) |
78 |
|
|
set trange [ * : * ] noreverse nowriteback # (currently ["31.12.1999":"01.01.2000"] ) |
79 |
|
|
set urange [ * : * ] noreverse nowriteback # (currently ["31.12.1999":"01.01.2000"] ) |
80 |
|
|
set vrange [ * : * ] noreverse nowriteback # (currently [-5.00000:5.00000] ) |
81 |
|
|
set xlabel "" 0.000000,0.000000 "" |
82 |
|
|
set x2label "" 0.000000,0.000000 "" |
83 |
|
|
set timefmt "%d\.%m\.%Y" |
84 |
|
|
set xrange [ * : * ] noreverse nowriteback # (currently ["31.12.1999":"01.01.2000"] ) |
85 |
|
|
set x2range [ * : * ] noreverse nowriteback # (currently [-10.0000:10.0000] ) |
86 |
|
|
set ylabel "" 0.000000,0.000000 "" |
87 |
|
|
set y2label "" 0.000000,0.000000 "" |
88 |
|
|
set yrange [ * : * ] noreverse nowriteback # (currently [-10.0000:10.0000] ) |
89 |
|
|
set y2range [ * : * ] noreverse nowriteback # (currently [-10.0000:10.0000] ) |
90 |
|
|
set zlabel "" 0.000000,0.000000 "" |
91 |
|
|
set zrange [ * : * ] noreverse nowriteback # (currently [-10.0000:10.0000] ) |
92 |
|
|
set zero 1e-08 |
93 |
|
|
set lmargin -1 |
94 |
|
|
set bmargin -1 |
95 |
|
|
set rmargin -1 |
96 |
|
|
set tmargin -1 |
97 |
|
|
set locale "C" |
98 |
|
|
plot '/var/tmp/stock4gp-lse' using 1:3:2:4 title 'LSE' with yerrorbars, '/var/tmp/stock4gp-lse' using 1:3 title 'average' with lines |
99 |
|
|
EOF |
100 |
dpavlin |
1.2 |
|
101 |
|
|
convert $dir/out.png -quality 90 $dir/stocks.jpg |