@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,383 @@
1
+ /**
2
+ * OneAgentCard - Displays agent status and mini metrics
3
+ * Part of ONE Ecosystem SDK
4
+ */
5
+
6
+ import React from 'react';
7
+ import { View, Text, StyleSheet, TouchableOpacity, ViewStyle, Platform } from 'react-native';
8
+ import type { AIAgent } from '../../../types/console';
9
+ import { AGENT_STATUS_COLORS, RISK_LEVEL_COLORS, formatPnl } from '../../../types/console';
10
+
11
+ const MONO = Platform.OS === 'ios' ? 'Courier New' : 'monospace';
12
+
13
+ export interface OneAgentCardProps {
14
+ agent: AIAgent;
15
+ onPress?: (agent: AIAgent) => void;
16
+ showMetrics?: boolean;
17
+ showIndicators?: boolean;
18
+ compact?: boolean;
19
+ style?: ViewStyle;
20
+ dark?: boolean;
21
+ }
22
+
23
+ export const OneAgentCard: React.FC<OneAgentCardProps> = ({
24
+ agent,
25
+ onPress,
26
+ showMetrics = true,
27
+ showIndicators = true,
28
+ compact = false,
29
+ style,
30
+ dark = true,
31
+ }) => {
32
+ const bg = dark ? '#111111' : '#ffffff';
33
+ const border = dark ? '#2A2A35' : '#E5E7EB';
34
+ const textPrimary = dark ? '#ffffff' : '#111827';
35
+ const textSecondary = dark ? '#9CA3AF' : '#6B7280';
36
+ const textMuted = dark ? '#555560' : '#9CA3AF';
37
+
38
+ const statusConfig = AGENT_STATUS_COLORS[agent.status];
39
+ const riskConfig = RISK_LEVEL_COLORS[agent.riskLevel];
40
+
41
+ const handlePress = () => {
42
+ if (onPress) {
43
+ onPress(agent);
44
+ }
45
+ };
46
+
47
+ // Render content shared between pressable and non-pressable versions
48
+ const renderCompactContent = () => (
49
+ <>
50
+ <View style={[styles.statusDot, { backgroundColor: statusConfig.color }]} />
51
+ <Text style={[styles.compactName, { color: textPrimary }]}>{agent.shortName}</Text>
52
+ <Text style={[
53
+ styles.compactPnl,
54
+ { color: agent.totalPnl >= 0 ? '#10B981' : '#EF4444' }
55
+ ]}>
56
+ {formatPnl(agent.totalPnl)}
57
+ </Text>
58
+ </>
59
+ );
60
+
61
+ const renderFullContent = () => (
62
+ <>
63
+ {/* Header */}
64
+ <View style={styles.header}>
65
+ <View style={styles.nameRow}>
66
+ <View style={[styles.colorDot, { backgroundColor: agent.color }]} />
67
+ <Text style={[styles.name, { color: textPrimary }]}>{agent.name}</Text>
68
+ </View>
69
+ <View style={[styles.statusBadge, { backgroundColor: statusConfig.bgColor }]}>
70
+ <View style={[styles.statusIndicator, { backgroundColor: statusConfig.color }]} />
71
+ <Text style={[styles.statusText, { color: statusConfig.color }]}>
72
+ {statusConfig.label}
73
+ </Text>
74
+ </View>
75
+ </View>
76
+
77
+ {/* Current Activity */}
78
+ {agent.currentPair && (
79
+ <View style={styles.activityRow}>
80
+ <Text style={[styles.activityLabel, { color: textMuted }]}>Watching</Text>
81
+ <Text style={[styles.activityValue, { color: textSecondary }]}>
82
+ {agent.currentPair} @ ${agent.currentPrice?.toFixed(2)}
83
+ </Text>
84
+ </View>
85
+ )}
86
+
87
+ {/* Signal */}
88
+ {agent.lastSignal && agent.lastSignal !== 'HOLD' && (
89
+ <View style={styles.signalRow}>
90
+ <Text style={[styles.signalLabel, { color: textMuted }]}>Signal</Text>
91
+ <View style={[
92
+ styles.signalBadge,
93
+ { backgroundColor: agent.lastSignal === 'LONG' ? '#D1FAE5' : '#FEE2E2' }
94
+ ]}>
95
+ <Text style={[
96
+ styles.signalText,
97
+ { color: agent.lastSignal === 'LONG' ? '#10B981' : '#EF4444' }
98
+ ]}>
99
+ {agent.lastSignal}
100
+ </Text>
101
+ </View>
102
+ {agent.lastSignalConfidence && (
103
+ <Text style={[styles.confidenceText, { color: textSecondary }]}>
104
+ {(agent.lastSignalConfidence * 100).toFixed(0)}%
105
+ </Text>
106
+ )}
107
+ </View>
108
+ )}
109
+
110
+ {/* Metrics */}
111
+ {showMetrics && (
112
+ <View style={styles.metricsGrid}>
113
+ <View style={styles.metricItem}>
114
+ <Text style={[styles.metricLabel, { color: textMuted }]}>P&L</Text>
115
+ <Text style={[
116
+ styles.metricValue,
117
+ { color: agent.totalPnl >= 0 ? '#10B981' : '#EF4444' }
118
+ ]}>
119
+ {formatPnl(agent.totalPnl)}
120
+ </Text>
121
+ </View>
122
+ <View style={styles.metricItem}>
123
+ <Text style={[styles.metricLabel, { color: textMuted }]}>Win Rate</Text>
124
+ <Text style={[styles.metricValue, { color: textPrimary }]}>
125
+ {(agent.winRate * 100).toFixed(1)}%
126
+ </Text>
127
+ </View>
128
+ <View style={styles.metricItem}>
129
+ <Text style={[styles.metricLabel, { color: textMuted }]}>Trades</Text>
130
+ <Text style={[styles.metricValue, { color: textPrimary }]}>
131
+ {agent.totalTrades}
132
+ </Text>
133
+ </View>
134
+ <View style={styles.metricItem}>
135
+ <Text style={[styles.metricLabel, { color: textMuted }]}>Positions</Text>
136
+ <Text style={[styles.metricValue, { color: textPrimary }]}>
137
+ {agent.openPositions}
138
+ </Text>
139
+ </View>
140
+ </View>
141
+ )}
142
+
143
+ {/* Indicators */}
144
+ {showIndicators && (
145
+ <View style={styles.indicatorsRow}>
146
+ <View style={styles.indicatorItem}>
147
+ <Text style={[styles.indicatorLabel, { color: textMuted }]}>Risk</Text>
148
+ <View style={[styles.riskBadge, { backgroundColor: riskConfig.bgColor }]}>
149
+ <Text style={[styles.riskText, { color: riskConfig.color }]}>
150
+ {agent.riskLevel.toUpperCase()}
151
+ </Text>
152
+ </View>
153
+ </View>
154
+ <View style={styles.indicatorItem}>
155
+ <Text style={[styles.indicatorLabel, { color: textMuted }]}>Exposure</Text>
156
+ <Text style={[styles.indicatorValue, { color: textSecondary }]}>
157
+ ${agent.totalExposure.toFixed(0)}
158
+ </Text>
159
+ </View>
160
+ </View>
161
+ )}
162
+
163
+ {/* Strategy Info */}
164
+ <View style={styles.strategyRow}>
165
+ <Text style={[styles.strategyLabel, { color: textMuted }]}>
166
+ {agent.primaryIndicators.join(' · ')}
167
+ </Text>
168
+ <Text style={[styles.leverageText, { color: textMuted }]}>
169
+ {agent.leverageRange[0]}-{agent.leverageRange[1]}x
170
+ </Text>
171
+ </View>
172
+ </>
173
+ );
174
+
175
+ if (compact) {
176
+ if (onPress) {
177
+ return (
178
+ <TouchableOpacity
179
+ style={[styles.compactContainer, { backgroundColor: bg, borderColor: border }, style]}
180
+ onPress={handlePress}
181
+ activeOpacity={0.7}
182
+ >
183
+ {renderCompactContent()}
184
+ </TouchableOpacity>
185
+ );
186
+ }
187
+ return (
188
+ <View style={[styles.compactContainer, { backgroundColor: bg, borderColor: border }, style]}>
189
+ {renderCompactContent()}
190
+ </View>
191
+ );
192
+ }
193
+
194
+ if (onPress) {
195
+ return (
196
+ <TouchableOpacity
197
+ style={[styles.container, { backgroundColor: bg, borderColor: border }, style]}
198
+ onPress={handlePress}
199
+ activeOpacity={0.7}
200
+ >
201
+ {renderFullContent()}
202
+ </TouchableOpacity>
203
+ );
204
+ }
205
+
206
+ return (
207
+ <View style={[styles.container, { backgroundColor: bg, borderColor: border }, style]}>
208
+ {renderFullContent()}
209
+ </View>
210
+ );
211
+ };
212
+
213
+ const styles = StyleSheet.create({
214
+ container: {
215
+ borderRadius: 12,
216
+ borderWidth: 1,
217
+ padding: 14,
218
+ gap: 10,
219
+ },
220
+ compactContainer: {
221
+ flexDirection: 'row',
222
+ alignItems: 'center',
223
+ borderRadius: 8,
224
+ borderWidth: 1,
225
+ paddingHorizontal: 12,
226
+ paddingVertical: 8,
227
+ gap: 8,
228
+ },
229
+ statusDot: {
230
+ width: 8,
231
+ height: 8,
232
+ borderRadius: 4,
233
+ },
234
+ compactName: {
235
+ fontFamily: MONO,
236
+ fontSize: 12,
237
+ fontWeight: '600',
238
+ flex: 1,
239
+ },
240
+ compactPnl: {
241
+ fontFamily: MONO,
242
+ fontSize: 12,
243
+ fontWeight: '600',
244
+ },
245
+ header: {
246
+ flexDirection: 'row',
247
+ justifyContent: 'space-between',
248
+ alignItems: 'center',
249
+ },
250
+ nameRow: {
251
+ flexDirection: 'row',
252
+ alignItems: 'center',
253
+ gap: 8,
254
+ },
255
+ colorDot: {
256
+ width: 10,
257
+ height: 10,
258
+ borderRadius: 5,
259
+ },
260
+ name: {
261
+ fontSize: 15,
262
+ fontWeight: '600',
263
+ },
264
+ statusBadge: {
265
+ flexDirection: 'row',
266
+ alignItems: 'center',
267
+ paddingHorizontal: 8,
268
+ paddingVertical: 4,
269
+ borderRadius: 12,
270
+ gap: 4,
271
+ },
272
+ statusIndicator: {
273
+ width: 6,
274
+ height: 6,
275
+ borderRadius: 3,
276
+ },
277
+ statusText: {
278
+ fontSize: 11,
279
+ fontWeight: '600',
280
+ textTransform: 'uppercase',
281
+ },
282
+ activityRow: {
283
+ flexDirection: 'row',
284
+ justifyContent: 'space-between',
285
+ alignItems: 'center',
286
+ },
287
+ activityLabel: {
288
+ fontFamily: MONO,
289
+ fontSize: 10,
290
+ textTransform: 'uppercase',
291
+ },
292
+ activityValue: {
293
+ fontFamily: MONO,
294
+ fontSize: 12,
295
+ },
296
+ signalRow: {
297
+ flexDirection: 'row',
298
+ alignItems: 'center',
299
+ gap: 8,
300
+ },
301
+ signalLabel: {
302
+ fontFamily: MONO,
303
+ fontSize: 10,
304
+ textTransform: 'uppercase',
305
+ },
306
+ signalBadge: {
307
+ paddingHorizontal: 8,
308
+ paddingVertical: 2,
309
+ borderRadius: 4,
310
+ },
311
+ signalText: {
312
+ fontFamily: MONO,
313
+ fontSize: 11,
314
+ fontWeight: '700',
315
+ },
316
+ confidenceText: {
317
+ fontFamily: MONO,
318
+ fontSize: 11,
319
+ },
320
+ metricsGrid: {
321
+ flexDirection: 'row',
322
+ justifyContent: 'space-between',
323
+ paddingTop: 6,
324
+ borderTopWidth: 1,
325
+ borderTopColor: '#2A2A35',
326
+ },
327
+ metricItem: {
328
+ alignItems: 'center',
329
+ gap: 2,
330
+ },
331
+ metricLabel: {
332
+ fontFamily: MONO,
333
+ fontSize: 9,
334
+ textTransform: 'uppercase',
335
+ },
336
+ metricValue: {
337
+ fontFamily: MONO,
338
+ fontSize: 13,
339
+ fontWeight: '600',
340
+ },
341
+ indicatorsRow: {
342
+ flexDirection: 'row',
343
+ justifyContent: 'space-between',
344
+ alignItems: 'center',
345
+ },
346
+ indicatorItem: {
347
+ flexDirection: 'row',
348
+ alignItems: 'center',
349
+ gap: 6,
350
+ },
351
+ indicatorLabel: {
352
+ fontFamily: MONO,
353
+ fontSize: 10,
354
+ textTransform: 'uppercase',
355
+ },
356
+ indicatorValue: {
357
+ fontFamily: MONO,
358
+ fontSize: 12,
359
+ },
360
+ riskBadge: {
361
+ paddingHorizontal: 6,
362
+ paddingVertical: 2,
363
+ borderRadius: 4,
364
+ },
365
+ riskText: {
366
+ fontFamily: MONO,
367
+ fontSize: 10,
368
+ fontWeight: '700',
369
+ },
370
+ strategyRow: {
371
+ flexDirection: 'row',
372
+ justifyContent: 'space-between',
373
+ alignItems: 'center',
374
+ },
375
+ strategyLabel: {
376
+ fontFamily: MONO,
377
+ fontSize: 9,
378
+ },
379
+ leverageText: {
380
+ fontFamily: MONO,
381
+ fontSize: 9,
382
+ },
383
+ });