V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
datayes2015
V2EX  ›  Python

年化收益率逆天增长达 294.1%--相似公司股票搬砖, 用 Python 实现妥不妥?

  •  
  •   datayes2015 · 2016-09-21 18:43:32 +08:00 · 2761 次点击
    这是一个创建于 2797 天前的主题,其中的信息可能已经有所发展或是发生改变。
    前段时间听到两只股票:川投能源,国投电力.

    这两个公司是一对好基友, 他们的主要资产是一家水电公司的 48%,52%股份, 两只股价常在两倍之间变动.

    于是出现很多人在这两只股票之间搬砖, 本帖就来验证一下搬砖的效果, 看看结果会不会令人大吃一惊呢?

    # 首先我们简单看下两只股票的走势.

    import seaborn as sns

    import pandas as pd

    import matplotlib.pylab as pylab

    from CAL.PyCAL import font

    begin_date, end_date = '20130101', '20150514'

    ct,gt = '600674', '600886'

    ct = DataAPI.MktEqudAdjGet(ticker=ct, beginDate=begin_date, endDate=end_date)

    gt = DataAPI.MktEqudAdjGet(ticker=gt, beginDate=begin_date, endDate=end_date)

    liangtou =pd.DataFrame()

    liangtou['川投股价'] = ct.closePrice

    liangtou['国投股价'] = gt.closePrice

    liangtou['川投国投股价比例'] = ct.closePrice / gt.closePrice

    liangtou.plot( figsize=(16,10))

    pylab.legend([u'川投股价',u'国投股价', u'川投国投股价比例'], prop=font)

    高清源代码请移步: https://uqer.io/community/share/5555cbfaf9f06c6c7404f8ae



    重点来了, 利用量化实验室的 strategy 模式, 咱来编写一个策略.
    起始建仓: 全仓 600886
    起始日期: 2014-12-01
    结束日期: 2015-05-14
    起始资金: 10w
    调仓频率: 1 天
    调仓信号: 川投能源收盘价 /国投能源收盘价*100%-200% 之差如果大于 1%, 卖出 886 买入 774, 如果小于-1%,则卖出 774 买入 886
    高清源代码请移步: https://uqer.io/community/share/5555cbfaf9f06c6c7404f8ae

    7 条回复    2016-10-19 16:55:39 +08:00
    GPIO
        1
    GPIO  
       2016-09-21 18:47:59 +08:00   ❤️ 1
    你再模拟下 2015 年 6 月到现在的收益率看看。
    iheshix
        2
    iheshix  
       2016-09-21 19:25:18 +08:00   ❤️ 1
    楼上 + 1
    southwolf
        3
    southwolf  
       2016-09-21 19:47:52 +08:00
    这种策略有啥用呢……牛市闭眼买都能赚钱……
    20150517
        4
    20150517  
       2016-09-21 19:52:48 +08:00
    整天做这种广告在 python 版块,不写推广,我要举报了
    kuaner
        5
    kuaner  
       2016-09-22 07:42:24 +08:00 via iPhone
    牛市行情,这种策略我可以写 100 个,不写推广,我要举报了
    leavic
        6
    leavic  
       2016-09-22 10:44:19 +08:00
    股市的基本特性是,从来不是你想买就能买,你想卖就能卖。实盘操作来一年再跟我谈策略。
    F10Y
        7
    F10Y  
       2016-10-19 16:55:39 +08:00
    交易手续费呢,写的策略都不实用,有毛用
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5539 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 81ms · UTC 02:52 · PVG 10:52 · LAX 19:52 · JFK 22:52
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.