Historical oi issue


  • I am trying to fetch oi data for a particular symbol
    my function:

    async getHistoricalOI({ symbolToken, interval, from, to }) {
    if (!this.sessionData?.jwtToken) {
    throw new Error('Not authenticated');
    }

    const token = this.getFuturesToken(symbolToken);
    console.log(token);
    
    const response = await axios.post(
      'https://apiconnect.angelone.in/rest/secure/angelbroking/historical/v1/getOIData',
      {
        exchange: 'NFO',
        symboltoken: token,
        interval,
        fromdate: from,
        todate: to
      },
      {
        headers: {
          'Authorization': `Bearer ${this.sessionData.jwtToken}`,
          'Content-Type': 'application/json',
          'Accept': 'application/json',
          'X-PrivateKey': CONFIG.API_KEY,
          'X-UserType': 'USER',
          'X-SourceID': 'WEB',
          'X-ClientLocalIP': '127.0.0.1',
          'X-ClientPublicIP': '127.0.0.1',
          'X-MACAddress': '00:00:00:00:00:00'
        }
      }
    );
    
    console.log(response);
    
    if (!response.data?.status) {
      throw new Error(response.data?.message || 'OI API failed');
    }
    
    return {
      success: true,
      interval,
      data: response.data.data || []
    };
    

    }

    response
    data: {
    message: 'Something Went Wrong, Please Try After Sometime',
    errorcode: 'AB1004',
    status: false,
    data: null
    }

    token used: 1114606 (which is for TCS25DECFUT)
    interval: 'ONE_DAY',
    from: '2025-12-01 09:15',
    to: '2025-12-19 15:30'

    also tried for :
    interval: 'THREE_MINUTE',
    from: '2025-12-19 09:15',
    to: '2025-12-19 15:30'


  • Hi @wish

    Requested token is not available from scrip master. Please do always check whether token is available from scripmaster before hitting the API.

    Latest ScripMaster json : https://margincalculator.angelone.in/OpenAPI_File/files/OpenAPIScripMaster.json