[Python] 퀀들(Quandl) - 금융 데이터
Nasdaq 의 Quandl 은 세계에서 가장 강력한 금융 데이터를 수집하는 도구 입니다. 투자 전문가에게 서비스를 제공하는 금융, 경제 및 대체 데이터 세트에 대한 최고의 소스를 제공 합니다.
설치
pip install quandl |
Quandl 을 사용하기 위해서는 API Key 받아야 한다. Quandl 사이트에 들어면 API Key 를 아래와 같이 확인 할 수 있다.
퀄들(Quandl) API 를 이용하여 금융 데이터를 수집할수 있습니다. 수집할 수 있는 데이터는 국제 금 가격, 국제 은 가격 등을 수집할 수 있다. 아래 코드는 금값을 수집하였다.
- 금 가격: LBMA/GOLD (런던 금시장 연합회)
- 은 가격: LBMA/SILVER (런던 금시장 연합회)
- 구리 가격: HRIS/CME_HG10
- 국제 원유 가격: OPEC/ORB
def dataPlt(info, title):
infoPlt = info.plot(kind='line', figsize=(12,9), grid=True, title = title)
infoPlt.legend(loc='upper left')
def QuandlPr(startDate, EndDate):
quandl.ApiConfig.api_key = quandl_api_key
df_gold = quandl.get("LBMA/GOLD", trim_start=startDate, trim_end=EndDate)
print(df_gold)
dataPlt(df_gold, "Gold Price")
df_silver = quandl.get("LBMA/SILVER", trim_start=startDate, trim_end=EndDate)
print(df_silver)
dataPlt(df_silver, "Silver Price")
df_copper = quandl.get("CHRIS/CME_HG10", trim_start=startDate, trim_end=EndDate)
print(df_copper)
dataPlt(df_copper, "Copper Price")
df_oil = quandl.get("OPEC/ORB", trim_start=startDate, trim_end=EndDate)
print(df_oil)
dataPlt(df_oil, "Oil Price")
'IT > 컴퓨터프로그램' 카테고리의 다른 글
[Python] INI 파일 일고 쓰기 (0) | 2022.07.16 |
---|---|
[자동화 프로그램] Sikulix (0) | 2022.07.15 |
[Python] OpenDartReader 사용하기 - 공시 보고 원문 활용 (0) | 2022.05.16 |
[Python] FinanceDataReader 를 통한 주가 읽기 - 볼린저밴드 (0) | 2022.05.16 |
[Python] FinanceDataReader 를 통한 주가 읽기 - 이동 평균선 (1) | 2022.05.16 |