Error of 429 while fetching option chain

Hello, I am fetching option chain of bank nifty, nifty. I am facing problem of 429 error code it seems like too many request quickly .
while I am not requesting much please guide me and help me to solve the issue and please answer or reply in required time . I have to to wait for your replies . because I have created 2 topics still not any response received me

use websocket for that

Hi, I am facing the same issue for getting stock data; my code looks like this. can you help how to solve this problem and it’s writing on dart: {
class UpstoxService {
final String accessToken = “token”
final JsonService jsonService;

UpstoxService(this.jsonService);

Future<String?> getInstrumentKey(String tradingSymbol) async {
try {
  final List<dynamic> data = await jsonService.loadJsonData();
  for (var item in data) {
    if (item['trading_symbol'] == tradingSymbol) {
      return item['instrument_key'];
    }
  }
  return 'null'; // Return null if no match is found
} catch (e) {
  print("Error finding instrument key: $e");
  return 'null';
}

}

Future<Map<String, String>> fetchStockData(String instrumentKey,String symbol) async {
final url = Uri.parse(‘https://api.upstox.com/v2/market-quote/quotes?instrument_key=$instrumentKey’);
final headers = {
‘Accept’: ‘application/json’,
‘Authorization’: ‘Bearer $accessToken’,
};

final response = await http.get(url, headers: headers);
print(response.statusCode);
if (response.statusCode == 200) {
  var data = jsonDecode(response.body);
  Map<String,String> extractData =  formatData(data['data']["NSE_EQ:$symbol"]);
  return extractData;
} else {
  throw Exception('No data available');
}

}

Map<String, String> formatData(var data) {
double open = data[‘ohlc’]![‘open’];
String close = data[‘ohlc’]![‘close’].toString();
double netChange = data[‘net_change’];
String percentageChange = ((netChange/open)*100).toStringAsFixed(2);

return  {
  "currentPrice":close,
  "percentageChange":"$percentageChange%",
  "amountChange":netChange.toString(),
};

}
}

}

Status code show as: {
429
}

Instead of fetching multiple Instruments keys try single and debug at console.log if data ia received, then try websocket.
Trying websocket worked for me

Please use websocket for this use case.

To access option chain data, it’s crucial to adhere to the guidelines provided on this page: Upstox API Documentation - Market Data Feed . Familiarizing yourself with the Market Data documentation section is advised for seamless integration.

Thank you.

can you know how to replace my code with websocket code?

If you know how to using WebSocketChannel in flutter.