Overall Statistics |
Total Orders 10 Average Win 2.60% Average Loss -0.56% Compounding Annual Return 5754.633% Drawdown 1.000% Expectancy 3.049 Start Equity 200000.00 End Equity 225678.42 Net Profit 12.839% Sharpe Ratio 323.258 Sortino Ratio 0 Probabilistic Sharpe Ratio 99.963% Loss Rate 29% Win Rate 71% Profit-Loss Ratio 4.67 Alpha 86.168 Beta 0.4 Annual Standard Deviation 0.266 Annual Variance 0.071 Information Ratio 280.854 Tracking Error 0.308 Treynor Ratio 215.046 Total Fees $1164.40 Estimated Strategy Capacity $170000000.00 Lowest Capacity Asset BTCBUSD 18R Portfolio Turnover 136.16% |
from AlgorithmImports import * class BinanceCryptoFutureDataAlgorithm(QCAlgorithm): def initialize(self) -> None: self.set_start_date(2022, 10, 1) self.set_end_date(2022, 10, 10) self.set_cash("BUSD", 100000) self.set_brokerage_model(BrokerageName.BINANCE_FUTURES, AccountType.MARGIN) self.universe_settings.resolution = Resolution.DAILY self.universe_settings.leverage = 2 symbols = Symbol.create("BTCBUSD", SecurityType.CRYPTO_FUTURE, Market.BINANCE) self.add_universe_selection(ManualUniverseSelectionModel(symbols)) self.add_alpha(CryptoFutureAlphaModel()) self.set_portfolio_construction(EqualWeightingPortfolioConstructionModel()) self.set_execution(ImmediateExecutionModel()) class CryptoFutureAlphaModel(AlphaModel): def __init__(self) -> None: self.symbols = [] def update(self, algorithm: QCAlgorithm, slice: Slice) -> List[Insight]: insights = [] for symbol in self.symbols: if symbol in slice.margin_interest_rates: interest_rate = slice.margin_interest_rates[symbol].interest_rate algorithm.log(f"{symbol} close at {slice.time}: {interest_rate}") if not slice.bars.contains_key(symbol) or not slice.quote_bars.contains_key(symbol): continue quote = slice.quote_bars[symbol] price = slice.bars[symbol].price if price - quote.bid.close > quote.ask.close - price: insights.append(Insight.price(symbol, timedelta(1), InsightDirection.DOWN)) else: insights.append(Insight.price(symbol, timedelta(1), InsightDirection.UP)) return insights def on_securities_changed(self, algorithm: QCAlgorithm, changes: SecurityChanges) -> None: for security in changes.added_securities: symbol = security.symbol self.symbols.append(symbol) # Historical data history = algorithm.history(symbol, 10, Resolution.DAILY) algorithm.debug(f"We got {len(history)} from our history request for {symbol}") for security in changes.removed_securities: symbol = security.symbol if symbol in self.symbols: self.symbols.remove(symbol)