Overall Statistics |
Total Orders 3 Average Win 0.01% Average Loss 0% Compounding Annual Return 2.716% Drawdown 11.900% Expectancy 0 Start Equity 200000.00 End Equity 218565.77 Net Profit 9.283% Sharpe Ratio 0.029 Sortino Ratio 0.038 Probabilistic Sharpe Ratio 16.420% Loss Rate 0% Win Rate 100% Profit-Loss Ratio 0 Alpha -0.048 Beta 0.095 Annual Standard Deviation 0.062 Annual Variance 0.004 Information Ratio -0.923 Tracking Error 0.562 Treynor Ratio 0.019 Total Fees $43.88 Estimated Strategy Capacity $150000.00 Lowest Capacity Asset BTCUSDT 18N Portfolio Turnover 0.02% |
# region imports from AlgorithmImports import * # endregion class BinanceBrokerageExampleAlgorithm(QCAlgorithm): def initialize(self): self.set_start_date(2021, 1, 1) self.set_cash('USDT', 100000) self.set_brokerage_model(BrokerageName.BINANCE, AccountType.CASH) self._symbol = self.add_crypto("BTCUSDT", Resolution.MINUTE).symbol # Set default order properties self.default_order_properties = BinanceOrderProperties() self.default_order_properties.time_in_force = TimeInForce.GOOD_TIL_CANCELED self.default_order_properties.post_only = False def on_data(self, data): if self.portfolio.invested: return # Place an order with the default order properties self.market_order(self._symbol, 1) # Place an order with new order properties order_properties = BinanceOrderProperties() order_properties.time_in_force = TimeInForce.DAY order_properties.post_only = True ticket = self.limit_order(self._symbol, -0.5, round(data[self._symbol].price + 1000, 2), order_properties = order_properties) # If we try to call `Update`, an exception is raised # ticket.update() # Update the order ticket.cancel() ticket = self.limit_order(self._symbol, -0.5, round(data[self._symbol].price + 100, 2), order_properties = order_properties)