Feature/custom strategy (#1172)

* feat: add Strategy Studio with multi-timeframe support
- Add Strategy Studio page with three-column layout for strategy management
- Support multi-timeframe K-line data selection (5m, 15m, 1h, 4h, etc.)
- Add GetWithTimeframes() function in market package for fetching multiple timeframes
- Add TimeframeSeriesData struct for storing per-timeframe technical indicators
- Update formatMarketData() to display all selected timeframes in AI prompt
- Add strategy API endpoints for CRUD operations and test run
- Integrate real AI test runs with configured AI models
- Support custom AI500 and OI Top API URLs from strategy config
* docs: add Strategy Studio screenshot to README files
* fix: correct strategy-studio.png filename case in README
* refactor: remove legacy signal source config and simplify trader creation
- Remove signal source configuration from traders page (now handled by strategy)
- Remove advanced options (legacy config) from TraderConfigModal
- Rename default strategy to "默认山寨策略" with AI500 coin pool URL
- Delete SignalSourceModal and SignalSourceWarning components
- Clean up related stores, hooks, and page components
This commit is contained in:
tinkle-community
2025-12-06 07:20:11 +08:00
committed by GitHub
parent afb2d158ac
commit 5cff32e4f2
37 changed files with 4965 additions and 1051 deletions

View File

@@ -1,4 +1,4 @@
import { Bot, Plus, Radio } from 'lucide-react'
import { Bot, Plus } from 'lucide-react'
import { t, type Language } from '../../../i18n/translations'
interface PageHeaderProps {
@@ -8,7 +8,6 @@ interface PageHeaderProps {
configuredExchangesCount: number
onAddModel: () => void
onAddExchange: () => void
onConfigureSignalSource: () => void
onCreateTrader: () => void
}
@@ -19,7 +18,6 @@ export function PageHeader({
configuredExchangesCount,
onAddModel,
onAddExchange,
onConfigureSignalSource,
onCreateTrader,
}: PageHeaderProps) {
const canCreateTrader =
@@ -86,19 +84,6 @@ export function PageHeader({
{t('exchanges', language)}
</button>
<button
onClick={onConfigureSignalSource}
className="px-3 md:px-4 py-2 rounded text-xs md:text-sm font-semibold transition-all hover:scale-105 flex items-center gap-1 md:gap-2 whitespace-nowrap"
style={{
background: '#2B3139',
color: '#EAECEF',
border: '1px solid #474D57',
}}
>
<Radio className="w-3 h-3 md:w-4 md:h-4" />
{t('signalSource', language)}
</button>
<button
onClick={onCreateTrader}
disabled={!canCreateTrader}

View File

@@ -1,54 +0,0 @@
import { AlertTriangle } from 'lucide-react'
import { t, type Language } from '../../../i18n/translations'
interface SignalSourceWarningProps {
language: Language
onConfigure: () => void
}
export function SignalSourceWarning({
language,
onConfigure,
}: SignalSourceWarningProps) {
return (
<div
className="rounded-lg px-4 py-3 flex items-start gap-3 animate-slide-in"
style={{
background: 'rgba(246, 70, 93, 0.1)',
border: '1px solid rgba(246, 70, 93, 0.3)',
}}
>
<AlertTriangle
size={20}
className="flex-shrink-0 mt-0.5"
style={{ color: '#F6465D' }}
/>
<div className="flex-1">
<div className="font-semibold mb-1" style={{ color: '#F6465D' }}>
{t('signalSourceNotConfigured', language)}
</div>
<div className="text-sm" style={{ color: '#848E9C' }}>
<p className="mb-2">{t('signalSourceWarningMessage', language)}</p>
<p>
<strong>{t('solutions', language)}</strong>
</p>
<ul className="list-disc list-inside space-y-1 ml-2 mt-1">
<li>"{t('signalSource', language)}"API地址</li>
<li>"使用币种池""使用OI Top"</li>
<li></li>
</ul>
</div>
<button
onClick={onConfigure}
className="mt-3 px-3 py-1.5 rounded text-sm font-semibold transition-all hover:scale-105"
style={{
background: '#F0B90B',
color: '#000',
}}
>
{t('configureSignalSourceNow', language)}
</button>
</div>
</div>
)
}