How to access data using apiConnect?

43 views Asked by At

I am new to Node.js

I am trying to make a API call to Edelweiss Connect API documentation for past Stock data using APIConnect

I wrote this piece of code

const { APIConnect } = require("api_connect_nodejs");
const apiConnect = new APIConnect(
    apiKey,
    password,
    reqId,
    downloadContract,
);

apiConnect.Init().then(() => {
    const eodChart = apiConnect
      .getEODChart(
        interval,
        assetType,
        symbol,
        exchangeType,
        tillDate
    )
    .then((result) => console.log(result))
    .catch((err) => console.log("Error intradayChart" , err));
  })
 .catch((err) => console.log("Init Failed" , err));

and I expected to give me this as output

  {
    "msgID": "6f5da42b-668f-4e76-a129-aa85b770cacd",
    "srvTm": 1660900624895,
    "data": [
      ["2021-05-27 00:00:00", 11, 11.22, 11, 11, 56087],
      ["2021-06-21 00:00:00", 10.8, 10.8, 9.8, 9.8, 909],
      ["2021-07-29 00:00:00", 9.8, 9.94, 9.51, 9.7, 2440],
      ["2021-08-30 00:00:00", 9.51, 9.51, 8.39, 8.39, 5490],
      ["2021-09-30 00:00:00", 8.39, 8.39, 8.39, 8.39, 20],
      ["2021-10-25 00:00:00", 8.39, 8.39, 8.39, 8.39, 152],
      ["2021-11-29 00:00:00", 8.55, 8.71, 8.55, 8.71, 100],
      ["2021-12-31 00:00:00", 8.71, 9.09, 8.71, 9.09, 49203]
    ],
    "nextTillDate": "2006-05-29 00:00:00"
  } 

but I am getting this as output

connected to server!
Error :  {
  appID: 'a9bb216d027e8cc68740b56fe3a80230',
  config: {},
  error: { actCd: '54', errCd: 'ETRD0009', errMsg: 'No data available' },
  msgID: '4e824788-d07b-4966-a458-2f8af63d5fac',
  srvTm: 1699958329802
}
Init Failed {
  appID: 'a9bb216d027e8cc68740b56fe3a80230',
  config: {},
  error: { actCd: '54', errCd: 'ETRD0009', errMsg: 'No data available' },
  msgID: '4e824788-d07b-4966-a458-2f8af63d5fac',
  srvTm: 1699958329802,
  msg: 'ReqId: No data available'
}
0

There are 0 answers