Overall Statistics
Total Trades
2
Average Win
0%
Average Loss
0%
Compounding Annual Return
-0.007%
Drawdown
0.000%
Expectancy
0
Net Profit
-0.008%
Sharpe Ratio
-0.561
Probabilistic Sharpe Ratio
2.648%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
-0
Beta
0
Annual Standard Deviation
0
Annual Variance
0
Information Ratio
-1.492
Tracking Error
0.109
Treynor Ratio
-1.093
Total Fees
$0.02
Estimated Strategy Capacity
$160000000000.00
Lowest Capacity Asset
YESBANK TA8Y7QR36M31
using QuantConnect.Orders;

namespace QuantConnect.Algorithm.CSharp
{
    public class ZerodhaBrokerageExampleAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private bool _ordered = false;
        
        public override void Initialize()
        {
            SetStartDate(2021, 1, 1);
            SetAccountCurrency("INR");
            SetCash(100000);
            
            SetBrokerageModel(BrokerageName.Zerodha, AccountType.Margin);
            
            _symbol = AddEquity("YESBANK", Resolution.Minute, Market.India).Symbol;

            // Set default order properties
            DefaultOrderProperties = new IndiaOrderProperties(Exchange.NSE, IndiaOrderProperties.IndiaProductType.NRML)
            {
                TimeInForce = TimeInForce.GoodTilCanceled,
            };
        }
        
        public override void OnData(Slice data)
        {
            if (Portfolio.Invested)
            {
                return;
            }
            
            // Place an order with the default order properties
            LimitOrder(_symbol, 1, Math.Round(data[_symbol].Price + 100, 1));
            
            // Place an order and with new order properties
            var orderProperties = new IndiaOrderProperties(Exchange.BSE, IndiaOrderProperties.IndiaProductType.MIS)
            {
            };
            var ticket = LimitOrder(_symbol, 1, Math.Round(data[_symbol].Price * 0.9m, 1), orderProperties: orderProperties);
            
            // Update the order
            var updateSettings = new UpdateOrderFields();
			updateSettings.LimitPrice = Math.Round(data[_symbol].Price * 0.95m, 1);
            ticket.Update(updateSettings);
        }
    }
}