Overall Statistics
Total Trades
2
Average Win
0.35%
Average Loss
0%
Compounding Annual Return
11.187%
Drawdown
15.100%
Expectancy
0
Net Profit
10.373%
Sharpe Ratio
0.614
Probabilistic Sharpe Ratio
31.734%
Loss Rate
0%
Win Rate
100%
Profit-Loss Ratio
0
Alpha
-0.087
Beta
0.202
Annual Standard Deviation
0.142
Annual Variance
0.02
Information Ratio
-1.404
Tracking Error
0.549
Treynor Ratio
0.43
Total Fees
$222.14
Estimated Strategy Capacity
$1000000.00
Lowest Capacity Asset
BTCUSD XJ
namespace QuantConnect.Algorithm.CSharp
{
    public class CoinbaseProBrokerageExampleAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        
        public override void Initialize()
        {
            SetStartDate(2021, 1, 1);
            SetCash(100000);
            
            SetBrokerageModel(BrokerageName.GDAX, AccountType.Cash);
            
            _symbol = AddCrypto("BTCUSD", Resolution.Minute).Symbol;

            // Set default order properties
            DefaultOrderProperties = new GDAXOrderProperties
            {
                TimeInForce = TimeInForce.GoodTilCanceled,
                PostOnly = false
            };
        }
        
        public override void OnData(Slice data)
        {
            if (Portfolio.Invested)
            {
                return;
            }
            
            // Place an order with the default order properties 
            MarketOrder(_symbol, 1);
            
            // Place an order with new order properties
            var orderProperties = new GDAXOrderProperties { PostOnly = true };
            var ticket = LimitOrder(_symbol, -0.5, Math.Round(data[_symbol].Price + 5000, 2), orderProperties: orderProperties);
            
            // If we try to call `Update`, an exception is raised
            // ticket.Update(...)
            
            // Update the order
            ticket.Cancel();
            LimitOrder(_symbol, -0.5, Math.Round(data[_symbol].Price + 1000, 2), orderProperties: orderProperties);
        }
    }
}