Spaces:
Running
Running
Download lib/knowledge-base.js from powerllm/anycoder-cf48624d: direct link, hf CLI and curl.
- Browser
- Download file 1.81 kB
-
https://huggingface.co/spaces/powerllm/anycoder-cf48624d/resolve/main/lib/knowledge-base.js
- Command line
-
hf download hf://spaces/powerllm/anycoder-cf48624d/lib/knowledge-base.js
-
curl -L -o knowledge-base.js https://huggingface.co/spaces/powerllm/anycoder-cf48624d/resolve/main/lib/knowledge-base.js
1.81 kB
| export const DEFAULT_KNOWLEDGE_BASE = [ | |
| { | |
| id: 1, | |
| rule: "RSI Oversold", | |
| condition: "RSI < 30", | |
| action: "LONG", | |
| confidence: "High", | |
| description: "Market is oversold. Expecting a bounce.", | |
| strategy: "mean_reversion" | |
| }, | |
| { | |
| id: 2, | |
| rule: "RSI Overbought", | |
| condition: "RSI > 70", | |
| action: "SHORT", | |
| confidence: "High", | |
| description: "Market is overbought. Expecting a correction.", | |
| strategy: "mean_reversion" | |
| }, | |
| { | |
| id: 3, | |
| rule: "Golden Cross", | |
| condition: "SMA_50 > SMA_200", | |
| action: "LONG", | |
| confidence: "Medium", | |
| description: "Bullish trend confirmation.", | |
| strategy: "trend_following" | |
| }, | |
| { | |
| id: 4, | |
| rule: "Death Cross", | |
| condition: "SMA_50 < SMA_200", | |
| action: "SHORT", | |
| confidence: "Medium", | |
| description: "Bearish trend confirmation.", | |
| strategy: "trend_following" | |
| }, | |
| { | |
| id: 5, | |
| rule: "Volume Spike", | |
| condition: "Volume > Avg_Volume * 2", | |
| action: "FOLLOW_TREND", | |
| confidence: "Medium", | |
| description: "High volume indicates strong momentum.", | |
| strategy: "momentum" | |
| } | |
| ] | |
| let uploadedRules = [] | |
| export function getKnowledgeBase() { | |
| return [...DEFAULT_KNOWLEDGE_BASE, ...uploadedRules] | |
| } | |
| export function addKnowledgeBaseRules(rules) { | |
| const newRules = rules.map((rule, index) => ({ | |
| ...rule, | |
| id: DEFAULT_KNOWLEDGE_BASE.length + uploadedRules.length + index + 1, | |
| isCustom: true | |
| })) | |
| uploadedRules = [...uploadedRules, ...newRules] | |
| return newRules | |
| } | |
| export function removeCustomRule(ruleId) { | |
| uploadedRules = uploadedRules.filter(rule => rule.id !== ruleId) | |
| return getKnowledgeBase() | |
| } | |
| export function clearAllCustomRules() { | |
| uploadedRules = [] | |
| return getKnowledgeBase() | |
| } | |
| export function getCustomRulesCount() { | |
| return uploadedRules.length | |
| } |