| Overall Statistics |
|
Total Orders 1 Average Win 0% Average Loss 0% Compounding Annual Return 86.155% Drawdown 79.700% Expectancy 0 Start Equity 10000.00 End Equity 258796.70 Net Profit 2487.967% Sharpe Ratio 1.815 Sortino Ratio 2.713 Probabilistic Sharpe Ratio 67.077% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0.423 Beta 0.918 Annual Standard Deviation 0.733 Annual Variance 0.537 Information Ratio 0.691 Tracking Error 0.495 Treynor Ratio 1.45 Total Fees â‚®15.90 Estimated Strategy Capacity â‚®440000.00 Lowest Capacity Asset BTCUSDT 18R Portfolio Turnover 0.08% |
# region imports
from AlgorithmImports import *
# endregion
class CryptoFutureAlgorithm(QCAlgorithm):
def initialize(self) -> None:
self.set_start_date(2020, 4, 1)
# Set brokerage and account type to match your brokerage environment for accurate fee and margin behavior.
self.set_brokerage_model(BrokerageName.BINANCE, AccountType.MARGIN)
# In the Binance brokerage, you can't trade with USD.
# Set the account currency as USDT and add the starting cash.
self.set_account_currency("USDT", 10000)
# Subscribe to the BTCUSDT perpetual Future contract.
self._symbol = self.add_crypto_future("BTCUSDT").symbol
def on_data(self, slice: Slice) -> None:
# Only place orders when market is open since market on open orders aren't supported.
if not self.portfolio.invested and self.is_market_open(self._symbol):
# Get the lot size from the symbol properties. Placing an order that respects the lot size
# ensures the order is valid and allows accurate profit and risk calculations for the whole portfolio.
lot_size = self.securities[self._symbol].symbol_properties.lot_size
# This example demonstrates an initial desired order size of 2.5 contracts, which will be rounded
# to 2 contracts since the lot size is 1.
quantity = 2.5 // lot_size * lot_size
self.market_order(self._symbol, quantity)