๋ฉ”์ธ ์ฝ˜ํ…์ธ ๋กœ ๊ฑด๋„ˆ๋›ฐ๊ธฐ

๊ฐœ์š”

Benzinga Python SDK๋Š” ์ •๋Ÿ‰ ๋ถ„์„๊ณผ ์‹œ์žฅ ์ธํ…”๋ฆฌ์ „์Šค๋ฅผ ์œ„ํ•ด Benzinga์˜ ๊ธˆ์œต ๋ฐ์ดํ„ฐ ๋ฐ ๋‰ด์Šค API์— ํญ๋„“๊ฒŒ ์ ‘๊ทผํ•  ์ˆ˜ ์žˆ๋Š” ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค. ์ด SDK๋Š” ๊ธˆ์œต ๋ฐ์ดํ„ฐ์™€ ๋‰ด์Šค ๋ฐ์ดํ„ฐ๋ฅผ ์œ„ํ•œ ๋‘ ๊ฐ€์ง€ ์ฃผ์š” ๋ชจ๋“ˆ์„ ์ œ๊ณตํ•˜์—ฌ, ๊ฐœ๋ฐœ์ž๊ฐ€ ์ •๊ตํ•œ ๊ธˆ์œต ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ๊ตฌ์ถ•ํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•ฉ๋‹ˆ๋‹ค.

์„ค์น˜

pip์™€ SSH๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ SDK๋ฅผ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค:
pip install git+ssh://[email protected]/Benzinga/benzinga-python-client.git

์ธ์ฆ

๋ชจ๋“  SDK ํด๋ž˜์Šค๋Š” ์ธ์ฆ์— API ํ‚ค๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค. API ํ‚ค๋ฅผ ๋ฐœ๊ธ‰๋ฐ›์œผ๋ ค๋ฉด cloud.benzinga.com์— ๋ฐฉ๋ฌธํ•˜์‹ญ์‹œ์˜ค.

๋ชจ๋“ˆ

SDK๋Š” ๋‘ ๊ฐœ์˜ ์ฃผ์š” ๋ชจ๋“ˆ๋กœ ๊ตฌ์„ฑ๋ฉ๋‹ˆ๋‹ค:
  • Financial Data - ์ •๋Ÿ‰์  ์žฌ๋ฌด ๋ถ„์„ ๋ฐ ์‹œ์žฅ ๋ฐ์ดํ„ฐ
  • News Data - ๊ธˆ์œต ๋‰ด์Šค, ํ—ค๋“œ๋ผ์ธ ๋ฐ ์‹œ์žฅ ์‹ฌ๋ฆฌ ๋ฐ์ดํ„ฐ

๊ธˆ์œต ๋ฐ์ดํ„ฐ ๋ชจ๋“ˆ

์ดˆ๊ธฐํ™”

from benzingaorg import financial_data

fin = financial_data.Benzinga(api_key='YOUR_API_KEY')

์‹œ์„ธ ๋ฐ ์‹œ์žฅ ๋ฐ์ดํ„ฐ

๊ฐ€๊ฒฉ ์ด๋ ฅ

์ง€์ •ํ•œ ๋‚ ์งœ ๋ฒ”์œ„์— ๋Œ€ํ•œ ์ผ๋ณ„ ์บ”๋“ค ๊ฐ€๊ฒฉ ์ด๋ ฅ์„ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.
data = fin.price_history(
    company_ticker='AAPL',
    start_date='2024-01-01',
    end_date='2024-12-31'
)
ํŒŒ๋ผ๋ฏธํ„ฐ:
  • company_ticker (ํ•„์ˆ˜) - ์ฃผ์‹ ํ‹ฐ์ปค
  • start_date (ํ•„์ˆ˜) - YYYY-MM-DD ํ˜•์‹์˜ ์‹œ์ž‘์ผ
  • end_date (ํ•„์ˆ˜) - YYYY-MM-DD ํ˜•์‹์˜ ์ข…๋ฃŒ์ผ

