AsthaTech / govortex

Golang SDK to trade with AsthaTrade
https://asthatrade.com/vortex
MIT License
1 stars 1 forks source link

Incorrect order type in API response #2

Open gmehta693 opened 9 months ago

gmehta693 commented 9 months ago

We placed an SL buy order below the LTP for an option and we saw that we are receiving order type as RL in the response of get orders API. Attaching screenshort for your reference. WhatsApp Image 2023-12-26 at 18 34 40

Order response:

{
    "status": "success",
    "orders": [
        {
            "order_id": "OEWKL00039J<",
            "exchange": "NSE_FO",
            "token": 65626,
            "order_number": "1100000106962668",
            "status": "PENDING",
            "error_reason": "",
            "transaction_type": "BUY",
            "product": "DELIVERY",
            "variety": "RL",
            "total_quantity": 500,
            "pending_quantity": 500,
            "traded_quantity": 0,
            "disclosed_quantity": 0,
            "disclosed_quantity_remaining": 0,
            "order_price": 90.00,
            "trigger_price": 0.00,
            "traded_price": 0.0,
            "validity": "DAY",
            "validity_days": 0,
            "symbol": "NIFTY",
            "series": "XX",
            "instrument_name": "",
            "expiry_date": "2023-12-28",
            "strike_price": 21500.00,
            "option_type": "PE",
            "lot_size": 50,
            "order_created_at": "2023-12-26 12:49:37",
            "initiated_by": "MOBILE-Ex",
            "modified_by": "MOBILE-Ex",
            "is_amo": false,
            "order_identifier": "app=dev_yTXpYjgu"
        }
    ],
    "metadata": {
        "total_records": 57,
        "all_records": 57,
        "completed_records": 16,
        "open_records": 1
    }
}
hmtp140789 commented 9 months ago

This is expected behaviour. For buy SL orders Trigger price should be above LTP. Same should be happening with other brokers too.

gmehta693 commented 9 months ago

Other brokers(Zerodha) don't allow SL orders with below LTP as trigger price. The problem is in the response we are receiving RL as order type but it shows SL type in your console. Is this discrepency expected?

prakshalgangwal commented 9 months ago

Hemant - As Gaurav mentioned, In Zerodha and other brokers, an SL order won't go through if trigger price is lower than the LTP.

In the above issue, SL order went through with invalid price (trigger less then LTP for Buy SL order, and we used vortex APIs to place it), ideally we should be getting an error message like this in attached picture. SL_order_error

hmtp140789 commented 9 months ago

Yes, Other brokers are handling this in FrontEnd. But it is difficult to handle that in APIs as APIs won't have LTPs. If we do an LTP check on backend, it will add an extra step to every order placement, consequently adding to latency. So it is a question of speed vs "correctness". Here we have chosen speed.