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


Python Report.print_report方法代码示例

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


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

示例1: run_simulation

# 需要导入模块: from mewp.simulate.report import Report [as 别名]
# 或者: from mewp.simulate.report.Report import print_report [as 别名]
def run_simulation(param, date_list, if_param):
    order_win_list = []
    daily_num_order = []
    order_waiting_list = []
    order_profit_list = []
    master = MasterReport()
    for date in date_list:
        date_pair = get_best_pair(date, market, "cu")
        if type(date_pair) != tuple:
            continue
        else:
            runner = back_test(date_pair, date, param, if_param)
            try:
                report = Report(runner)
            except IndexError:
                print "WTF? {} has IndexError".format(date)
                continue
            report.print_report(to_file=False, to_screen=False, to_master=master)
            order_win_list.append(runner._algo.tracker.order_winning_ratio())
            temp = runner._algo.tracker.analyze_all_waiting()
            order_waiting_list.append(temp[0])
            daily_num_order.append(temp[2])
            order_profit_list.append(runner._algo.tracker.analyze_all_profit()[0])
    [overall, days] = master.print_report(to_file=False, print_days=True)
    final_pnl = float(overall.final_pnl)
    final_return = float(overall.final_return)
    sharpe_ratio = float(overall.sharpe_ratio)
    win_ratio = float(overall.win_ratio)
    daily_draw_down = np.asarray(days.max_draw_down)
    max_draw_down = daily_draw_down.max()
    avg_draw_down = daily_draw_down.mean()
    num_orders = sum(days.order_count)
    order_win_list = np.asarray(order_win_list)
    order_profit_list = np.asarray(order_profit_list)
    order_waiting_list = np.asarray(order_waiting_list)
    daily_num_order = np.asarray(daily_num_order)
    if daily_num_order.sum() < 1:
        order_win = -1
        order_waiting = -1
        order_profit = -1
    else:
        order_win = sum(order_win_list * daily_num_order / daily_num_order.sum())
        order_waiting = sum(order_waiting_list * daily_num_order / daily_num_order.sum())
        order_profit = sum(order_profit_list * daily_num_order / daily_num_order.sum())

    return (
        final_pnl,
        final_return,
        sharpe_ratio,
        win_ratio,
        max_draw_down,
        avg_draw_down,
        num_orders,
        order_win,
        order_waiting,
        order_profit,
    )
开发者ID:Coderx7,项目名称:CNN,代码行数:59,代码来源:cu.py

示例2: run_simulation

# 需要导入模块: from mewp.simulate.report import Report [as 别名]
# 或者: from mewp.simulate.report.Report import print_report [as 别名]
def run_simulation(param, date_list, product):
    order_win_list = []
    daily_num_order = []
    order_waiting_list = []
    order_profit_list = []
    master = MasterReport()
    tracker = get_tracker(date_list, product)


    for date in date_list:
        date_pair = get_best_pair(date, market, product)
        if type(date_pair) != tuple:
            continue
        else:
            runner, _ = back_test(date_pair, date, param, tracker)
            try:
                report = Report(runner)
            except IndexError:
                print 'WTF? {} has IndexError'.format(date)
                continue
            report.print_report(to_file=False, to_screen=False, to_master=master)

    try:
        [overall, days] = master.print_report(to_file=False, print_days=False)
    except TypeError as inst:
        if inst.args[0] == "'NoneType' object has no attribute '__getitem__'":
            return ('NA', 'NA', 'NA', 'NA', 'NA', 'NA', 'NA', 'NA', 'NA', 'NA')
        else:
            raise Exception("god knows what happens")

    #pnls
    final_pnl = float(overall.final_pnl)
    final_return = float(overall.final_return)
    sharpe_ratio = float(overall.sharpe_ratio)
    win_ratio = float(overall.win_ratio)

    #max draw down
    daily_draw_down = np.asarray(days.max_draw_down)
    max_draw_down = daily_draw_down.max()
    avg_draw_down = daily_draw_down.mean()

    #num orders
    num_orders = sum(days.order_count)

    #order analysis
    order_win = tracker.order_winning_ratio()
    order_waiting = tracker.analyze_all_waiting()[0]
    order_waiting_median = tracker.analyze_all_waiting()[3]
    order_profit = tracker.analyze_all_profit()[0]
    order_profit_median = tracker.analyze_all_profit()[3]
    num_rounds = tracker.analyze_all_profit()[2]

    return final_pnl, final_return, sharpe_ratio, win_ratio, max_draw_down,\
        avg_draw_down, num_orders, num_rounds, order_win, order_waiting, order_waiting_median, \
        order_profit, order_profit_median