์‹œ์„ธ

OHLC, ๋งค์ˆ˜/๋งค๋„ ํ˜ธ๊ฐ€, ๊ฑฐ๋ž˜๋Ÿ‰, ๋“ฑ๋ฝ๋ฅ ์„ ํฌํ•จํ•œ ์‹ค์‹œ๊ฐ„ ์‹œ์„ธ ๋ฐ์ดํ„ฐ๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.
quote = fin.quote(company_ticker='AAPL')
๋ฐ˜ํ™˜๊ฐ’: Symbol, exchange, type, name, open, high, low, close, bid price, ask price, volume, change percent

์ฐจํŠธ

์›ํ•˜๋Š” ์‹œ๊ฐ„ ๊ฐ„๊ฒฉ์œผ๋กœ ์ฐจํŠธ ๋ฐ์ดํ„ฐ๋ฅผ ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค.
chart = fin.chart(
    company_ticker='AAPL',
    start_date='2024-01-01',
    end_date='2024-12-31',
    interval='1D'  # ์„ ํƒ ์‚ฌํ•ญ: 1MONTH, 1W, 1D, 1H, 15M
)
๊ฐ„๊ฒฉ ์˜ต์…˜: 1MONTH, 1W, 1D, 1H, 15M

์ž๋™์™„์„ฑ

์œ ์—ฐํ•œ ๊ฒ€์ƒ‰ ๋ฐฉ์‹์„ ํ†ตํ•ด ๊ธฐ์—… ํ‹ฐ์ปค๋ฅผ ์กฐํšŒํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
results = fin.auto_complete(
    company_ticker='AAPL',
    search_method='SYMBOL'  # ์„ ํƒ ์‚ฌํ•ญ: SYMBOL, SYMBOL_NAME, SYMBOL_WITHIN
)

๊ธฐ์ดˆ ์žฌ๋ฌด ๋ฐ์ดํ„ฐ

๊ธฐ์ดˆ ์žฌ๋ฌด ์ง€ํ‘œ

๊ธฐ์—…์˜ ํฌ๊ด„์ ์ธ ๊ธฐ์ดˆ ์žฌ๋ฌด ์ง€ํ‘œ๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.
fundamentals = fin.fundamentals(
    company_ticker='AAPL',
    isin=None,  # ์„ ํƒ ์‚ฌํ•ญ
    cik=None,   # ์„ ํƒ ์‚ฌํ•ญ
    date=None   # ์„ ํƒ ์‚ฌํ•ญ: YYYY-MM-DD
)

์žฌ๋ฌด์ œํ‘œ

์ƒ์„ธ ์žฌ๋ฌด์ œํ‘œ์— ์•ก์„ธ์Šคํ•ฉ๋‹ˆ๋‹ค.
financials = fin.financials(
    company_ticker='AAPL',
    isin=None,
    cik=None,
    date=None
)

Valuation Ratios

๋ฐธ๋ฅ˜์—์ด์…˜ ์ง€ํ‘œ์™€ ๋น„์œจ ๋ฐ์ดํ„ฐ๋ฅผ ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค.
valuation = fin.valuation_ratios(
    company_ticker='AAPL',
    isin=None,
    cik=None,
    date=None
)

์ˆ˜์ต์„ฑ ๋น„์œจ

์ˆ˜์ต์„ฑ ๊ด€๋ จ ๋น„์œจ ๋ฐ ์ง€ํ‘œ๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.
earning_ratios = fin.earning_ratios(
    company_ticker='AAPL',
    isin=None,
    cik=None,
    date=None
)

์šด์˜ ๋น„์œจ

์šด์˜ ํšจ์œจ์„ฑ ๋น„์œจ์„ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.
operation_ratios = fin.operation_ratios(
    company_ticker='AAPL',
    isin=None,
    cik=None,
    date=None
)

๊ธฐ์—… ์ด๋ฒคํŠธ ๋ฐ calendar ๋ฐ์ดํ„ฐ

