Comparing version 1.0.0-prealpha.1 to 1.0.0-prealpha.2
132
index.js
import fs from "fs"; | ||
export { getTradeSummary } from "./market-data/trading-summary/trading-summary-and-recapitulation/getTradeSummary.js"; | ||
export { getRecapSummary } from "./market-data/trading-summary/trading-summary-and-recapitulation/getRecapSummary.js"; | ||
// import { getBrokerSearch } from "./members-and-participants/exchange-members-profiles/index.js"; | ||
export { getIndexSummary } from "./market-data/trading-summary/index-summary/getIndexSummary.js"; | ||
export { getIndexIC } from "./market-data/trading-summary/index-summary/getIndexIC.js"; | ||
export { getConstituent } from "./market-data/trading-summary/index-summary/getConstituent.js"; | ||
// export { getTradeSummary } from "./market-data/trading-summary/trading-summary-and-recapitulation/getTradeSummary.js"; | ||
// export { getRecapSummary } from "./market-data/trading-summary/trading-summary-and-recapitulation/getRecapSummary.js"; | ||
export { getStockSummary } from "./market-data/trading-summary/stock-summary/getStockSummary.js"; | ||
export { getMarginSummary } from "./market-data/trading-summary/stock-summary/getMarginSummary.js"; | ||
export { getShortSellSummary } from "./market-data/trading-summary/stock-summary/getShortSellSummary.js"; | ||
// export { getIndexSummary } from "./market-data/trading-summary/index-summary/getIndexSummary.js"; | ||
// export { getIndexIC } from "./market-data/trading-summary/index-summary/getIndexIC.js"; | ||
// export { getConstituent } from "./market-data/trading-summary/index-summary/getConstituent.js"; | ||
export { getBrokerSummary } from "./market-data/trading-summary/broker-summary/GetBrokerSummary.js"; | ||
// export { getStockSummary } from "./market-data/trading-summary/stock-summary/getStockSummary.js"; | ||
// export { getMarginSummary } from "./market-data/trading-summary/stock-summary/getMarginSummary.js"; | ||
// export { getShortSellSummary } from "./market-data/trading-summary/stock-summary/getShortSellSummary.js"; | ||
export { getPedSummary } from "./market-data/trading-summary/ped-summary/getPedSummary.js"; | ||
// export { getBrokerSummary } from "./market-data/trading-summary/broker-summary/getBrokerSummary.js"; | ||
export { getStatistic } from "./market-data/statistical-reports/statistics/getStatistic.js"; | ||
export { getPerfSumLq45Company } from "./market-data/statistical-reports/company-fact-sheet-lq45/getPerfSumLq45Company.js"; | ||
export { getBook } from "./market-data/statistical-reports/bond-book/getBook.js"; | ||
export { getFactSheetIndex } from "./market-data/statistical-reports/fact-sheet-index/getFactSheetIndex.js"; | ||
export { getNewListing } from "./market-data/statistical-reports/new-listing-information/getNewListing.js"; | ||
// export { getPedSummary } from "./market-data/trading-summary/ped-summary/getPedSummary.js"; | ||
export { getIndexGroupPrevalues } from "./market-data/stocks-data/stock-index/getIndexGroupPrevalues.js"; | ||
export { getStockUploader } from "./market-data/stocks-data/stock-index/getStockUploader.js"; | ||
// export { getStatistic } from "./market-data/statistical-reports/statistics/getStatistic.js"; | ||
// export { getPerfSumLq45Company } from "./market-data/statistical-reports/company-fact-sheet-lq45/getPerfSumLq45Company.js"; | ||
// export { getBook } from "./market-data/statistical-reports/bond-book/getBook.js"; | ||
// export { getFactSheetIndex } from "./market-data/statistical-reports/fact-sheet-index/getFactSheetIndex.js"; | ||
// export { getNewListing } from "./market-data/statistical-reports/new-listing-information/getNewListing.js"; | ||
export { getSectors } from "./market-data/stocks-data/stock-list/getSectors.js"; | ||
export { getBoards } from "./market-data/stocks-data/stock-list/getBoards.js"; | ||
export { getSecuritiesStock } from "./market-data/stocks-data/stock-list/getSecuritiesStock.js"; | ||
// export { getIndexGroupPrevalues } from "./market-data/stocks-data/stock-index/getIndexGroupPrevalues.js"; | ||
// export { getStockUploader } from "./market-data/stocks-data/stock-index/getStockUploader.js"; | ||
export { getCompositeBondIndex } from "./market-data/bonds-sukuk/indobex/getCompositeBondIndex.js"; | ||
export { getGovernmentBondIndex } from "./market-data/bonds-sukuk/indobex/getGovernmentBondIndex.js"; | ||
export { getCorporateBondIndex } from "./market-data/bonds-sukuk/indobex/getCorporateBondIndex.js"; | ||
// export { getSectors } from "./market-data/stocks-data/stock-list/getSectors.js"; | ||
// export { getBoards } from "./market-data/stocks-data/stock-list/getBoards.js"; | ||
// export { getSecuritiesStock } from "./market-data/stocks-data/stock-list/getSecuritiesStock.js"; | ||
export { getGovIssuer } from "./market-data/bonds-sukuk/corporate-bonds-sukuk/getGovIssuer.js"; | ||
export { getBondSukuk } from "./market-data/bonds-sukuk/corporate-bonds-sukuk/getBondSukuk.js"; | ||
// export { getCompositeBondIndex } from "./market-data/bonds-sukuk/indobex/getCompositeBondIndex.js"; | ||
// export { getGovernmentBondIndex } from "./market-data/bonds-sukuk/indobex/getGovernmentBondIndex.js"; | ||
// export { getCorporateBondIndex } from "./market-data/bonds-sukuk/indobex/getCorporateBondIndex.js"; | ||
export { getETPTickerList } from "./market-data/bonds-sukuk/etp-trading/getETPTickerList.js"; | ||
export { getETPTradeActivity } from "./market-data/bonds-sukuk/etp-trading/getETPTradeActivity.js"; | ||
export { getETPMarketSnapshot } from "./market-data/bonds-sukuk/etp-trading/getETPMarketSnapshot.js"; | ||
export { getETPDailySummary } from "./market-data/bonds-sukuk/etp-trading/getETPDailySummary.js"; | ||
export { getETPSecurityList } from "./market-data/bonds-sukuk/etp-trading/getETPSecurityList.js"; | ||
// export { getGovIssuer } from "./market-data/bonds-sukuk/corporate-bonds-sukuk/getGovIssuer.js"; | ||
// export { getBondSukuk } from "./market-data/bonds-sukuk/corporate-bonds-sukuk/getBondSukuk.js"; | ||
export { getOtcReport } from "./market-data/bonds-sukuk/otc-trading-report/getOtcReport.js"; | ||
export { getOtcTrade } from "./market-data/bonds-sukuk/otc-trading-report/getOtcTrade.js"; | ||
export { getOtcCorrected } from "./market-data/bonds-sukuk/otc-trading-report/getOtcCorrected.js"; | ||
export { getOtcCancelled } from "./market-data/bonds-sukuk/otc-trading-report/getOtcCancelled.js"; | ||
// export { getETPTickerList } from "./market-data/bonds-sukuk/etp-trading/getETPTickerList.js"; | ||
// export { getETPTradeActivity } from "./market-data/bonds-sukuk/etp-trading/getETPTradeActivity.js"; | ||
// export { getETPMarketSnapshot } from "./market-data/bonds-sukuk/etp-trading/getETPMarketSnapshot.js"; | ||
// export { getETPDailySummary } from "./market-data/bonds-sukuk/etp-trading/getETPDailySummary.js"; | ||
// export { getETPSecurityList } from "./market-data/bonds-sukuk/etp-trading/getETPSecurityList.js"; | ||
export { getMarketTime } from "./market-data/bonds-sukuk/pds-quotation/getMarketTime.js"; | ||
export { getInstrumentList } from "./market-data/bonds-sukuk/pds-quotation/getInstrumentList.js"; | ||
export { getPdQuotation } from "./market-data/bonds-sukuk/pds-quotation/getPdQuotation.js"; | ||
export { getPdQuotationReference } from "./market-data/bonds-sukuk/pds-quotation/getPdQuotationReference.js"; | ||
// export { getOtcReport } from "./market-data/bonds-sukuk/otc-trading-report/getOtcReport.js"; | ||
// export { getOtcTrade } from "./market-data/bonds-sukuk/otc-trading-report/getOtcTrade.js"; | ||
// export { getOtcCorrected } from "./market-data/bonds-sukuk/otc-trading-report/getOtcCorrected.js"; | ||
// export { getOtcCancelled } from "./market-data/bonds-sukuk/otc-trading-report/getOtcCancelled.js"; | ||
export { getMaturityYear } from "./market-data/asset-backed-securities-data/getMaturityYear.js"; | ||
export { getAbs } from "./market-data/asset-backed-securities-data/getAbs.js"; | ||
export { getAbsSearchTable } from "./market-data/asset-backed-securities-data/getAbsSearchTable.js"; | ||
// export { getMarketTime } from "./market-data/bonds-sukuk/pds-quotation/getMarketTime.js"; | ||
// export { getInstrumentList } from "./market-data/bonds-sukuk/pds-quotation/getInstrumentList.js"; | ||
// export { getPdQuotation } from "./market-data/bonds-sukuk/pds-quotation/getPdQuotation.js"; | ||
// export { getPdQuotationReference } from "./market-data/bonds-sukuk/pds-quotation/getPdQuotationReference.js"; | ||
export { getEtfMarket } from "./market-data/exchanged-traded-fund-etf-data/getEtfMarket.js"; | ||
// export { getMaturityYear } from "./market-data/asset-backed-securities-data/getMaturityYear.js"; | ||
// export { getAbs } from "./market-data/asset-backed-securities-data/getAbs.js"; | ||
// export { getAbsSearchTable } from "./market-data/asset-backed-securities-data/getAbsSearchTable.js"; | ||
export { getContractCodeList } from "./market-data/derivatives-data/getContractCodeList.js"; | ||
// export { getEtfMarket } from "./market-data/exchanged-traded-fund-etf-data/getEtfMarket.js"; | ||
export { getFutureToday } from "./market-data/derivatives-data/getFutureToday.js"; | ||
export { getMarketSummary } from "./market-data/derivatives-data/getMarketSummary.js"; | ||
export { getMarketHistory } from "./market-data/derivatives-data/getMarketHistory.js"; | ||
export { getFuturesChart } from "./market-data/derivatives-data/getFuturesChart.js"; | ||
export { getMostActiveBroker } from "./market-data/derivatives-data/getMostActiveBroker.js"; | ||
export { getMostActiveContract } from "./market-data/derivatives-data/getMostActiveContract.js"; | ||
// export { getContractCodeList } from "./market-data/derivatives-data/getContractCodeList.js"; | ||
export { getIssuerList } from "./market-data/structured-warrant-sw/issuer-company-list/getIssuerList.js"; | ||
// export { getFutureToday } from "./market-data/derivatives-data/getFutureToday.js"; | ||
// export { getMarketSummary } from "./market-data/derivatives-data/getMarketSummary.js"; | ||
// export { getMarketHistory } from "./market-data/derivatives-data/getMarketHistory.js"; | ||
// export { getFuturesChart } from "./market-data/derivatives-data/getFuturesChart.js"; | ||
// export { getMostActiveBroker } from "./market-data/derivatives-data/getMostActiveBroker.js"; | ||
// export { getMostActiveContract } from "./market-data/derivatives-data/getMostActiveContract.js"; | ||
export { getEmiten } from "./market-data/structured-warrant-sw/structured-warrant-information/getEmiten.js"; | ||
export { getIssuerDDL } from "./market-data/structured-warrant-sw/structured-warrant-information/getIssuerDDL.js"; | ||
export { getSwTypes } from "./market-data/structured-warrant-sw/structured-warrant-information/getSwTypes.js"; | ||
export { getSwInformation } from "./market-data/structured-warrant-sw/structured-warrant-information/getSwInformation.js"; | ||
// export { getIssuerList } from "./market-data/structured-warrant-sw/issuer-company-list/getIssuerList.js"; | ||
export { getSwTrading } from "./market-data/structured-warrant-sw/structured-warrant-summary/getSwTrading.js"; | ||
// export { getEmiten } from "./market-data/structured-warrant-sw/structured-warrant-information/getEmiten.js"; | ||
// export { getIssuerDDL } from "./market-data/structured-warrant-sw/structured-warrant-information/getIssuerDDL.js"; | ||
// export { getSwTypes } from "./market-data/structured-warrant-sw/structured-warrant-information/getSwTypes.js"; | ||
// export { getSwInformation } from "./market-data/structured-warrant-sw/structured-warrant-information/getSwInformation.js"; | ||
export { getDireMarket } from "./market-data/reits-dinfra/getDireMarket.js"; | ||
export { getDinfraMarket } from "./market-data/reits-dinfra/getDinfraMarket.js"; | ||
// export { getSwTrading } from "./market-data/structured-warrant-sw/structured-warrant-summary/getSwTrading.js"; | ||
export { getSlbDaily } from "./market-data/securities-borrowing-and-lending/getSlbDaily.js"; | ||
export { getSlbFiles } from "./market-data/securities-borrowing-and-lending/getSlbFiles.js"; | ||
export { getSlbLendableStock } from "./market-data/securities-borrowing-and-lending/getSlbLendableStock.js"; | ||
export { getSlbTopActiveStock } from "./market-data/securities-borrowing-and-lending/getSlbTopActiveStock.js"; | ||
export { getSlbTopLenderFreq } from "./market-data/securities-borrowing-and-lending/getSlbTopLenderFreq.js"; | ||
export { getSlbTopLenderVal } from "./market-data/securities-borrowing-and-lending/getSlbTopLenderVal.js"; | ||
// export { getDireMarket } from "./market-data/reits-dinfra/getDireMarket.js"; | ||
// export { getDinfraMarket } from "./market-data/reits-dinfra/getDinfraMarket.js"; | ||
// getBook | ||
// export { getSlbDaily } from "./market-data/securities-borrowing-and-lending/getSlbDaily.js"; | ||
// export { getSlbFiles } from "./market-data/securities-borrowing-and-lending/getSlbFiles.js"; | ||
// export { getSlbLendableStock } from "./market-data/securities-borrowing-and-lending/getSlbLendableStock.js"; | ||
// export { getSlbTopActiveStock } from "./market-data/securities-borrowing-and-lending/getSlbTopActiveStock.js"; | ||
// export { getSlbTopLenderFreq } from "./market-data/securities-borrowing-and-lending/getSlbTopLenderFreq.js"; | ||
// export { getSlbTopLenderVal } from "./market-data/securities-borrowing-and-lending/getSlbTopLenderVal.js"; | ||
// getStatistic | ||
// const data = await getSlbTopLenderVal(); | ||
// const data = await getBrokerSearch(); | ||
// https://www.idx.co.id/primary/MarketData/GetAbsSearchTable?draw=1&start=0&length=9999&yearMatured=&bondId=SPSMFBTN02A2 | ||
// // console.log(data); | ||
@@ -97,0 +95,0 @@ // // const jsonData = JSON.stringify(data, null, 2); // `null` and `2` are for pretty-printing |
import { fetchData } from "../../utils/template.js"; | ||
/** | ||
* Retrieves Asset-Backed Securities (ABS) data from IDX. | ||
* @returns {Promise<string>} - A JSON string of the ABS data. | ||
*/ | ||
export async function getAbs() { | ||
@@ -8,8 +12,8 @@ const url = "https://www.idx.co.id/primary/MarketData/GetAbs"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching ABS data:", error.message); | ||
throw new Error(`Failed to fetch ABS data: ${error.message}`); | ||
} | ||
} | ||
} |
import { fetchData } from "../../utils/template.js"; | ||
export async function getAbsSearchTable(bondId='', yearMatured='') { | ||
const url = `https://www.idx.co.id/primary/MarketData/GetAbsSearchTable?draw=1&start=0&length=9999`; | ||
// &yearMatured=${yearMatured}&bondId=${bondId} | ||
/** | ||
* Retrieves ABS search table data from IDX with optional filters. | ||
* @param {string} [bondId=''] - The bond ID to filter the search results. | ||
* @param {string} [yearMatured=''] - The year of maturity to filter the search results. | ||
* @returns {Promise<string>} - A JSON string of the ABS search table data. | ||
*/ | ||
export async function getAbsSearchTable() { | ||
const baseUrl = "https://www.idx.co.id/primary/MarketData/GetAbsSearchTable"; | ||
const queryParams = new URLSearchParams({ | ||
draw: 1, | ||
start: 0, | ||
length: 9999 | ||
}).toString(); | ||
const url = `${baseUrl}?${queryParams}`; | ||
const referrer = "https://www.idx.co.id/en/market-data/asset-backed-securities-data/"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response['data'], null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching ABS search table data:", error.message); | ||
throw new Error(`Failed to fetch ABS search table data: ${error.message}`); | ||
} | ||
} | ||
} |
import { fetchData } from "../../utils/template.js"; | ||
/** | ||
* Retrieves maturity year data from IDX. | ||
* @returns {Promise<string>} - A JSON string of the maturity year data. | ||
*/ | ||
export async function getMaturityYear() { | ||
@@ -8,8 +12,8 @@ const url = "https://www.idx.co.id/primary/Helper/GetMaturityYear"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching maturity year data:", error.message); | ||
throw new Error(`Failed to fetch maturity year data: ${error.message}`); | ||
} | ||
} | ||
} |
import fs from "fs"; | ||
import { fetchData } from '../../../utils/template.js'; | ||
const pageSize=100 | ||
const pageSize = 100; | ||
// Helper function to build the fetch URL | ||
/** | ||
* Builds the fetch URL for bond data. | ||
* @param {number} indexFrom - The starting index for pagination. | ||
* @param {number} bondType - The type of bond (1 for corporate, 2 for government). | ||
* @param {number} instrumentId - The instrument ID (0 for all, 1 for obligation, 2 for sukuk). | ||
* @returns {string} - The URL for fetching bond data. | ||
*/ | ||
function buildFetchUrl(indexFrom, bondType, instrumentId) { | ||
@@ -14,12 +19,14 @@ return `https://www.idx.co.id/secondary/get/BondSukuk/bond?pageSize=${pageSize}&indexFrom=${indexFrom}&bondType=${bondType}&instrumentId=${instrumentId}`; | ||
// Main function to fetch bond data with pagination | ||
// bondType 1 corporate 2 gov | ||
// instrumentId 0 all 1 obligation 2 sukuk | ||
export async function getBondSukuk(indexFrom = 1, bondType = 2, instrumentId=0) { | ||
/** | ||
* Fetches bond data with pagination. | ||
* @param {number} [indexFrom=1] - The starting index for pagination. | ||
* @param {number} [bondType=2] - The type of bond (1 for corporate, 2 for government). | ||
* @param {number} [instrumentId=0] - The instrument ID (0 for all, 1 for obligation, 2 for sukuk). | ||
* @returns {Promise<string>} - A JSON string of all fetched bond data. | ||
*/ | ||
export async function getBondSukuk(indexFrom = 1, bondType = 2, instrumentId = 0) { | ||
const allResults = []; | ||
try { | ||
const initialUrl = buildFetchUrl(pageSize, indexFrom, bondType, instrumentId); | ||
const initialUrl = buildFetchUrl(indexFrom, bondType, instrumentId); | ||
const initialData = await fetchData(initialUrl, referrer); | ||
@@ -31,8 +38,8 @@ | ||
while (indexFrom <= totalPages) { | ||
console.log(indexFrom); | ||
console.log(`Fetching page ${indexFrom} of ${totalPages}`); | ||
const url = buildFetchUrl(pageSize, indexFrom, bondType); | ||
const url = buildFetchUrl(indexFrom, bondType, instrumentId); | ||
const data = await fetchData(url, referrer); | ||
console.log(data.Results); | ||
console.log(`Fetched ${data.Results.length} results from page ${indexFrom}`); | ||
allResults.push(...data.Results); | ||
@@ -46,5 +53,5 @@ | ||
} catch (error) { | ||
console.error('There was a problem with the fetch operation:', error); | ||
throw error; | ||
console.error('Error fetching bond data:', error.message); | ||
throw new Error(`Failed to fetch bond data: ${error.message}`); | ||
} | ||
} |
import { fetchData } from "../../../utils/template.js"; | ||
export async function getGovIssuer() { | ||
const url = "https://www.idx.co.id/primary/BondSukuk/GetGovIssuer?pageSize=1000&pageNumber=1"; | ||
/** | ||
* Retrieves government issuer data from IDX. | ||
* @param {number} [pageSize=1000] - The number of records to retrieve per page. | ||
* @param {number} [pageNumber=1] - The page number to retrieve. | ||
* @returns {Promise<string>} - A JSON string of the government issuer data. | ||
*/ | ||
export async function getGovIssuer(pageSize = 1000, pageNumber = 1) { | ||
const baseUrl = "https://www.idx.co.id/primary/BondSukuk/GetGovIssuer"; | ||
const queryParams = new URLSearchParams({ pageSize, pageNumber }).toString(); | ||
const url = `${baseUrl}?${queryParams}`; | ||
const referrer = "https://www.idx.co.id/en/market-data/bonds-sukuk/corporate-bonds-sukuk/"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching government issuer data:", error.message); | ||
throw new Error(`Failed to fetch government issuer data: ${error.message}`); | ||
} | ||
} | ||
} |
import { fetchData } from "../../../utils/template.js"; | ||
export async function getETPDailySummary(date='20240731') { | ||
const url = `https://www.idx.co.id/primary/BondSukuk/GetETPDailySummary?start=0&length=10&keyword=&date=20240827&_=1724761641023`; | ||
/** | ||
* Retrieves the ETP daily summary from IDX for a specified date. | ||
* @param {string} [date='20240731'] - The date for which to retrieve the ETP daily summary (format: YYYYMMDD). | ||
* @returns {Promise<string>} - A JSON string of the ETP daily summary data. | ||
*/ | ||
export async function getETPDailySummary(date = '20240731') { | ||
const baseUrl = "https://www.idx.co.id/primary/BondSukuk/GetETPDailySummary"; | ||
const queryParams = new URLSearchParams({ | ||
start: 0, | ||
length: 10, | ||
keyword: '', | ||
date, | ||
_: Date.now() // Use current timestamp to avoid caching issues | ||
}).toString(); | ||
const url = `${baseUrl}?${queryParams}`; | ||
const referrer = "https://www.idx.co.id/en/market-data/bonds-sukuk/etp-trading/"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching ETP daily summary:", error.message); | ||
throw new Error(`Failed to fetch ETP daily summary: ${error.message}`); | ||
} | ||
} | ||
} |
import { fetchData } from "../../../utils/template.js"; | ||
export async function getETPMarketSnapshot(date='20240731') { | ||
const url = `https://www.idx.co.id/primary/BondSukuk/GetETPMarketSnapshot?date=20240827&start=0&length=10&keyword=`; | ||
/** | ||
* Retrieves the ETP market snapshot from IDX for a specified date. | ||
* @param {string} [date='20240731'] - The date for which to retrieve the ETP market snapshot (format: YYYYMMDD). | ||
* @returns {Promise<string>} - A JSON string of the ETP market snapshot data. | ||
*/ | ||
export async function getETPMarketSnapshot(date = '20240731') { | ||
const baseUrl = "https://www.idx.co.id/primary/BondSukuk/GetETPMarketSnapshot"; | ||
const queryParams = new URLSearchParams({ | ||
date, | ||
start: 0, | ||
length: 10, | ||
keyword: '', | ||
_: Date.now() // Use current timestamp to avoid caching issues | ||
}).toString(); | ||
const url = `${baseUrl}?${queryParams}`; | ||
const referrer = "https://www.idx.co.id/en/market-data/bonds-sukuk/etp-trading/"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching ETP market snapshot:", error.message); | ||
throw new Error(`Failed to fetch ETP market snapshot: ${error.message}`); | ||
} | ||
} | ||
} |
import { fetchData } from "../../../utils/template.js"; | ||
export async function getETPSecurityList(ticker='') { | ||
const url = `https://www.idx.co.id/primary/BondSukuk/GetETPSecurityList?ticker=${ticker}&length=10&start=0`; | ||
/** | ||
* Retrieves the list of ETP securities from IDX based on the given ticker. | ||
* @param {string} [ticker=''] - The ticker symbol to filter ETP securities. If empty, retrieves all securities. | ||
* @returns {Promise<string>} - A JSON string of the ETP securities list. | ||
*/ | ||
export async function getETPSecurityList(ticker = '') { | ||
const baseUrl = "https://www.idx.co.id/primary/BondSukuk/GetETPSecurityList"; | ||
const queryParams = new URLSearchParams({ | ||
ticker, | ||
length: 10, | ||
start: 0, | ||
_: Date.now() // Use current timestamp to avoid caching issues | ||
}).toString(); | ||
const url = `${baseUrl}?${queryParams}`; | ||
const referrer = "https://www.idx.co.id/en/market-data/bonds-sukuk/etp-trading/"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching ETP security list:", error.message); | ||
throw new Error(`Failed to fetch ETP security list: ${error.message}`); | ||
} | ||
} |
import { fetchData } from "../../../utils/template.js"; | ||
/** | ||
* Retrieves the list of ETP tickers from IDX. | ||
* @returns {Promise<string>} - A JSON string of the ETP tickers list. | ||
*/ | ||
export async function getETPTickerList() { | ||
@@ -8,8 +12,8 @@ const url = "https://www.idx.co.id/primary/BondSukuk/GetETPTickerList"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching ETP ticker list:", error.message); | ||
throw new Error(`Failed to fetch ETP ticker list: ${error.message}`); | ||
} | ||
} |
import { fetchData } from "../../../utils/template.js"; | ||
export async function getETPTradeActivity(date='20240731') { | ||
const url = `https://www.idx.co.id/primary/BondSukuk/GetETPTradeActivity?length=10&start=0&date=${date}&_=1724761584820`; | ||
/** | ||
* Retrieves ETP trade activity data from IDX for a specified date. | ||
* @param {string} [date='20240731'] - The date for which to retrieve ETP trade activity (format: YYYYMMDD). | ||
* @returns {Promise<string>} - A JSON string of the ETP trade activity data. | ||
*/ | ||
export async function getETPTradeActivity(date = '20240731') { | ||
const baseUrl = "https://www.idx.co.id/primary/BondSukuk/GetETPTradeActivity"; | ||
const queryParams = new URLSearchParams({ | ||
length: 10, | ||
start: 0, | ||
date, | ||
_: Date.now() // Use current timestamp to avoid caching issues | ||
}).toString(); | ||
const url = `${baseUrl}?${queryParams}`; | ||
const referrer = "https://www.idx.co.id/en/market-data/bonds-sukuk/etp-trading/"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching ETP trade activity:", error.message); | ||
throw new Error(`Failed to fetch ETP trade activity: ${error.message}`); | ||
} | ||
} | ||
} |
import { fetchData } from "../../../utils/template.js"; | ||
/** | ||
* Retrieves the Composite Bond Index data from IDX. | ||
* @returns {Promise<string>} - A JSON string of the Composite Bond Index data. | ||
*/ | ||
export async function getCompositeBondIndex() { | ||
@@ -8,8 +12,8 @@ const url = "https://www.idx.co.id/primary/BondSukuk/GetCompositeBondIndex"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching Composite Bond Index data:", error.message); | ||
throw new Error(`Failed to fetch Composite Bond Index data: ${error.message}`); | ||
} | ||
} | ||
} |
import { fetchData } from "../../../utils/template.js"; | ||
export async function getCorporateBondIndex() { | ||
const url = "https://www.idx.co.id/primary/BondSukuk/GetCorporateBondIndex?length=10&start=1"; | ||
/** | ||
* Retrieves the Corporate Bond Index data from IDX. | ||
* @param {number} [length=10] - The number of records to retrieve. | ||
* @param {number} [start=1] - The starting index for the records. | ||
* @returns {Promise<string>} - A JSON string of the Corporate Bond Index data. | ||
*/ | ||
export async function getCorporateBondIndex(length = 10, start = 1) { | ||
const baseUrl = "https://www.idx.co.id/primary/BondSukuk/GetCorporateBondIndex"; | ||
const queryParams = new URLSearchParams({ length, start }).toString(); | ||
const url = `${baseUrl}?${queryParams}`; | ||
const referrer = "https://www.idx.co.id/en/market-data/bonds-sukuk/indobex/"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching Corporate Bond Index data:", error.message); | ||
throw new Error(`Failed to fetch Corporate Bond Index data: ${error.message}`); | ||
} | ||
} | ||
} |
import { fetchData } from "../../../utils/template.js"; | ||
export async function getGovernmentBondIndex() { | ||
const url = "https://www.idx.co.id/primary/BondSukuk/GetGovernmentBondIndex?length=10&start=1"; | ||
/** | ||
* Retrieves the Government Bond Index data from IDX. | ||
* @param {number} [length=10] - The number of records to retrieve. | ||
* @param {number} [start=1] - The starting index for the records. | ||
* @returns {Promise<string>} - A JSON string of the Government Bond Index data. | ||
*/ | ||
export async function getGovernmentBondIndex(length = 10, start = 1) { | ||
const baseUrl = "https://www.idx.co.id/primary/BondSukuk/GetGovernmentBondIndex"; | ||
const queryParams = new URLSearchParams({ length, start }).toString(); | ||
const url = `${baseUrl}?${queryParams}`; | ||
const referrer = "https://www.idx.co.id/en/market-data/bonds-sukuk/indobex/"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching Government Bond Index data:", error.message); | ||
throw new Error(`Failed to fetch Government Bond Index data: ${error.message}`); | ||
} | ||
} | ||
} |
import { fetchData } from "../../../utils/template.js"; | ||
/** | ||
* Retrieves the OTC cancelled trading data. | ||
* @returns {Promise<string>} - A JSON string of the OTC cancelled trading data. | ||
*/ | ||
export async function getOtcCancelled() { | ||
const url = `https://www.idx.co.id/secondary/get/otc/cancelled?length=9999&start=0`; | ||
const baseUrl = "https://www.idx.co.id/secondary/get/otc/cancelled"; | ||
const queryParams = new URLSearchParams({ | ||
length: 9999, | ||
start: 0 | ||
}).toString(); | ||
const url = `${baseUrl}?${queryParams}`; | ||
const referrer = "https://www.idx.co.id/en/market-data/bonds-sukuk/otc-trading-report/"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching OTC cancelled trading data:", error.message); | ||
throw new Error(`Failed to fetch OTC cancelled trading data: ${error.message}`); | ||
} | ||
} | ||
} |
import { fetchData } from "../../../utils/template.js"; | ||
/** | ||
* Retrieves the OTC corrected trading data. | ||
* @returns {Promise<string>} - A JSON string of the OTC corrected trading data. | ||
*/ | ||
export async function getOtcCorrected() { | ||
const url = `https://www.idx.co.id/secondary/get/otc/corrected`; | ||
const baseUrl = "https://www.idx.co.id/secondary/get/otc/corrected"; | ||
const queryParams = new URLSearchParams({}).toString(); | ||
const url = `${baseUrl}?${queryParams}`; | ||
const referrer = "https://www.idx.co.id/en/market-data/bonds-sukuk/otc-trading-report/"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching OTC corrected trading data:", error.message); | ||
throw new Error(`Failed to fetch OTC corrected trading data: ${error.message}`); | ||
} | ||
} | ||
} |
import { fetchData } from "../../../utils/template.js"; | ||
/** | ||
* Retrieves the OTC trading report for today. | ||
* @returns {Promise<string>} - A JSON string of the OTC trading report data for today. | ||
*/ | ||
export async function getOtcReport() { | ||
const url = `https://www.idx.co.id/secondary/get/otc/lastreport/todayreport?filter=null&length=999999&start=0`; | ||
const baseUrl = "https://www.idx.co.id/secondary/get/otc/lastreport/todayreport"; | ||
const queryParams = new URLSearchParams({ | ||
filter: 'null', | ||
length: 999999, | ||
start: 0 | ||
}).toString(); | ||
const url = `${baseUrl}?${queryParams}`; | ||
const referrer = "https://www.idx.co.id/en/market-data/bonds-sukuk/otc-trading-report/"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching OTC trading report:", error.message); | ||
throw new Error(`Failed to fetch OTC trading report: ${error.message}`); | ||
} | ||
} | ||
} |
import { fetchData } from "../../../utils/template.js"; | ||
/** | ||
* Retrieves the OTC trading data for today. | ||
* @returns {Promise<string>} - A JSON string of the OTC trading data for today. | ||
*/ | ||
export async function getOtcTrade() { | ||
const url = `https://www.idx.co.id/secondary/get/otc/lastreport/todaytrade?filter=null&length=999999&start=0`; | ||
const baseUrl = "https://www.idx.co.id/secondary/get/otc/lastreport/todaytrade"; | ||
const queryParams = new URLSearchParams({ | ||
filter: 'null', | ||
length: 999999, | ||
start: 0 | ||
}).toString(); | ||
const url = `${baseUrl}?${queryParams}`; | ||
const referrer = "https://www.idx.co.id/en/market-data/bonds-sukuk/otc-trading-report/"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching OTC trading data:", error.message); | ||
throw new Error(`Failed to fetch OTC trading data: ${error.message}`); | ||
} | ||
} | ||
} |
import { fetchData } from "../../../utils/template.js"; | ||
/** | ||
* Retrieves the list of instruments from IDX. | ||
* @returns {Promise<string>} - A JSON string of the instrument list data. | ||
*/ | ||
export async function getInstrumentList() { | ||
const url = `https://www.idx.co.id/primary/BondSukuk/GetInstrumentList`; | ||
const baseUrl = "https://www.idx.co.id/primary/BondSukuk/GetInstrumentList"; | ||
const queryParams = new URLSearchParams({}).toString(); | ||
const url = `${baseUrl}?${queryParams}`; | ||
const referrer = "https://www.idx.co.id/en/market-data/bonds-sukuk/pds-quotation/"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching instrument list:", error.message); | ||
throw new Error(`Failed to fetch instrument list: ${error.message}`); | ||
} | ||
} | ||
} |
import { fetchData } from "../../../utils/template.js"; | ||
/** | ||
* Retrieves the current market time from IDX. | ||
* @returns {Promise<string>} - A JSON string of the market time data. | ||
*/ | ||
export async function getMarketTime() { | ||
const url = `https://www.idx.co.id/primary/Helper/GetMarketTime`; | ||
const baseUrl = "https://www.idx.co.id/primary/Helper/GetMarketTime"; | ||
const queryParams = new URLSearchParams({}).toString(); | ||
const url = `${baseUrl}?${queryParams}`; | ||
const referrer = "https://www.idx.co.id/en/market-data/bonds-sukuk/pds-quotation/"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching market time:", error.message); | ||
throw new Error(`Failed to fetch market time: ${error.message}`); | ||
} | ||
} |
import { fetchData } from "../../../utils/template.js"; | ||
export async function getPdQuotation(instrument='FR0097') { | ||
const url = `https://www.idx.co.id/primary/BondSukuk/GetPdQuotation?Instrument=${instrument}`; | ||
/** | ||
* Retrieves the PD quotation for a specified instrument from IDX. | ||
* @param {string} [instrument='FR0097'] - The instrument code to retrieve the PD quotation for. | ||
* @returns {Promise<string>} - A JSON string of the PD quotation data. | ||
*/ | ||
export async function getPdQuotation(instrument = 'FR0097') { | ||
const baseUrl = "https://www.idx.co.id/primary/BondSukuk/GetPdQuotation"; | ||
const queryParams = new URLSearchParams({ | ||
Instrument: instrument | ||
}).toString(); | ||
const url = `${baseUrl}?${queryParams}`; | ||
const referrer = "https://www.idx.co.id/en/market-data/bonds-sukuk/pds-quotation/"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching PD quotation:", error.message); | ||
throw new Error(`Failed to fetch PD quotation: ${error.message}`); | ||
} | ||
} |
import { fetchData } from "../../../utils/template.js"; | ||
export async function getPdQuotationReference(instrument='FR0097') { | ||
const url = `https://www.idx.co.id/primary/BondSukuk/GetPdQuotationReference?Instrument=${instrument}`; | ||
/** | ||
* Retrieves the PD quotation reference for a specified instrument from IDX. | ||
* @param {string} [instrument='FR0097'] - The instrument code to retrieve the PD quotation reference for. | ||
* @returns {Promise<string>} - A JSON string of the PD quotation reference data. | ||
*/ | ||
export async function getPdQuotationReference(instrument = 'FR0097') { | ||
const baseUrl = "https://www.idx.co.id/primary/BondSukuk/GetPdQuotationReference"; | ||
const queryParams = new URLSearchParams({ | ||
Instrument: instrument | ||
}).toString(); | ||
const url = `${baseUrl}?${queryParams}`; | ||
const referrer = "https://www.idx.co.id/en/market-data/bonds-sukuk/pds-quotation/"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching PD quotation reference:", error.message); | ||
throw new Error(`Failed to fetch PD quotation reference: ${error.message}`); | ||
} | ||
} | ||
import { fetchData } from "../../utils/template.js"; | ||
/** | ||
* Retrieves the list of contract codes from IDX. | ||
* @returns {Promise<string>} - A JSON string of the contract code list. | ||
*/ | ||
export async function getContractCodeList() { | ||
@@ -8,8 +12,8 @@ const url = "https://www.idx.co.id/primary/DerivativesData/GetContractCodeList"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching contract code list:", error.message); | ||
throw new Error(`Failed to fetch contract code list: ${error.message}`); | ||
} | ||
} |
import { fetchData } from "../../utils/template.js"; | ||
export async function getFuturesChart() { | ||
const url = "https://www.idx.co.id/primary/DerivativesData/GetFuturesChart?period=1Y&contractCode=BM10Z2"; | ||
/** | ||
* Retrieves futures chart data from IDX. | ||
* @param {string} [period='1Y'] - The period for the chart data (e.g., '1Y' for one year). | ||
* @param {string} [contractCode='BM10Z2'] - The contract code for the futures chart. | ||
* @returns {Promise<string>} - A JSON string of the futures chart data. | ||
*/ | ||
export async function getFuturesChart({ | ||
period = '1Y', | ||
contractCode = 'BM10Z2' | ||
} = {}) { | ||
const baseUrl = "https://www.idx.co.id/primary/DerivativesData/GetFuturesChart"; | ||
const queryParams = new URLSearchParams({ period, contractCode }).toString(); | ||
const url = `${baseUrl}?${queryParams}`; | ||
const referrer = "https://www.idx.co.id/en/market-data/derivatives-data/futures/"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching futures chart data:", error.message); | ||
throw new Error(`Failed to fetch futures chart data: ${error.message}`); | ||
} | ||
} | ||
} |
import { fetchData } from "../../utils/template.js"; | ||
/** | ||
* Retrieves today's futures data from IDX. | ||
* @returns {Promise<string>} - A JSON string of today's futures data. | ||
*/ | ||
export async function getFutureToday() { | ||
@@ -8,8 +12,8 @@ const url = "https://www.idx.co.id/primary/DerivativesData/GetFutureToday"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching today's futures data:", error.message); | ||
throw new Error(`Failed to fetch today's futures data: ${error.message}`); | ||
} | ||
} |
import { fetchData } from "../../utils/template.js"; | ||
export async function getMarketHistory() { | ||
const url = "https://www.idx.co.id/primary/DerivativesData/GetMarketHistory?start=0&length=9999&date="; | ||
/** | ||
* Retrieves market history data from IDX. | ||
* @param {string} [date=''] - The date for which to retrieve market history data (format: YYYY-MM-DD). | ||
* @param {number} [start=0] - The starting index for pagination. | ||
* @param {number} [length=9999] - The number of records to retrieve. | ||
* @returns {Promise<string>} - A JSON string of the market history data. | ||
*/ | ||
export async function getMarketHistory({ | ||
date = '', | ||
start = 0, | ||
length = 9999 | ||
} = {}) { | ||
const baseUrl = "https://www.idx.co.id/primary/DerivativesData/GetMarketHistory"; | ||
const queryParams = new URLSearchParams({ start, length, date }).toString(); | ||
const url = `${baseUrl}?${queryParams}`; | ||
const referrer = "https://www.idx.co.id/en/market-data/derivatives-data/futures/"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching market history data:", error.message); | ||
throw new Error(`Failed to fetch market history data: ${error.message}`); | ||
} | ||
} |
import { fetchData } from "../../utils/template.js"; | ||
/** | ||
* Retrieves market summary data from IDX. | ||
* @returns {Promise<string>} - A JSON string of the market summary data. | ||
*/ | ||
export async function getMarketSummary() { | ||
@@ -8,8 +12,8 @@ const url = "https://www.idx.co.id/primary/DerivativesData/GetMarketSummary"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching market summary data:", error.message); | ||
throw new Error(`Failed to fetch market summary data: ${error.message}`); | ||
} | ||
} |
import { fetchData } from "../../utils/template.js"; | ||
/** | ||
* Retrieves data on the most active brokers from IDX. | ||
* @returns {Promise<string>} - A JSON string of the most active brokers data. | ||
*/ | ||
export async function getMostActiveBroker() { | ||
@@ -8,8 +12,8 @@ const url = "https://www.idx.co.id/primary/DerivativesData/GetMostActiveBroker"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching most active brokers data:", error.message); | ||
throw new Error(`Failed to fetch most active brokers data: ${error.message}`); | ||
} | ||
} | ||
} |
import { fetchData } from "../../utils/template.js"; | ||
/** | ||
* Retrieves data on the most active contracts from IDX. | ||
* @returns {Promise<string>} - A JSON string of the most active contracts data. | ||
*/ | ||
export async function getMostActiveContract() { | ||
@@ -8,8 +12,8 @@ const url = "https://www.idx.co.id/primary/DerivativesData/GetMostActiveContract"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching most active contracts data:", error.message); | ||
throw new Error(`Failed to fetch most active contracts data: ${error.message}`); | ||
} | ||
} | ||
} |
import { fetchData } from "../../utils/template.js"; | ||
export async function getEtfMarket() { | ||
const url = "https://www.idx.co.id/primary/EDD/GetEtfMarket?length=9999"; | ||
/** | ||
* Retrieves ETF market data from IDX. | ||
* @param {number} [length=9999] - The number of records to retrieve. | ||
* @returns {Promise<string>} - A JSON string of the ETF market data. | ||
*/ | ||
export async function getEtfMarket({ | ||
length = 9999 | ||
} = {}) { | ||
const baseUrl = "https://www.idx.co.id/primary/EDD/GetEtfMarket"; | ||
const queryParams = new URLSearchParams({ length }).toString(); | ||
const url = `${baseUrl}?${queryParams}`; | ||
const referrer = "https://www.idx.co.id/en/market-data/exchanged-traded-fund-etf-data/"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching ETF market data:", error.message); | ||
throw new Error(`Failed to fetch ETF market data: ${error.message}`); | ||
} | ||
} | ||
} |
import { fetchData } from "../../utils/template.js"; | ||
export async function getDinfraMarket() { | ||
const url = "https://www.idx.co.id/primary/EDD/GetDinfraMarket?start=0&length=9999"; | ||
/** | ||
* Retrieves the DINFRA market data from IDX. | ||
* @param {number} [start=0] - The starting index for pagination. | ||
* @param {number} [length=9999] - The number of records to retrieve. | ||
* @returns {Promise<string>} - A JSON string of the DINFRA market data. | ||
*/ | ||
export async function getDinfraMarket({ | ||
start = 0, | ||
length = 9999 | ||
} = {}) { | ||
const baseUrl = "https://www.idx.co.id/primary/EDD/GetDinfraMarket"; | ||
const queryParams = new URLSearchParams({ start, length }).toString(); | ||
const url = `${baseUrl}?${queryParams}`; | ||
const referrer = "https://www.idx.co.id/en/market-data/reits-dinfra/"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching DINFRA market data:", error.message); | ||
throw new Error(`Failed to fetch DINFRA market data: ${error.message}`); | ||
} | ||
} | ||
} |
import { fetchData } from "../../utils/template.js"; | ||
export async function getDireMarket() { | ||
const url = "https://www.idx.co.id/primary/EDD/GetDireMarket?start=0&length=9999"; | ||
/** | ||
* Retrieves the DIRE market data from IDX. | ||
* @param {number} [start=0] - The starting index for pagination. | ||
* @param {number} [length=9999] - The number of records to retrieve. | ||
* @returns {Promise<string>} - A JSON string of the DIRE market data. | ||
*/ | ||
export async function getDireMarket({ | ||
start = 0, | ||
length = 9999 | ||
} = {}) { | ||
const baseUrl = "https://www.idx.co.id/primary/EDD/GetDireMarket"; | ||
const queryParams = new URLSearchParams({ start, length }).toString(); | ||
const url = `${baseUrl}?${queryParams}`; | ||
const referrer = "https://www.idx.co.id/en/market-data/reits-dinfra/"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching DIRE market data:", error.message); | ||
throw new Error(`Failed to fetch DIRE market data: ${error.message}`); | ||
} | ||
} | ||
} |
import { fetchData } from "../../../utils/template.js"; | ||
/** | ||
* Retrieves the index group prevalues from IDX. | ||
* @returns {Promise<string>} - A JSON string of the index group prevalues data. | ||
*/ | ||
export async function getIndexGroupPrevalues() { | ||
const url = "https://www.idx.co.id/primary/StockData/GetIndexGroupPrevalues"; | ||
const baseUrl = "https://www.idx.co.id/primary/StockData/GetIndexGroupPrevalues"; | ||
const queryParams = new URLSearchParams({}).toString(); | ||
const url = `${baseUrl}?${queryParams}`; | ||
const referrer = "https://www.idx.co.id/en/market-data/stocks-data/stock-index/"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching index group prevalues:", error.message); | ||
throw new Error(`Failed to fetch index group prevalues: ${error.message}`); | ||
} | ||
} | ||
} |
import { fetchData } from "../../../utils/template.js"; | ||
export async function getStockUploader(typeIndex='', year='', tableIndex='stockIndex' | ||
// stockIndex, preOpeningStocks, marginStocks | ||
) { | ||
const url = `https://www.idx.co.id/secondary/get/StockData/GetStockUploader?typeIndex=${typeIndex}&year=${year}&table=${tableIndex}&locale=en`; | ||
/** | ||
* Retrieves stock uploader data from IDX based on the specified parameters. | ||
* @param {string} [typeIndex=''] - The type of index to retrieve data for (e.g., 'stockIndex', 'preOpeningStocks', 'marginStocks'). | ||
* @param {string} [year=''] - The year for which to retrieve data. | ||
* @param {string} [tableIndex='stockIndex'] - The table index to specify which data to retrieve (default is 'stockIndex'). | ||
* @returns {Promise<string>} - A JSON string of the stock uploader data. | ||
*/ | ||
export async function getStockUploader(typeIndex = '', year = '', tableIndex = 'stockIndex') { | ||
const baseUrl = "https://www.idx.co.id/secondary/get/StockData/GetStockUploader"; | ||
const queryParams = new URLSearchParams({ | ||
typeIndex, | ||
year, | ||
table: tableIndex, | ||
locale: 'en' | ||
}).toString(); | ||
const url = `${baseUrl}?${queryParams}`; | ||
const referrer = "https://www.idx.co.id/en/market-data/stocks-data/stock-index/"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching stock uploader data:", error.message); | ||
throw new Error(`Failed to fetch stock uploader data: ${error.message}`); | ||
} | ||
} |
import { fetchData } from "../../../utils/template.js"; | ||
/** | ||
* Retrieves the list of boards from IDX. | ||
* @returns {Promise<string>} - A JSON string of the boards data. | ||
*/ | ||
export async function getBoards() { | ||
const url = "https://www.idx.co.id/primary/Helper/GetBoards?language=en-us"; | ||
const baseUrl = "https://www.idx.co.id/primary/Helper/GetBoards"; | ||
const queryParams = new URLSearchParams({ | ||
language: 'en-us' | ||
}).toString(); | ||
const url = `${baseUrl}?${queryParams}`; | ||
const referrer = "https://www.idx.co.id/en/market-data/stocks-data/stock-list/"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching boards:", error.message); | ||
throw new Error(`Failed to fetch boards: ${error.message}`); | ||
} | ||
} |
import { fetchData } from "../../../utils/template.js"; | ||
/** | ||
* Retrieves the list of sectors from IDX. | ||
* @returns {Promise<string>} - A JSON string of the sectors data. | ||
*/ | ||
export async function getSectors() { | ||
const url = "https://www.idx.co.id/primary/Helper/GetSectors?language=en-us"; | ||
const baseUrl = "https://www.idx.co.id/primary/Helper/GetSectors"; | ||
const queryParams = new URLSearchParams({ | ||
language: 'en-us' | ||
}).toString(); | ||
const url = `${baseUrl}?${queryParams}`; | ||
const referrer = "https://www.idx.co.id/en/market-data/stocks-data/stock-list/"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching sectors:", error.message); | ||
throw new Error(`Failed to fetch sectors: ${error.message}`); | ||
} | ||
} |
import { fetchData } from "../../../utils/template.js"; | ||
export async function getSecuritiesStock(code='', sector='', board='') { | ||
const url = `https://www.idx.co.id/primary/StockData/GetSecuritiesStock?start=0&length=9999&code=${encodeURIComponent(code)}§or=${encodeURIComponent(sector)}&board=${encodeURIComponent(board)}&language=en-us`; | ||
/** | ||
* Retrieves securities stock data from IDX based on specified parameters. | ||
* @param {string} [code=''] - The stock code to filter by. | ||
* @param {string} [sector=''] - The sector to filter by. | ||
* @param {string} [board=''] - The board to filter by. | ||
* @returns {Promise<string>} - A JSON string of the securities stock data. | ||
*/ | ||
export async function getSecuritiesStock(code = '', sector = '', board = '') { | ||
const baseUrl = "https://www.idx.co.id/primary/StockData/GetSecuritiesStock"; | ||
const queryParams = new URLSearchParams({ | ||
start: 0, | ||
length: 9999, | ||
code, | ||
sector, | ||
board, | ||
language: 'en-us' | ||
}).toString(); | ||
const url = `${baseUrl}?${queryParams}`; | ||
const referrer = "https://www.idx.co.id/en/market-data/stocks-data/stock-list/"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching securities stock data:", error.message); | ||
throw new Error(`Failed to fetch securities stock data: ${error.message}`); | ||
} | ||
} |
import { fetchData } from "../../../utils/template.js"; | ||
export async function getIssuerList() { | ||
const url = "https://www.idx.co.id/primary/StructuredWarrant/GetIssuerList?length=9999&start=0"; | ||
/** | ||
* Retrieves the list of issuers from IDX. | ||
* @param {number} [length=9999] - The number of issuers to retrieve. | ||
* @param {number} [start=0] - The starting index for pagination. | ||
* @returns {Promise<string>} - A JSON string of the issuer list. | ||
*/ | ||
export async function getIssuerList(length = 9999, start = 0) { | ||
const baseUrl = "https://www.idx.co.id/primary/StructuredWarrant/GetIssuerList"; | ||
const queryParams = new URLSearchParams({ length, start }).toString(); | ||
const url = `${baseUrl}?${queryParams}`; | ||
const referrer = "https://www.idx.co.id/en/market-data/structured-warrant-sw/issuer-company-list/"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching issuer list:", error.message); | ||
throw new Error(`Failed to fetch issuer list: ${error.message}`); | ||
} | ||
} |
import { fetchData } from "../../../utils/template.js"; | ||
export async function getEmiten() { | ||
const url = "https://www.idx.co.id/primary/Helper/GetEmiten?emitenType=s"; | ||
/** | ||
* Retrieves the list of emitters from IDX. | ||
* @param {string} emitenType - The type of emitters to retrieve (e.g., 's' for structured warrants). | ||
* @returns {Promise<string>} - A JSON string of the emitters list. | ||
*/ | ||
export async function getEmiten(emitenType = '') { | ||
const url = `https://www.idx.co.id/primary/Helper/GetEmiten?emitenType=${encodeURIComponent(emitenType)}`; | ||
const referrer = "https://www.idx.co.id/en/market-data/structured-warrant-sw/structured-warrant-information/"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching emitters:", error.message); | ||
throw new Error(`Failed to fetch emitters: ${error.message}`); | ||
} | ||
} | ||
} |
import { fetchData } from "../../../utils/template.js"; | ||
/** | ||
* Retrieves the structured warrant issuers dropdown list from IDX. | ||
* @returns {Promise<string>} - A JSON string of the issuer dropdown list. | ||
*/ | ||
export async function getIssuerDDL() { | ||
@@ -8,8 +12,8 @@ const url = "https://www.idx.co.id/primary/StructuredWarrant/GetIssuerDDL"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching issuer dropdown list:", error.message); | ||
throw new Error(`Failed to fetch issuer dropdown list: ${error.message}`); | ||
} | ||
} |
import { fetchData } from "../../../utils/template.js"; | ||
export async function getSwInformation() { | ||
const url = "https://www.idx.co.id/secondary/get/StructuredWarrant/Information?length=9999&issuer=&swType=&start=0"; | ||
/** | ||
* Retrieves structured warrant information from IDX. | ||
* @param {string} underlying - The underlying asset. | ||
* @param {string} issuer - The issuer of the structured warrant. | ||
* @param {string} swType - The type of structured warrant (e.g., 'call', 'put'). | ||
* @returns {Promise<string>} - A JSON string of the structured warrant information. | ||
*/ | ||
export async function getSwInformation(underlying='', issuer='', swType='') { | ||
const baseUrl = "https://www.idx.co.id/secondary/get/StructuredWarrant/Information"; | ||
const params = new URLSearchParams({ | ||
length: '9999', | ||
underlying, | ||
issuer, | ||
swType, | ||
start: '0' | ||
}).toString(); | ||
const url = `${baseUrl}?${params}`; | ||
const referrer = "https://www.idx.co.id/en/market-data/structured-warrant-sw/structured-warrant-information/"; | ||
@@ -11,5 +27,5 @@ | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching structured warrant information:", error); | ||
throw new Error(`Failed to fetch structured warrant information: ${error.message}`); | ||
} | ||
} | ||
} |
import { fetchData } from "../../../utils/template.js"; | ||
/** | ||
* Retrieves the structured warrant types from IDX. | ||
* @returns {Promise<string>} - A JSON string of the structured warrant types. | ||
*/ | ||
export async function getSwTypes() { | ||
@@ -8,8 +12,8 @@ const url = "https://www.idx.co.id/primary/StructuredWarrant/GetSwTypes"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching structured warrant types:", error.message); | ||
throw new Error(`Failed to fetch structured warrant types: ${error.message}`); | ||
} | ||
} | ||
} |
import { fetchData } from "../../../utils/template.js"; | ||
export async function getSwTrading() { | ||
const url = "https://www.idx.co.id/secondary/get/StructuredWarrant/Trading?length=9999&issuer=&SW=&start=0&datefrom=1901-01-01&dateto=2024-08-27"; | ||
/** | ||
* Retrieves structured warrant trading data from IDX. | ||
* @param {number} [length=9999] - The number of records to retrieve. | ||
* @param {string} [issuer=''] - The issuer filter for the structured warrants. | ||
* @param {string} [swType=''] - The structured warrant type filter. | ||
* @param {number} [start=0] - The starting index for pagination. | ||
* @param {string} [dateFrom='1901-01-01'] - The start date for the trading data. | ||
* @param {string} [dateTo='2024-08-27'] - The end date for the trading data. | ||
* @returns {Promise<string>} - A JSON string of the structured warrant trading data. | ||
*/ | ||
export async function getSwTrading({ | ||
length = 9999, | ||
issuer = '', | ||
swType = '', | ||
start = 0, | ||
dateFrom = '', | ||
dateTo = ''} = {}) { | ||
const baseUrl = "https://www.idx.co.id/secondary/get/StructuredWarrant/Trading"; | ||
const queryParams = new URLSearchParams({ | ||
length, | ||
issuer, | ||
SW: swType, | ||
start, | ||
datefrom: dateFrom, | ||
dateto: dateTo | ||
}).toString(); | ||
const url = `${baseUrl}?${queryParams}`; | ||
const referrer = "https://www.idx.co.id/en/market-data/structured-warrant-sw/structured-warrant-summary/"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response["Results"], null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching structured warrant trading data:", error.message); | ||
throw new Error(`Failed to fetch structured warrant trading data: ${error.message}`); | ||
} | ||
} | ||
} |
import { fetchData } from "../../../utils/template.js"; | ||
/** | ||
* Retrieves the constituent data for IDX. | ||
* @returns {Promise<string>} - A JSON string of the constituent data. | ||
*/ | ||
export async function getConstituent() { | ||
const url = "https://www.idx.co.id/primary/StockData/GetConstituent"; | ||
const referrer = | ||
"https://www.idx.co.id/en/market-data/trading-summary/index-summary/"; | ||
const baseUrl = "https://www.idx.co.id/primary/StockData/GetConstituent"; | ||
const queryParams = new URLSearchParams({}).toString(); | ||
const url = `${baseUrl}?${queryParams}`; | ||
const referrer = "https://www.idx.co.id/en/market-data/trading-summary/index-summary/"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching constituent data:", error.message); | ||
throw new Error(`Failed to fetch constituent data: ${error.message}`); | ||
} | ||
} | ||
} |
@@ -1,15 +0,20 @@ | ||
import { fetchData } from "../../../utils/template.js"; | ||
import { fetchData } from "../../../utils/template.js"; | ||
export async function getIndexIC() { | ||
const url = "https://www.idx.co.id/primary/StockData/GetIndexIC"; | ||
const referrer = | ||
"https://www.idx.co.id/en/market-data/trading-summary/index-summary/"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
} | ||
} | ||
/** | ||
* Retrieves the Index IC data from IDX. | ||
* @returns {Promise<string>} - A JSON string of the Index IC data. | ||
*/ | ||
export async function getIndexIC() { | ||
const baseUrl = "https://www.idx.co.id/primary/StockData/GetIndexIC"; | ||
const queryParams = new URLSearchParams({}).toString(); | ||
const url = `${baseUrl}?${queryParams}`; | ||
const referrer = "https://www.idx.co.id/en/market-data/trading-summary/index-summary/"; | ||
try { | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching Index IC data:", error.message); | ||
throw new Error(`Failed to fetch Index IC data: ${error.message}`); | ||
} | ||
} |
import { fetchData } from "../../../utils/template.js"; | ||
/** | ||
* Retrieves the index summary for a specified date from IDX. | ||
* @param {string} date - The date for which to retrieve the index summary (format: YYYYMMDD). | ||
* @returns {Promise<string>} - A JSON string of the index summary data. | ||
*/ | ||
export async function getIndexSummary(date) { | ||
const url = `https://www.idx.co.id/primary/TradingSummary/GetIndexSummary?date=${date}&length=9999&start=0`; | ||
const referrer = | ||
"https://www.idx.co.id/en/market-data/trading-summary/index-summary/"; | ||
const baseUrl = "https://www.idx.co.id/primary/TradingSummary/GetIndexSummary"; | ||
const queryParams = new URLSearchParams({ | ||
date, | ||
length: 9999, | ||
start: 0 | ||
}).toString(); | ||
const url = `${baseUrl}?${queryParams}`; | ||
const referrer = "https://www.idx.co.id/en/market-data/trading-summary/index-summary/"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching index summary:", error.message); | ||
throw new Error(`Failed to fetch index summary: ${error.message}`); | ||
} | ||
} | ||
} |
@@ -1,15 +0,25 @@ | ||
import { fetchData } from "../../../utils/template.js"; | ||
export async function getPedSummary(date='') { | ||
const url = `https://www.idx.co.id/primary/TradingSummary/GetPedSummary?length=9999&start=0&date=${date}`; | ||
/** | ||
* Retrieves the PED summary for a specified date from IDX. | ||
* @param {string} [date=''] - The date for which to retrieve the PED summary (format: YYYYMMDD). Defaults to an empty string. | ||
* @returns {Promise<string>} - A JSON string of the PED summary data. | ||
*/ | ||
export async function getPedSummary(date = '') { | ||
const baseUrl = "https://www.idx.co.id/primary/TradingSummary/GetPedSummary"; | ||
const queryParams = new URLSearchParams({ | ||
length: 9999, | ||
start: 0, | ||
date | ||
}).toString(); | ||
const url = `${baseUrl}?${queryParams}`; | ||
const referrer = "https://www.idx.co.id/en/market-data/trading-summary/ped-summary/"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching PED summary:", error.message); | ||
throw new Error(`Failed to fetch PED summary: ${error.message}`); | ||
} | ||
} | ||
} |
@@ -1,16 +0,25 @@ | ||
import { fetchData } from "../../../utils/template.js"; | ||
export async function getMarginSummary(date='') { | ||
const url = `https://www.idx.co.id/primary/TradingSummary/GetMarginSummary?length=9999&start=0&date=${date}`; | ||
const referrer = | ||
"https://www.idx.co.id/en/market-data/trading-summary/stock-summary/"; | ||
/** | ||
* Retrieves the margin summary for a specified date from IDX. | ||
* @param {string} [date=''] - The date for which to retrieve the margin summary (format: YYYYMMDD). Defaults to an empty string. | ||
* @returns {Promise<string>} - A JSON string of the margin summary data. | ||
*/ | ||
export async function getMarginSummary(date = '') { | ||
const baseUrl = "https://www.idx.co.id/primary/TradingSummary/GetMarginSummary"; | ||
const queryParams = new URLSearchParams({ | ||
length: 9999, | ||
start: 0, | ||
date | ||
}).toString(); | ||
const url = `${baseUrl}?${queryParams}`; | ||
const referrer = "https://www.idx.co.id/en/market-data/trading-summary/stock-summary/"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching margin summary:", error.message); | ||
throw new Error(`Failed to fetch margin summary: ${error.message}`); | ||
} | ||
} |
@@ -1,16 +0,25 @@ | ||
import { fetchData } from "../../../utils/template.js"; | ||
export async function getShortSellSummary(date='') { | ||
const url = `https://www.idx.co.id/primary/TradingSummary/GetShortSellSummary?length=9999&start=0&date=${date}`; | ||
const referrer = | ||
"https://www.idx.co.id/en/market-data/trading-summary/stock-summary/"; | ||
/** | ||
* Retrieves the short sell summary for a specified date from IDX. | ||
* @param {string} [date=''] - The date for which to retrieve the short sell summary (format: YYYYMMDD). Defaults to an empty string. | ||
* @returns {Promise<string>} - A JSON string of the short sell summary data. | ||
*/ | ||
export async function getShortSellSummary(date = '') { | ||
const baseUrl = "https://www.idx.co.id/primary/TradingSummary/GetShortSellSummary"; | ||
const queryParams = new URLSearchParams({ | ||
length: 9999, | ||
start: 0, | ||
date | ||
}).toString(); | ||
const url = `${baseUrl}?${queryParams}`; | ||
const referrer = "https://www.idx.co.id/en/market-data/trading-summary/stock-summary/"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching short sell summary:", error.message); | ||
throw new Error(`Failed to fetch short sell summary: ${error.message}`); | ||
} | ||
} | ||
} |
@@ -1,16 +0,25 @@ | ||
import { fetchData } from "../../../utils/template.js"; | ||
export async function getStockSummary(date='') { | ||
const url = `https://www.idx.co.id/primary/TradingSummary/GetStockSummary?length=9999&start=0&date=${date}`; | ||
const referrer = | ||
"https://www.idx.co.id/en/market-data/trading-summary/stock-summary/"; | ||
/** | ||
* Retrieves the stock summary for a specified date from IDX. | ||
* @param {string} [date=''] - The date for which to retrieve the stock summary (format: YYYYMMDD). Defaults to an empty string. | ||
* @returns {Promise<string>} - A JSON string of the stock summary data. | ||
*/ | ||
export async function getStockSummary(date = '') { | ||
const baseUrl = "https://www.idx.co.id/primary/TradingSummary/GetStockSummary"; | ||
const queryParams = new URLSearchParams({ | ||
length: 9999, | ||
start: 0, | ||
date | ||
}).toString(); | ||
const url = `${baseUrl}?${queryParams}`; | ||
const referrer = "https://www.idx.co.id/en/market-data/trading-summary/stock-summary/"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching stock summary:", error.message); | ||
throw new Error(`Failed to fetch stock summary: ${error.message}`); | ||
} | ||
} | ||
} |
import { fetchData } from "../../../utils/template.js"; | ||
/** | ||
* Retrieves the recap summary from IDX. | ||
* @returns {Promise<string>} - A JSON string of the recap summary data. | ||
*/ | ||
export async function getRecapSummary() { | ||
const url = "https://www.idx.co.id/primary/TradingSummary/GetRecapSummary"; | ||
const referrer = | ||
"https://www.idx.co.id/en/market-data/trading-summary/trading-summary-and-recapitulation/"; | ||
const baseUrl = "https://www.idx.co.id/primary/TradingSummary/GetRecapSummary"; | ||
const queryParams = new URLSearchParams({}).toString(); | ||
const url = `${baseUrl}?${queryParams}`; | ||
const referrer = "https://www.idx.co.id/en/market-data/trading-summary/trading-summary-and-recapitulation/"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching recap summary:", error.message); | ||
throw new Error(`Failed to fetch recap summary: ${error.message}`); | ||
} | ||
} | ||
} |
import { fetchData } from "../../../utils/template.js"; | ||
/** | ||
* Retrieves the trade summary from IDX. | ||
* @returns {Promise<string>} - A JSON string of the trade summary data. | ||
*/ | ||
export async function getTradeSummary() { | ||
const url = "https://www.idx.co.id/primary/Home/GetTradeSummary?lang=en"; | ||
const referrer = | ||
"https://www.idx.co.id/en/market-data/trading-summary/trading-summary-and-recapitulation/"; | ||
const baseUrl = "https://www.idx.co.id/primary/Home/GetTradeSummary"; | ||
const queryParams = new URLSearchParams({ | ||
lang: 'en' | ||
}).toString(); | ||
const url = `${baseUrl}?${queryParams}`; | ||
const referrer = "https://www.idx.co.id/en/market-data/trading-summary/trading-summary-and-recapitulation/"; | ||
try { | ||
const res = await fetchData(url, referrer); | ||
return JSON.stringify(res, null, 2); | ||
const response = await fetchData(url, referrer); | ||
return JSON.stringify(response, null, 2); | ||
} catch (error) { | ||
console.error("Error fetching boards:", error); | ||
throw error; | ||
console.error("Error fetching trade summary:", error.message); | ||
throw new Error(`Failed to fetch trade summary: ${error.message}`); | ||
} | ||
} |
{ | ||
"name": "idx-bei", | ||
"version": "1.0.0-prealpha.1", | ||
"version": "1.0.0-prealpha.2", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
75709
1609
74
3