보강됨 - 기사 구독
finlight.me WebSocket API를 사용하면 기사 업데이트를 실시간으로 구독할 수 있습니다. 연결하고 구독하면 쿼리와 일치하는 최신 기사를 즉시 받고, 이후 기준에 맞는 새로 게시된 기사가 나타나는 대로 받습니다.
기사 모델
응답의 기사 모델에는 링크, 제목, 게시 날짜, 출처 등 기사에 대한 모든 정보가 포함됩니다. 또한 감성과 그에 대한 신뢰도가 포함됩니다.
- Name
link- Type
- string
- Description
전체 기사로의 URL.
- Name
source- Type
- string
- Description
출처 웹사이트. 예:
www.reuters.com
- Name
title- Type
- string
- Description
기사 제목.
- Name
summary- Type
- string
- Description
기사 요약(있는 경우). null일 수 있습니다.
- Name
publishDate- Type
- Date
- Description
게시 날짜(ISO 날짜).
- Name
createdAt- Type
- Date
- Description
finlight 시스템에서 기사의 내부 생성 날짜(ISO 날짜).
- Name
revisedDate- Type
- Date | null
- Description
최초 게시 이후 기사가 마지막으로 수정된 날짜. 기사가 한 번도 수정되지 않은 경우
null.includeUpdates가 활성화되고 기사가 수정된 경우에 존재합니다.
- Name
isUpdate- Type
- boolean
- Description
이 전송이 기사의 게시 후 업데이트에 의해 트리거된 경우
true.includeUpdates가 활성화된 경우에만 존재합니다.
- Name
language- Type
- string
- Description
ISO 639-1 언어 코드. 예:
en|de|fr
- Name
sentiment- Type
- string
- Description
감성 분석 결과. 값은
positive|neutral|negative일 수 있습니다.
- Name
confidence- Type
- number
- Description
감성 분석의 신뢰도(0~1).
- Name
images- Type
- string[]
- Description
기사의 이미지 URL 배열.
- Name
countries- Type
- string[]
- Description
기사와 관련된 국가를 나타내는 ISO 3166-1 alpha-2 형식의 국가 코드 배열. 예:
["US", "GB", "DE"]. 비어 있을 수 있습니다.
- Name
categories- Type
- string[]
- Description
기사 카테고리 배열. 가능한 값:
markets|economy|business|politics|geopolitics|regulation|technology|energy|commodities|crypto|health|climate|security. 비어 있을 수 있습니다.
- Name
companies- Type
- Company[]
- Description
기사에서 언급된 회사 배열. 특정 구독 등급에서만 표시/사용 가능합니다. null일 수 있습니다.
회사 모델
응답의 회사 모델에는 기사에서 언급된 회사에 대한 정보가 포함됩니다. 회사 이름, 티커 심볼, 산업 등의 세부 정보가 포함됩니다.
- Name
companyId- Type
- number
- Description
회사의 고유 식별자.
- Name
confidence- Type
- string
- Description
회사 식별의 신뢰도(0~1).
- Name
country- Type
- string
- Description
회사가 소재한 국가(ISO 3166-1 alpha-2 형식). 예:
US|DE|GB
- Name
exchange- Type
- string
- Description
회사가 상장된 증권 거래소.
- Name
industry- Type
- Date
- Description
회사의 산업 섹터. 예:
Biotechnology, Technology
- Name
name- Type
- string
- Description
회사 전체 이름. 예:
Apple Inc.
- Name
sector- Type
- string
- Description
회사의 섹터. 예:
Technology|Health Care
- Name
ticker- Type
- string
- Description
회사의 주식 티커 심볼. 예:
AAPL|GOOGL
- Name
isin- Type
- string
- Description
회사의 국제 증권 식별 번호(ISIN). 예:
US0378331005
- Name
openfigi- Type
- string
- Description
회사의 OpenFIGI 식별자. 예:
BBG000B9XRY4
- Name
primaryListing- Type
- object
- Description
회사의 주요 증권 거래소 상장 정보.
- Name
primaryListing.ticker- Type
- string
- Description
주요 거래소의 주요 티커 심볼.
- Name
primaryListing.exchangeCode- Type
- string
- Description
주식이 상장된 주요 거래소의 코드.
- Name
primaryListing.exchangeCountry- Type
- string
- Description
주식이 상장된 주요 거래소의 국가.
- Name
isins- Type
- string[]
- Description
회사의 국제 증권 식별 번호(ISIN) 배열.
- Name
otherListings- Type
- object[]
- Description
회사의 기타 증권 거래소 상장 정보 배열.
- Name
otherListings[].ticker- Type
- string
- Description
대체 거래소의 티커 심볼.
- Name
otherListings[].exchangeCode- Type
- string
- Description
주식이 상장된 대체 거래소의 코드.
- Name
otherListings[].exchangeCountry- Type
- string
- Description
주식이 상장된 대체 거래소의 국가.
기사 가져오기
구독하면 먼저 쿼리와 일치하는 최신 기사를 받고, 이후 게시되는 대로 새 기사를 받습니다.
구독 시 받는 기사를 좁히기 위해 다양한 매개변수를 지정할 수 있습니다:
- Name
query- Type
- string
- Description
관련 기사를 찾기 위한 검색 쿼리. 고급 쿼리
- Name
sources- Type
- string[]
- Description
단일 또는 여러 기사 출처로 필터링합니다. 예: ["www.reuters.com", "www.cnbc.com"]. 유효한 값은 source 엔드포인트를 참조하세요. 와일드카드
"*"를 지원하여 모든 출처를 포함할 수 있습니다.
- Name
excludeSources- Type
- string[]
- Description
단일 또는 여러 출처를 제외합니다. 예: ["www.reuters.com", "www.cnbc.com"]. 유효한 값은 source 엔드포인트를 참조하세요.
- Name
tickers- Type
- string[]
- Description
주식 티커 심볼로 필터링합니다(문자열 배열). 이 티커를 언급하는 기사를 반환합니다. 와일드카드
"*"를 지원하여 모든 티커를 포함할 수 있습니다.
- Name
countries- Type
- string[]
- Description
ISO 3166-1 alpha-2 국가 코드를 사용하여 회사 국가로 필터링합니다(문자열 배열). 예:
["US", "GB", "DE"]
- Name
includeEntities- Type
- boolean
- Description
기사에서 언급된 회사를 포함합니다. 특정 구독 등급이 필요합니다.
- Name
includeUpdates- Type
- boolean
- Description
활성화하면 업데이트된 기사가
isUpdate=true와revisedDate타임스탬프와 함께 다시 전송됩니다. 최초 게시 후 기사 수정이나 내용 추가를 모니터링하는 데 유용합니다.
- Name
extended- Type
- boolean
- Description
(지원 중단) 확장된 기사 정보를 받으려면
true(summary포함).
Request
import { FinlightApi } from 'finlight-client'
const client = new FinlightApi({
apiKey: 'YOUR_API_KEY', // Replace with your API key
})
client.websocket.connect(
{
query: 'Nvidia',
language: 'en',
extended: true,
countries: ['US', 'GB'],
},
(article) => {
console.log('New article received:', article)
},
)
연결 한도 관리: 구독 등급이 병렬 WebSocket 연결 수를 제한하는 경우, takeover 옵션을 사용하여 한도를 초과해 새 연결을 열려고 할 때 가장 오래된 연결을 자동으로 닫을 수 있습니다. 이는 개발 중이나 애플리케이션 재시작 시 연결 오류를 방지합니다.
// TypeScript example with takeover enabled
const client = new FinlightApi(
{
apiKey: 'YOUR_API_KEY',
},
{
takeover: true, // Automatically close oldest connection when limit is reached
},
)
# Python example with takeover enabled
from finlight_client import FinlightApi, ApiConfig, WebSocketOptions
client = FinlightApi(
config=ApiConfig(api_key="YOUR_API_KEY"),
websocket_options=WebSocketOptions(takeover=True)
)
기본적으로 takeover는 false이며, 한도에 도달한 경우 새 연결이 거부됩니다. 편의를 위해 개발 중에는 활성화하되, 연결을 명시적으로 관리하기 위해 프로덕션에서는 비활성화로 유지하는 것을 고려하세요.
Response
{
"link": "https://www.example.com/article1",
"source": "www.example.com",
"title": "Stock Market Hits New Highs",
"summary": "A brief summary of the article...",
"publishDate": "2023-10-01T12:34:56Z",
"createdAt": "2023-10-01T12:35:10Z",
"language": "en",
"sentiment": "positive",
"confidence": 0.95,
"images": [
"https://www.example.com/image1.jpg",
"https://www.example.com/image2.jpg"
],
"countries": ["US"],
"categories": ["markets", "technology"],
"companies": [
{
"companyId": 41494,
"confidence": "0.9335401058197021",
"country": "US",
"exchange": "XNAS",
"industry": "Biotechnology: Pharmaceutical Preparations",
"name": "Summit Therapeutics Inc. Common Stock",
"sector": "Health Care",
"ticker": "SMMT",
"isin": "US86627T1088",
"openfigi": "BBG01PH11VP5",
"primaryListing": {
"ticker": "SMMT",
"exchangeCode": "XNAS",
"exchangeCountry": "US"
},
"isins": ["US86627T1088", "US86627T2088"],
"otherListings": [
{
"ticker": "SMMT.L",
"exchangeCode": "XLON",
"exchangeCountry": "GB"
}
]
}
]
}
Response (includeUpdates: true)
{
"link": "https://www.example.com/article1",
"source": "www.example.com",
"title": "Stock Market Hits New Highs — Updated",
"summary": "An updated summary of the article...",
"publishDate": "2023-10-01T12:34:56Z",
"createdAt": "2023-10-01T12:35:10Z",
"revisedDate": "2023-10-02T08:00:00Z",
"isUpdate": true,
"language": "en",
"sentiment": "positive",
"confidence": 0.95,
"images": [
"https://www.example.com/image1.jpg"
],
"countries": ["US"],
"categories": ["markets"],
"companies": []
}
연결을 열어 둔 채 추가 요청 없이 실시간으로 기사를 받을 수 있습니다. 새 기사가 사용 가능해지면 콜백 함수로 직접 전송됩니다.