feat: add multi-account and advanced analytics

Integrated Multi-Account Manager, Auto Scanner, and Economic Calendar modules. Refined UI with a institutional design language, enhanced visual consistency via global styles, and improved error handling for third-party API services. Added date filtering presets to the signal history module.
This commit is contained in:
desartstudio95
2026-06-13 22:47:55 -07:00
parent 2d6e1a0809
commit 75db8e2ec0
20 changed files with 1383 additions and 517 deletions
+17 -4
View File
@@ -47,12 +47,13 @@ async function getCurrentPriceProxy(symbol: string): Promise<number | null> {
return null; // Synthetic indices handled separately or simulated
}
if (process.env.TWELVE_DATA_API_KEY) {
const apiKey = process.env.TWELVE_DATA_API_KEY || "e3143522be4c4aac89e1f9a39925ed80";
if (apiKey) {
try {
let twelveSymbol = symStr;
if (twelveSymbol === 'GOLD' || twelveSymbol === 'OURO') twelveSymbol = 'XAU/USD';
if (twelveSymbol === 'SILVER' || twelveSymbol === 'PRATA') twelveSymbol = 'XAG/USD';
const res = await axios.get(`https://api.twelvedata.com/price?symbol=${twelveSymbol}&apikey=${process.env.TWELVE_DATA_API_KEY}`);
const res = await axios.get(`https://api.twelvedata.com/price?symbol=${twelveSymbol}&apikey=${apiKey}`);
if (res.data && res.data.price) return parseFloat(res.data.price);
} catch (e: any) {
// Fallback silently if TwelveData is rate-limited or fails
@@ -862,12 +863,13 @@ const sendTelegramAlertServer = async (text: string, botToken: string, chatId: s
return res.json({ values: [] });
}
if (process.env.TWELVE_DATA_API_KEY) {
const apiKey = process.env.TWELVE_DATA_API_KEY || "e3143522be4c4aac89e1f9a39925ed80";
if (apiKey) {
try {
let twelveSymbol = symStr;
if (twelveSymbol === 'GOLD' || twelveSymbol === 'OURO') twelveSymbol = 'XAU/USD';
if (twelveSymbol === 'SILVER' || twelveSymbol === 'PRATA') twelveSymbol = 'XAG/USD';
const tkres = await axios.get(`https://api.twelvedata.com/time_series?symbol=${twelveSymbol}&interval=15min&apikey=${process.env.TWELVE_DATA_API_KEY}`);
const tkres = await axios.get(`https://api.twelvedata.com/time_series?symbol=${twelveSymbol}&interval=15min&apikey=${apiKey}`);
if (tkres.data && tkres.data.values) {
return res.json({ values: tkres.data.values });
}
@@ -995,6 +997,17 @@ const sendTelegramAlertServer = async (text: string, botToken: string, chatId: s
}
});
// Proxy for Economic Calendar (using fair economy due to 12Data missing macro economic endpoints)
app.get("/api/economic_calendar", async (req, res) => {
try {
const calendarRes = await axios.get("https://nfs.faireconomy.media/ff_calendar_thisweek.json");
return res.json({ success: true, data: calendarRes.data });
} catch(e: any) {
console.error("Economic calendar error:", e.message);
return res.status(500).json({ success: false, error: "Failed to fetch calendar data" });
}
});
// Vite middleware for development
if (process.env.NODE_ENV !== "production") {
const vite = await createViteServer({