GithubHelp home page GithubHelp logo

Comments (5)

ShivdasBachewar avatar ShivdasBachewar commented on June 29, 2024

it seems they have some session time, which is default to 3600 seconds (1 hr).
we can update that and we need not have to login again for specified period.
https://napi.kotaksecurities.com/devportal/applications/

note: I was also facing same issue, I am also trying the same now.
after try please add your views

from kotak-neo-api.

shusinghal avatar shusinghal commented on June 29, 2024

Hi Shidas,

client.modify_order(order_id = "", price = 0, quantity = 1, disclosed_quantity = 0, trigger_price = 0, validity = "GFD")

To use modify order, I need client object. This object is initiating the login process. If I have logged in one time, I should not require to login again till session timeout.

from kotak-neo-api.

syedasif11 avatar syedasif11 commented on June 29, 2024

@shusinghal That may be because you are calling client.login(mobilenumber=neo_creds.mobile_num, password=neo_creds.password) again. This is what I am doing:
Ex.,


neo_object = None

def get_neo_client():
    if neo_object is not None:
        return neo_object
    # Normal login process
    client = NeoAPI(access_token=neo_creds.accesstoken.strip(), consumer_key=neo_creds.consumerkey.strip(),
                    consumer_secret=neo_creds.consumer_secret.strip(), environment='prod', on_close=None, on_open=None)
    .....
    .....
    # Once session is generated, set neo_object
    neo_object = client

from kotak-neo-api.

ShivdasBachewar avatar ShivdasBachewar commented on June 29, 2024

shusinghal

As per my analysis,
once you are logged in to kotak api and generated session,
generated session is used in all your subsequent request.
Library is not doing re-login

`class ModifyOrder(object):
def init(self, api_client):
self.api_client = api_client ## already logged in session
self.rest_client = rest.RESTClientObject(api_client.configuration)

def quick_modification(self, order_id, price, order_type, quantity, validity, instrument_token,
                       exchange_segment, product, trading_symbol, transaction_type, trigger_price,
                       dd, market_protection, disclosed_quantity, filled_quantity, amo):
    header_params = {'Authorization': "Bearer " + self.api_client.configuration.bearer_token,
                     "Sid": self.api_client.configuration.edit_sid,
                     "Auth": self.api_client.configuration.edit_token,
                     "neo-fin-key": self.api_client.configuration.get_neo_fin_key(),
                     "Content-Type": "application/x-www-form-urlencoded"}

    body_params = {"tk": instrument_token, "mp": market_protection, "pc": product, "dd": dd,
                   "dq": disclosed_quantity, "vd": validity, "ts": trading_symbol, "tt": transaction_type,
                   "pr": price, "pt": order_type, "fq": filled_quantity, 'am': amo,
                   "tp": trigger_price, "qt": quantity, "no": order_id, "es": exchange_segment}

    query_params = {"sId": self.api_client.configuration.serverId}
    try:
        URL = self.api_client.configuration.get_url_details("modify_order")
        orders_resp = self.rest_client.request(
            url=URL, method='POST',
            query_params=query_params,
            headers=header_params,
            body=body_params
        )

        return orders_resp.json()

    except ApiException as ex:
        return {"error": ex}`

from kotak-neo-api.

Kotak-Neo avatar Kotak-Neo commented on June 29, 2024

@shusinghal The library is not re-logging while calling any method. Please debug your code to rectify this issue.

from kotak-neo-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.