arupa.pckswarms.ch - interesting uncommon markets


Arupa

20 June 2011

New code drop for Arupa. The results are way more realistic.

13 June 2011

New code drop for Arupa. The results are supprisingly good. For those of you who have spent too much time in the MBA world, this is not a positive statement.

While we're on the subject, usage of Arupa is at your own risk. Stupid doesn't even begin to define those who trust this for buy/sell signals. And, of course I don't even begin to qualify as a Financial Advistor (tm).

The current set of paths that it finds have values below. In all cases we start with 10,000 in value. That none of the numbers are less than 10,000 are disturbing. What that means is that either the program magically found a profitable path EVERY single time, or, there is a bug. My money would be on a bug. The only other explanation is that the S&P 500 was roughly 920 on my start data (in June 2009) and it is now in the mid 1200s, so, I'm just showing that in a rising market my code returns positive results....

* (dolist (ele (slot-value *zz* 'path)) (format t "~a~&" (slot-value ele 'path-value)))
92200.07
88040.42
81063.26
71856.84
59704.953
82867.195
110148.56
64777.594
87582.81
78722.5
100124.94
82667.24
60901.586
97835.82
67075.58
80327.84
89310.61
82566.93
69452.17
86621.4
81860.77
77281.84
105007.266
100011.164
72536.914
59579.8
77292.13
91197.195
90168.26
79084.12
86901.16
76833.766
94230.01
87130.92
89202.04
89526.06
78451.45
84265.664
85603.46
105289.73
85968.41
96727.53
76345.48
99173.52
109497.86
71800.74
75943.53
90546.086
95126.68
74256.516
93842.31
79140.195
101999.625
77442.805
72012.35
94718.19
71650.21
92260.945
106868.3
69531.164
87925.28
95629.84
76795.48
76938.83
104632.98
101337.555
66223.44
92845.62
99388.555
69935.25
57458.766
97588.0
61100.434
96563.734
82894.74
79687.5
70325.766
90546.18
94332.945
75761.86
62077.33
101627.16
62435.355
99443.336
48729.875
78649.76
82239.81
85627.22
109853.97
82751.0
104192.914
78135.88
64432.457
61161.254
62048.4
70886.3
77958.04
70617.28
110150.73
95278.82
67937.85
88591.97
79894.17
83562.18
74737.41
66615.734
76377.62
72341.445
103848.195
67556.67
99913.98
100363.63
63441.957
80770.99
66092.49
87215.664
81243.234
95238.69
72839.28
69922.2
58167.17
73812.93
78514.1
74214.53
63690.2
75311.91
61204.195
104933.125
60436.65
106315.96
57665.4
76495.7
59311.16
94974.34
87899.625
84939.46
58431.72
66236.34
100552.78
65558.7
100068.24
67595.4
80703.15
85584.16
91365.66
69907.02
69501.07
64369.703
64295.707
66359.53
98607.47
106859.2
65096.098
70782.81
61499.918
81683.8
79532.84
57493.25
84932.375
55989.633
106899.17
78709.69
77324.58
64450.855
102422.75
68053.28
106902.695
110273.8
88108.31
60879.766
61197.26
109559.79
90561.26
106857.305
89319.75
99310.91
60261.086
105175.17
67892.07
69070.65
85398.51
67868.3
102082.945
87821.87
68020.68
63279.848
102715.25
107980.35
92190.71
100547.94
69020.77
88376.89
83694.71
65795.89
66122.84
63286.53
82959.73
80447.79
73652.0
81941.58
70570.28
64597.633
108984.18
101276.62
91502.46
92923.945
96260.11
93963.51
77145.42
82132.35
91663.414
90061.9
66462.28
86103.22
87228.89
100645.11
107539.336
76203.5
94756.14
71218.26
70183.69
101593.76
68173.266
77418.24
76053.13
95306.52
72687.65
79773.03
72265.47
74177.53
67455.305
106023.016
99697.14
88811.875
81068.7
87017.58
57966.24
77360.05
78468.23
98182.02
84318.69
66451.11
96018.875
104156.03
86277.12
80276.305
71715.695
62726.477
73481.63
87173.05
70682.57
77060.09
78000.09
93265.25
75082.68
68155.6
90852.85
63443.11
80034.34
81304.37
79528.01
98775.39
80865.125
103226.97
85903.12
78899.22
81775.22
79799.63
75188.21
71115.73
79134.24
72392.59
80046.555
83082.48
98663.61
84917.914
99514.6
103782.04
92824.05
77509.93
64616.453
72108.87
64146.703
70133.32
94755.83
82220.24
105719.555
57384.7
91926.93
84933.01
106026.54
104438.47
107710.82
63960.56
97656.98
96387.82
66331.34
76730.1
64197.06
76435.195
106873.79
86900.0
104235.21
67935.516
102493.836
80958.375
81478.414
69077.58
78197.664
73357.21
NIL
* 

