Overall Statistics |
Total Trades 255 Average Win 3.55% Average Loss -2.51% Compounding Annual Return 7.219% Drawdown 54.200% Expectancy 0.018 Net Profit 7.256% Sharpe Ratio 0.356 Probabilistic Sharpe Ratio 22.161% Loss Rate 58% Win Rate 42% Profit-Loss Ratio 1.42 Alpha 0.157 Beta -0.065 Annual Standard Deviation 0.529 Annual Variance 0.28 Information Ratio 0.946 Tracking Error 0.706 Treynor Ratio -2.902 Total Fees â‚®24778.77 Estimated Strategy Capacity â‚®44000000.00 Lowest Capacity Asset BTCUSDT 2V3 Portfolio Turnover 80.87% |
from AlgorithmImports import * class BybitCryptoFutureDataAlgorithm(QCAlgorithm): def Initialize(self) -> None: self.SetStartDate(2022, 1, 1) self.SetEndDate(2023, 1, 1) self.SetAccountCurrency("USDT", 100000) self.SetBrokerageModel(BrokerageName.Bybit, AccountType.Margin) crypto_future = self.AddCryptoFuture("BTCUSDT", Resolution.Daily) # perpetual futures does not have a filter function self.symbol = crypto_future.Symbol # Historical data history = self.History(self.symbol, 10, Resolution.Daily) self.Debug(f"We got {len(history)} from our history request for {self.symbol}") def OnData(self, slice: Slice) -> None: if self.symbol in slice.MarginInterestRates: interest_rate = slice.MarginInterestRates[self.symbol].InterestRate self.Log(f"{self.symbol} close at {slice.Time}: {interest_rate}") if not slice.Bars.ContainsKey(self.symbol) or not slice.QuoteBars.ContainsKey(self.symbol): return quote = slice.QuoteBars[self.symbol] price = slice.Bars[self.symbol].Price if price - quote.Bid.Close > quote.Ask.Close - price: self.SetHoldings(self.symbol, -1) else: self.SetHoldings(self.symbol, 1)