Position - LONG or SHORT

gautamsatpathy
How to determine if a Position is a LONG position or a SHORT one?

The position payload does not provide this information so it must be inferred from the data available. Is there any best practice for this?

@sujith
Tagged:
  • gautamsatpathy
    The reason I ask this is because the "Convert Position" API requires a value for transaction_type (BUY / SELL).

    Each Position returned by the Positions API is the consolidated transactions for a Single (Unique) Instrument. It is easy to determine if a Position can be converted by checking the "Quantity" value to ensure that it is greater than 0 (Net Position). For Open Positions (Quantity > 0), the buy_quantity field can be compared to the sell_quantity field and LONG / SHORT can be determined.

    As per my understanding, the buy_quantity is the sum of overnight_quantity and day_buy_quantity for LONG positions. Since there is no sample given for an overnight SHORT position, I am not sure of what values to expect. If I SHORT 1 Lot NIFTY FUT (or OPT) as CNC, then will we have the following values?

    Net Position
    Day 1 - SHORT 1 Lot NIFTY FUT (Near Month)
    1. quantity = 1
    2. day_buy_quantity = 0
    3. buy_quantity = 0
    4. day_sell_quantity = 1
    5. sell_quantity = 1
    6. overnight_quantity = 0
    Day 2 - No Transactions on NIFTY FUT (Near Month)
    1. quantity = 1
    2. day_buy_quantity = 0
    3. buy_quantity = 0
    4. day_sell_quantity = 0
    5. sell_quantity = 1
    6. overnight_quantity = 1
    Day 3 - BUY 1 Lot NIFTY FUT (Near Month)
    1. quantity = 0
    2. day_buy_quantity = 1
    3. buy_quantity = 1
    4. day_sell_quantity = 0
    5. sell_quantity = 1
    6. overnight_quantity = 1
    Would you please confirm this? The only other way to confirm this is to actually take a SHORT FUT / OPT position overnight and check the JSON response payload - a rather expensive affair :)

  • sujith
    You need to check the quantity field of net positions.
  • gautamsatpathy
    I know that @sujith !

    I asked a very specific question about SHORT overnight positions that is not covered in your documentation.

    This is an opportunity for you to answer that question and improve your product documentation.

    Please confirm whether the scenario outlined above is correct or not. And if not, what is the correct payloads.
This discussion has been closed.