Here is another way how you can format using 'f-string' format:
print(
f"{'Trades:':<15}{cnt:>10}",
f"\n{'Wins:':<15}{wins:>10}",
f"\n{'Losses:':<15}{losses:>10}",
f"\n{'Breakeven:':<15}{evens:>10}",
f"\n{'Win/Loss Ratio:':<15}{win_r:>10}",
f"\n{'Mean Win:':<15}{mean_w:>10}",
f"\n{'Mean Loss:':<15}{mean_l:>10}",
f"\n{'Mean:':<15}{mean_trd:>10}",
f"\n{'Std Dev:':<15}{sd:>10}",
f"\n{'Max Loss:':<15}{max_l:>10}",
f"\n{'Max Win:':<15}{max_w:>10}",
f"\n{'Sharpe Ratio:':<15}{sharpe_r:>10}",
)
This will provide the following output:
Trades: 2304
Wins: 1232
Losses: 1035
Breakeven: 37
Win/Loss Ratio: 1.19
Mean Win: 0.381
Mean Loss: -0.395
Mean: 0.026
Std Dev: 0.56
Max Loss: -3.406
Max Win: 4.09
Sharpe Ratio: 0.7395
What you are doing here is you are saying that the first column is 15 chars long and it's left-justified and the second column (values) is 10 chars long and it's right-justified.
If you joining items from the list and you want to format space between items you can use `` and regular formatting techniques.
This example separates each number by 3 spaces. The key here is f"{'':>3}"
print(f"{'':>3}".join(str(i) for i in range(1, 11)))
output:
1 2 3 4 5 6 7 8 9 10