Python client function for margins/orders?

zuser
Hi,

What is function of Python client for margin calculation of an order as mentioned https://kite.trade/docs/connect/v3/margins/ ?
  • sujith
    @zuser,
    pykiteconnect doesn't have it yet. We are working on it.
  • milli
    Is there a manual way to calculate the margin required for an instrument & order type combination? Say for example, if I placed an order for CDS:USDINR20DECFUT NRML type, to find the margin would there be a percentage like LTP x 1000 x percentage to find the margin?

    Thanks
  • rakeshr
    Calculating margin is a bit difficult to be done at your end. As it not only depends on the LTP movement but also on other factors like existing positions, open orders, etc. You can use open margin calculation APIs. Also, we will be integrating this API soon with all our official clients including python.
  • milli
    milli edited November 19
    @rakeshr is there a sample code that can give an outline on integrating

    https://kite.trade/docs/connect/v3/margins/

    with the python code? Any pointers would help.

    Thanks a lot.
  • sujith
    @milli,
    Here is the Java example. Params are exactly the same, the way you interact with the python request library might be different.
  • milli
    @sujith thanks, I will study and get back.

    Meanwhile, as a quick hack and to get things up and running quickly ; would a 4% margin for currency derivatives be sufficient to cover the various parameters as mentioned by @rakeshr ? I am mainly interested in USDINR and GBPINR.

    Thanks
  • rakeshr
    would a 4% margin for currency derivatives be sufficient to cover the various parameters
    No. The Span margin varies for both CDS contracts.
    If you are in so hurry, maybe you can try using this branch of Connect Python client(which has Margin APIs integrated, but the test is still going on).
  • milli
    hi @sujith @rakeshr

    Can I not use

    https://api.kite.trade/margins/currency

    to get the currently required margin for currency derivatives?

    Thanks
  • sujith
    @milli,
    It only gives you data about the leverage. You will have to use that for calculation and it is manually updated by the RMS team which can be updated multiple times during the day as well.
    If you are looking for a straight forward solution like margin = qty * last price then you can use this. If you want the exact values which depend on your portfolio and pending orders then you need to use this.

Sign In or Register to comment.