Overview

Arupa is a stock market swarm portfolio discovery program. It is heavily inspired both by Marco Dorigo's Swarm Optimization ideas as well as Mandelbrot's fractal markets ideas

Data Collection

I use Yahoo Finance to get the data. You can get data in nice csv responses.

Collect the data when the markets are open (in the US) with a crontab entry which looks like:

       1,16,31,46 15-22 * * 1-5  $HOME/work/stcstw/djia.sh
      

djia.sh is a simple shell script which collects one csv file per day of the DJIA 30, and S&P500 stocks.

It uses a simple http client in lisp

Once you have the data process it into a binary file with parse.lisp

      (parse-directory-to-db "~/markets/sp500/*.csv") 
      

That parsed a whole directory of csv files for the S&P 500 into one binary file.

Once that is done grab the below and put them all in the same directory:

(load "arupa")
(defvar *zz* (arupa))

* (describe *zz*)

#
  [standard-object]

Slots with :INSTANCE allocation:
  STOCKS               = #
  CURRENT-LENGTH       = 0
  TRANSACTIONS         = NIL
  PATH                 = (# #..
  PATH-VALUE           = 0
  ACCUMULATION-LENGTH  = 43612
* (defvar *yy* (first (slot-value *zz* 'path)))

*YY*


* (describe *yy*)

#
  [standard-object]

Slots with :INSTANCE allocation:
  STOCKS               = #
  CURRENT-LENGTH       = 0
  TRANSACTIONS         = NIL
  PATH                 = ((BUY #1="EIX " 21 39.37 0) (SELL #1# 21 39.36 1)..
  PATH-VALUE           = 54214.58
  ACCUMULATION-LENGTH  = 40335
* (slot-value *yy* 'path)

((BUY "EIX " 21 39.37 0) (SELL "EIX " 21 39.36 1) (BUY "AIZ " 48 36.99 2)
 (BUY "AET " 9 43.47 3) (BUY "BLL " 11 39.04 4) (BUY "HRB " 55 15.99 5)
 (BUY "TE  " 80 19.1 6) (SELL "AIZ " 48 36.99 7) (BUY "CTSH" 12 75.75 8)
 (BUY "CTSH" 12 75.67 9) (BUY "HCP " 35 37.45 10) (BUY "LOW " 68 24.19 11)
 (BUY "DGX " 1 57.98 12) (BUY "HCP " 29 37.45 13) (SELL "AET " 9 43.46 14)
 (BUY "AET " 12 43.46 15) (BUY "DGX " 28 57.96 16) (BUY "HRB " 13 15.98 17)
 (SELL "BLL " 11 39.09 18) (BUY "EIX " 4 39.41 19) (BUY "CTSH" 5 76.05 20)
 (BUY "MEE " 24 65.51 21) (SELL "HRB " 55 15.97 22) (BUY "AET " 16 43.59 23)
 (BUY "MEE " 24 64.01 24) (BUY "CVS " 11 38.8 25) (SELL "TE  " 80 19.06 26)
 (BUY "AET " 17 43.59 27) (SELL "CTSH" 12 74.76 28) (BUY "EIX " 39 39.32 29)
 (SELL "CTSH" 12 74.76 31) (BUY "DGX " 29 57.63 32) (BUY "KFT " 29 34.75 33)
 (BUY "CVS " 45 38.8 34) (SELL "HCP " 35 37.22 35) (BUY "LMT " 12 77.26 36)
 (BUY "EIX " 43 39.32 38) (SELL "LOW " 68 24.25 39) (BUY "LMT " 10 77.26 40)
 (BUY "LMT " 12 77.26 41) (BUY "HRB " 69 15.97 42) (SELL "DGX " 1 57.63 43)
 (SELL "HCP " 29 37.22 44) (BUY "CVS " 44 38.8 45) (SELL "AET " 12 43.59 46)
 (BUY "AIZ " 37 37.08 47) (BUY "LMT " 22 77.26 48) (BUY "DGX " 14 57.63 49)
 (BUY "BLL " 14 39.08 50) (BUY "LMT " 21 77.26 51) (SELL "DGX " 28 57.63 52)
 (SELL "HRB " 13 15.97 53) (BUY "TE  " 80 19.06 54) (BUY "HCP " 30 37.22 55)
 (BUY "TSS " 76 18.46 56) (SELL "EIX " 4 39.32 57) (SELL "CTSH" 5 74.76 58)
 (SELL "MEE " 24 64.01 59) (BUY "TE  " 52 19.06 60) (BUY "AET " 34 43.56 61)
 (BUY "MEE " 6 63.96 62))


In the buy/sell list you have (buy|sell), ticker, quantity, price, and time offset. Normally you would follow this by a pattern matching routine to match a portion of the above walk through a portfolio to some time period, to decide to buy or sell for real.


Bruce O'Neel

Last modified: Wed Jun 5 22:19:37 CEST 2011