๋ชจ๋“  calendar ๋ฉ”์„œ๋“œ๋Š” ํŽ˜์ด์ง€๋„ค์ด์…˜ ๋ฐ ํ•„ํ„ฐ๋ง์„ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค.
# ๋ฐฐ๋‹น
dividends = fin.dividends(
    page=0,
    pagesize=100,
    date_from='2024-01-01',
    date_to='2024-12-31',
    ticker='AAPL',
    importance=None
)

# ์• ๋„๋ฆฌ์ŠคํŠธ ๋ ˆ์ดํŒ…
ratings = fin.ratings(
    page=0,
    pagesize=100,
    date_from='2024-01-01',
    date_to='2024-12-31',
    ticker='AAPL',
    importance=None
)

# ์‹ค์ 
earnings = fin.earnings(
    page=0,
    pagesize=100,
    date_from='2024-01-01',
    date_to='2024-12-31',
    ticker='AAPL',
    importance=None
)

# ์ฃผ์‹ ๋ถ„ํ• 
splits = fin.splits(
    page=0,
    pagesize=100,
    date_from='2024-01-01',
    date_to='2024-12-31',
    ticker='AAPL',
    importance=None
)

# ๊ฒฝ์ œ ์ง€ํ‘œ
economics = fin.economics(
    page=0,
    pagesize=100,
    date_from='2024-01-01',
    date_to='2024-12-31',
    importance=None
)

# ์‹ค์  ๊ฐ€์ด๋˜์Šค
guidance = fin.guidance(
    page=0,
    pagesize=100,
    date_from='2024-01-01',
    date_to='2024-12-31',
    ticker='AAPL',
    importance=None
)

# IPO
ipos = fin.ipo(
    page=0,
    pagesize=100,
    date_from='2024-01-01',
    date_to='2024-12-31',
    ticker='AAPL',
    importance=None
)

# ๊ฐœ์ธํˆฌ์ž์ž ํ™œ๋™
retail = fin.retail(
    page=0,
    pagesize=100,
    date_from='2024-01-01',
    date_to='2024-12-31',
    ticker='AAPL',
    importance=None
)

# ์ปจํผ๋Ÿฐ์Šค ์ฝœ
conference_calls = fin.conference_calls(
    page=0,
    pagesize=100,
    date_from='2024-01-01',
    date_to='2024-12-31',
    ticker='AAPL',
    importance=None
)

ํšŒ์‚ฌ ์ •๋ณด

ํšŒ์‚ฌ ํ”„๋กœํ•„

์ƒ์„ธํ•œ ํšŒ์‚ฌ ํ”„๋กœํ•„ ์ •๋ณด๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.
profile = fin.company_profile(company_ticker='AAPL')

ํšŒ์‚ฌ

๊ธฐ๋ณธ์ ์ธ ํšŒ์‚ฌ ์ •๋ณด๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.
company = fin.company(company_ticker='AAPL')

์ฃผ์‹ ์ข…๋ฅ˜

์ฃผ์‹ ์ข…๋ฅ˜์— ๋Œ€ํ•œ ์„ธ๋ถ€ ์ •๋ณด๋ฅผ ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค.
share_class = fin.share_class(company_ticker='AAPL')

์‹ค์  ๋ณด๊ณ ์„œ

๊ณผ๊ฑฐ ์‹ค์  ๋ณด๊ณ ์„œ๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.
earning_reports = fin.earning_reports(company_ticker='AAPL')

๋กœ๊ณ 

์„ ํƒ์  ํ•„ํ„ฐ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๊ธฐ์—… ๋กœ๊ณ ๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.
logos = fin.logos(
    ticker='AAPL',
    filters=None  # ์„ ํƒ ์‚ฌํ•ญ ํ•„ํ„ฐ
)

๊ฒ€์ƒ‰ ๋ฐ ๋ถ„์„

์ธ์ŠคํŠธ๋ฃจ๋จผํŠธ

