Overall Statistics
Total Trades
2
Average Win
0.45%
Average Loss
0%
Compounding Annual Return
-10.148%
Drawdown
16.100%
Expectancy
0
Net Profit
-4.388%
Sharpe Ratio
-0.711
Probabilistic Sharpe Ratio
8.500%
Loss Rate
0%
Win Rate
100%
Profit-Loss Ratio
0
Alpha
-0.017
Beta
0.25
Annual Standard Deviation
0.124
Annual Variance
0.015
Information Ratio
0.527
Tracking Error
0.368
Treynor Ratio
-0.352
Total Fees
$212.31
Estimated Strategy Capacity
$1200000.00
Lowest Capacity Asset
BTCUSD 2PF
class FTXUSBrokerageExampleAlgorithm(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2021, 9, 1)
        self.SetCash(100000)
        
        self.SetBrokerageModel(BrokerageName.FTXUS, AccountType.Margin)
        
        self.symbol = self.AddCrypto("BTCUSD", Resolution.Minute).Symbol
        
        # Set default order properties
        self.DefaultOrderProperties = FTXOrderProperties()
        self.DefaultOrderProperties.TimeInForce = TimeInForce.Day
        self.DefaultOrderProperties.ReduceOnly = False
        self.DefaultOrderProperties.PostOnly = False


    def OnData(self, data):
        if self.Portfolio.Invested:
            return
        
        # Place an order with the default order properties
        self.MarketOrder(self.symbol, 1)
        
        # Place an order with new order properties
        order_properties = FTXOrderProperties()
        order_properties.TimeInForce = TimeInForce.GoodTilCanceled
        order_properties.ReduceOnly = True
        order_properties.PostOnly = True
        ticket = self.LimitOrder(self.symbol, -0.5, round(data[self.symbol].Price + 5000, 0), orderProperties = order_properties)
        
        # If we try to call `Update`, an exception is raised
        # ticket.Update()
        
        # Update the order
        ticket.Cancel()
        ticket = self.LimitOrder(self.symbol, -0.5, round(data[self.symbol].Price + 1000, 0), orderProperties = order_properties)