Numpy Strategies 0.0.7
The 3 moment CAPM takes into account the mean, variance and skewness of asset returns. An investor prefers high positive skewness and low risk, because this corresponds to higher returns. I also did an experiment with fractional Brownian motion.
Numpy 1 Portfolio closure
After six weeks the Numpy 1 portfolio was closed. During this period ULCM merged. The portfolio did rather well, I would say, with more than 50 dollar profit per week.
It was a good week for the Numpy 4 portfolio.
The Numpy 5 portfolio had some startup issues, but now everything seems fine.
Fractional Brownian Motion
The fractal brownian motion describes fractal movements. The Hurst exponent H is the main parameter of this model. This exponent has a value between 0 and 1 and is a measure of self similarity of timeseries. A value of 0.5 corresponds with a random walk. H bigger than 0.5 indicates a tendency to trend, while H smaller than 0.5 corresponds with a tendency to oscillate around a mean. H can be estimated from a so called rescaled range. Luckily the Python pyeeg package already has a function that does that.
1 2 3 4 5 6 7 8 9 10 11 12 13 14
... H = pyeeg.hurst(returns) R = zeros( ( len(c), len(c) ) ) for i in range(1, len(c) + 1): for j in range(1, len(c) + 1): doubleH = 2 * H R[i - 1][j - 1] = (i ** doubleH + j ** doubleH - abs(i -j) ** doubleH) / 2 sigma = cholesky(R) path = sigma.dot( standard_normal( len(c) ) ) + c path = abs(path) ...
Here is a generated chart.
3 moment CAPM
The 3 moment CAPM takes into account the mean, variance and skewness of asset returns. An investor prefers high positive skewness and low risk, because this corresponds to higher returns. I also added the probability of positive returns as an optimization parameter. But that still was not selective enough, so I also select stocks that recently dropped in price by a certain amount.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
... S = stats.skew( returns ) skews.append( S ) pinc = pPos( returns ) pincs.append( pinc ) beforeLastReturn = c[ len( c ) - 2 ] / c[ len( c ) - 3 ] - 1 if beforeLastReturn > -1 * float( argv ) * ev: continue t = file.replace('.csv', ''), ev, madC, S, pinc records.append( t ) ( a,b,residuals ) = fitline( mads, evs ) ( aSkew, bSkew, residuals ) = fitline( mads, skews ) ( aPinc, bPinc, residuals ) = fitline( mads, pincs ) for t in records: symbol, evC, madC, S, pinc = t if evC > a * madC + b: if S > 0 and S > aSkew * madC + bSkew: if pinc > aPinc * madC + bPinc: ...
A Betazoid portfolio
I never met a chocolate I didn’t like.
Inikiwi was half human and half Betazoid. Her human father Klojo left her when she was seven, while her mother Imzadi was too busy with her career, so she spent her most of her youth in Federation boarding schools.
Inikiwi’s first job as counsellor was on a military starship with a mission to explore deep space. As most Betazoids, Inikiwi was an empath and a real “people person”. She did not fit the techie world of a space ship. Inikiwi especially disliked the engineers. They were always scurrying around working on the Perpetuum Mobile Drive. What she found most annoying was the way the techies bumped into her and made insensitive remarks about her shoes.
Inikiwi loved shoes. She loved the sound they made. She loved the way they felt, especially when they were new. In fact she tried to buy as many pairs of shoes as possible. There were weeks, when she would wear a different pair of shoes every single day.
Inikiwi had a pair of Betazed stilleto heels on her wishlist. The heels were so high that made it almost impossible to walk and that’s the way the counsellor liked it. It made the engineers doubt all the laws of physics and quantum logic. Not to mention the damage it did to the ship floor.
Unfortunately, such exquisite footwear came with a price. A price, which even a senior Galaxy class captain could not afford. So the only option left was to make some money gambling on the Federation exchange. Inikiwi found an investment consultant, who she felt strongly was trustworthy. He constucted the following portfolio for her:
The securities were bought on a Friday at the open price. All the green numbers made Inikiwi feel warm and fuzzy inside. Inikiwi called this portfolio Numpy 7, for 7 was her lucky number. According to Federation regulation the minimal holding period for securities was six weeks. Inikiwi anticipated more green numbers at that time, so she decided to celebrate in advance with a chocolate cake and chocolate sundae as desert. Yes, she was a true chocolate connoisseur.
Random links of interest
If you liked this post and are interested in NumPy check out NumPy Beginner’s Guide by yours truly.