Overall Statistics |
Total Orders 2 Average Win 0.35% Average Loss 0% Compounding Annual Return 6.341% Drawdown 25.200% Expectancy 0 Start Equity 100000 End Equity 122587.15 Net Profit 22.587% Sharpe Ratio 0.331 Sortino Ratio 0.437 Probabilistic Sharpe Ratio 18.467% Loss Rate 0% Win Rate 100% Profit-Loss Ratio 0 Alpha -0.068 Beta 0.211 Annual Standard Deviation 0.141 Annual Variance 0.02 Information Ratio -0.978 Tracking Error 0.509 Treynor Ratio 0.221 Total Fees $82.67 Estimated Strategy Capacity $3600000.00 Lowest Capacity Asset BTCUSD E3 Portfolio Turnover 0.03% |
from AlgorithmImports import * class BitfinexBrokerageExampleAlgorithm(QCAlgorithm): def initialize(self): self.set_start_date(2021, 1, 1) self.set_cash(100000) self.set_brokerage_model(BrokerageName.BITFINEX, AccountType.MARGIN) self._symbol = self.add_crypto("BTCUSD", Resolution.MINUTE).symbol # Set default order properties self.default_order_properties = BitfinexOrderProperties() self.default_order_properties.time_in_force = TimeInForce.DAY self.default_order_properties.hidden = False 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 = BitfinexOrderProperties() order_properties.time_in_force = TimeInForce.GOOD_TIL_CANCELED order_properties.post_only = True order_properties.hidden = True ticket = self.limit_order(self._symbol, -0.5, round(data[self._symbol].price + 5000, 2), order_properties = order_properties) # Update the order order_fields = UpdateOrderFields() order_fields.quantity = -0.4 order_fields.limit_price = round(data[self._symbol].price + 1000, 2) order_fields.tag = "Informative order tag" response = ticket.update(order_fields) if not self.live_mode and response.is_success: self.debug("Order updated successfully")