initial commit

This commit is contained in:
2026-01-31 22:34:57 +09:00
commit f1301de543
875 changed files with 196598 additions and 0 deletions

33
services/geminiService.ts Normal file
View File

@@ -0,0 +1,33 @@
import { GoogleGenAI } from "@google/genai";
export async function analyzeMarketSentiment(news: string[]) {
const ai = new GoogleGenAI({ apiKey: process.env.API_KEY });
const prompt = `Based on the following news headlines, provide a concise market sentiment summary (Bullish/Bearish/Neutral) and 3 key takeaways for a stock trader. News: ${news.join('. ')}`;
try {
const response = await ai.models.generateContent({
model: 'gemini-3-flash-preview',
contents: prompt,
});
return response.text;
} catch (error) {
console.error("Gemini Error:", error);
return "AI insight currently unavailable.";
}
}
export async function getStockInsight(stockName: string, recentTrend: string) {
const ai = new GoogleGenAI({ apiKey: process.env.API_KEY });
const prompt = `Analyze the stock ${stockName} which has been ${recentTrend}. Suggest a potential strategy for an automated trading bot (e.g., Trailing Stop percentage, Accumulation frequency).`;
try {
const response = await ai.models.generateContent({
model: 'gemini-3-pro-preview',
contents: prompt,
});
return response.text;
} catch (error) {
return "Detailed analysis unavailable at this moment.";
}
}