zoukankan      html  css  js  c++  java
  • hhh-lll Donchian channel strategy

    code

    
    # -*- coding: utf-8 -*-
    """
    strat_donchian.py
    """
    import itertools; type(itertools)
    import os, pathlib, datetime; type(os); type(pathlib);type(datetime)
    import pandas as pd; type(pd)
    import numpy as np; type(np)
    import matplotlib.pyplot as plt; type(plt)
    
    from copy import deepcopy;type(deepcopy)
    from collections import OrderedDict ; type(OrderedDict)
    
    import toolkit.myDataIO as mdio ; type(mdio)
    import util.ttr as ttr     
    
    import strat_sz100iw_report as wr; type(wr)
    
    import imp; type(imp)
    #imp.reload(mdio)
    #imp.reload(ttr)
    
    from config import gc
    
    
    #%%
    
                
    def main():
        '''
        >>> main()
        
        
    首先查看一下参数设置:
    code                 = 399330
    start_year           = None
    hh_n                 = 4
    ll_n                 = 4
    maxloss_pct          = 0.12
    with_plot            = True
    
    标的资产的代码和名称是: 深证100 (399330)
    ++++++++++++++++++++++++++++++++++++++++
    初级的买入信号的数量: 279
    初级的卖出信号的数量: 173
    去除连续的买入信号的数量: 45
    去除连续的卖出信号的数量: 45
    整理首尾后的买入信号的数量: 45
    整理首尾后的卖出信号的数量: 46
    
    End equity :     17369.60
    
    hh_n               : 4
    ll_n               : 4
    start_date         : 2006-01-25 00:00:00
    end_date           : 2020-05-15 00:00:00
    end_index          : 4802.32
    index_growth       : 4.995
    end_equity         : 17369.603
    end_nav            : 18.065
    cagr               : 0.224
    mdd                : 0.306
    sharpe             : 1.108
    annu_volatility    : 0.202
    策略收益率的标准差 : 0.028
    
        
        '''
        print('首先查看一下参数设置:')
        for k,v in gc.params.items():
            print('{:20s} = {}'.format(k,v) )
        print()
        qsq=ttr.QsQuant(**gc.params)
        qsq.load_data()
        qsq.generate_signal()
        df, perf_dict = qsq.simulate_LineMode()
    
    
    
  • 相关阅读:
    Docker For Windows | Setting Up Docker On Windows
    10款游戏的设计分析
    游戏中的沉浸(Flow in Games)
    游戏中运用了人工智能、机器学习等智能算法的思考
    虚幻4的智能指针
    linux下查看已安装的软件与卸载
    Centos7.2下安装mysql5.7,使用rpm包安装
    VMware 安装 CentOS7
    并发之痛 Thread,Goroutine,Actor
    Creating and using a blendspace in c++
  • 原文地址:https://www.cnblogs.com/duan-qs/p/12970046.html
Copyright © 2011-2022 走看看