@one_deploy/sdk 1.0.6 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +339 -0
- package/dist/ForexPoolDataGenerator--__twRwl.d.mts +76 -0
- package/dist/ForexPoolDataGenerator-eUgwsU_B.d.ts +76 -0
- package/dist/OneForexTradeHistory-TlKxjbFF.d.ts +250 -0
- package/dist/OneForexTradeHistory-iDySMcw0.d.mts +250 -0
- package/dist/components/index.d.mts +539 -0
- package/dist/components/index.d.ts +539 -0
- package/dist/components/index.js +7295 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/index.mjs +7243 -0
- package/dist/components/index.mjs.map +1 -0
- package/dist/config/index.d.mts +1 -0
- package/dist/config/index.d.ts +1 -0
- package/dist/console-BfTMA7ah.d.mts +504 -0
- package/dist/console-BfTMA7ah.d.ts +504 -0
- package/dist/hooks/index.d.mts +323 -1
- package/dist/hooks/index.d.ts +323 -1
- package/dist/hooks/index.js +3223 -0
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +3204 -1
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.d.mts +18 -352
- package/dist/index.d.ts +18 -352
- package/dist/index.js +8646 -574
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8449 -432
- package/dist/index.mjs.map +1 -1
- package/dist/providers/index.d.mts +31 -31
- package/dist/providers/index.d.ts +31 -31
- package/dist/providers/index.js +140 -153
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/index.mjs +100 -109
- package/dist/providers/index.mjs.map +1 -1
- package/dist/react-native.d.mts +8 -140
- package/dist/react-native.d.ts +8 -140
- package/dist/react-native.js +2527 -0
- package/dist/react-native.js.map +1 -1
- package/dist/react-native.mjs +2497 -2
- package/dist/react-native.mjs.map +1 -1
- package/dist/services/index.d.mts +85 -4
- package/dist/services/index.d.ts +85 -4
- package/dist/services/index.js +1621 -0
- package/dist/services/index.js.map +1 -1
- package/dist/services/index.mjs +1619 -1
- package/dist/services/index.mjs.map +1 -1
- package/dist/types/index.d.mts +203 -1
- package/dist/types/index.d.ts +203 -1
- package/dist/types/index.js +275 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/index.mjs +251 -0
- package/dist/types/index.mjs.map +1 -1
- package/dist/useForexTrading-BleeSor8.d.mts +80 -0
- package/dist/useForexTrading-ZgW_G40Q.d.ts +80 -0
- package/package.json +9 -2
- package/src/components/OneConnectButton.tsx +24 -1
- package/src/components/OneNFTGallery.tsx +13 -7
- package/src/components/OneOfframpWidget.tsx +4 -3
- package/src/components/OnePayWidget.tsx +10 -1
- package/src/components/OneSendWidget.tsx +3 -3
- package/src/components/OneSwapWidget.tsx +4 -4
- package/src/components/OneTransactionButton.tsx +28 -3
- package/src/components/OneWalletBalance.tsx +1 -1
- package/src/components/ai/OneForexCapitalSplit.tsx +112 -0
- package/src/components/ai/OneForexConsoleView.tsx +90 -0
- package/src/components/ai/OneForexPairSelector.tsx +101 -0
- package/src/components/ai/OneForexPoolCard.tsx +105 -0
- package/src/components/ai/OneForexTradeHistory.tsx +107 -0
- package/src/components/ai/console/OneAIQuantConsole.tsx +423 -0
- package/src/components/ai/console/OneAgentCard.tsx +383 -0
- package/src/components/ai/console/OneAgentConsole.tsx +469 -0
- package/src/components/ai/console/OneDecisionTimeline.tsx +433 -0
- package/src/components/ai/console/OneMetricsDashboard.tsx +493 -0
- package/src/components/ai/console/OnePositionCard.tsx +406 -0
- package/src/components/ai/console/OnePositionDetail.tsx +600 -0
- package/src/components/ai/console/OneRiskIndicator.tsx +464 -0
- package/src/components/ai/console/OneTradingConsole.tsx +660 -0
- package/src/components/ai/console/index.ts +17 -0
- package/src/components/ai/index.ts +10 -0
- package/src/hooks/index.ts +46 -0
- package/src/hooks/useAIDecisions.ts +280 -0
- package/src/hooks/useAIPositions.ts +349 -0
- package/src/hooks/useAIQuantConsole.ts +283 -0
- package/src/hooks/useAIRiskStatus.ts +276 -0
- package/src/hooks/useAITrading.ts +190 -0
- package/src/hooks/useBotSimulation.ts +201 -0
- package/src/hooks/useForexTrading.ts +430 -0
- package/src/hooks/useTradingConsole.ts +243 -0
- package/src/index.ts +123 -5
- package/src/providers/OneProvider.tsx +181 -5
- package/src/providers/index.ts +22 -8
- package/src/react-native.ts +41 -0
- package/src/services/forex/BotSimulationEngine.ts +968 -0
- package/src/services/forex/ForexPoolDataGenerator.ts +542 -0
- package/src/services/forex/ForexSimulationEngine.ts +482 -0
- package/src/services/forex/index.ts +21 -0
- package/src/services/index.ts +16 -0
- package/src/types/aiTrading.ts +151 -0
- package/src/types/console.ts +380 -0
- package/src/types/forex.ts +282 -0
- package/src/types/index.ts +106 -0
- package/dist/price-CgqXPnT3.d.ts +0 -13
- package/dist/price-ClbLHHjv.d.mts +0 -13
- package/dist/supabase-BT0c7q9e.d.mts +0 -82
- package/dist/supabase-BT0c7q9e.d.ts +0 -82
|
@@ -0,0 +1,660 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OneTradingConsole - Total unified console view (AI + Forex)
|
|
3
|
+
* Part of ONE Ecosystem SDK
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import React, { useRef, useEffect, useState } from 'react';
|
|
7
|
+
import { View, Text, StyleSheet, ScrollView, ViewStyle, Platform, TouchableOpacity } from 'react-native';
|
|
8
|
+
import type { CombinedLogEntry, ConsoleMetrics, RiskStatus, AIAgent } from '../../../types/console';
|
|
9
|
+
import type { BotLogEntry } from '../../../services/forex/BotSimulationEngine';
|
|
10
|
+
import type { ForexLogEntry } from '../../../types/forex';
|
|
11
|
+
import { AI_LOG_COLORS, FOREX_LOG_COLORS } from '../../../types/console';
|
|
12
|
+
import { OneMetricsDashboard } from './OneMetricsDashboard';
|
|
13
|
+
import { OneRiskIndicator } from './OneRiskIndicator';
|
|
14
|
+
|
|
15
|
+
const MONO = Platform.OS === 'ios' ? 'Courier New' : 'monospace';
|
|
16
|
+
|
|
17
|
+
export interface OneTradingConsoleProps {
|
|
18
|
+
mode?: 'combined' | 'ai-only' | 'forex-only';
|
|
19
|
+
// Combined logs
|
|
20
|
+
combinedLogs?: CombinedLogEntry[];
|
|
21
|
+
// Or separate logs
|
|
22
|
+
aiLogs?: BotLogEntry[];
|
|
23
|
+
forexLogs?: ForexLogEntry[];
|
|
24
|
+
// Data
|
|
25
|
+
agents?: AIAgent[];
|
|
26
|
+
metrics?: ConsoleMetrics;
|
|
27
|
+
riskStatus?: RiskStatus | null;
|
|
28
|
+
// Display options
|
|
29
|
+
maxLogs?: number;
|
|
30
|
+
autoScroll?: boolean;
|
|
31
|
+
showMetrics?: boolean;
|
|
32
|
+
showRisk?: boolean;
|
|
33
|
+
showControls?: boolean;
|
|
34
|
+
consoleHeight?: number;
|
|
35
|
+
// Controls
|
|
36
|
+
isAIRunning?: boolean;
|
|
37
|
+
isForexRunning?: boolean;
|
|
38
|
+
onStartAI?: () => void;
|
|
39
|
+
onStopAI?: () => void;
|
|
40
|
+
onStartForex?: () => void;
|
|
41
|
+
onStopForex?: () => void;
|
|
42
|
+
onStartAll?: () => void;
|
|
43
|
+
onStopAll?: () => void;
|
|
44
|
+
onClearLogs?: () => void;
|
|
45
|
+
onRefresh?: () => void;
|
|
46
|
+
// Callbacks
|
|
47
|
+
onAgentSelect?: (agent: AIAgent) => void;
|
|
48
|
+
style?: ViewStyle;
|
|
49
|
+
dark?: boolean;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export const OneTradingConsole: React.FC<OneTradingConsoleProps> = ({
|
|
53
|
+
mode = 'combined',
|
|
54
|
+
combinedLogs = [],
|
|
55
|
+
aiLogs = [],
|
|
56
|
+
forexLogs = [],
|
|
57
|
+
agents = [],
|
|
58
|
+
metrics,
|
|
59
|
+
riskStatus,
|
|
60
|
+
maxLogs = 200,
|
|
61
|
+
autoScroll = true,
|
|
62
|
+
showMetrics = true,
|
|
63
|
+
showRisk = true,
|
|
64
|
+
showControls = true,
|
|
65
|
+
consoleHeight = 400,
|
|
66
|
+
isAIRunning = false,
|
|
67
|
+
isForexRunning = false,
|
|
68
|
+
onStartAI,
|
|
69
|
+
onStopAI,
|
|
70
|
+
onStartForex,
|
|
71
|
+
onStopForex,
|
|
72
|
+
onStartAll,
|
|
73
|
+
onStopAll,
|
|
74
|
+
onClearLogs,
|
|
75
|
+
onRefresh,
|
|
76
|
+
onAgentSelect,
|
|
77
|
+
style,
|
|
78
|
+
dark = true,
|
|
79
|
+
}) => {
|
|
80
|
+
const bg = dark ? '#0A0A0C' : '#ffffff';
|
|
81
|
+
const consoleBg = dark ? '#0A0A0C' : '#F9FAFB';
|
|
82
|
+
const cardBg = dark ? '#111111' : '#F9FAFB';
|
|
83
|
+
const border = dark ? '#2A2A35' : '#E5E7EB';
|
|
84
|
+
const textPrimary = dark ? '#ffffff' : '#111827';
|
|
85
|
+
const textSecondary = dark ? '#9CA3AF' : '#6B7280';
|
|
86
|
+
const textMuted = dark ? '#555560' : '#9CA3AF';
|
|
87
|
+
|
|
88
|
+
const scrollRef = useRef<ScrollView>(null);
|
|
89
|
+
const [selectedTab, setSelectedTab] = useState<'console' | 'metrics' | 'risk' | 'agents'>('console');
|
|
90
|
+
|
|
91
|
+
// Merge logs if not using combined
|
|
92
|
+
const allLogs: CombinedLogEntry[] = combinedLogs.length > 0
|
|
93
|
+
? combinedLogs
|
|
94
|
+
: [
|
|
95
|
+
...aiLogs.map(log => ({
|
|
96
|
+
id: log.id,
|
|
97
|
+
timestamp: log.timestamp,
|
|
98
|
+
source: 'ai' as const,
|
|
99
|
+
strategyId: log.strategyId,
|
|
100
|
+
strategyName: log.strategyName,
|
|
101
|
+
type: log.type,
|
|
102
|
+
message: log.message,
|
|
103
|
+
data: log.data,
|
|
104
|
+
importance: log.importance,
|
|
105
|
+
})),
|
|
106
|
+
...forexLogs.map(log => ({
|
|
107
|
+
id: log.id,
|
|
108
|
+
timestamp: log.timestamp,
|
|
109
|
+
source: 'forex' as const,
|
|
110
|
+
type: log.type,
|
|
111
|
+
message: log.message,
|
|
112
|
+
data: log.data,
|
|
113
|
+
importance: log.importance,
|
|
114
|
+
})),
|
|
115
|
+
].sort((a, b) => a.timestamp - b.timestamp);
|
|
116
|
+
|
|
117
|
+
// Filter logs based on mode
|
|
118
|
+
const filteredLogs = allLogs.filter(log => {
|
|
119
|
+
if (mode === 'ai-only') return log.source === 'ai';
|
|
120
|
+
if (mode === 'forex-only') return log.source === 'forex';
|
|
121
|
+
return true;
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
const visibleLogs = filteredLogs.slice(-maxLogs);
|
|
125
|
+
|
|
126
|
+
const isAnyRunning = isAIRunning || isForexRunning;
|
|
127
|
+
|
|
128
|
+
// Auto-scroll
|
|
129
|
+
useEffect(() => {
|
|
130
|
+
if (autoScroll && scrollRef.current && selectedTab === 'console') {
|
|
131
|
+
setTimeout(() => scrollRef.current?.scrollToEnd({ animated: true }), 50);
|
|
132
|
+
}
|
|
133
|
+
}, [visibleLogs.length, autoScroll, selectedTab]);
|
|
134
|
+
|
|
135
|
+
const formatTime = (ts: number) => {
|
|
136
|
+
const d = new Date(ts);
|
|
137
|
+
return `${d.getHours().toString().padStart(2, '0')}:${d.getMinutes().toString().padStart(2, '0')}:${d.getSeconds().toString().padStart(2, '0')}`;
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
const getLogColor = (log: CombinedLogEntry): string => {
|
|
141
|
+
if (log.source === 'ai') {
|
|
142
|
+
return AI_LOG_COLORS[log.type as keyof typeof AI_LOG_COLORS] || textMuted;
|
|
143
|
+
}
|
|
144
|
+
return FOREX_LOG_COLORS[log.type as keyof typeof FOREX_LOG_COLORS] || textMuted;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const activeAgents = agents.filter(a => a.status === 'active');
|
|
148
|
+
const totalPnl = agents.reduce((sum, a) => sum + a.totalPnl, 0);
|
|
149
|
+
|
|
150
|
+
return (
|
|
151
|
+
<View style={[styles.container, { backgroundColor: bg }, style]}>
|
|
152
|
+
{/* Header */}
|
|
153
|
+
<View style={[styles.header, { borderBottomColor: border }]}>
|
|
154
|
+
<View style={styles.headerLeft}>
|
|
155
|
+
<Text style={[styles.title, { color: textPrimary }]}>Trading Console</Text>
|
|
156
|
+
<View style={styles.statusBadges}>
|
|
157
|
+
{mode !== 'forex-only' && (
|
|
158
|
+
<View style={[
|
|
159
|
+
styles.statusBadge,
|
|
160
|
+
{ backgroundColor: isAIRunning ? '#D1FAE5' : '#F3F4F6' }
|
|
161
|
+
]}>
|
|
162
|
+
<View style={[
|
|
163
|
+
styles.statusDot,
|
|
164
|
+
{ backgroundColor: isAIRunning ? '#10B981' : '#9CA3AF' }
|
|
165
|
+
]} />
|
|
166
|
+
<Text style={[
|
|
167
|
+
styles.statusText,
|
|
168
|
+
{ color: isAIRunning ? '#10B981' : '#9CA3AF' }
|
|
169
|
+
]}>
|
|
170
|
+
AI
|
|
171
|
+
</Text>
|
|
172
|
+
</View>
|
|
173
|
+
)}
|
|
174
|
+
{mode !== 'ai-only' && (
|
|
175
|
+
<View style={[
|
|
176
|
+
styles.statusBadge,
|
|
177
|
+
{ backgroundColor: isForexRunning ? '#DBEAFE' : '#F3F4F6' }
|
|
178
|
+
]}>
|
|
179
|
+
<View style={[
|
|
180
|
+
styles.statusDot,
|
|
181
|
+
{ backgroundColor: isForexRunning ? '#3B82F6' : '#9CA3AF' }
|
|
182
|
+
]} />
|
|
183
|
+
<Text style={[
|
|
184
|
+
styles.statusText,
|
|
185
|
+
{ color: isForexRunning ? '#3B82F6' : '#9CA3AF' }
|
|
186
|
+
]}>
|
|
187
|
+
FX
|
|
188
|
+
</Text>
|
|
189
|
+
</View>
|
|
190
|
+
)}
|
|
191
|
+
</View>
|
|
192
|
+
</View>
|
|
193
|
+
{showControls && (
|
|
194
|
+
<View style={styles.headerControls}>
|
|
195
|
+
{onClearLogs && (
|
|
196
|
+
<TouchableOpacity
|
|
197
|
+
style={[styles.controlBtn, { backgroundColor: cardBg }]}
|
|
198
|
+
onPress={onClearLogs}
|
|
199
|
+
activeOpacity={0.7}
|
|
200
|
+
>
|
|
201
|
+
<Text style={[styles.controlBtnText, { color: textSecondary }]}>Clear</Text>
|
|
202
|
+
</TouchableOpacity>
|
|
203
|
+
)}
|
|
204
|
+
{onRefresh && (
|
|
205
|
+
<TouchableOpacity
|
|
206
|
+
style={[styles.controlBtn, { backgroundColor: cardBg }]}
|
|
207
|
+
onPress={onRefresh}
|
|
208
|
+
activeOpacity={0.7}
|
|
209
|
+
>
|
|
210
|
+
<Text style={[styles.controlBtnText, { color: textSecondary }]}>Refresh</Text>
|
|
211
|
+
</TouchableOpacity>
|
|
212
|
+
)}
|
|
213
|
+
{(onStartAll || onStopAll) && (
|
|
214
|
+
<TouchableOpacity
|
|
215
|
+
style={[
|
|
216
|
+
styles.controlBtn,
|
|
217
|
+
{ backgroundColor: isAnyRunning ? '#FEE2E2' : '#D1FAE5' }
|
|
218
|
+
]}
|
|
219
|
+
onPress={isAnyRunning ? onStopAll : onStartAll}
|
|
220
|
+
activeOpacity={0.7}
|
|
221
|
+
>
|
|
222
|
+
<Text style={[
|
|
223
|
+
styles.controlBtnText,
|
|
224
|
+
{ color: isAnyRunning ? '#EF4444' : '#10B981' }
|
|
225
|
+
]}>
|
|
226
|
+
{isAnyRunning ? 'Stop' : 'Start'}
|
|
227
|
+
</Text>
|
|
228
|
+
</TouchableOpacity>
|
|
229
|
+
)}
|
|
230
|
+
</View>
|
|
231
|
+
)}
|
|
232
|
+
</View>
|
|
233
|
+
|
|
234
|
+
{/* Quick Stats */}
|
|
235
|
+
<View style={[styles.quickStats, { backgroundColor: cardBg, borderBottomColor: border }]}>
|
|
236
|
+
<View style={styles.quickStatItem}>
|
|
237
|
+
<Text style={[styles.quickStatLabel, { color: textMuted }]}>Agents</Text>
|
|
238
|
+
<Text style={[styles.quickStatValue, { color: textPrimary }]}>
|
|
239
|
+
{activeAgents.length}/{agents.length}
|
|
240
|
+
</Text>
|
|
241
|
+
</View>
|
|
242
|
+
<View style={styles.quickStatDivider} />
|
|
243
|
+
<View style={styles.quickStatItem}>
|
|
244
|
+
<Text style={[styles.quickStatLabel, { color: textMuted }]}>P&L</Text>
|
|
245
|
+
<Text style={[
|
|
246
|
+
styles.quickStatValue,
|
|
247
|
+
{ color: totalPnl >= 0 ? '#10B981' : '#EF4444' }
|
|
248
|
+
]}>
|
|
249
|
+
{totalPnl >= 0 ? '+' : ''}${totalPnl.toFixed(2)}
|
|
250
|
+
</Text>
|
|
251
|
+
</View>
|
|
252
|
+
<View style={styles.quickStatDivider} />
|
|
253
|
+
<View style={styles.quickStatItem}>
|
|
254
|
+
<Text style={[styles.quickStatLabel, { color: textMuted }]}>Logs</Text>
|
|
255
|
+
<Text style={[styles.quickStatValue, { color: textPrimary }]}>
|
|
256
|
+
{visibleLogs.length}
|
|
257
|
+
</Text>
|
|
258
|
+
</View>
|
|
259
|
+
</View>
|
|
260
|
+
|
|
261
|
+
{/* Tab Bar */}
|
|
262
|
+
<View style={[styles.tabBar, { borderBottomColor: border }]}>
|
|
263
|
+
<TouchableOpacity
|
|
264
|
+
style={[styles.tab, selectedTab === 'console' && styles.tabActive]}
|
|
265
|
+
onPress={() => setSelectedTab('console')}
|
|
266
|
+
activeOpacity={0.7}
|
|
267
|
+
>
|
|
268
|
+
<Text style={[
|
|
269
|
+
styles.tabText,
|
|
270
|
+
{ color: selectedTab === 'console' ? '#3B82F6' : textSecondary }
|
|
271
|
+
]}>
|
|
272
|
+
Console
|
|
273
|
+
</Text>
|
|
274
|
+
</TouchableOpacity>
|
|
275
|
+
{showMetrics && metrics && (
|
|
276
|
+
<TouchableOpacity
|
|
277
|
+
style={[styles.tab, selectedTab === 'metrics' && styles.tabActive]}
|
|
278
|
+
onPress={() => setSelectedTab('metrics')}
|
|
279
|
+
activeOpacity={0.7}
|
|
280
|
+
>
|
|
281
|
+
<Text style={[
|
|
282
|
+
styles.tabText,
|
|
283
|
+
{ color: selectedTab === 'metrics' ? '#3B82F6' : textSecondary }
|
|
284
|
+
]}>
|
|
285
|
+
Metrics
|
|
286
|
+
</Text>
|
|
287
|
+
</TouchableOpacity>
|
|
288
|
+
)}
|
|
289
|
+
{showRisk && riskStatus && (
|
|
290
|
+
<TouchableOpacity
|
|
291
|
+
style={[styles.tab, selectedTab === 'risk' && styles.tabActive]}
|
|
292
|
+
onPress={() => setSelectedTab('risk')}
|
|
293
|
+
activeOpacity={0.7}
|
|
294
|
+
>
|
|
295
|
+
<Text style={[
|
|
296
|
+
styles.tabText,
|
|
297
|
+
{ color: selectedTab === 'risk' ? '#3B82F6' : textSecondary }
|
|
298
|
+
]}>
|
|
299
|
+
Risk
|
|
300
|
+
</Text>
|
|
301
|
+
</TouchableOpacity>
|
|
302
|
+
)}
|
|
303
|
+
{agents.length > 0 && (
|
|
304
|
+
<TouchableOpacity
|
|
305
|
+
style={[styles.tab, selectedTab === 'agents' && styles.tabActive]}
|
|
306
|
+
onPress={() => setSelectedTab('agents')}
|
|
307
|
+
activeOpacity={0.7}
|
|
308
|
+
>
|
|
309
|
+
<Text style={[
|
|
310
|
+
styles.tabText,
|
|
311
|
+
{ color: selectedTab === 'agents' ? '#3B82F6' : textSecondary }
|
|
312
|
+
]}>
|
|
313
|
+
Agents
|
|
314
|
+
</Text>
|
|
315
|
+
</TouchableOpacity>
|
|
316
|
+
)}
|
|
317
|
+
</View>
|
|
318
|
+
|
|
319
|
+
{/* Content */}
|
|
320
|
+
{selectedTab === 'console' && (
|
|
321
|
+
<View style={[styles.consoleContainer, { backgroundColor: consoleBg, height: consoleHeight }]}>
|
|
322
|
+
<ScrollView
|
|
323
|
+
ref={scrollRef}
|
|
324
|
+
style={styles.consoleScroll}
|
|
325
|
+
contentContainerStyle={styles.consoleContent}
|
|
326
|
+
>
|
|
327
|
+
{visibleLogs.map((log) => (
|
|
328
|
+
<View key={log.id} style={styles.logRow}>
|
|
329
|
+
<Text style={[styles.logTime, { color: textMuted }]}>
|
|
330
|
+
{formatTime(log.timestamp)}
|
|
331
|
+
</Text>
|
|
332
|
+
<View style={[
|
|
333
|
+
styles.sourceBadge,
|
|
334
|
+
{ backgroundColor: log.source === 'ai' ? '#1E3A5F' : '#1E3A3A' }
|
|
335
|
+
]}>
|
|
336
|
+
<Text style={[
|
|
337
|
+
styles.sourceText,
|
|
338
|
+
{ color: log.source === 'ai' ? '#60A5FA' : '#5EEAD4' }
|
|
339
|
+
]}>
|
|
340
|
+
{log.source === 'ai' ? (log.strategyName || 'AI') : 'FX'}
|
|
341
|
+
</Text>
|
|
342
|
+
</View>
|
|
343
|
+
<Text style={[styles.logType, { color: getLogColor(log) }]}>
|
|
344
|
+
{log.type.padEnd(10)}
|
|
345
|
+
</Text>
|
|
346
|
+
<Text
|
|
347
|
+
style={[
|
|
348
|
+
styles.logMessage,
|
|
349
|
+
{ color: log.importance === 'high' ? textPrimary : textSecondary },
|
|
350
|
+
log.importance === 'high' && styles.logMessageHigh,
|
|
351
|
+
]}
|
|
352
|
+
numberOfLines={2}
|
|
353
|
+
>
|
|
354
|
+
{log.message}
|
|
355
|
+
</Text>
|
|
356
|
+
</View>
|
|
357
|
+
))}
|
|
358
|
+
{visibleLogs.length === 0 && (
|
|
359
|
+
<View style={styles.emptyState}>
|
|
360
|
+
<Text style={[styles.emptyIcon, { color: textMuted }]}>⚡</Text>
|
|
361
|
+
<Text style={[styles.emptyTitle, { color: textSecondary }]}>
|
|
362
|
+
No Activity Yet
|
|
363
|
+
</Text>
|
|
364
|
+
<Text style={[styles.emptyText, { color: textMuted }]}>
|
|
365
|
+
Start the trading simulation to see live activity
|
|
366
|
+
</Text>
|
|
367
|
+
</View>
|
|
368
|
+
)}
|
|
369
|
+
</ScrollView>
|
|
370
|
+
</View>
|
|
371
|
+
)}
|
|
372
|
+
|
|
373
|
+
{selectedTab === 'metrics' && metrics && (
|
|
374
|
+
<ScrollView style={styles.tabContent} contentContainerStyle={styles.tabContentInner}>
|
|
375
|
+
<OneMetricsDashboard
|
|
376
|
+
metrics={metrics}
|
|
377
|
+
showNAV={true}
|
|
378
|
+
showPnL={true}
|
|
379
|
+
showTrades={true}
|
|
380
|
+
showPositions={true}
|
|
381
|
+
showStrategies={true}
|
|
382
|
+
dark={dark}
|
|
383
|
+
/>
|
|
384
|
+
</ScrollView>
|
|
385
|
+
)}
|
|
386
|
+
|
|
387
|
+
{selectedTab === 'risk' && riskStatus && (
|
|
388
|
+
<ScrollView style={styles.tabContent} contentContainerStyle={styles.tabContentInner}>
|
|
389
|
+
<OneRiskIndicator
|
|
390
|
+
riskStatus={riskStatus}
|
|
391
|
+
showDetails={true}
|
|
392
|
+
showWarnings={true}
|
|
393
|
+
showLimits={true}
|
|
394
|
+
dark={dark}
|
|
395
|
+
/>
|
|
396
|
+
</ScrollView>
|
|
397
|
+
)}
|
|
398
|
+
|
|
399
|
+
{selectedTab === 'agents' && agents.length > 0 && (
|
|
400
|
+
<ScrollView style={styles.tabContent} contentContainerStyle={styles.tabContentInner}>
|
|
401
|
+
{agents.map(agent => (
|
|
402
|
+
<TouchableOpacity
|
|
403
|
+
key={agent.id}
|
|
404
|
+
style={[styles.agentRow, { backgroundColor: cardBg, borderColor: border }]}
|
|
405
|
+
onPress={() => onAgentSelect?.(agent)}
|
|
406
|
+
activeOpacity={0.7}
|
|
407
|
+
>
|
|
408
|
+
<View style={styles.agentLeft}>
|
|
409
|
+
<View style={[styles.agentDot, { backgroundColor: agent.color }]} />
|
|
410
|
+
<View>
|
|
411
|
+
<Text style={[styles.agentName, { color: textPrimary }]}>{agent.name}</Text>
|
|
412
|
+
<Text style={[styles.agentPair, { color: textMuted }]}>
|
|
413
|
+
{agent.currentPair || 'Idle'}
|
|
414
|
+
</Text>
|
|
415
|
+
</View>
|
|
416
|
+
</View>
|
|
417
|
+
<View style={styles.agentRight}>
|
|
418
|
+
<Text style={[
|
|
419
|
+
styles.agentPnl,
|
|
420
|
+
{ color: agent.totalPnl >= 0 ? '#10B981' : '#EF4444' }
|
|
421
|
+
]}>
|
|
422
|
+
{agent.totalPnl >= 0 ? '+' : ''}${agent.totalPnl.toFixed(2)}
|
|
423
|
+
</Text>
|
|
424
|
+
<View style={[
|
|
425
|
+
styles.agentStatus,
|
|
426
|
+
{ backgroundColor: agent.status === 'active' ? '#D1FAE5' : '#F3F4F6' }
|
|
427
|
+
]}>
|
|
428
|
+
<Text style={[
|
|
429
|
+
styles.agentStatusText,
|
|
430
|
+
{ color: agent.status === 'active' ? '#10B981' : '#9CA3AF' }
|
|
431
|
+
]}>
|
|
432
|
+
{agent.status}
|
|
433
|
+
</Text>
|
|
434
|
+
</View>
|
|
435
|
+
</View>
|
|
436
|
+
</TouchableOpacity>
|
|
437
|
+
))}
|
|
438
|
+
</ScrollView>
|
|
439
|
+
)}
|
|
440
|
+
</View>
|
|
441
|
+
);
|
|
442
|
+
};
|
|
443
|
+
|
|
444
|
+
const styles = StyleSheet.create({
|
|
445
|
+
container: {
|
|
446
|
+
flex: 1,
|
|
447
|
+
borderRadius: 12,
|
|
448
|
+
overflow: 'hidden',
|
|
449
|
+
},
|
|
450
|
+
header: {
|
|
451
|
+
flexDirection: 'row',
|
|
452
|
+
justifyContent: 'space-between',
|
|
453
|
+
alignItems: 'center',
|
|
454
|
+
padding: 14,
|
|
455
|
+
borderBottomWidth: 1,
|
|
456
|
+
},
|
|
457
|
+
headerLeft: {
|
|
458
|
+
flexDirection: 'row',
|
|
459
|
+
alignItems: 'center',
|
|
460
|
+
gap: 10,
|
|
461
|
+
},
|
|
462
|
+
headerControls: {
|
|
463
|
+
flexDirection: 'row',
|
|
464
|
+
gap: 8,
|
|
465
|
+
},
|
|
466
|
+
title: {
|
|
467
|
+
fontSize: 16,
|
|
468
|
+
fontWeight: '700',
|
|
469
|
+
},
|
|
470
|
+
statusBadges: {
|
|
471
|
+
flexDirection: 'row',
|
|
472
|
+
gap: 6,
|
|
473
|
+
},
|
|
474
|
+
statusBadge: {
|
|
475
|
+
flexDirection: 'row',
|
|
476
|
+
alignItems: 'center',
|
|
477
|
+
paddingHorizontal: 6,
|
|
478
|
+
paddingVertical: 3,
|
|
479
|
+
borderRadius: 10,
|
|
480
|
+
gap: 4,
|
|
481
|
+
},
|
|
482
|
+
statusDot: {
|
|
483
|
+
width: 6,
|
|
484
|
+
height: 6,
|
|
485
|
+
borderRadius: 3,
|
|
486
|
+
},
|
|
487
|
+
statusText: {
|
|
488
|
+
fontSize: 10,
|
|
489
|
+
fontWeight: '600',
|
|
490
|
+
},
|
|
491
|
+
controlBtn: {
|
|
492
|
+
paddingHorizontal: 10,
|
|
493
|
+
paddingVertical: 5,
|
|
494
|
+
borderRadius: 6,
|
|
495
|
+
},
|
|
496
|
+
controlBtnText: {
|
|
497
|
+
fontSize: 11,
|
|
498
|
+
fontWeight: '600',
|
|
499
|
+
},
|
|
500
|
+
quickStats: {
|
|
501
|
+
flexDirection: 'row',
|
|
502
|
+
justifyContent: 'space-around',
|
|
503
|
+
alignItems: 'center',
|
|
504
|
+
paddingVertical: 10,
|
|
505
|
+
borderBottomWidth: 1,
|
|
506
|
+
},
|
|
507
|
+
quickStatItem: {
|
|
508
|
+
alignItems: 'center',
|
|
509
|
+
gap: 2,
|
|
510
|
+
},
|
|
511
|
+
quickStatLabel: {
|
|
512
|
+
fontFamily: MONO,
|
|
513
|
+
fontSize: 9,
|
|
514
|
+
textTransform: 'uppercase',
|
|
515
|
+
},
|
|
516
|
+
quickStatValue: {
|
|
517
|
+
fontFamily: MONO,
|
|
518
|
+
fontSize: 14,
|
|
519
|
+
fontWeight: '700',
|
|
520
|
+
},
|
|
521
|
+
quickStatDivider: {
|
|
522
|
+
width: 1,
|
|
523
|
+
height: 24,
|
|
524
|
+
backgroundColor: '#2A2A35',
|
|
525
|
+
},
|
|
526
|
+
tabBar: {
|
|
527
|
+
flexDirection: 'row',
|
|
528
|
+
borderBottomWidth: 1,
|
|
529
|
+
},
|
|
530
|
+
tab: {
|
|
531
|
+
flex: 1,
|
|
532
|
+
paddingVertical: 10,
|
|
533
|
+
alignItems: 'center',
|
|
534
|
+
borderBottomWidth: 2,
|
|
535
|
+
borderBottomColor: 'transparent',
|
|
536
|
+
},
|
|
537
|
+
tabActive: {
|
|
538
|
+
borderBottomColor: '#3B82F6',
|
|
539
|
+
},
|
|
540
|
+
tabText: {
|
|
541
|
+
fontSize: 12,
|
|
542
|
+
fontWeight: '600',
|
|
543
|
+
},
|
|
544
|
+
consoleContainer: {
|
|
545
|
+
overflow: 'hidden',
|
|
546
|
+
},
|
|
547
|
+
consoleScroll: {
|
|
548
|
+
flex: 1,
|
|
549
|
+
},
|
|
550
|
+
consoleContent: {
|
|
551
|
+
padding: 8,
|
|
552
|
+
},
|
|
553
|
+
logRow: {
|
|
554
|
+
flexDirection: 'row',
|
|
555
|
+
alignItems: 'flex-start',
|
|
556
|
+
paddingVertical: 2,
|
|
557
|
+
},
|
|
558
|
+
logTime: {
|
|
559
|
+
fontFamily: MONO,
|
|
560
|
+
fontSize: 10,
|
|
561
|
+
width: 55,
|
|
562
|
+
marginRight: 6,
|
|
563
|
+
},
|
|
564
|
+
sourceBadge: {
|
|
565
|
+
paddingHorizontal: 4,
|
|
566
|
+
paddingVertical: 1,
|
|
567
|
+
borderRadius: 3,
|
|
568
|
+
marginRight: 6,
|
|
569
|
+
minWidth: 28,
|
|
570
|
+
alignItems: 'center',
|
|
571
|
+
},
|
|
572
|
+
sourceText: {
|
|
573
|
+
fontFamily: MONO,
|
|
574
|
+
fontSize: 8,
|
|
575
|
+
fontWeight: '700',
|
|
576
|
+
},
|
|
577
|
+
logType: {
|
|
578
|
+
fontFamily: MONO,
|
|
579
|
+
fontSize: 10,
|
|
580
|
+
fontWeight: '700',
|
|
581
|
+
width: 75,
|
|
582
|
+
marginRight: 6,
|
|
583
|
+
},
|
|
584
|
+
logMessage: {
|
|
585
|
+
fontFamily: MONO,
|
|
586
|
+
fontSize: 10,
|
|
587
|
+
flex: 1,
|
|
588
|
+
},
|
|
589
|
+
logMessageHigh: {
|
|
590
|
+
fontWeight: '600',
|
|
591
|
+
},
|
|
592
|
+
emptyState: {
|
|
593
|
+
alignItems: 'center',
|
|
594
|
+
paddingVertical: 60,
|
|
595
|
+
gap: 12,
|
|
596
|
+
},
|
|
597
|
+
emptyIcon: {
|
|
598
|
+
fontSize: 36,
|
|
599
|
+
},
|
|
600
|
+
emptyTitle: {
|
|
601
|
+
fontSize: 14,
|
|
602
|
+
fontWeight: '600',
|
|
603
|
+
},
|
|
604
|
+
emptyText: {
|
|
605
|
+
fontSize: 12,
|
|
606
|
+
textAlign: 'center',
|
|
607
|
+
},
|
|
608
|
+
tabContent: {
|
|
609
|
+
flex: 1,
|
|
610
|
+
},
|
|
611
|
+
tabContentInner: {
|
|
612
|
+
padding: 14,
|
|
613
|
+
},
|
|
614
|
+
agentRow: {
|
|
615
|
+
flexDirection: 'row',
|
|
616
|
+
justifyContent: 'space-between',
|
|
617
|
+
alignItems: 'center',
|
|
618
|
+
padding: 12,
|
|
619
|
+
borderRadius: 8,
|
|
620
|
+
borderWidth: 1,
|
|
621
|
+
marginBottom: 8,
|
|
622
|
+
},
|
|
623
|
+
agentLeft: {
|
|
624
|
+
flexDirection: 'row',
|
|
625
|
+
alignItems: 'center',
|
|
626
|
+
gap: 10,
|
|
627
|
+
},
|
|
628
|
+
agentDot: {
|
|
629
|
+
width: 10,
|
|
630
|
+
height: 10,
|
|
631
|
+
borderRadius: 5,
|
|
632
|
+
},
|
|
633
|
+
agentName: {
|
|
634
|
+
fontSize: 13,
|
|
635
|
+
fontWeight: '600',
|
|
636
|
+
},
|
|
637
|
+
agentPair: {
|
|
638
|
+
fontFamily: MONO,
|
|
639
|
+
fontSize: 10,
|
|
640
|
+
},
|
|
641
|
+
agentRight: {
|
|
642
|
+
alignItems: 'flex-end',
|
|
643
|
+
gap: 4,
|
|
644
|
+
},
|
|
645
|
+
agentPnl: {
|
|
646
|
+
fontFamily: MONO,
|
|
647
|
+
fontSize: 14,
|
|
648
|
+
fontWeight: '600',
|
|
649
|
+
},
|
|
650
|
+
agentStatus: {
|
|
651
|
+
paddingHorizontal: 6,
|
|
652
|
+
paddingVertical: 2,
|
|
653
|
+
borderRadius: 4,
|
|
654
|
+
},
|
|
655
|
+
agentStatusText: {
|
|
656
|
+
fontSize: 9,
|
|
657
|
+
fontWeight: '600',
|
|
658
|
+
textTransform: 'uppercase',
|
|
659
|
+
},
|
|
660
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ONE SDK - Trading Console Components
|
|
3
|
+
* Real-time trading console UI components
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// Main Console Views
|
|
7
|
+
export * from './OneTradingConsole';
|
|
8
|
+
export * from './OneAIQuantConsole';
|
|
9
|
+
export * from './OneAgentConsole';
|
|
10
|
+
export * from './OnePositionDetail';
|
|
11
|
+
|
|
12
|
+
// Building Block Components
|
|
13
|
+
export * from './OneAgentCard';
|
|
14
|
+
export * from './OnePositionCard';
|
|
15
|
+
export * from './OneRiskIndicator';
|
|
16
|
+
export * from './OneMetricsDashboard';
|
|
17
|
+
export * from './OneDecisionTimeline';
|
|
@@ -15,3 +15,13 @@ export * from './OneCycleSelector';
|
|
|
15
15
|
|
|
16
16
|
// Trading Pair Selection
|
|
17
17
|
export * from './OnePairSelector';
|
|
18
|
+
|
|
19
|
+
// StableFX Forex Components
|
|
20
|
+
export * from './OneForexPoolCard';
|
|
21
|
+
export * from './OneForexCapitalSplit';
|
|
22
|
+
export * from './OneForexConsoleView';
|
|
23
|
+
export * from './OneForexPairSelector';
|
|
24
|
+
export * from './OneForexTradeHistory';
|
|
25
|
+
|
|
26
|
+
// Trading Console Components
|
|
27
|
+
export * from './console';
|