-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackground.js
More file actions
49 lines (47 loc) · 1.25 KB
/
background.js
File metadata and controls
49 lines (47 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
chrome.runtime.onInstalled.addListener(() => {
console.log("SmartTradeAI Extension Installed.");
// Initialize default strategies
chrome.storage.local.set({
strategies: {
moving_average: {
name: "Moving Average",
description: "Compares current price with moving average",
params: {
period: 14
}
},
rsi: {
name: "RSI Strategy",
description: "Uses RSI to detect overbought/oversold conditions",
params: {
period: 14,
overbought: 70,
oversold: 30
}
},
macd: {
name: "MACD Strategy",
description: "Uses MACD crossovers for signals",
params: {
fastPeriod: 12,
slowPeriod: 26,
signalPeriod: 9
}
}
}
});
});
// Handle messages from content script
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
console.log("Received message:", request);
if (request.type === "showNotification") {
chrome.notifications.create({
type: "basic",
iconUrl: "assets/icon.png",
title: "SmartTradeAI Alert",
message: request.message
}, (notificationId) => {
console.log("Notification created:", notificationId);
});
}
});