loseed arguments
(fig, rtn, entry_best, data_win, data_lose, exit_profit,
exit_nbar_best, exit_nbar_worst, nbar)
| 493 | |
| 494 | |
| 495 | def plot_summary2(fig, rtn, entry_best, data_win, data_lose, exit_profit, |
| 496 | exit_nbar_best, exit_nbar_worst, nbar): |
| 497 | ''' loseed arguments ''' |
| 498 | cursors = [] |
| 499 | winrtn = rtn.reindex(data_win.index) |
| 500 | losertn = rtn.reindex(data_lose.index) |
| 501 | fig.canvas.set_window_title(u'��ͼ���ܶ�') |
| 502 | ax11 = fig.add_subplot(2, 2, 1) |
| 503 | ax11.plot(range(len(losertn)), losertn.tolist(), 'yo--', label=u'����س�') |
| 504 | ax11.plot(len(losertn)+np.arange(len(winrtn)), winrtn.tolist(), 'ro--', label=u'ӯ���س�') |
| 505 | ax11.plot(rtn.order().tolist(), 'b') |
| 506 | |
| 507 | ax11.legend(prop=font, loc='upper left').get_frame().set_alpha(0.5) |
| 508 | cursors.append(Cursor(ax11, useblit=True, color='red', linewidth=1, |
| 509 | vertOn = True, horizOn = True)) |
| 510 | |
| 511 | ax11.set_xlabel(u'�س�', fontproperties=font_big) |
| 512 | |
| 513 | ax12 = fig.add_subplot(2, 2, 2) |
| 514 | binwidth = (rtn.max() - rtn.min()) / 30 |
| 515 | #rtn.plot(ax=ax12, kind='kde', color='b', label="") |
| 516 | bins = np.arange(rtn.min(), rtn.max() + binwidth, binwidth) |
| 517 | rst = ax12.hist(rtn, bins=bins, color = 'y' , normed=False, label=u'�س��ֲ�') |
| 518 | n, bins = rst[0], rst[1] |
| 519 | plot_contribution(ax12, bins, rtn, 'bo--') |
| 520 | ax12.legend(prop=font, loc='upper left').get_frame().set_alpha(0.5) |
| 521 | cursors.append(Cursor(ax12, useblit=True, color='red', linewidth=1, |
| 522 | vertOn = True, horizOn = True)) |
| 523 | |
| 524 | #ax21 = fig.add_subplot(3, 2, 3) |
| 525 | #ds = entry_best.reindex(data_lose.index)-data_lose['exit_profit'] |
| 526 | #ax21.plot(range(len(ds)), ds, 'yo--', label=u'�������') |
| 527 | #dl = (entry_best.reindex(data_win.index)-data_win['exit_profit']).tolist() |
| 528 | #ax21.plot(len(ds)+np.arange(len(dl)), dl, 'ro--', label=u'ӯ������') |
| 529 | #ax21.set_xticklabels([]) |
| 530 | #ax21.set_xlabel(u'����', fontproperties=font_big) |
| 531 | #ax21.legend(prop=font, loc='upper left').get_frame().set_alpha(0.5) |
| 532 | #cursors.append(Cursor(ax21, useblit=True, color='red', linewidth=1, |
| 533 | #vertOn = True, horizOn = True)) |
| 534 | |
| 535 | |
| 536 | #diff = entry_best - exit_profit |
| 537 | #ax22 = fig.add_subplot(3, 2, 4) |
| 538 | #binwidth = (diff.max() - diff.min()) / 30 |
| 539 | ##diff.plot(ax=ax22, kind='kde', color='b', label="") |
| 540 | #bins = np.arange(diff.min(), diff.max() + binwidth, binwidth) |
| 541 | #rst = ax22.hist(diff, bins=bins, color = 'y' , normed=False, label=u'���·ֲ�') |
| 542 | #n, bins = rst[0], rst[1] |
| 543 | #plot_contribution(ax22, bins, diff, 'bo--') |
| 544 | #ax22.legend(prop=font, loc='upper left').get_frame().set_alpha(0.5) |
| 545 | #cursors.append(Cursor(ax22, useblit=True, color='red', linewidth=1, |
| 546 | #vertOn = True, horizOn = True)) |
| 547 | if nbar>0: |
| 548 | ax31 = fig.add_subplot(2, 2, 3) |
| 549 | bl = (exit_nbar_best.reindex(data_lose.index)-data_lose['exit_profit']).order(ascending=False) |
| 550 | wl = (exit_nbar_worst.reindex(data_lose.index)-data_lose['exit_profit']).reindex(bl.index) |
| 551 | ax31.plot(bl, color='y') |
| 552 | ax31.plot(wl, color='k') |
no test coverage detected