단일 API 호출로 폴란드 기업 재무 데이터 추출하는 방법
Source: Dev.to
Introduction
폴란드 기업에 대한 재무 데이터가 필요했던 적 있나요? 핀테크 앱을 만들든, 경쟁사 분석을 하든, 실사를 자동화하든, 폴란드 국가 법원 등록부(KRS)에서 데이터를 접근하는 것은… 고통스러울 수 있습니다.
이 튜토리얼에서는 30 초 이내에 모든 폴란드 기업의 재무제표, 손익계산서 및 주요 재무 지표를 얻는 방법을 보여드리겠습니다.
문제
폴란드에서는 모든 기업이 연간 재무제표를 eKRS 포털에 제출하도록 요구합니다. 이 데이터는 공개되어 있지만:
- 공식 API가 존재하지 않음
- 여러 페이지를 탐색해야 함
- 파일이 XML 또는 XHTML 형식으로 제공됨
복잡한 폴란드 회계 스키마 (AktywaRazem, KapitalWlasny, ZyskNetto…)
- 회계 기준에 따라 다른 스키마 존재 (UoR vs IFRS)
스크래퍼를 처음부터 구축하는 데 20‑40시간이 걸립니다. 하지만 이것은 첫 번째 단계에 불과합니다 — 그 다음에는 XML을 파싱해야 하는데, 이는 폴란드 회계 용어를 배우고 여러 스키마 버전을 처리해야 함을 의미합니다.
솔루션
우리는 Apify의 Poland KRS Financial Scraper Actor를 사용할 것입니다. 이 Actor는 모든 복잡성을 처리합니다 — XML 파싱 포함 — 그리고 사용 준비가 된 재무 지표가 포함된 구조화된 JSON을 반환합니다.
핵심 이점: totalAssets, equity, revenue, netProfit 등을 JSON으로 바로 얻을 수 있어, 귀하가 XML 파싱을 할 필요가 없습니다.
사전 요구 사항
- 무료 Apify 계정 (sign up here)
- API 토큰 (Apify Console → Settings → Integrations에서 확인)
- 폴란드 회사의 NIP(세금 ID) 또는 KRS 번호
Method 1: Using the Apify Console (No Code)
가장 간단한 테스트 방법:
-
Actor 페이지로 이동합니다.
-
입력을 입력합니다:
{ "krs": "0000023302" } -
Start 버튼을 클릭합니다.
-
~30 초 정도 기다립니다.
-
Dataset 탭에서 결과를 확인합니다.
방법 2: API 사용 (JavaScript/Node.js)
애플리케이션에 통합하려면:
const Apify = require('apify-client');
const client = new Apify.ApifyClient({
token: 'YOUR_API_TOKEN',
});
async function getPolishCompanyFinancials(krsNumber) {
// Start the Actor
const run = await client.actor('minute_contest/poland-krs-financial-scraper').call({
krs: krsNumber,
});
// Get results from dataset
const { items } = await client.dataset(run.defaultDatasetId).listItems();
return items[0];
}
// Example usage
(async) => {
const financials = await getPolishCompanyFinancials('0000023302');
console.log(financials);
})();
샘플 출력
{
"krs": "0000023302",
"year": 2024,
"fileName": "Sprawozdanie_finansowe_2024.xml",
"fileFormat": "xml",
"financials": {
"totalAssets": 54850000000,
"equity": 32100000000,
"fixedAssets": 42100000000,
"currentAssets": 12750000000,
"revenue": 33500000000,
"operatingProfit": 4200000000,
"netProfit": 2850000000
},
"success": true
}
방법 3: cURL 사용
빠른 명령줄 테스트 또는 모든 언어와의 통합을 위해:
curl -X POST "https://api.apify.com/v2/acts/minute_contest~poland-krs-financial-scraper/run-sync-get-dataset-items" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{"krs": "0000023302"}'
방법 4: Python 사용
from apify_client import ApifyClient
client = ApifyClient("YOUR_API_TOKEN")
def get_polish_company_financials(krs_number):
run_input = {"krs": krs_number}
run = client.actor("minute_contest/poland-krs-financial-scraper").call(run_input=run_input)
items = list(client.dataset(run["defaultDatasetId"]).iterate_items())
return items[0] if items else None
# Example
financials = get_polish_company_financials("0000023302")
print(f"Total Assets: {financials['financials']['totalAssets']:,} PLN")
print(f"Net Profit: {financials['financials']['netProfit']:,} PLN")
KRS 대신 NIP 사용하기
KRS 번호가 없나요? 대신 회사의 NIP(세금 ID)를 사용하세요:
const financials = await getPolishCompanyFinancials({ nip: '8992736629' });
Actor가 NIP에서 자동으로 KRS 번호를 조회합니다.
출력 이해
파싱된 재무 지표
| Field | 폴란드어 이름 | 설명 |
|---|---|---|
totalAssets | Aktywa razem | 총 자산 |
fixedAssets | Aktywa trwałe | 고정 / 비유동 자산 |
currentAssets | Aktywa obrotowe | 유동 자산 |
equity | Kapitał własny | 주주 자본 |
revenue | Przychody | 판매 수익 |
operatingProfit | Zysk operacyjny | 영업 이익 |
netProfit | Zysk netto | 순이익 |
원시 데이터 접근
맞춤 파싱이 필요한 경우 전체 XML/XHTML 파일을 rawXml에서 사용할 수 있습니다:
const { rawXml, fileFormat } = financials;
if (fileFormat === 'xml') {
const parser = new DOMParser();
const doc = parser.parseFromString(rawXml, 'text/xml');
// Custom extraction...
}
실제 사용 사례
경쟁사‑분석 대시보드
const competitors = ['0000023302', '0000012345', '0000067890'];
const results = await Promise.all(
competitors.map(krs => getPolishCompanyFinancials(krs))
);
console.table(results.map(r => ({
krs: r.krs,
revenue: r.financials.revenue,
netProfit: r.financials.netProfit,
})));
대량 조회 예시
const results = await Promise.all(
krsList.map(krs => getPolishCompanyFinancials(krs))
);
// Compare metrics
results.forEach(company => {
console.log(`KRS ${company.krs}: Revenue ${company.financials.revenue}`);
});
자동 실사
async function dueDiligenceCheck(nip) {
const financials = await getPolishCompanyFinancials({ nip });
const checks = {
hasPositiveEquity: financials.financials.equity > 0,
isProfitable: financials.financials.netProfit > 0,
currentRatio:
financials.financials.currentAssets /
(financials.financials.totalAssets - financials.financials.equity)
};
return { financials, checks };
}
대량 데이터 수집
const companies = readCSV('polish_companies.csv'); // List of KRS numbers
for (const krs of companies) {
const data = await getPolishCompanyFinancials(krs);
await saveToDatabase(data);
await sleep(1000); // Rate limiting
}
가격
Actor는 pay‑per‑result 가격 모델을 사용합니다:
- ~$0.03 성공적인 추출당
- 구독이 필요 없습니다
- 테스트용 무료 티어 제공
오류 처리
const result = await getPolishCompanyFinancials('0000023302');
if (!result.success) {
console.error(`Error: ${result.error}`);
// 일반적인 오류:
// - "Company not found" – 잘못된 KRS 번호
// - "No financial statements" – 아직 재무제표가 제출되지 않음
// - "Multiple formats" – XHTML을 별도로 처리
}
결론
폴란드 기업의 재무 데이터를 접근하는 것이 복잡할 필요는 없습니다. 단일 API 호출만으로 구조화된 재무 지표를 받아 분석에 바로 활용할 수 있습니다.
링크
질문이 있나요? 댓글에 남겨 주세요!
