当前位置: 首页>>代码示例>>Python>>正文


Python Report.get_final_pnl方法代码示例

本文整理汇总了Python中mewp.simulate.report.Report.get_final_pnl方法的典型用法代码示例。如果您正苦于以下问题:Python Report.get_final_pnl方法的具体用法?Python Report.get_final_pnl怎么用?Python Report.get_final_pnl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mewp.simulate.report.Report的用法示例。


在下文中一共展示了Report.get_final_pnl方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run_simulation

# 需要导入模块: from mewp.simulate.report import Report [as 别名]
# 或者: from mewp.simulate.report.Report import get_final_pnl [as 别名]
def run_simulation(params):
    date = '2015-01-01'
    dateend = '2015-05-01'
    ma_diff = []
    dates = [str(x).split(' ')[0] for x in pd.date_range(date, dateend).tolist()]
    algo = { 'class': MyMM }
    temp = {'item': 'au1506'}
    temp['ma_diff_length'] = params[0]
    temp['trigger_diff'] = params[1]
    temp['ma_window'] = params[2]
    temp['spread'] = params[3]
    temp['inv_coef'] = params[4]
    temp['chunk'] = params[5]
    temp['gap'] = params[6]
    algo['param'] = temp
    settings = { 'date': dates, 'algo': algo, 'tickset': 'top', 'verbose' : True,
                     'path': DATA_PATH }
    runner = SingleRunner(settings)
    runner.run()
    report = Report(runner)
    pnl = report.get_final_pnl()
    sharp_ratio = report.get_sharpie_ratio()
    del runner._algo.volatility_finder
    del runner._algo
    runner.close()
    del runner._me
    del runner._price_table
    del runner
    return pnl, sharp_ratio
开发者ID:volpato30,项目名称:Backtest,代码行数:31,代码来源:grid_search_mm.py

示例2: run_simulation

# 需要导入模块: from mewp.simulate.report import Report [as 别名]
# 或者: from mewp.simulate.report.Report import get_final_pnl [as 别名]
def run_simulation(p):
    runner.run(algo_param={'rolling': p[0], 'bollinger': p[1], 'stop_win': p[2]})
    report = Report(runner)
    runner._algo.tracker.order_winning_ratio()
    pnl = float(report.get_final_pnl())
    final_return = float(report.get_final_return())
    sharpe_ratio = float(report.get_sharpie_ratio())
    avg_draw_down = float(report.get_avg_max_draw_down())
    max_draw_down = float(report.get_max_max_draw_down()[0])
    order_winning_ratio = float(runner._algo.tracker.order_winning_ratio())
    waiting_time = float(runner._algo.tracker.analyze_all_waiting()[0])
    avg_profit = float(runner._algo.tracker.analyze_all_profit()[0])
    num_orders = int(runner._algo.tracker.analyze_all_profit()[2])

    return pnl, final_return, sharpe_ratio, avg_draw_down, max_draw_down, \
        order_winning_ratio, waiting_time, avg_profit, num_orders
开发者ID:Coderx7,项目名称:CNN,代码行数:18,代码来源:trailing_stopwin.py


注:本文中的mewp.simulate.report.Report.get_final_pnl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。