@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.
Files changed (104) hide show
  1. package/README.md +339 -0
  2. package/dist/ForexPoolDataGenerator--__twRwl.d.mts +76 -0
  3. package/dist/ForexPoolDataGenerator-eUgwsU_B.d.ts +76 -0
  4. package/dist/OneForexTradeHistory-TlKxjbFF.d.ts +250 -0
  5. package/dist/OneForexTradeHistory-iDySMcw0.d.mts +250 -0
  6. package/dist/components/index.d.mts +539 -0
  7. package/dist/components/index.d.ts +539 -0
  8. package/dist/components/index.js +7295 -0
  9. package/dist/components/index.js.map +1 -0
  10. package/dist/components/index.mjs +7243 -0
  11. package/dist/components/index.mjs.map +1 -0
  12. package/dist/config/index.d.mts +1 -0
  13. package/dist/config/index.d.ts +1 -0
  14. package/dist/console-BfTMA7ah.d.mts +504 -0
  15. package/dist/console-BfTMA7ah.d.ts +504 -0
  16. package/dist/hooks/index.d.mts +323 -1
  17. package/dist/hooks/index.d.ts +323 -1
  18. package/dist/hooks/index.js +3223 -0
  19. package/dist/hooks/index.js.map +1 -1
  20. package/dist/hooks/index.mjs +3204 -1
  21. package/dist/hooks/index.mjs.map +1 -1
  22. package/dist/index.d.mts +18 -352
  23. package/dist/index.d.ts +18 -352
  24. package/dist/index.js +8646 -574
  25. package/dist/index.js.map +1 -1
  26. package/dist/index.mjs +8449 -432
  27. package/dist/index.mjs.map +1 -1
  28. package/dist/providers/index.d.mts +31 -31
  29. package/dist/providers/index.d.ts +31 -31
  30. package/dist/providers/index.js +140 -153
  31. package/dist/providers/index.js.map +1 -1
  32. package/dist/providers/index.mjs +100 -109
  33. package/dist/providers/index.mjs.map +1 -1
  34. package/dist/react-native.d.mts +8 -140
  35. package/dist/react-native.d.ts +8 -140
  36. package/dist/react-native.js +2527 -0
  37. package/dist/react-native.js.map +1 -1
  38. package/dist/react-native.mjs +2497 -2
  39. package/dist/react-native.mjs.map +1 -1
  40. package/dist/services/index.d.mts +85 -4
  41. package/dist/services/index.d.ts +85 -4
  42. package/dist/services/index.js +1621 -0
  43. package/dist/services/index.js.map +1 -1
  44. package/dist/services/index.mjs +1619 -1
  45. package/dist/services/index.mjs.map +1 -1
  46. package/dist/types/index.d.mts +203 -1
  47. package/dist/types/index.d.ts +203 -1
  48. package/dist/types/index.js +275 -0
  49. package/dist/types/index.js.map +1 -1
  50. package/dist/types/index.mjs +251 -0
  51. package/dist/types/index.mjs.map +1 -1
  52. package/dist/useForexTrading-BleeSor8.d.mts +80 -0
  53. package/dist/useForexTrading-ZgW_G40Q.d.ts +80 -0
  54. package/package.json +9 -2
  55. package/src/components/OneConnectButton.tsx +24 -1
  56. package/src/components/OneNFTGallery.tsx +13 -7
  57. package/src/components/OneOfframpWidget.tsx +4 -3
  58. package/src/components/OnePayWidget.tsx +10 -1
  59. package/src/components/OneSendWidget.tsx +3 -3
  60. package/src/components/OneSwapWidget.tsx +4 -4
  61. package/src/components/OneTransactionButton.tsx +28 -3
  62. package/src/components/OneWalletBalance.tsx +1 -1
  63. package/src/components/ai/OneForexCapitalSplit.tsx +112 -0
  64. package/src/components/ai/OneForexConsoleView.tsx +90 -0
  65. package/src/components/ai/OneForexPairSelector.tsx +101 -0
  66. package/src/components/ai/OneForexPoolCard.tsx +105 -0
  67. package/src/components/ai/OneForexTradeHistory.tsx +107 -0
  68. package/src/components/ai/console/OneAIQuantConsole.tsx +423 -0
  69. package/src/components/ai/console/OneAgentCard.tsx +383 -0
  70. package/src/components/ai/console/OneAgentConsole.tsx +469 -0
  71. package/src/components/ai/console/OneDecisionTimeline.tsx +433 -0
  72. package/src/components/ai/console/OneMetricsDashboard.tsx +493 -0
  73. package/src/components/ai/console/OnePositionCard.tsx +406 -0
  74. package/src/components/ai/console/OnePositionDetail.tsx +600 -0
  75. package/src/components/ai/console/OneRiskIndicator.tsx +464 -0
  76. package/src/components/ai/console/OneTradingConsole.tsx +660 -0
  77. package/src/components/ai/console/index.ts +17 -0
  78. package/src/components/ai/index.ts +10 -0
  79. package/src/hooks/index.ts +46 -0
  80. package/src/hooks/useAIDecisions.ts +280 -0
  81. package/src/hooks/useAIPositions.ts +349 -0
  82. package/src/hooks/useAIQuantConsole.ts +283 -0
  83. package/src/hooks/useAIRiskStatus.ts +276 -0
  84. package/src/hooks/useAITrading.ts +190 -0
  85. package/src/hooks/useBotSimulation.ts +201 -0
  86. package/src/hooks/useForexTrading.ts +430 -0
  87. package/src/hooks/useTradingConsole.ts +243 -0
  88. package/src/index.ts +123 -5
  89. package/src/providers/OneProvider.tsx +181 -5
  90. package/src/providers/index.ts +22 -8
  91. package/src/react-native.ts +41 -0
  92. package/src/services/forex/BotSimulationEngine.ts +968 -0
  93. package/src/services/forex/ForexPoolDataGenerator.ts +542 -0
  94. package/src/services/forex/ForexSimulationEngine.ts +482 -0
  95. package/src/services/forex/index.ts +21 -0
  96. package/src/services/index.ts +16 -0
  97. package/src/types/aiTrading.ts +151 -0
  98. package/src/types/console.ts +380 -0
  99. package/src/types/forex.ts +282 -0
  100. package/src/types/index.ts +106 -0
  101. package/dist/price-CgqXPnT3.d.ts +0 -13
  102. package/dist/price-ClbLHHjv.d.mts +0 -13
  103. package/dist/supabase-BT0c7q9e.d.mts +0 -82
  104. package/dist/supabase-BT0c7q9e.d.ts +0 -82
