ratulsur commited on
Commit
cb1cc81
·
verified ·
1 Parent(s): c209383

Create deepseek_api.py

Browse files
Files changed (1) hide show
  1. utils/deepseek_api.py +20 -0
utils/deepseek_api.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+
3
+ class DeepSeekAI:
4
+ """Class to interact with DeepSeek API for AI-based market analysis"""
5
+
6
+ DEEPSEEK_API_URL = "https://api.deepseek.com/v1/analyze"
7
+
8
+ def __init__(self, api_key):
9
+ """Initialize DeepSeekAI with API key"""
10
+ self.api_key = api_key
11
+
12
+ def analyze_stock(self, data):
13
+ """Send stock data to DeepSeek for analysis and prediction"""
14
+ headers = {"Authorization": f"Bearer {self.api_key}"}
15
+ try:
16
+ response = requests.post(self.DEEPSEEK_API_URL, json={"data": data.to_dict()}, headers=headers)
17
+ response.raise_for_status()
18
+ return response.json()
19
+ except requests.exceptions.RequestException as e:
20
+ return {"error": str(e)}