Overall Statistics |
Total Orders 1 Average Win 0% Average Loss 0% Compounding Annual Return -66.174% Drawdown 50.600% Expectancy 0 Start Equity 100000.00 End Equity 52678.25 Net Profit -47.322% Sharpe Ratio -0.962 Sortino Ratio -1.243 Probabilistic Sharpe Ratio 3.557% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha -0.002 Beta 0.995 Annual Standard Deviation 0.601 Annual Variance 0.362 Information Ratio 0.093 Tracking Error 0.01 Treynor Ratio -0.582 Total Fees â‚®99.75 Estimated Strategy Capacity â‚®150000.00 Lowest Capacity Asset BTCUSDT 2UZ Portfolio Turnover 0.49% |
from AlgorithmImports import * class CoinAPIDataAlgorithm(QCAlgorithm): def initialize(self) -> None: self.set_start_date(2022, 6, 1) self.set_end_date(2023, 1, 1) self.set_account_currency("USDT", 100000) # Bybit accepts both Cash and Margin account types. self.set_brokerage_model(BrokerageName.BYBIT, AccountType.MARGIN) # Warm up the security with the last known price to avoid conversion error self.set_security_initializer(BrokerageModelSecurityInitializer(self.brokerage_model, FuncSecuritySeeder(self.get_last_known_price))) # Requesting data crypto = self.add_crypto("BTCUSDT", Resolution.MINUTE, Market.BYBIT) self.btcusdt = crypto.symbol self.minimum_order_size = crypto.symbol_properties.minimum_order_size # Historical data history = self.history(self.btcusdt, 30, Resolution.DAILY) self.debug(f"We got {len(history)} items from our history request") # Add Crypto Universe Selection self._universe = self.add_universe(CryptoUniverse.bybit(self.universe_selection_filter)) # Historical Universe data universe_history = self.history(self._universe, 30, Resolution.DAILY) self.debug(f"We got {len(universe_history)} items from our universe history request") for (univere_symbool, time), universe_day in universe_history.items(): for universe_item in universe_day: self.debug(f"{universe_item.symbol} price at {universe_item.end_time}: {universe_item.close}") def universe_selection_filter(self, universe_day: List[CryptoUniverse]) -> List[Symbol]: return [universe_item.symbol for universe_item in universe_day if universe_item.volume >= 100 and universe_item.volume_in_usd > 10000] def on_data(self, slice: Slice) -> None: if self.portfolio.cash_book['BTC'].amount == 0: free_cash = self.portfolio.cash_book['USDT'].amount * (1-self.settings.free_portfolio_value_percentage) quantity = free_cash / slice[self.btcusdt].price quantity -= quantity % self.minimum_order_size if quantity > 0: self.market_order(self.btcusdt, quantity)