Kotak-Neo / kotak-neo-api

113 stars 105 forks source link

Incorrect Expiry dates in epoch in Scrip_Master. #74

Closed youngking1686 closed 12 months ago

youngking1686 commented 12 months ago

Scrip_master downloads the scrips data from the below url

"https://lapi.kotaksecurities.com/wso2-scripmaster/v1/prod/2023-10-09/transformed/nse_fo.csv". When I look for Expiry date it seems to be in epoch format and incorrect. For example: For an 12th oct 23 expiry the epoch expiry time (1388241000) mentioned in the data points to 12th oct "2013" ten years back!

How are we suppose to filter and pick instrument details based on this ?

Please look into it and fix this. Please provide the expiry date in human date format itself as it was in the old api, it will be easier to work with.

geek-coder commented 12 months ago

This is IBM BIOS epoch time. You can use that to get correct expiry date time.

geek-coder commented 12 months ago
def getDatetimeFromIBM( self, ibm_epoch_time ):
    unix_epoch_time = ibm_epoch_time + 315511200
    # Convert the Unix epoch time to a datetime object.
    datetime_object = dt.datetime.fromtimestamp(unix_epoch_time)
    return datetime_object.date()

You can apply this function to get datetime .

youngking1686 commented 12 months ago

Thanks for the insight its working and I'll keep it, anyway using an workaround now, First time coming across ibm epoch time. A small suggestion for the API team It would be great if things are kept simple and straight forward so It would be easy for users like me to focus on the strategy rather than the coding intricacies. Thanks again.

geek-coder commented 12 months ago

Thanks, if thats working, could you please close this issue. Will get this documented and is already mentioned in #65 . So this is a duplicate.

youngking1686 commented 12 months ago

Provided solutions works fine, it was actually not a bug but lack of information and user friendliness.