Kotak-Neo / kotak-neo-api

108 stars 97 forks source link

Modify Order : getting bad request #8

Closed udhajare closed 1 year ago

udhajare commented 1 year ago

client.modify_order(order_id='230718001217031', order_type='SL', price=0.25, quantity=40, disclosed_quantity=0, trigger_price=0.25, validity="DAY")

In above code tried validity as 'GFD" also tried sending prices as int,String

KSAPIHelp commented 1 year ago

use below given structure

OrderID="XXXXXXXXXXXX" Price="XXXXXX" Qty=XXXXX OrderType="L" client.modify_order(order_id = OrderID, price = Price, quantity = Qty, disclosed_quantity = 0, trigger_price = 0, validity = "GFD", order_type=OrderType)

KSAPIHelp commented 1 year ago

dont forget to use Help Functionality

client.help()

Response

{1: 'help("place_order")', 2: 'help("modify_order")', 3: 'help("holdings")', 4: 'help("positions")', 5: 'help("limits")', 6: 'help("trade_report")', 7: 'help("margin_required")', 8: 'help("cancel_order")', 9: 'help("order_history")', 10: 'help("scrip_master")', 11: 'help("quotes")', 12: 'help("socket")', 13: 'help("search_scrip")', 14: 'help("order_report")', 15: 'help("subscribe_to_orderfeed")', 16: 'help()'}

client.help("modify_order")

`NeoAPI.modify_order(self: <class 'inspect._empty'>, order_id: <class 'inspect._empty'>, price: <class 'inspect._empty'>, order_type: <class 'inspect._empty'>, quantity: <class 'inspect._empty'>, validity: <class 'inspect._empty'>, instrument_token: <class 'inspect._empty'>, exchange_segment: <class 'inspect._empty'>, product: <class 'inspect._empty'>, trading_symbol: <class 'inspect._empty'>, transaction_type: <class 'inspect._empty'>, trigger_price: <class 'inspect._empty'>, dd: <class 'inspect._empty'>, market_protection: <class 'inspect._empty'>, disclosed_quantity: <class 'inspect._empty'>, filled_quantity: <class 'inspect._empty'>, amo: <class 'inspect._empty'>): There are 2 ways to modify the order one is bypassing all the parameters and another one is pass the order_id based on that we will take the values from order book and updated the latest details

        Modify an existing order with new values for its parameters.

        Args:
            amo: (str, optional): Default sets to NO. Override with 'YES' if you want to pass amo
            order_id (int): The unique identifier of the order to be modified.
            price (float): The new price for the order.
            order_type (str): The new order type for the order.
            quantity (int): The new quantity of the order.
            validity (str): The new validity for the order.
            instrument_token (int, optional): The unique identifier of the instrument. Defaults to None.
            exchange_segment (str, optional): The exchange segment of the order. Defaults to None.
            product (str, optional): The product type for the order. Defaults to None.
            trading_symbol (str, optional): The trading symbol of the order. Defaults to None.
            transaction_type (str, optional): The transaction type for the order. Defaults to None.
            trigger_price (float, optional): The new trigger price for the order. Defaults to "0".
            dd (str, optional): The new disclosed quantity for the order. Defaults to "NA".
            market_protection (str, optional): The new market protection for the order. Defaults to "0".
            disclosed_quantity (str, optional): The new disclosed quantity for the order. Defaults to "0".
            filled_quantity (str, optional): The new filled quantity for the order. Defaults to "0".

        Raises:
            ValueError: If order ID is not provided.

        Returns:
            The Status of the Given Order ID modification`
udhajare commented 1 year ago
a = client.modify_order(order_id='230720001454476',  price='992',
                        quantity=1, disclosed_quantity=0, trigger_price=0, validity="GFD",
                        order_type='L', amo='YES')

Giving in a same sequenxce but still getting same error.

{'stat': 'Not_Ok', 'stCode': 5202, 'errMsg': 'Error: Invalid Request'}

udhajare commented 1 year ago

UPDATE: Acc to doc it says int as argument but all params should be in String.

a = client.modify_order(order_id='230720001454476', price='992', quantity='1', disclosed_quantity='0', trigger_price='0', validity="DAY", order_type='L', amo='YES')