์„นํ„ฐ ๋ฐ ์‹œ๊ฐ€์ด์•ก ํ•„ํ„ฐ๋ฅผ ์‚ฌ์šฉํ•ด ์ข…๋ชฉ์„ ํ•„ํ„ฐ๋งํ•ฉ๋‹ˆ๋‹ค.
instruments = fin.instruments(
    sector=None,      # ์„ ํƒ ์‚ฌํ•ญ: ์„นํ„ฐ ํ•„ํ„ฐ
    market_cap=None   # ์„ ํƒ ์‚ฌํ•ญ: ์‹œ๊ฐ€์ด์•ก ํ•„ํ„ฐ
)

์ฆ๊ถŒ

symbol, exchange, currency, CUSIP์„ ํฌํ•จํ•œ ์ฆ๊ถŒ ์ƒ์„ธ ์ •๋ณด๋ฅผ ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค.
security = fin.security(company_ticker='AAPL')

์‹œ์„ธ ๊ธ‰๋ณ€ ์ข…๋ชฉ

์ƒ์Šน๋ฅ ยทํ•˜๋ฝ๋ฅ  ์ƒ์œ„ ์ข…๋ชฉ์„ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.
movers = fin.movers(
    session=None,  # ์„ ํƒ์‚ฌํ•ญ: pre, post, regular
    sector=None    # ์„ ํƒ์‚ฌํ•ญ ์„นํ„ฐ ํ•„ํ„ฐ
)

ํ‹ฐ์ปค ์ƒ์„ธ

์ฃผ์š” ํ†ต๊ณ„, ๋™์ข… ์—…๊ณ„ ๊ธฐ์—… ์ •๋ณด ๋ฐ ๋ฐฑ๋ถ„์œ„(percentile) ๋ฐ์ดํ„ฐ๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.
detail = fin.ticker_detail(company_ticker='AAPL')

์˜ต์…˜ ๋ฐ์ดํ„ฐ

์˜ต์…˜ ๊ฑฐ๋ž˜ ๋™ํ–ฅ

์˜ต์…˜ ๊ฑฐ๋ž˜ ํ™œ๋™์„ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.
options = fin.options_activity(
    company_ticker='AAPL',
    date_from='2024-01-01',  # ์„ ํƒ ์‚ฌํ•ญ
    date_to='2024-12-31',    # ์„ ํƒ ์‚ฌํ•ญ
    page=0,                   # ์„ ํƒ ์‚ฌํ•ญ
    pagesize=100             # ์„ ํƒ ์‚ฌํ•ญ
)

๋‰ด์Šค ๋ฐ์ดํ„ฐ ๋ชจ๋“ˆ

์ดˆ๊ธฐํ™”

from benzingaorg import news_data

news = news_data.News(api_key='YOUR_API_KEY')

๋‰ด์Šค ๋ฉ”์„œ๋“œ

๋‰ด์Šค

์œ ์—ฐํ•œ ํ•„ํ„ฐ๋ง ๋ฐ ํ‘œ์‹œ ์˜ต์…˜์œผ๋กœ ๋‰ด์Šค ๊ธฐ์‚ฌ๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.
articles = news.news(
    pagesize=15,              # ๊ธฐ๋ณธ๊ฐ’: 15
    display_output='full',    # ์˜ต์…˜: full, abstract, headline
    date_from='2024-01-01',   # ์„ ํƒ์‚ฌํ•ญ
    date_to='2024-12-31',     # ์„ ํƒ์‚ฌํ•ญ
    channel=None              # ์„ ํƒ์‚ฌํ•ญ: ์ฑ„๋„๋กœ ํ•„ํ„ฐ๋ง
)
ํ‘œ์‹œ ํ˜•์‹ ์˜ต์…˜:
  • full - ์ „์ฒด ๊ธฐ์‚ฌ ๋‚ด์šฉ
  • abstract - ๊ธฐ์‚ฌ ์š”์•ฝ
  • headline - ํ—ค๋“œ๋ผ์ธ๋งŒ

์ฃผ์š” ๋‰ด์Šค

