Overall Statistics |
Total Orders 256 Average Win 3.55% Average Loss -2.51% Compounding Annual Return 7.220% Drawdown 54.200% Expectancy 0.018 Start Equity 100000 End Equity 107256.83 Net Profit 7.257% Sharpe Ratio 0.465 Sortino Ratio 0.584 Probabilistic Sharpe Ratio 28.630% Loss Rate 58% Win Rate 42% Profit-Loss Ratio 1.42 Alpha 0.257 Beta -0.065 Annual Standard Deviation 0.637 Annual Variance 0.406 Information Ratio 1.066 Tracking Error 0.849 Treynor Ratio -4.563 Total Fees â‚®24781.77 Estimated Strategy Capacity â‚®43000000.00 Lowest Capacity Asset BTCUSDT 2V3 Portfolio Turnover 80.87% |
from AlgorithmImports import * class BybitCryptoFutureDataAlgorithm(QCAlgorithm): def initialize(self) -> None: self.set_start_date(2022, 1, 1) self.set_end_date(2023, 1, 1) self.set_account_currency("USDT", 100000) self.set_brokerage_model(BrokerageName.BYBIT, AccountType.MARGIN) crypto_future = self.add_crypto_future("BTCUSDT", Resolution.DAILY) # perpetual futures does not have a filter function self.btcusdt = crypto_future.symbol # Historical data history = self.history(self.btcusdt, 10, Resolution.DAILY) self.debug(f"We got {len(history)} from our history request for {self.btcusdt}") def on_data(self, slice: Slice) -> None: if self.btcusdt in slice.margin_interest_rates: interest_rate = slice.margin_interest_rates[self.btcusdt].interest_rate self.log(f"{self.btcusdt} close at {slice.time}: {interest_rate}") if not slice.bars.contains_key(self.btcusdt) or not slice.quote_bars.contains_key(self.btcusdt): return quote = slice.quote_bars[self.btcusdt] price = slice.bars[self.btcusdt].price if price - quote.bid.close > quote.ask.close - price: self.set_holdings(self.btcusdt, -1) else: self.set_holdings(self.btcusdt, 1)