Spaces:
Running
Running
Upload pages/index.js with huggingface_hub
Browse files78 unmodified lines7980818282838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615778 unmodified lines console.error("Fetch error:", error) setDataError('Network error') } finally { setIsLoading(false) setIsLoading(false) } }
fetchData() interval = setInterval(fetchData, 5000) // 5 second refresh }
return () => clearInterval(interval) }, [isRunning, selectedAsset, knowledgeBase])
const analyzeTick = (tick, rules) => { for (let rule of rules) { const condition = rule.condition.toLowerCase() let match = false
// RSI Logic if (condition.includes('rsi')) { if (condition.includes('< 30') && tick.rsi < 30) match = true else if (condition.includes('> 70') && tick.rsi > 70) match = true } // Simple Trend Logic else if (condition.includes('trend')) { if (condition.includes('up') && tick.trend === 'UP') match = true else if (condition.includes('down') && tick.trend === 'DOWN') match = true } if (match) { return { ...rule, ...calculateTradeParams(tick.price, rule.action), confidenceValue: rule.confidence === 'High' ? 90 : rule.confidence === 'Medium' ? 60 : 30 } } } return null }
const handleUpload = (rules) => { const newRules = addKnowledgeBaseRules(rules) setKnowledgeBase(newRules) setCustomRulesCount(getCustomRulesCount()) }
const handleRemoveRule = (id) => { if (id === 'all') { clearAllCustomRules() setKnowledgeBase(getKnowledgeBase()) setCustomRulesCount(0) } else { const updated = removeCustomRule(id) setKnowledgeBase(updated) setCustomRulesCount(getCustomRulesCount()) } }
return ( <div className="min-h-screen bg-dark-900 text-white selection:bg-primary-500/30"> <Head> <title>ITC Engine Pro - AI Trading</title> <meta name="description" content="AI-Powered Algorithmic Trading System" /> <link rel="icon" href="/favicon.ico" /> </Head>
<Header />
<main className="container mx-auto px-4 py-8"> {/* Control Bar */} <div className="flex flex-col md:flex-row justify-between items-center mb-8 gap-4"> <div className="flex items-center space-x-4"> <button onClick={() => setIsRunning(!isRunning)} className={`flex items-center space-x-2 px-6 py-3 rounded-xl font-bold transition-all shadow-lg ${ isRunning ? 'bg-red-500/10 text-red-400 border border-red-500/20 hover:bg-red-500/20' :pages/index.js+76-1