Navigation

    SmartAPI Forum
    • Register
    • Login
    • Search
    • Categories
    • Popular
    • Groups
    • FAQs
    • API Docs
    1. Home
    2. wish
    W
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 1
    • Best 0
    • Groups 0

    wish

    @wish

    0
    Reputation
    1
    Profile views
    1
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    wish Unfollow Follow

    Latest posts made by wish

    • 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'

      posted in NodeJS SDK
      W
      wish