开发者ID:Coderx7,项目名称:CNN,代码行数:57,代码来源:al.py

示例3: run_simulation

# 需要导入模块: from mewp.simulate.report import Report [as 别名]
# 或者: from mewp.simulate.report.Report import print_report [as 别名]
def run_simulation(param, date_list, product):
    order_win_list = []
    daily_num_order = []
    order_waiting_list = []
    order_profit_list = []
    master = MasterReport()
    for date in date_list:
        date_pair = get_best_pair(date,market, product)
        if type(date_pair) != tuple:
            continue
        else:
            runner = back_test(date_pair, date, param)
            try:
                report = Report(runner)
            except IndexError:
                print 'WTF? {} has IndexError'.format(date)
                continue
            report.print_report(to_file=False, to_screen=False, to_master=master)
            order_win_list.append(runner._algo.tracker.order_winning_ratio())
            temp = runner._algo.tracker.analyze_all_waiting()
            order_waiting_list.append(temp[0])
            daily_num_order.append(temp[2])
            order_profit_list.append(runner._algo.tracker.analyze_all_profit()[0])
    try:
        [overall, days] = master.print_report(to_file=False, print_days=False)
    except TypeError as inst:
        if inst.args[0] == "'NoneType' object has no attribute '__getitem__'":
            return ('NA', 'NA', 'NA', 'NA', 'NA', 'NA', 'NA', 'NA', 'NA', 'NA')
        else:
            raise Exception("god knows what happens")
    final_pnl = float(overall.final_pnl)
    final_return = float(overall.final_return)
    sharpe_ratio = float(overall.sharpe_ratio)
    win_ratio = float(overall.win_ratio)
    daily_draw_down = np.asarray(days.max_draw_down)
    max_draw_down = daily_draw_down.max()
    avg_draw_down = daily_draw_down.mean()
    num_orders = sum(days.order_count)
    order_win_list = np.asarray(order_win_list)
    order_profit_list = np.asarray(order_profit_list)
    order_waiting_list = np.asarray(order_waiting_list)
    daily_num_order= np.asarray(daily_num_order)
    if daily_num_order.sum() < 1:
        order_win = -1
        order_waiting = -1
        order_profit = -1
    else:
        order_win = sum(order_win_list * daily_num_order/daily_num_order.sum())
        order_waiting = sum(order_waiting_list * daily_num_order/daily_num_order.sum())
        order_profit = sum(order_profit_list * daily_num_order/daily_num_order.sum())

    return final_pnl, final_return, sharpe_ratio, win_ratio, max_draw_down,\
        avg_draw_down, num_orders, order_win, order_waiting, order_profit
开发者ID:Coderx7,项目名称:CNN,代码行数:55,代码来源:czce.py

示例4: run_simulation

# 需要导入模块: from mewp.simulate.report import Report [as 别名]
# 或者: from mewp.simulate.report.Report import print_report [as 别名]
def run_simulation(param, date_list, product):
    pnl_list = []
    order_win_list = []
    order_profit_list = []
    num_rounds_list = []
    master = MasterReport()
    for date in date_list:
        date_pair = get_best_pair(date,market, product)
        if type(date_pair) != tuple:
            continue
        else:
            result = back_test(date_pair, date, param)
            pnl_list.append(result[0])
            order_win_list.append(result[1])
            order_profit_list.append(result[2])
            num_rounds_list.append(result[3])
            runner = result[4]
            try:
                report = Report(runner)
            except IndexError:
                print 'WTF? {} has IndexError'.format(date)
                continue
            report.print_report(to_file=False, to_screen=False, to_master=master)
    return pnl_list, order_win_list, order_profit_list, num_rounds_list, master
开发者ID:Coderx7,项目名称:CNN,代码行数:26,代码来源:pb.py


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