์ธ๊ธฐ ์žˆ๋Š” ๋‰ด์Šค ๊ธฐ์‚ฌ๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.
top = news.top_news(
    type=None,      # ์„ ํƒ ์‚ฌํ•ญ: ๋‰ด์Šค ์œ ํ˜•
    channel=None,   # ์„ ํƒ ์‚ฌํ•ญ: ์ฑ„๋„ ํ•„ํ„ฐ
    limit=10        # ๋ฐ˜ํ™˜ํ•  ๊ธฐ์‚ฌ ๊ฐœ์ˆ˜
)

์ฑ„๋„

์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ๋‰ด์Šค ์ฑ„๋„ ๋ชฉ๋ก์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.
channels = news.channels()
๋ฐ˜ํ™˜๊ฐ’: ์ฑ„๋„ ์ด๋ฆ„๊ณผ ID

์ •๋Ÿ‰ ์ง€ํ‘œ ๋‰ด์Šค

์ •๋Ÿ‰ ์ง€ํ‘œ๊ฐ€ ํฌํ•จ๋œ ๋‰ด์Šค ๋ฐ์ดํ„ฐ๋ฅผ ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
quantified = news.quantified_news(
    page=0,
    pagesize=100,
    date_from='2024-01-01',  # ์„ ํƒ ์‚ฌํ•ญ
    date_to='2024-12-31'     # ์„ ํƒ ์‚ฌํ•ญ
)
๋ฐ˜ํ™˜๊ฐ’: ํ—ค๋“œ๋ผ์ธ, ๊ฑฐ๋ž˜๋Ÿ‰, ์‹œ๊ฐ€ ๊ฐญ, ๋ณ€๋™ ๋ฒ”์œ„ ์ง€ํ‘œ ๋ฐ ๊ธฐํƒ€ ์ •๋Ÿ‰ ๋ฐ์ดํ„ฐ

์ถœ๋ ฅ ํ˜•์‹

๋‘ ๋ชจ๋“ˆ ๋ชจ๋‘ JSON ์‹œ๊ฐํ™”๋ฅผ ๊ฐœ์„ ํ•˜๊ธฐ ์œ„ํ•ด .output() ๋ฉ”์„œ๋“œ๋ฅผ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค.
# ๊ธˆ์œต ๋ฐ์ดํ„ฐ ์ถœ๋ ฅ
data = fin.quote('AAPL')
fin.output(data)

# ๋‰ด์Šค ๋ฐ์ดํ„ฐ ์ถœ๋ ฅ
articles = news.news(pagesize=10)
news.output(articles)

์™„์ „ํ•œ ์˜ˆ์ œ

from benzingaorg import financial_data, news_data

# ๋ชจ๋“ˆ ์ดˆ๊ธฐํ™”
fin = financial_data.Benzinga(api_key='YOUR_API_KEY')
news = news_data.News(api_key='YOUR_API_KEY')

# ๊ธˆ์œต ๋ฐ์ดํ„ฐ ๊ฐ€์ ธ์˜ค๊ธฐ
quote = fin.quote('AAPL')
fundamentals = fin.fundamentals('AAPL')
earnings = fin.earnings(ticker='AAPL', date_from='2024-01-01')

# ๋‰ด์Šค ๋ฐ์ดํ„ฐ ๊ฐ€์ ธ์˜ค๊ธฐ
articles = news.news(pagesize=20, display_output='full')
top_news = news.top_news(limit=5)

# ํฌ๋งท ์ง€์ • ๋ฐ ํ‘œ์‹œ
fin.output(quote)
news.output(articles)

๋ฆฌ์†Œ์Šค

์ง€์›

๊ธฐ์ˆ  ์ง€์› ๋˜๋Š” API ํ‚ค ๋ฐœ๊ธ‰์ด ํ•„์š”ํ•  ๊ฒฝ์šฐ cloud.benzinga.com์„ ํ†ตํ•ด Benzinga์— ๋ฌธ์˜ํ•˜์‹ญ์‹œ์˜ค.