| Overall Statistics |
|
Total Orders 2 Average Win 0% Average Loss 0% Compounding Annual Return 9.626% Drawdown 7.800% Expectancy 0 Start Equity 1000000 End Equity 1095611.18 Net Profit 9.561% Sharpe Ratio 0.505 Sortino Ratio 0.657 Probabilistic Sharpe Ratio 32.727% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha -0.111 Beta 1.266 Annual Standard Deviation 0.111 Annual Variance 0.012 Information Ratio -0.877 Tracking Error 0.087 Treynor Ratio 0.044 Total Fees $113.45 Estimated Strategy Capacity $29000000.00 Lowest Capacity Asset MWD R735QTJ8XC9X Portfolio Turnover 0.28% |
import numpy as np
from AlgorithmImports import *
class SharpeRatioBacktest(QCAlgorithm):
def initialize(self):
self.set_start_date(2017, 1, 1)
self.set_end_date(2018, 1, 1)
self.set_cash(1_000_000)
self.symbols = ["MS", "XOM"]
for symbol in self.symbols:
self.add_equity(symbol, Resolution.DAILY)
self.weights = {"MS": 0.5, "XOM": 0.5}
def on_data(self, data):
if not self.portfolio[self.symbols[0]].invested:
for symbol, weight in self.weights.items():
self.set_holdings(symbol, weight)