-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathanalyzer.py
34 lines (28 loc) · 1.1 KB
/
analyzer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
def printTradeAnalysis(analyzer):
'''
Function to print the Technical Analysis results in a nice format.
'''
#Get the results we are interested in
total_open = analyzer.total.open
total_closed = analyzer.total.closed
total_won = analyzer.won.total
total_lost = analyzer.lost.total
win_streak = analyzer.streak.won.longest
lose_streak = analyzer.streak.lost.longest
pnl_net = round(analyzer.pnl.net.total,2)
strike_rate = int((total_won / total_closed) * 100)
#Designate the rows
h1 = ['Total Open', 'Total Won', 'Win Streak', 'Strike Rate']
h2 = ['Total Closed', 'Total Lost', 'Losing Streak','PnL Net']
r1 = [total_open, total_won, win_streak, strike_rate]
r2 = [total_closed, total_lost, lose_streak, pnl_net]
from tabulate import tabulate
table_values= [h1,
r1,
h2,
r2]
print("\n\nTrade Analysis Results:")
print (tabulate(table_values,))
def printSQN(analyzer):
sqn = round(analyzer.sqn,2)
print('SQN: {}'.format(sqn))