How to find basket margin (say for Iron Condor) using c# ?

tradermangesh
How to find basket margin (say for Iron Condor) using c# ?

I am using MarginList = kite.GetOrderMargins(ordersList); in c# but its not giving basket margin

I am finding only following for margin related functions

kite.GetOrderMargins

and

kite.GetMargins

There is no function for getting Basket Margin
  • sujith
    You are referring to official .NET library or @HowUTrade library?
  • tradermangesh
    I have downloaded official .net library... it has only 2 choices

    kite.GetOrderMargins and
    kite.GetMargins

    I want to get basket margin for 4 trades together
  • tradermangesh
    My code is as follows

    CE_Sell_Strike = "46500";
    PE_Sell_Strike = "45500";
    CE_Buy_Strike = 46800;
    PE_Buy_Strike = 45200;
    string ScriptName = "BANKNIFTY";
    int ScriptLotSize = 15;

    string CE_SELL_Symbol = ScriptName + Kite_BNF_Exp_O + CE_Sell_Strike + "CE";
    string PE_SELL_Symbol = ScriptName + Kite_BNF_Exp_O + PE_Sell_Strike + "PE";
    string CE_Buy_Symbol = ScriptName + Kite_BNF_Exp_O + Convert.ToString(CE_Buy_Strike) + "CE";
    string PE_Buy_Symbol = ScriptName + Kite_BNF_Exp_O + Convert.ToString(PE_Buy_Strike) + "PE";

    OrderMarginParams order1Params = new OrderMarginParams();
    order1Params.Exchange = "NFO";
    order1Params.TradingSymbol = CE_SELL_Symbol;
    order1Params.TransactionType = Constants.TRANSACTION_TYPE_SELL;
    order1Params.Variety = "regular";
    order1Params.Product = Constants.PRODUCT_NRML;
    order1Params.OrderType = Constants.ORDER_TYPE_MARKET;
    order1Params.Quantity = ScriptLotSize;

    OrderMarginParams order2Params = new OrderMarginParams();
    order2Params.Exchange = "NFO";
    order2Params.TradingSymbol = PE_SELL_Symbol;
    order2Params.TransactionType = Constants.TRANSACTION_TYPE_SELL;
    order2Params.Variety = "regular";
    order2Params.Product = Constants.PRODUCT_NRML;
    order2Params.OrderType = Constants.ORDER_TYPE_MARKET;
    order2Params.Quantity = ScriptLotSize;

    OrderMarginParams order3Params = new OrderMarginParams();
    order3Params.Exchange = "NFO";
    order3Params.TradingSymbol = CE_Buy_Symbol;
    order3Params.TransactionType = Constants.TRANSACTION_TYPE_BUY;
    order3Params.Variety = "regular";
    order3Params.Product = Constants.PRODUCT_NRML;
    order3Params.OrderType = Constants.ORDER_TYPE_MARKET;
    order3Params.Quantity = ScriptLotSize;

    OrderMarginParams order4Params = new OrderMarginParams();
    order4Params.Exchange = "NFO";
    order4Params.TradingSymbol = PE_Buy_Symbol;
    order4Params.TransactionType = Constants.TRANSACTION_TYPE_BUY;
    order4Params.Variety = "regular";
    order4Params.Product = Constants.PRODUCT_NRML;
    order4Params.OrderType = Constants.ORDER_TYPE_MARKET;
    order4Params.Quantity = ScriptLotSize;

    List ordersList = new List();
    ordersList.Add(order3Params);
    ordersList.Add(order4Params);
    ordersList.Add(order1Params);
    ordersList.Add(order2Params);

    List MarginList = new List();
    MarginList = kite.GetOrderMargins(ordersList);
  • sujith
    Can you try using the latest version of the library? It is there in the source code.
Sign In or Register to comment.