@@ -0,0 +1,423 @@
1
+ /**
2
+ * OneAIQuantConsole - All 7 AI agents overview
3
+ * Part of ONE Ecosystem SDK
4
+ */
5
+
6
+ import React, { useState } from 'react';
7
+ import { View, Text, StyleSheet, ScrollView, ViewStyle, Platform, TouchableOpacity } from 'react-native';
8
+ import type { AIAgent, ConsoleMetrics, RiskStatus } from '../../../types/console';
9
+ import { OneAgentCard } from './OneAgentCard';
10
+ import { OneMetricsDashboard } from './OneMetricsDashboard';
11
+ import { OneRiskIndicator } from './OneRiskIndicator';
12
+
13
+ const MONO = Platform.OS === 'ios' ? 'Courier New' : 'monospace';
14
+
15
+ export interface OneAIQuantConsoleProps {
16
+ agents: AIAgent[];
17
+ metrics?: ConsoleMetrics;
18
+ riskStatus?: RiskStatus | null;
19
+ layout?: 'list' | 'grid' | 'compact';
20
+ showMetrics?: boolean;
21
+ showRisk?: boolean;
22
+ showPerformance?: boolean;
23
+ showPositions?: boolean;
24
+ onAgentSelect?: (agent: AIAgent) => void;
25
+ onStartAll?: () => void;
26
+ onStopAll?: () => void;
27
+ isRunning?: boolean;
28
+ style?: ViewStyle;
29
+ dark?: boolean;
30
+ }
31
+
32
+ export const OneAIQuantConsole: React.FC<OneAIQuantConsoleProps> = ({
33
+ agents,
34
+ metrics,
35
+ riskStatus,
36
+ layout = 'list',
37
+ showMetrics = true,
38
+ showRisk = true,
39
+ showPerformance = true,
40
+ showPositions = true,
41
+ onAgentSelect,
42
+ onStartAll,
43
+ onStopAll,
44
+ isRunning = false,
45
+ style,
46
+ dark = true,
47
+ }) => {
48
+ const bg = dark ? '#0A0A0C' : '#ffffff';
49
+ const border = dark ? '#2A2A35' : '#E5E7EB';
50
+ const textPrimary = dark ? '#ffffff' : '#111827';
51
+ const textSecondary = dark ? '#9CA3AF' : '#6B7280';
52
+ const textMuted = dark ? '#555560' : '#9CA3AF';
53
+ const cardBg = dark ? '#111111' : '#F9FAFB';
54
+
55
+ const [selectedTab, setSelectedTab] = useState<'agents' | 'metrics' | 'risk'>('agents');
56
+
57
+ const activeAgents = agents.filter(a => a.status === 'active');
58
+ const totalPnl = agents.reduce((sum, a) => sum + a.totalPnl, 0);
59
+ const totalPositions = agents.reduce((sum, a) => sum + a.openPositions, 0);
60
+
61
+ const handleAgentPress = (agent: AIAgent) => {
62
+ if (onAgentSelect) {
63
+ onAgentSelect(agent);
64
+ }
65
+ };
66
+
67
+ const renderAgentList = () => {
68
+ if (layout === 'compact') {
69
+ return (
70
+ <View style={styles.compactGrid}>
71
+ {agents.map(agent => (
72
+ <OneAgentCard
73
+ key={agent.id}
74
+ agent={agent}
75
+ onPress={handleAgentPress}
76
+ compact={true}
77
+ dark={dark}
78
+ style={styles.compactCard}
79
+ />
80
+ ))}
81
+ </View>
82
+ );
83
+ }
84
+
85
+ if (layout === 'grid') {
86
+ return (
87
+ <View style={styles.agentGrid}>
88
+ {agents.map(agent => (
89
+ <View key={agent.id} style={styles.gridItem}>
90
+ <OneAgentCard
91
+ agent={agent}
92
+ onPress={handleAgentPress}
93
+ showMetrics={showPerformance}
94
+ showIndicators={true}
95
+ dark={dark}
96
+ />
97
+ </View>
98
+ ))}
99
+ </View>
100
+ );
101
+ }
102
+
103
+ // Default: list layout
104
+ return (
105
+ <View style={styles.agentList}>
106
+ {agents.map(agent => (
107
+ <OneAgentCard
108
+ key={agent.id}
109
+ agent={agent}
110
+ onPress={handleAgentPress}
111
+ showMetrics={showPerformance}
112
+ showIndicators={showPositions}
113
+ dark={dark}
114
+ />
115
+ ))}
116
+ </View>
117
+ );
118
+ };
119
+
120
+ return (
121
+ <View style={[styles.container, { backgroundColor: bg }, style]}>
122
+ {/* Header */}
123
+ <View style={[styles.header, { borderBottomColor: border }]}>
124
+ <View style={styles.headerLeft}>
125
+ <Text style={[styles.title, { color: textPrimary }]}>AI Quant Console</Text>
126
+ <View style={[styles.statusBadge, { backgroundColor: isRunning ? '#D1FAE5' : '#F3F4F6' }]}>
127
+ <View style={[
128
+ styles.statusDot,
129
+ { backgroundColor: isRunning ? '#10B981' : '#9CA3AF' }
130
+ ]} />
131
+ <Text style={[
132
+ styles.statusText,
133
+ { color: isRunning ? '#10B981' : '#9CA3AF' }
134
+ ]}>
135
+ {isRunning ? 'Running' : 'Stopped'}
136
+ </Text>
137
+ </View>
138
+ </View>
139
+ <View style={styles.headerRight}>
140
+ {onStartAll && onStopAll && (
141
+ <TouchableOpacity
142
+ style={[
143
+ styles.controlButton,
144
+ { backgroundColor: isRunning ? '#FEE2E2' : '#D1FAE5' }
145
+ ]}
146
+ onPress={isRunning ? onStopAll : onStartAll}
147
+ activeOpacity={0.7}
148
+ >
149
+ <Text style={[
150
+ styles.controlButtonText,
151
+ { color: isRunning ? '#EF4444' : '#10B981' }
152
+ ]}>
153
+ {isRunning ? 'Stop All' : 'Start All'}
154
+ </Text>
155
+ </TouchableOpacity>
156
+ )}
157
+ </View>
158
+ </View>
159
+
160
+ {/* Quick Stats */}
161
+ <View style={[styles.quickStats, { backgroundColor: cardBg, borderBottomColor: border }]}>
162
+ <View style={styles.quickStatItem}>
163
+ <Text style={[styles.quickStatLabel, { color: textMuted }]}>Agents</Text>
164
+ <Text style={[styles.quickStatValue, { color: textPrimary }]}>
165
+ {activeAgents.length}/{agents.length}
166
+ </Text>
167
+ </View>
168
+ <View style={styles.quickStatDivider} />
169
+ <View style={styles.quickStatItem}>
170
+ <Text style={[styles.quickStatLabel, { color: textMuted }]}>Total P&L</Text>
171
+ <Text style={[
172
+ styles.quickStatValue,
173
+ { color: totalPnl >= 0 ? '#10B981' : '#EF4444' }
174
+ ]}>
175
+ {totalPnl >= 0 ? '+' : ''}${totalPnl.toFixed(2)}
176
+ </Text>
177
+ </View>
178
+ <View style={styles.quickStatDivider} />
179
+ <View style={styles.quickStatItem}>
180
+ <Text style={[styles.quickStatLabel, { color: textMuted }]}>Positions</Text>
181
+ <Text style={[styles.quickStatValue, { color: textPrimary }]}>
182
+ {totalPositions}
183
+ </Text>
184
+ </View>
185
+ </View>
186
+
187
+ {/* Tab Navigation */}
188
+ <View style={[styles.tabBar, { borderBottomColor: border }]}>
189
+ <TouchableOpacity
190
+ style={[
191
+ styles.tab,
192
+ selectedTab === 'agents' && styles.tabActive,
193
+ selectedTab === 'agents' && { borderBottomColor: '#3B82F6' }
194
+ ]}
195
+ onPress={() => setSelectedTab('agents')}
196
+ activeOpacity={0.7}
197
+ >
198
+ <Text style={[
199
+ styles.tabText,
200
+ { color: selectedTab === 'agents' ? '#3B82F6' : textSecondary }
201
+ ]}>
202
+ Agents ({agents.length})
203
+ </Text>
204
+ </TouchableOpacity>
205
+ {showMetrics && metrics && (
206
+ <TouchableOpacity
207
+ style={[
208
+ styles.tab,
209
+ selectedTab === 'metrics' && styles.tabActive,
210
+ selectedTab === 'metrics' && { borderBottomColor: '#3B82F6' }
211
+ ]}
212
+ onPress={() => setSelectedTab('metrics')}
213
+ activeOpacity={0.7}
214
+ >
215
+ <Text style={[
216
+ styles.tabText,
217
+ { color: selectedTab === 'metrics' ? '#3B82F6' : textSecondary }
218
+ ]}>
219
+ Metrics
220
+ </Text>
221
+ </TouchableOpacity>
222
+ )}
223
+ {showRisk && riskStatus && (
224
+ <TouchableOpacity
225
+ style={[
226
+ styles.tab,
227
+ selectedTab === 'risk' && styles.tabActive,
228
+ selectedTab === 'risk' && { borderBottomColor: '#3B82F6' }
229
+ ]}
230
+ onPress={() => setSelectedTab('risk')}
231
+ activeOpacity={0.7}
232
+ >
233
+ <Text style={[
234
+ styles.tabText,
235
+ { color: selectedTab === 'risk' ? '#3B82F6' : textSecondary }
236
+ ]}>
237
+ Risk
238
+ </Text>
239
+ </TouchableOpacity>
240
+ )}
241
+ </View>
242
+
243
+ {/* Content */}
244
+ <ScrollView style={styles.content} contentContainerStyle={styles.contentInner}>
245
+ {selectedTab === 'agents' && renderAgentList()}
246
+
247
+ {selectedTab === 'metrics' && metrics && (
248
+ <OneMetricsDashboard
249
+ metrics={metrics}
250
+ showNAV={true}
251
+ showPnL={true}
252
+ showTrades={true}
253
+ showPositions={true}
254
+ showStrategies={true}
255
+ dark={dark}
256
+ />
257
+ )}
258
+
259
+ {selectedTab === 'risk' && riskStatus && (
260
+ <OneRiskIndicator
261
+ riskStatus={riskStatus}
262
+ showDetails={true}
263
+ showWarnings={true}
264
+ showLimits={true}
265
+ dark={dark}
266
+ />
267
+ )}
268
+
269
+ {/* Empty state */}
270
+ {agents.length === 0 && selectedTab === 'agents' && (
271
+ <View style={styles.emptyState}>
272
+ <Text style={[styles.emptyIcon, { color: textMuted }]}>⚡</Text>
273
+ <Text style={[styles.emptyTitle, { color: textSecondary }]}>
274
+ No Agents Available
275
+ </Text>
276
+ <Text style={[styles.emptyText, { color: textMuted }]}>
277
+ Start the simulation to see AI trading agents
278
+ </Text>
279
+ </View>
280
+ )}
281
+ </ScrollView>
282
+ </View>
283
+ );
284
+ };
285
+
286
+ const styles = StyleSheet.create({
287
+ container: {
288
+ flex: 1,
289
+ borderRadius: 12,
290
+ overflow: 'hidden',
291
+ },
292
+ header: {
293
+ flexDirection: 'row',
294
+ justifyContent: 'space-between',
295
+ alignItems: 'center',
296
+ padding: 14,
297
+ borderBottomWidth: 1,
298
+ },
299
+ headerLeft: {
300
+ flexDirection: 'row',
301
+ alignItems: 'center',
302
+ gap: 10,
303
+ },
304
+ headerRight: {
305
+ flexDirection: 'row',
306
+ alignItems: 'center',
307
+ gap: 8,
308
+ },
309
+ title: {
310
+ fontSize: 16,
311
+ fontWeight: '700',
312
+ },
313
+ statusBadge: {
314
+ flexDirection: 'row',
315
+ alignItems: 'center',
316
+ paddingHorizontal: 8,
317
+ paddingVertical: 4,
318
+ borderRadius: 12,
319
+ gap: 4,
320
+ },
321
+ statusDot: {
322
+ width: 6,
323
+ height: 6,
324
+ borderRadius: 3,
325
+ },
326
+ statusText: {
327
+ fontSize: 11,
328
+ fontWeight: '600',
329
+ },
330
+ controlButton: {
331
+ paddingHorizontal: 12,
332
+ paddingVertical: 6,
333
+ borderRadius: 6,
334
+ },
335
+ controlButtonText: {
336
+ fontSize: 12,
337
+ fontWeight: '600',
338
+ },
339
+ quickStats: {
340
+ flexDirection: 'row',
341
+ justifyContent: 'space-around',
342
+ alignItems: 'center',
343
+ paddingVertical: 12,
344
+ borderBottomWidth: 1,
345
+ },
346
+ quickStatItem: {
347
+ alignItems: 'center',
348
+ gap: 2,
349
+ },
350
+ quickStatLabel: {
351
+ fontFamily: MONO,
352
+ fontSize: 9,
353
+ textTransform: 'uppercase',
354
+ },
355
+ quickStatValue: {
356
+ fontFamily: MONO,
357
+ fontSize: 16,
358
+ fontWeight: '700',
359
+ },
360
+ quickStatDivider: {
361
+ width: 1,
362
+ height: 30,
363
+ backgroundColor: '#2A2A35',
364
+ },
365
+ tabBar: {
366
+ flexDirection: 'row',
367
+ borderBottomWidth: 1,
368
+ },
369
+ tab: {
370
+ flex: 1,
371
+ paddingVertical: 12,
372
+ alignItems: 'center',
373
+ borderBottomWidth: 2,
374
+ borderBottomColor: 'transparent',
375
+ },
376
+ tabActive: {
377
+ borderBottomWidth: 2,
378
+ },
379
+ tabText: {
380
+ fontSize: 13,
381
+ fontWeight: '600',
382
+ },
383
+ content: {
384
+ flex: 1,
385
+ },
386
+ contentInner: {
387
+ padding: 14,
388
+ gap: 12,
389
+ },
390
+ agentList: {
391
+ gap: 12,
392
+ },
393
+ agentGrid: {
394
+ flexDirection: 'row',
395
+ flexWrap: 'wrap',
396
+ gap: 12,
397
+ },
398
+ gridItem: {
399
+ width: '48%',
400
+ },
401
+ compactGrid: {
402
+ gap: 8,
403
+ },
404
+ compactCard: {
405
+ marginBottom: 0,
406
+ },
407
+ emptyState: {
408
+ alignItems: 'center',
409
+ paddingVertical: 60,
410
+ gap: 12,
411
+ },
412
+ emptyIcon: {
413
+ fontSize: 40,
414
+ },
415
+ emptyTitle: {
416
+ fontSize: 16,
417
+ fontWeight: '600',
418
+ },
419
+ emptyText: {
420
+ fontSize: 13,
421
+ textAlign: 'center',
422
+ },
423
+ });