@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
package/dist/hooks/index.d.mts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { a as EngineWalletBalance } from '../engine-BeVuHpVx.mjs';
|
|
2
2
|
import { Token, TokenPrice, StrategyCategory, AIStrategy, AINavSnapshot, AIMarketData, AIOrderStatus, AIOrder, CreateAIOrderRequest, ApiResponse, AIPortfolioSummary, AITradeAllocation } from '../types/index.mjs';
|
|
3
|
+
export { g as UseForexInvestmentsResult, i as UseForexPoolDataResult, U as UseForexPoolsResult, h as UseForexSimulationResult, j as UseForexTradingResult, e as clearForexAccessToken, s as setForexAccessToken, f as setForexEngineUrl, a as useForexInvestments, c as useForexPoolData, u as useForexPools, b as useForexSimulation, d as useForexTrading } from '../useForexTrading-BleeSor8.mjs';
|
|
4
|
+
import { U as AIQuantConsoleOptions, S as StrategyPersonality, a1 as AIAgent$1, a as BotLogEntry, c as BotState, D as AIPosition, G as AIDecision, R as RiskStatus, K as ConsoleMetrics, C as PositionStatus, E as DecisionAction, a2 as RiskLevel, T as TradingStatus, Q as TradingConsoleOptions, t as ForexLogEntry, m as ForexPoolTransaction, j as ForexPool, p as ForexInvestment, N as CombinedLogEntry } from '../console-BfTMA7ah.mjs';
|
|
3
5
|
|
|
4
6
|
interface UseWalletBalanceOptions {
|
|
5
7
|
chains?: number[];
|
|
@@ -181,5 +183,325 @@ interface UseAITradingResult {
|
|
|
181
183
|
* Combined hook for all AI trading functionality
|
|
182
184
|
*/
|
|
183
185
|
declare function useAITrading(): UseAITradingResult;
|
|
186
|
+
interface AIAgent {
|
|
187
|
+
id: string;
|
|
188
|
+
name: string;
|
|
189
|
+
name_zh: string;
|
|
190
|
+
description: string;
|
|
191
|
+
description_zh: string;
|
|
192
|
+
category: string;
|
|
193
|
+
risk_level: number;
|
|
194
|
+
icon: string;
|
|
195
|
+
color: string;
|
|
196
|
+
tiers: Array<{
|
|
197
|
+
tier: number;
|
|
198
|
+
amount: number;
|
|
199
|
+
label: string;
|
|
200
|
+
label_zh: string;
|
|
201
|
+
}>;
|
|
202
|
+
supported_cycles: number[];
|
|
203
|
+
default_cycle: number;
|
|
204
|
+
supported_pairs: string[];
|
|
205
|
+
supported_chains: string[];
|
|
206
|
+
is_active: boolean;
|
|
207
|
+
preview?: {
|
|
208
|
+
tier: {
|
|
209
|
+
tier: number;
|
|
210
|
+
amount: number;
|
|
211
|
+
label: string;
|
|
212
|
+
};
|
|
213
|
+
cycle: number;
|
|
214
|
+
dailyLots: number;
|
|
215
|
+
stabilityScore: number;
|
|
216
|
+
roiRange: {
|
|
217
|
+
min: number;
|
|
218
|
+
max: number;
|
|
219
|
+
userMin: number;
|
|
220
|
+
userMax: number;
|
|
221
|
+
};
|
|
222
|
+
shareRate: number;
|
|
223
|
+
profitEstimate: {
|
|
224
|
+
monthlyMin: number;
|
|
225
|
+
monthlyMax: number;
|
|
226
|
+
cycleMin: number;
|
|
227
|
+
cycleMax: number;
|
|
228
|
+
};
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
interface AIAgentParams {
|
|
232
|
+
dailyLots: number;
|
|
233
|
+
effectiveCapital: number;
|
|
234
|
+
stabilityScore: number;
|
|
235
|
+
roiRange: {
|
|
236
|
+
min: number;
|
|
237
|
+
max: number;
|
|
238
|
+
userMin: number;
|
|
239
|
+
userMax: number;
|
|
240
|
+
};
|
|
241
|
+
shareRate: number;
|
|
242
|
+
profitEstimate: {
|
|
243
|
+
monthlyMin: number;
|
|
244
|
+
monthlyMax: number;
|
|
245
|
+
cycleMin: number;
|
|
246
|
+
cycleMax: number;
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
interface UseAIAgentsResult {
|
|
250
|
+
agents: AIAgent[];
|
|
251
|
+
shareRates: Record<number, number>;
|
|
252
|
+
isLoading: boolean;
|
|
253
|
+
error: string | null;
|
|
254
|
+
refresh: () => Promise<void>;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Hook to fetch all AI agents with their configurations
|
|
258
|
+
*/
|
|
259
|
+
declare function useAIAgents(includeInactive?: boolean): UseAIAgentsResult;
|
|
260
|
+
interface UseAIAgentResult {
|
|
261
|
+
agent: AIAgent | null;
|
|
262
|
+
params: AIAgentParams | null;
|
|
263
|
+
isLoading: boolean;
|
|
264
|
+
error: string | null;
|
|
265
|
+
refresh: () => Promise<void>;
|
|
266
|
+
calculateParams: (amount: number, cycleDays: number) => Promise<AIAgentParams | null>;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Hook to fetch a single AI agent with detailed parameters
|
|
270
|
+
*/
|
|
271
|
+
declare function useAIAgent(agentId: string | undefined): UseAIAgentResult;
|
|
272
|
+
interface UseAIAgentSubscriptionResult {
|
|
273
|
+
subscribe: (agentId: string, amount: number, cycleDays: number, txHash?: string) => Promise<ApiResponse<{
|
|
274
|
+
order: AIOrder;
|
|
275
|
+
}>>;
|
|
276
|
+
isLoading: boolean;
|
|
277
|
+
error: string | null;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Hook to subscribe to an AI agent strategy
|
|
281
|
+
*/
|
|
282
|
+
declare function useAIAgentSubscription(): UseAIAgentSubscriptionResult;
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* ONE SDK - AI Quant Console Hook
|
|
286
|
+
* Combined hook for all AI trading console data
|
|
287
|
+
*/
|
|
288
|
+
|
|
289
|
+
interface UseAIQuantConsoleResult {
|
|
290
|
+
strategies: StrategyPersonality[];
|
|
291
|
+
agents: AIAgent$1[];
|
|
292
|
+
logs: BotLogEntry[];
|
|
293
|
+
logsByStrategy: Map<string, BotLogEntry[]>;
|
|
294
|
+
botStates: Map<string, BotState>;
|
|
295
|
+
positions: AIPosition[];
|
|
296
|
+
openPositions: AIPosition[];
|
|
297
|
+
decisions: AIDecision[];
|
|
298
|
+
recentDecisions: AIDecision[];
|
|
299
|
+
riskStatus: RiskStatus | null;
|
|
300
|
+
metrics: ConsoleMetrics;
|
|
301
|
+
isRunning: boolean;
|
|
302
|
+
isLoading: boolean;
|
|
303
|
+
error: string | null;
|
|
304
|
+
start: (strategyIds?: string[]) => void;
|
|
305
|
+
stop: (strategyIds?: string[]) => void;
|
|
306
|
+
clearLogs: () => void;
|
|
307
|
+
emitBootSequence: () => void;
|
|
308
|
+
refresh: () => Promise<void>;
|
|
309
|
+
getAgent: (strategyId: string) => AIAgent$1 | undefined;
|
|
310
|
+
getAgentLogs: (strategyId: string) => BotLogEntry[];
|
|
311
|
+
getAgentPositions: (strategyId: string) => AIPosition[];
|
|
312
|
+
getAgentDecisions: (strategyId: string) => AIDecision[];
|
|
313
|
+
}
|
|
314
|
+
declare function useAIQuantConsole(options?: AIQuantConsoleOptions): UseAIQuantConsoleResult;
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* ONE SDK - Bot Simulation Hook
|
|
318
|
+
* Provides React hook for subscribing to BotSimulationEngine events
|
|
319
|
+
*/
|
|
320
|
+
|
|
321
|
+
interface UseBotSimulationOptions {
|
|
322
|
+
maxLogs?: number;
|
|
323
|
+
strategyIds?: string[];
|
|
324
|
+
userPairs?: string[];
|
|
325
|
+
userChains?: string[];
|
|
326
|
+
autoStart?: boolean;
|
|
327
|
+
}
|
|
328
|
+
interface UseBotSimulationResult {
|
|
329
|
+
/** All log entries from all strategies */
|
|
330
|
+
logs: BotLogEntry[];
|
|
331
|
+
/** Logs grouped by strategy ID */
|
|
332
|
+
logsByStrategy: Map<string, BotLogEntry[]>;
|
|
333
|
+
/** Current state for each strategy */
|
|
334
|
+
botStates: Map<string, BotState>;
|
|
335
|
+
/** Whether simulation is currently running */
|
|
336
|
+
isRunning: boolean;
|
|
337
|
+
/** Available strategies */
|
|
338
|
+
strategies: StrategyPersonality[];
|
|
339
|
+
/** Start the simulation */
|
|
340
|
+
start: (strategyIds?: string[], userPairs?: string[], userChains?: string[]) => void;
|
|
341
|
+
/** Stop the simulation */
|
|
342
|
+
stop: (strategyIds?: string[]) => void;
|
|
343
|
+
/** Clear all logs */
|
|
344
|
+
clearLogs: () => void;
|
|
345
|
+
/** Emit boot sequence messages */
|
|
346
|
+
emitBootSequence: () => void;
|
|
347
|
+
/** Get state for a specific strategy */
|
|
348
|
+
getBotState: (strategyId: string) => BotState | undefined;
|
|
349
|
+
}
|
|
350
|
+
declare function useBotSimulation(options?: UseBotSimulationOptions): UseBotSimulationResult;
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* ONE SDK - AI Positions Hook
|
|
354
|
+
* Provides React hook for fetching and tracking AI trading positions
|
|
355
|
+
*/
|
|
356
|
+
|
|
357
|
+
declare function setConsoleAccessToken(token: string): void;
|
|
358
|
+
declare function clearConsoleAccessToken(): void;
|
|
359
|
+
declare function setConsoleEngineUrl(url: string): void;
|
|
360
|
+
interface UseAIPositionsOptions {
|
|
361
|
+
strategyId?: string;
|
|
362
|
+
strategyIds?: string[];
|
|
363
|
+
status?: PositionStatus | PositionStatus[];
|
|
364
|
+
pollInterval?: number;
|
|
365
|
+
simulation?: boolean;
|
|
366
|
+
}
|
|
367
|
+
interface UseAIPositionsResult {
|
|
368
|
+
positions: AIPosition[];
|
|
369
|
+
openPositions: AIPosition[];
|
|
370
|
+
closedPositions: AIPosition[];
|
|
371
|
+
isLoading: boolean;
|
|
372
|
+
error: string | null;
|
|
373
|
+
refresh: () => Promise<void>;
|
|
374
|
+
closePosition: (positionId: string) => Promise<boolean>;
|
|
375
|
+
updateStopLoss: (positionId: string, stopLoss: number) => Promise<boolean>;
|
|
376
|
+
updateTakeProfit: (positionId: string, takeProfit: number) => Promise<boolean>;
|
|
377
|
+
summary: {
|
|
378
|
+
totalPositions: number;
|
|
379
|
+
openCount: number;
|
|
380
|
+
totalExposure: number;
|
|
381
|
+
totalPnl: number;
|
|
382
|
+
unrealizedPnl: number;
|
|
383
|
+
avgLeverage: number;
|
|
384
|
+
byStrategy: Record<string, {
|
|
385
|
+
count: number;
|
|
386
|
+
pnl: number;
|
|
387
|
+
exposure: number;
|
|
388
|
+
}>;
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
declare function useAIPositions(options?: UseAIPositionsOptions): UseAIPositionsResult;
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* ONE SDK - AI Decisions Hook
|
|
395
|
+
* Provides React hook for fetching AI trading decision history with reasoning
|
|
396
|
+
*/
|
|
397
|
+
|
|
398
|
+
interface UseAIDecisionsOptions {
|
|
399
|
+
strategyId?: string;
|
|
400
|
+
strategyIds?: string[];
|
|
401
|
+
actions?: DecisionAction[];
|
|
402
|
+
limit?: number;
|
|
403
|
+
pollInterval?: number;
|
|
404
|
+
simulation?: boolean;
|
|
405
|
+
}
|
|
406
|
+
interface UseAIDecisionsResult {
|
|
407
|
+
decisions: AIDecision[];
|
|
408
|
+
recentDecisions: AIDecision[];
|
|
409
|
+
executedDecisions: AIDecision[];
|
|
410
|
+
isLoading: boolean;
|
|
411
|
+
error: string | null;
|
|
412
|
+
refresh: () => Promise<void>;
|
|
413
|
+
getByStrategy: (strategyId: string) => AIDecision[];
|
|
414
|
+
getByAction: (action: DecisionAction) => AIDecision[];
|
|
415
|
+
stats: {
|
|
416
|
+
totalDecisions: number;
|
|
417
|
+
executedCount: number;
|
|
418
|
+
executionRate: number;
|
|
419
|
+
byAction: Record<DecisionAction, number>;
|
|
420
|
+
byStrategy: Record<string, number>;
|
|
421
|
+
avgConfidence: number;
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
declare function useAIDecisions(options?: UseAIDecisionsOptions): UseAIDecisionsResult;
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* ONE SDK - AI Risk Status Hook
|
|
428
|
+
* Provides React hook for monitoring trading risk status and limits
|
|
429
|
+
*/
|
|
430
|
+
|
|
431
|
+
interface UseAIRiskStatusOptions {
|
|
432
|
+
strategyId?: string;
|
|
433
|
+
pollInterval?: number;
|
|
434
|
+
simulation?: boolean;
|
|
435
|
+
}
|
|
436
|
+
interface UseAIRiskStatusResult {
|
|
437
|
+
riskStatus: RiskStatus;
|
|
438
|
+
isLoading: boolean;
|
|
439
|
+
error: string | null;
|
|
440
|
+
refresh: () => Promise<void>;
|
|
441
|
+
isWithinLimits: boolean;
|
|
442
|
+
canTrade: boolean;
|
|
443
|
+
riskLevel: RiskLevel;
|
|
444
|
+
tradingStatus: TradingStatus;
|
|
445
|
+
warnings: string[];
|
|
446
|
+
pauseTrading: () => Promise<boolean>;
|
|
447
|
+
resumeTrading: () => Promise<boolean>;
|
|
448
|
+
resetDailyLimits: () => Promise<boolean>;
|
|
449
|
+
}
|
|
450
|
+
declare function useAIRiskStatus(options?: UseAIRiskStatusOptions): UseAIRiskStatusResult;
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* ONE SDK - Master Trading Console Hook
|
|
454
|
+
* Orchestrates all AI and Forex trading data in a unified interface
|
|
455
|
+
*/
|
|
456
|
+
|
|
457
|
+
interface UseTradingConsoleResult {
|
|
458
|
+
ai: {
|
|
459
|
+
strategies: StrategyPersonality[];
|
|
460
|
+
agents: AIAgent$1[];
|
|
461
|
+
positions: AIPosition[];
|
|
462
|
+
decisions: AIDecision[];
|
|
463
|
+
riskStatus: RiskStatus | null;
|
|
464
|
+
simulationLogs: BotLogEntry[];
|
|
465
|
+
logsByStrategy: Map<string, BotLogEntry[]>;
|
|
466
|
+
botStates: Map<string, BotState>;
|
|
467
|
+
};
|
|
468
|
+
forex: {
|
|
469
|
+
logs: ForexLogEntry[];
|
|
470
|
+
poolTransactions: ForexPoolTransaction[];
|
|
471
|
+
pools: ForexPool[];
|
|
472
|
+
investments: ForexInvestment[];
|
|
473
|
+
stats: {
|
|
474
|
+
totalPnl: number;
|
|
475
|
+
totalTrades: number;
|
|
476
|
+
totalPips: number;
|
|
477
|
+
totalLots: number;
|
|
478
|
+
};
|
|
479
|
+
};
|
|
480
|
+
combinedLogs: CombinedLogEntry[];
|
|
481
|
+
metrics: ConsoleMetrics;
|
|
482
|
+
controls: {
|
|
483
|
+
startAISimulation: (strategyIds?: string[]) => void;
|
|
484
|
+
stopAISimulation: (strategyIds?: string[]) => void;
|
|
485
|
+
startForexSimulation: () => void;
|
|
486
|
+
stopForexSimulation: () => void;
|
|
487
|
+
startAll: () => void;
|
|
488
|
+
stopAll: () => void;
|
|
489
|
+
clearLogs: () => void;
|
|
490
|
+
emitBootSequence: () => void;
|
|
491
|
+
refreshAll: () => Promise<void>;
|
|
492
|
+
};
|
|
493
|
+
state: {
|
|
494
|
+
isAISimulationRunning: boolean;
|
|
495
|
+
isForexSimulationRunning: boolean;
|
|
496
|
+
isAnyRunning: boolean;
|
|
497
|
+
isLoading: boolean;
|
|
498
|
+
error: string | null;
|
|
499
|
+
};
|
|
500
|
+
getAgent: (strategyId: string) => AIAgent$1 | undefined;
|
|
501
|
+
getAgentLogs: (strategyId: string) => BotLogEntry[];
|
|
502
|
+
getAgentPositions: (strategyId: string) => AIPosition[];
|
|
503
|
+
getAgentDecisions: (strategyId: string) => AIDecision[];
|
|
504
|
+
}
|
|
505
|
+
declare function useTradingConsole(options?: TradingConsoleOptions): UseTradingConsoleResult;
|
|
184
506
|
|
|
185
|
-
export { type UseAIMarketDataResult, type UseAIOrdersOptions, type UseAIOrdersResult, type UseAIPortfolioResult, type UseAIStrategiesOptions, type UseAIStrategiesResult, type UseAIStrategyResult, type UseAITradingResult, clearAITradingAccessToken, setAITradingAccessToken, useAIMarketData, useAIOrders, useAIPortfolio, useAIStrategies, useAIStrategy, useAITrading, useTokenPrice, useTokenPrices, useWalletBalance };
|
|
507
|
+
export { type AIAgent, type AIAgentParams, type UseAIAgentResult, type UseAIAgentSubscriptionResult, type UseAIAgentsResult, type UseAIDecisionsOptions, type UseAIDecisionsResult, type UseAIMarketDataResult, type UseAIOrdersOptions, type UseAIOrdersResult, type UseAIPortfolioResult, type UseAIPositionsOptions, type UseAIPositionsResult, type UseAIQuantConsoleResult, type UseAIRiskStatusOptions, type UseAIRiskStatusResult, type UseAIStrategiesOptions, type UseAIStrategiesResult, type UseAIStrategyResult, type UseAITradingResult, type UseBotSimulationOptions, type UseBotSimulationResult, type UseTradingConsoleResult, clearAITradingAccessToken, clearConsoleAccessToken, setAITradingAccessToken, setConsoleAccessToken, setConsoleEngineUrl, useAIAgent, useAIAgentSubscription, useAIAgents, useAIDecisions, useAIMarketData, useAIOrders, useAIPortfolio, useAIPositions, useAIQuantConsole, useAIRiskStatus, useAIStrategies, useAIStrategy, useAITrading, useBotSimulation, useTokenPrice, useTokenPrices, useTradingConsole, useWalletBalance };
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { a as EngineWalletBalance } from '../engine-DSc1Em4V.js';
|
|
2
2
|
import { Token, TokenPrice, StrategyCategory, AIStrategy, AINavSnapshot, AIMarketData, AIOrderStatus, AIOrder, CreateAIOrderRequest, ApiResponse, AIPortfolioSummary, AITradeAllocation } from '../types/index.js';
|
|
3
|
+
export { g as UseForexInvestmentsResult, i as UseForexPoolDataResult, U as UseForexPoolsResult, h as UseForexSimulationResult, j as UseForexTradingResult, e as clearForexAccessToken, s as setForexAccessToken, f as setForexEngineUrl, a as useForexInvestments, c as useForexPoolData, u as useForexPools, b as useForexSimulation, d as useForexTrading } from '../useForexTrading-ZgW_G40Q.js';
|
|
4
|
+
import { U as AIQuantConsoleOptions, S as StrategyPersonality, a1 as AIAgent$1, a as BotLogEntry, c as BotState, D as AIPosition, G as AIDecision, R as RiskStatus, K as ConsoleMetrics, C as PositionStatus, E as DecisionAction, a2 as RiskLevel, T as TradingStatus, Q as TradingConsoleOptions, t as ForexLogEntry, m as ForexPoolTransaction, j as ForexPool, p as ForexInvestment, N as CombinedLogEntry } from '../console-BfTMA7ah.js';
|
|
3
5
|
|
|
4
6
|
interface UseWalletBalanceOptions {
|
|
5
7
|
chains?: number[];
|
|
@@ -181,5 +183,325 @@ interface UseAITradingResult {
|
|
|
181
183
|
* Combined hook for all AI trading functionality
|
|
182
184
|
*/
|
|
183
185
|
declare function useAITrading(): UseAITradingResult;
|
|
186
|
+
interface AIAgent {
|
|
187
|
+
id: string;
|
|
188
|
+
name: string;
|
|
189
|
+
name_zh: string;
|
|
190
|
+
description: string;
|
|
191
|
+
description_zh: string;
|
|
192
|
+
category: string;
|
|
193
|
+
risk_level: number;
|
|
194
|
+
icon: string;
|
|
195
|
+
color: string;
|
|
196
|
+
tiers: Array<{
|
|
197
|
+
tier: number;
|
|
198
|
+
amount: number;
|
|
199
|
+
label: string;
|
|
200
|
+
label_zh: string;
|
|
201
|
+
}>;
|
|
202
|
+
supported_cycles: number[];
|
|
203
|
+
default_cycle: number;
|
|
204
|
+
supported_pairs: string[];
|
|
205
|
+
supported_chains: string[];
|
|
206
|
+
is_active: boolean;
|
|
207
|
+
preview?: {
|
|
208
|
+
tier: {
|
|
209
|
+
tier: number;
|
|
210
|
+
amount: number;
|
|
211
|
+
label: string;
|
|
212
|
+
};
|
|
213
|
+
cycle: number;
|
|
214
|
+
dailyLots: number;
|
|
215
|
+
stabilityScore: number;
|
|
216
|
+
roiRange: {
|
|
217
|
+
min: number;
|
|
218
|
+
max: number;
|
|
219
|
+
userMin: number;
|
|
220
|
+
userMax: number;
|
|
221
|
+
};
|
|
222
|
+
shareRate: number;
|
|
223
|
+
profitEstimate: {
|
|
224
|
+
monthlyMin: number;
|
|
225
|
+
monthlyMax: number;
|
|
226
|
+
cycleMin: number;
|
|
227
|
+
cycleMax: number;
|
|
228
|
+
};
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
interface AIAgentParams {
|
|
232
|
+
dailyLots: number;
|
|
233
|
+
effectiveCapital: number;
|
|
234
|
+
stabilityScore: number;
|
|
235
|
+
roiRange: {
|
|
236
|
+
min: number;
|
|
237
|
+
max: number;
|
|
238
|
+
userMin: number;
|
|
239
|
+
userMax: number;
|
|
240
|
+
};
|
|
241
|
+
shareRate: number;
|
|
242
|
+
profitEstimate: {
|
|
243
|
+
monthlyMin: number;
|
|
244
|
+
monthlyMax: number;
|
|
245
|
+
cycleMin: number;
|
|
246
|
+
cycleMax: number;
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
interface UseAIAgentsResult {
|
|
250
|
+
agents: AIAgent[];
|
|
251
|
+
shareRates: Record<number, number>;
|
|
252
|
+
isLoading: boolean;
|
|
253
|
+
error: string | null;
|
|
254
|
+
refresh: () => Promise<void>;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Hook to fetch all AI agents with their configurations
|
|
258
|
+
*/
|
|
259
|
+
declare function useAIAgents(includeInactive?: boolean): UseAIAgentsResult;
|
|
260
|
+
interface UseAIAgentResult {
|
|
261
|
+
agent: AIAgent | null;
|
|
262
|
+
params: AIAgentParams | null;
|
|
263
|
+
isLoading: boolean;
|
|
264
|
+
error: string | null;
|
|
265
|
+
refresh: () => Promise<void>;
|
|
266
|
+
calculateParams: (amount: number, cycleDays: number) => Promise<AIAgentParams | null>;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Hook to fetch a single AI agent with detailed parameters
|
|
270
|
+
*/
|
|
271
|
+
declare function useAIAgent(agentId: string | undefined): UseAIAgentResult;
|
|
272
|
+
interface UseAIAgentSubscriptionResult {
|
|
273
|
+
subscribe: (agentId: string, amount: number, cycleDays: number, txHash?: string) => Promise<ApiResponse<{
|
|
274
|
+
order: AIOrder;
|
|
275
|
+
}>>;
|
|
276
|
+
isLoading: boolean;
|
|
277
|
+
error: string | null;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Hook to subscribe to an AI agent strategy
|
|
281
|
+
*/
|
|
282
|
+
declare function useAIAgentSubscription(): UseAIAgentSubscriptionResult;
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* ONE SDK - AI Quant Console Hook
|
|
286
|
+
* Combined hook for all AI trading console data
|
|
287
|
+
*/
|
|
288
|
+
|
|
289
|
+
interface UseAIQuantConsoleResult {
|
|
290
|
+
strategies: StrategyPersonality[];
|
|
291
|
+
agents: AIAgent$1[];
|
|
292
|
+
logs: BotLogEntry[];
|
|
293
|
+
logsByStrategy: Map<string, BotLogEntry[]>;
|
|
294
|
+
botStates: Map<string, BotState>;
|
|
295
|
+
positions: AIPosition[];
|
|
296
|
+
openPositions: AIPosition[];
|
|
297
|
+
decisions: AIDecision[];
|
|
298
|
+
recentDecisions: AIDecision[];
|
|
299
|
+
riskStatus: RiskStatus | null;
|
|
300
|
+
metrics: ConsoleMetrics;
|
|
301
|
+
isRunning: boolean;
|
|
302
|
+
isLoading: boolean;
|
|
303
|
+
error: string | null;
|
|
304
|
+
start: (strategyIds?: string[]) => void;
|
|
305
|
+
stop: (strategyIds?: string[]) => void;
|
|
306
|
+
clearLogs: () => void;
|
|
307
|
+
emitBootSequence: () => void;
|
|
308
|
+
refresh: () => Promise<void>;
|
|
309
|
+
getAgent: (strategyId: string) => AIAgent$1 | undefined;
|
|
310
|
+
getAgentLogs: (strategyId: string) => BotLogEntry[];
|
|
311
|
+
getAgentPositions: (strategyId: string) => AIPosition[];
|
|
312
|
+
getAgentDecisions: (strategyId: string) => AIDecision[];
|
|
313
|
+
}
|
|
314
|
+
declare function useAIQuantConsole(options?: AIQuantConsoleOptions): UseAIQuantConsoleResult;
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* ONE SDK - Bot Simulation Hook
|
|
318
|
+
* Provides React hook for subscribing to BotSimulationEngine events
|
|
319
|
+
*/
|
|
320
|
+
|
|
321
|
+
interface UseBotSimulationOptions {
|
|
322
|
+
maxLogs?: number;
|
|
323
|
+
strategyIds?: string[];
|
|
324
|
+
userPairs?: string[];
|
|
325
|
+
userChains?: string[];
|
|
326
|
+
autoStart?: boolean;
|
|
327
|
+
}
|
|
328
|
+
interface UseBotSimulationResult {
|
|
329
|
+
/** All log entries from all strategies */
|
|
330
|
+
logs: BotLogEntry[];
|
|
331
|
+
/** Logs grouped by strategy ID */
|
|
332
|
+
logsByStrategy: Map<string, BotLogEntry[]>;
|
|
333
|
+
/** Current state for each strategy */
|
|
334
|
+
botStates: Map<string, BotState>;
|
|
335
|
+
/** Whether simulation is currently running */
|
|
336
|
+
isRunning: boolean;
|
|
337
|
+
/** Available strategies */
|
|
338
|
+
strategies: StrategyPersonality[];
|
|
339
|
+
/** Start the simulation */
|
|
340
|
+
start: (strategyIds?: string[], userPairs?: string[], userChains?: string[]) => void;
|
|
341
|
+
/** Stop the simulation */
|
|
342
|
+
stop: (strategyIds?: string[]) => void;
|
|
343
|
+
/** Clear all logs */
|
|
344
|
+
clearLogs: () => void;
|
|
345
|
+
/** Emit boot sequence messages */
|
|
346
|
+
emitBootSequence: () => void;
|
|
347
|
+
/** Get state for a specific strategy */
|
|
348
|
+
getBotState: (strategyId: string) => BotState | undefined;
|
|
349
|
+
}
|
|
350
|
+
declare function useBotSimulation(options?: UseBotSimulationOptions): UseBotSimulationResult;
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* ONE SDK - AI Positions Hook
|
|
354
|
+
* Provides React hook for fetching and tracking AI trading positions
|
|
355
|
+
*/
|
|
356
|
+
|
|
357
|
+
declare function setConsoleAccessToken(token: string): void;
|
|
358
|
+
declare function clearConsoleAccessToken(): void;
|
|
359
|
+
declare function setConsoleEngineUrl(url: string): void;
|
|
360
|
+
interface UseAIPositionsOptions {
|
|
361
|
+
strategyId?: string;
|
|
362
|
+
strategyIds?: string[];
|
|
363
|
+
status?: PositionStatus | PositionStatus[];
|
|
364
|
+
pollInterval?: number;
|
|
365
|
+
simulation?: boolean;
|
|
366
|
+
}
|
|
367
|
+
interface UseAIPositionsResult {
|
|
368
|
+
positions: AIPosition[];
|
|
369
|
+
openPositions: AIPosition[];
|
|
370
|
+
closedPositions: AIPosition[];
|
|
371
|
+
isLoading: boolean;
|
|
372
|
+
error: string | null;
|
|
373
|
+
refresh: () => Promise<void>;
|
|
374
|
+
closePosition: (positionId: string) => Promise<boolean>;
|
|
375
|
+
updateStopLoss: (positionId: string, stopLoss: number) => Promise<boolean>;
|
|
376
|
+
updateTakeProfit: (positionId: string, takeProfit: number) => Promise<boolean>;
|
|
377
|
+
summary: {
|
|
378
|
+
totalPositions: number;
|
|
379
|
+
openCount: number;
|
|
380
|
+
totalExposure: number;
|
|
381
|
+
totalPnl: number;
|
|
382
|
+
unrealizedPnl: number;
|
|
383
|
+
avgLeverage: number;
|
|
384
|
+
byStrategy: Record<string, {
|
|
385
|
+
count: number;
|
|
386
|
+
pnl: number;
|
|
387
|
+
exposure: number;
|
|
388
|
+
}>;
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
declare function useAIPositions(options?: UseAIPositionsOptions): UseAIPositionsResult;
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* ONE SDK - AI Decisions Hook
|
|
395
|
+
* Provides React hook for fetching AI trading decision history with reasoning
|
|
396
|
+
*/
|
|
397
|
+
|
|
398
|
+
interface UseAIDecisionsOptions {
|
|
399
|
+
strategyId?: string;
|
|
400
|
+
strategyIds?: string[];
|
|
401
|
+
actions?: DecisionAction[];
|
|
402
|
+
limit?: number;
|
|
403
|
+
pollInterval?: number;
|
|
404
|
+
simulation?: boolean;
|
|
405
|
+
}
|
|
406
|
+
interface UseAIDecisionsResult {
|
|
407
|
+
decisions: AIDecision[];
|
|
408
|
+
recentDecisions: AIDecision[];
|
|
409
|
+
executedDecisions: AIDecision[];
|
|
410
|
+
isLoading: boolean;
|
|
411
|
+
error: string | null;
|
|
412
|
+
refresh: () => Promise<void>;
|
|
413
|
+
getByStrategy: (strategyId: string) => AIDecision[];
|
|
414
|
+
getByAction: (action: DecisionAction) => AIDecision[];
|
|
415
|
+
stats: {
|
|
416
|
+
totalDecisions: number;
|
|
417
|
+
executedCount: number;
|
|
418
|
+
executionRate: number;
|
|
419
|
+
byAction: Record<DecisionAction, number>;
|
|
420
|
+
byStrategy: Record<string, number>;
|
|
421
|
+
avgConfidence: number;
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
declare function useAIDecisions(options?: UseAIDecisionsOptions): UseAIDecisionsResult;
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* ONE SDK - AI Risk Status Hook
|
|
428
|
+
* Provides React hook for monitoring trading risk status and limits
|
|
429
|
+
*/
|
|
430
|
+
|
|
431
|
+
interface UseAIRiskStatusOptions {
|
|
432
|
+
strategyId?: string;
|
|
433
|
+
pollInterval?: number;
|
|
434
|
+
simulation?: boolean;
|
|
435
|
+
}
|
|
436
|
+
interface UseAIRiskStatusResult {
|
|
437
|
+
riskStatus: RiskStatus;
|
|
438
|
+
isLoading: boolean;
|
|
439
|
+
error: string | null;
|
|
440
|
+
refresh: () => Promise<void>;
|
|
441
|
+
isWithinLimits: boolean;
|
|
442
|
+
canTrade: boolean;
|
|
443
|
+
riskLevel: RiskLevel;
|
|
444
|
+
tradingStatus: TradingStatus;
|
|
445
|
+
warnings: string[];
|
|
446
|
+
pauseTrading: () => Promise<boolean>;
|
|
447
|
+
resumeTrading: () => Promise<boolean>;
|
|
448
|
+
resetDailyLimits: () => Promise<boolean>;
|
|
449
|
+
}
|
|
450
|
+
declare function useAIRiskStatus(options?: UseAIRiskStatusOptions): UseAIRiskStatusResult;
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* ONE SDK - Master Trading Console Hook
|
|
454
|
+
* Orchestrates all AI and Forex trading data in a unified interface
|
|
455
|
+
*/
|
|
456
|
+
|
|
457
|
+
interface UseTradingConsoleResult {
|
|
458
|
+
ai: {
|
|
459
|
+
strategies: StrategyPersonality[];
|
|
460
|
+
agents: AIAgent$1[];
|
|
461
|
+
positions: AIPosition[];
|
|
462
|
+
decisions: AIDecision[];
|
|
463
|
+
riskStatus: RiskStatus | null;
|
|
464
|
+
simulationLogs: BotLogEntry[];
|
|
465
|
+
logsByStrategy: Map<string, BotLogEntry[]>;
|
|
466
|
+
botStates: Map<string, BotState>;
|
|
467
|
+
};
|
|
468
|
+
forex: {
|
|
469
|
+
logs: ForexLogEntry[];
|
|
470
|
+
poolTransactions: ForexPoolTransaction[];
|
|
471
|
+
pools: ForexPool[];
|
|
472
|
+
investments: ForexInvestment[];
|
|
473
|
+
stats: {
|
|
474
|
+
totalPnl: number;
|
|
475
|
+
totalTrades: number;
|
|
476
|
+
totalPips: number;
|
|
477
|
+
totalLots: number;
|
|
478
|
+
};
|
|
479
|
+
};
|
|
480
|
+
combinedLogs: CombinedLogEntry[];
|
|
481
|
+
metrics: ConsoleMetrics;
|
|
482
|
+
controls: {
|
|
483
|
+
startAISimulation: (strategyIds?: string[]) => void;
|
|
484
|
+
stopAISimulation: (strategyIds?: string[]) => void;
|
|
485
|
+
startForexSimulation: () => void;
|
|
486
|
+
stopForexSimulation: () => void;
|
|
487
|
+
startAll: () => void;
|
|
488
|
+
stopAll: () => void;
|
|
489
|
+
clearLogs: () => void;
|
|
490
|
+
emitBootSequence: () => void;
|
|
491
|
+
refreshAll: () => Promise<void>;
|
|
492
|
+
};
|
|
493
|
+
state: {
|
|
494
|
+
isAISimulationRunning: boolean;
|
|
495
|
+
isForexSimulationRunning: boolean;
|
|
496
|
+
isAnyRunning: boolean;
|
|
497
|
+
isLoading: boolean;
|
|
498
|
+
error: string | null;
|
|
499
|
+
};
|
|
500
|
+
getAgent: (strategyId: string) => AIAgent$1 | undefined;
|
|
501
|
+
getAgentLogs: (strategyId: string) => BotLogEntry[];
|
|
502
|
+
getAgentPositions: (strategyId: string) => AIPosition[];
|
|
503
|
+
getAgentDecisions: (strategyId: string) => AIDecision[];
|
|
504
|
+
}
|
|
505
|
+
declare function useTradingConsole(options?: TradingConsoleOptions): UseTradingConsoleResult;
|
|
184
506
|
|
|
185
|
-
export { type UseAIMarketDataResult, type UseAIOrdersOptions, type UseAIOrdersResult, type UseAIPortfolioResult, type UseAIStrategiesOptions, type UseAIStrategiesResult, type UseAIStrategyResult, type UseAITradingResult, clearAITradingAccessToken, setAITradingAccessToken, useAIMarketData, useAIOrders, useAIPortfolio, useAIStrategies, useAIStrategy, useAITrading, useTokenPrice, useTokenPrices, useWalletBalance };
|
|
507
|
+
export { type AIAgent, type AIAgentParams, type UseAIAgentResult, type UseAIAgentSubscriptionResult, type UseAIAgentsResult, type UseAIDecisionsOptions, type UseAIDecisionsResult, type UseAIMarketDataResult, type UseAIOrdersOptions, type UseAIOrdersResult, type UseAIPortfolioResult, type UseAIPositionsOptions, type UseAIPositionsResult, type UseAIQuantConsoleResult, type UseAIRiskStatusOptions, type UseAIRiskStatusResult, type UseAIStrategiesOptions, type UseAIStrategiesResult, type UseAIStrategyResult, type UseAITradingResult, type UseBotSimulationOptions, type UseBotSimulationResult, type UseTradingConsoleResult, clearAITradingAccessToken, clearConsoleAccessToken, setAITradingAccessToken, setConsoleAccessToken, setConsoleEngineUrl, useAIAgent, useAIAgentSubscription, useAIAgents, useAIDecisions, useAIMarketData, useAIOrders, useAIPortfolio, useAIPositions, useAIQuantConsole, useAIRiskStatus, useAIStrategies, useAIStrategy, useAITrading, useBotSimulation, useTokenPrice, useTokenPrices, useTradingConsole, useWalletBalance };
|