summaryrefslogtreecommitdiff
path: root/pypers/simionato_talk/simpleplotter.py
diff options
context:
space:
mode:
authormichele.simionato <devnull@localhost>2007-12-02 11:13:11 +0000
committermichele.simionato <devnull@localhost>2007-12-02 11:13:11 +0000
commit20ce686b0193d67ea56823a30551140f88b3aee1 (patch)
tree76015e7e4dc0b000bd857a2bdba6fb7976ac29a7 /pypers/simionato_talk/simpleplotter.py
parentf08f40335ad7f0ac961f25dabaaed34c4d4bcc44 (diff)
downloadmicheles-20ce686b0193d67ea56823a30551140f88b3aee1.tar.gz
Commited all py papers into Google code
Diffstat (limited to 'pypers/simionato_talk/simpleplotter.py')
-rw-r--r--pypers/simionato_talk/simpleplotter.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/pypers/simionato_talk/simpleplotter.py b/pypers/simionato_talk/simpleplotter.py
new file mode 100644
index 0000000..dcdb5ef
--- /dev/null
+++ b/pypers/simionato_talk/simpleplotter.py
@@ -0,0 +1,21 @@
+import os, sys
+from ms.plot_utils import GnuPlotter
+DATADIR = os.path.expanduser('~/sp/equities-histories')
+
+def make_graph(code, batch):
+ gp = GnuPlotter(batch=batch)
+ lines = list(file(os.path.join(DATADIR, code)))[-500:]
+ data = ''.join(lines)
+ png_file='/tmp/%s.png' % code
+ gp.plot(locals())
+ return png_file
+
+if __name__ == '__main__':
+ L = len(sys.argv) - 1
+ if L == 1:
+ batch = False
+ elif L == 2:
+ batch = bool(int(sys.argv[2])) # 0 or 1
+ else:
+ sys.exit('Examples: $ python simpleplotter.py fri-gb;AVE')
+ make_graph(sys.argv[1], batch)