import requests

# Solactive API 엔드포인트 및 클라이언트 ID 설정
BASE_URL = "https://clients.solactive.com/api/rest/v1/indices"
CLIENT_ID = "your_client_id"  # Solactive에서 제공받은 클라이언트 ID
ISIN = "DE000SL0J6Z8"

def fetch_index_data():
    try:
        # API 요청 URL 구성
        url = f"{BASE_URL}/{CLIENT_ID}/{ISIN}/index"
        
        # GET 요청 보내기
        response = requests.get(url)
        
        # 응답 데이터 확인
        if response.status_code == 200:
            data = response.json()
            print("Index Data:")
            print(data)
        else:
            print(f"Failed to fetch data. HTTP Status Code: {response.status_code}")
    except Exception as e:
        print(f"An error occurred: {e}")

# 실행
fetch_index_data()

 

'Python > 파이썬_자동매매' 카테고리의 다른 글

볼린저밴드  (0) 2025.02.02
샤프비율  (0) 2025.02.02
변동성  (0) 2025.02.02
MDD (Maximum Draw Down)  (0) 2025.02.02
CAGR (연평균수익률)  (0) 2025.02.02

+ Recent posts