Рассмотрим код ниже.
let symbol = "SIBN";
let from = new Date("2024-05-02");
let to = new Date("2024-05-02");
let batch : ResponseData;
let historyResponse : ResponseData = { columns : [], data : [] };
do {
const start = historyResponse.data.length;
const query = `${symbol}.json?sort_order=desc&marketprice_board=1&from=${format(from, "yyyy-MM-dd")}&to=${format(to, "yyyy-MM-dd")}&start=${start}`;
const url = `history/engines/stock/markets/shares/securities/${query}`;
const response : { history : ResponseData } = await moexClient.request(url);
batch = response.history;
if (historyResponse.columns.length == 0) {
historyResponse.columns = batch.columns;
}
historyResponse.data = [ ...historyResponse.data, ...batch.data];
} while(batch.data.length > 0);
client отправляет вот такой запрос (надо скроллить вправо, двумя * выделена добавка от кода клиента):
_header: 'GET /iss/history/engines/stock/markets/shares/securities/SIBN.json?sort_order=desc&marketprice_board=1&from=2024-05-02&to=2024-05-02&start=0**.json&lang=ru** HTTP/1.1\r\n' +
'Accept: application/json, text/plain, */*\r\n' +
'User-Agent: axios/0.27.2\r\n' +
'Host: iss.moex.com\r\n' +
'Connection: keep-alive\r\n' +
'\r\n',