CIFM China Alpha

钊色推荐的基金一直定投到现在,年均获利都在15%~20%左右。虽然前不久上投出了丑闻,但也不影响定投的回报。所以说定投真是个好东西,唯一的弊端就是钱不够灵活,你得有耐心一直等到盈利再卖,而且你得有胆量越跌越买。

其实,说穿了,你只需要扔那儿不管他就行了,反正每个月自动扣钱。至于你设置每个月什么时候扣钱,见仁见智,也许没啥规律可循。

闲来无事,还是忍不住从Google财经拉了些上投阿尔法的数据下来,算了下每天的算术平均值(虽然有更复杂的算法,例如考虑不同月份的权重,或者根据过往数据,自动学习规律建模),但定投本来原理就在于平均,所以也许这样效果已经足够令人满意了。

CIFM China Alpha
CIFM China Alpha

从图上看来,每月1号买是个不错的选择,但定投经常会有时延,如果延到了3、4号,就霉了。我目前的25日发工资,26日买也不错,而且27,28的数据也还行,所以结论就是不用改了…:P

PS:  BeautifulSoup的作者对于他这个咚咚的兴趣已然失去,所以目前为止,Python 3的HTML Parser + Tree Walker还有待新兴之星。下面这个脚本只是临时自用而已,很瓜的用正则析数据…

Python 脚本

Steps to install mirrorrr and birdnest to GAE

  1. Create a GAE application named ‘<xxx>-proxy’;
    @ https://appengine.google.com
  2. Download the GAE SDK and then unzip it;
    @ https://code.google.com/appengine/downloads.html
  3. svn checkout http://mirrorrr.googlecode.com/svn/trunk/ <xxx>-proxy
  4. Change application name to ‘<xxx>-proxy’ and version to ‘1’ in app.yaml file
  5. Delete index.yaml file
  6. appcfg.py update xxx-proxy

自己建一个是好习惯,表老抢别人的流量用,霍霍~~~

Updated: Steps to install Birdnest to GAE

  1. Create a GAE application named ‘<xxx>-twitter’;
    @ https://appengine.google.com
  2. Download the GAE SDK and then unzip it;
    @ https://code.google.com/appengine/downloads.html
  3. svn checkout http://birdnest.googlecode.com/svn/branches/gae/
    DO NOT USE TRUNK
  4. Change application name to ‘<xxx>-twitter ‘ in app.yaml file
  5. Remove the following codes from code.py file.

    import socket
    import re
    ua = web.ctx.environ.get(“HTTP_USER_AGENT”, ‘None’)
    if ua.find(‘jibjib) >= 0:
    socket.setdefaulttimeout(60)
    elif ua.find(‘zh-CN’) >= 0:
    #raise Exception(‘unknown error’)
    socket.setdefaulttimeout(2)
    else:
    socket.setdefaulttimeout(2)

  6. appcfg.py update xxx-twitter

Slice as a copy

Fine, I have no choice, but to say I am an outman… I’ve no idea that python slice can be used as a copy of the original array, which, of course, can save us a tons of typing.

Again, when I talked about slice, I mean array slice, not immutable/optimized string slice.

>>> a = [ 1, 2, 3 ]
>>> b = a[ : ]

>>> id( a )
12822008
>>> id( b )
17547792

>>> id( a[ 0 ] )
505408872
>>> id( b[ 0 ] )
505408872

>>> a = ‘123’
>>> b = a[ : ]

>>> id( a )
12578656
>>> id( b )
12578656