DagonGod / utils /deepseek_api.py
ratulsur's picture
Create deepseek_api.py
cb1cc81 verified
raw
history blame contribute delete
745 Bytes
import requests
class DeepSeekAI:
"""Class to interact with DeepSeek API for AI-based market analysis"""
DEEPSEEK_API_URL = "https://api.deepseek.com/v1/analyze"
def __init__(self, api_key):
"""Initialize DeepSeekAI with API key"""
self.api_key = api_key
def analyze_stock(self, data):
"""Send stock data to DeepSeek for analysis and prediction"""
headers = {"Authorization": f"Bearer {self.api_key}"}
try:
response = requests.post(self.DEEPSEEK_API_URL, json={"data": data.to_dict()}, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
return {"error": str(e)}