AI Trading Overview
The ONE SDK (@one_deploy/sdk v1.1.0) includes a full AI-powered trading agent system. AI agents execute algorithmic trading strategies on behalf of users, operating across multiple chains and trading pairs with configurable risk profiles and investment cycles.
Architecture
+------------------------------------------------------------------+
| Your Application |
+------------------------------------------------------------------+
| React Native | Web / Node (API only) |
| - OneChainSelector | - OneEngineClient |
| - OneTierSelector | AI trading methods |
| - OneCycleSelector | - useAIStrategies |
| - OnePairSelector | - useAIPortfolio |
+------------------------------------------------------------------+
| @one_deploy/sdk |
| +---------------------------+ +-----------------------------+ |
| | AI Trading Hooks | | AI Trading API | |
| | - useAIStrategies | | - getAIStrategies | |
| | - useAIStrategy | | - createAIOrder | |
| | - useAIOrders | | - pauseAIOrder | |
| | - useAIPortfolio | | - resumeAIOrder | |
| | - useAIMarketData | | - redeemAIOrder | |
| | - useAITrading | | - getAIPortfolio | |
| +---------------------------+ +-----------------------------+ |
| +----------------------------------------------------------+ |
| | botSimulationEngine (P&L projections) | |
| +----------------------------------------------------------+ |
+------------------------------------------------------------------+
| |
v v
ONE Engine API Blockchain Networks
engine.one23.io (Base, Ethereum, etc.)
Authentication: Standalone Token Management
AI trading hooks and API methods use standalone token management, not OneProvider. You must set the access token explicitly using setAITradingAccessToken before calling any AI trading method, and clear it with clearAITradingAccessToken when the user signs out.
import {
setAITradingAccessToken,
clearAITradingAccessToken,
} from '@one_deploy/sdk';
// After your user authenticates, set the token
const token = await authenticateUser(); // your auth flow
setAITradingAccessToken(token);
// All AI trading hooks and API calls now use this token
// ...
// On sign-out, clear the token
clearAITradingAccessToken();
This design allows AI trading to function independently from the provider-based auth system, which is especially useful in React Native apps that do not use OneProvider.
Strategy Categories
Every AI strategy belongs to a StrategyCategory. Each category represents a different algorithmic approach and risk/reward profile.
type StrategyCategory =
| 'conservative'
| 'balanced'
| 'aggressive'
| 'hedge'
| 'arbitrage'
| 'trend'
| 'grid'
| 'dca';
| Category | Description | Typical Risk |
|---|---|---|
conservative | Capital preservation focus, low drawdown tolerance | Low |
balanced | Moderate exposure with active rebalancing | Medium |
aggressive | High conviction positions with wider stop-losses | High |
hedge | Delta-neutral or hedged positions to reduce market exposure | Low-Medium |
arbitrage | Exploits price discrepancies across venues or chains | Low |
trend | Momentum-following algorithms that ride sustained moves | Medium-High |
grid | Places layered buy/sell orders across a price range | Medium |
dca | Dollar-cost averaging -- splits entry across time intervals | Low-Medium |
Risk Levels
The RiskLevel type represents the overall risk classification assigned to a strategy or order.
type RiskLevel = 'conservative' | 'moderate' | 'aggressive';
| Risk Level | Max Drawdown | Position Sizing | Description |
|---|---|---|---|
conservative | 5-10% | Small (1-3% per trade) | Prioritises capital preservation |
moderate | 10-20% | Medium (3-7% per trade) | Balanced risk/reward |
aggressive | 20-40% | Large (7-15% per trade) | Maximises upside, accepts volatility |
Trade Actions
The TradeAction type enumerates every action an AI agent can take on a position.
type TradeAction =
| 'buy'
| 'sell'
| 'long'
| 'short'
| 'close_long'
| 'close_short';
| Action | Direction | Description |
|---|---|---|
buy | Long | Open a spot buy position |
sell | -- | Close a spot position or take profit |
long | Long | Open a leveraged long (perpetuals) |
short | Short | Open a leveraged short (perpetuals) |
close_long | -- | Close an open long position |
close_short | -- | Close an open short position |
Order Lifecycle
An AI trading order moves through the following states:
pending ──> active ──> completed
│ │
├──> paused │
│ │ │
│ └──> active (resumed)
│
└──> redeemed (early withdrawal)
type AIOrderStatus =
| 'pending'
| 'active'
| 'paused'
| 'completed'
| 'redeemed'
| 'failed';
Builder Flow
Creating an AI trading order follows a step-by-step builder flow. The SDK provides dedicated selector components for each step.
Select Strategy ──> Select Chain ──> Select Tier ──> Select Cycle ──> Select Pair ──> Set Amount ──> Create Order
│ │ │ │ │
v v v v v
useAIStrategies OneChainSelector OneTierSelector OneCycleSelector OnePairSelector
Key Exports
import {
// Authentication
setAITradingAccessToken,
clearAITradingAccessToken,
// Hooks
useAIStrategies,
useAIStrategy,
useAIOrders,
useAIPortfolio,
useAIMarketData,
useAITrading,
// Components (React Native)
OneChainSelector,
OneTierSelector,
OneCycleSelector,
OnePairSelector,
// API client
OneEngineClient,
// Simulation
botSimulationEngine,
// Constants
CHAIN_CONFIG,
PAIR_ICONS,
DEFAULT_SHARE_RATES,
// Types
type StrategyCategory,
type RiskLevel,
type TradeAction,
type AIOrderStatus,
type AIStrategy,
type AIOrder,
type AIPortfolioSummary,
type AINavSnapshot,
type AITradeExecution,
type AITradeAllocation,
type AIRedemptionResult,
type CreateAIOrderRequest,
} from '@one_deploy/sdk';
Next Steps
- Agent Catalog -- browse and filter available AI strategies.
- Trading Pairs -- select trading pairs for orders.
- Investment Cycles -- understand lock periods and share rates.
- Creating Orders -- build and submit an AI trading order.
- Portfolio Dashboard -- view aggregated portfolio metrics.
- Bot Console -- monitor NAV snapshots and trade history.
- Strategy Management -- pause, resume, and redeem orders.
- Early Withdrawal -- understand penalties for early redemption.
- Components -- reference docs for each selector component.