Trading Pairs
Trading pairs define the asset combination an AI agent will trade. The ONE SDK provides both an API method to fetch supported pairs and a ready-made OnePairSelector component for React Native UIs.
getTradingPairs API
Retrieve the full list of supported trading pairs from the engine.
import { OneEngineClient } from '@one_deploy/sdk';
const engine = new OneEngineClient({
apiKey: process.env.ONE_API_KEY!,
projectId: process.env.ONE_PROJECT_ID!,
});
const pairs = await engine.getTradingPairs();
pairs.forEach((pair) => {
console.log(`${pair.symbol} -- ${pair.baseAsset}/${pair.quoteAsset}`);
console.log(` Chain: ${pair.chainId}`);
console.log(` Active: ${pair.isActive}`);
});
Method Signature
getTradingPairs(): Promise<TradingPair[]>
TradingPair Type
interface TradingPair {
/** Unique pair identifier, e.g. "BTC_USDT". */
symbol: string;
/** Base asset symbol, e.g. "BTC". */
baseAsset: string;
/** Quote asset symbol, e.g. "USDT". */
quoteAsset: string;
/** Chain ID where this pair is traded. */
chainId: number;
/** Whether the pair is currently available for new orders. */
isActive: boolean;
/** Minimum order size in quote currency. */
minOrderSize: number;
/** Maximum order size in quote currency, or null for unlimited. */
maxOrderSize: number | null;
/** Price precision (decimal places). */
pricePrecision: number;
/** Quantity precision (decimal places). */
quantityPrecision: number;
}
PAIR_ICONS Constant
The PAIR_ICONS constant maps pair symbols to their icon URIs, useful for displaying pair logos in your UI.
import { PAIR_ICONS } from '@one_deploy/sdk';
// PAIR_ICONS is a Record<string, string>
const btcIcon = PAIR_ICONS['BTC']; // URI to BTC icon asset
const ethIcon = PAIR_ICONS['ETH']; // URI to ETH icon asset
const usdtIcon = PAIR_ICONS['USDT']; // URI to USDT icon asset
const PAIR_ICONS: Record<string, string> = {
BTC: 'https://assets.one23.io/icons/btc.png',
ETH: 'https://assets.one23.io/icons/eth.png',
USDT: 'https://assets.one23.io/icons/usdt.png',
USDC: 'https://assets.one23.io/icons/usdc.png',
SOL: 'https://assets.one23.io/icons/sol.png',
BNB: 'https://assets.one23.io/icons/bnb.png',
// ... additional assets
};
OnePairSelector Component
The OnePairSelector is a React Native component that renders a selectable list of trading pairs with icons and pair details.
React Native Only
OnePairSelector is exported from the React Native entry point of @one_deploy/sdk. It is not available on web.
Quick Start
import { useState } from 'react';
import { OnePairSelector } from '@one_deploy/sdk';
import type { TradingPair } from '@one_deploy/sdk';
function PairSelection() {
const [selectedPair, setSelectedPair] = useState<TradingPair | null>(null);
return (
<OnePairSelector
strategyId="strat_abc123"
chainId={8453}
onSelect={(pair) => {
setSelectedPair(pair);
console.log('Selected pair:', pair.symbol);
}}
/>
);
}
OnePairSelectorProps
interface OnePairSelectorProps {
/** Strategy ID to filter pairs by supported pairs. */
strategyId: string;
/** Chain ID to filter pairs by chain. */
chainId: number;
/** Currently selected pair symbol. */
selectedPair?: string;
/** Callback fired when the user selects a pair. */
onSelect: (pair: TradingPair) => void;
/** Whether to show pair icons. Defaults to true. */
showIcons?: boolean;
/** Whether to show inactive pairs (greyed out). Defaults to false. */
showInactive?: boolean;
/** Additional style applied to the container. */
style?: ViewStyle;
/** Style applied to each pair item. */
itemStyle?: ViewStyle;
/** Test ID for testing frameworks. */
testID?: string;
}
Props Table
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
strategyId | string | Yes | -- | Strategy ID to filter pairs |
chainId | number | Yes | -- | Chain ID to filter available pairs |
selectedPair | string | No | -- | Currently selected pair symbol |
onSelect | (pair: TradingPair) => void | Yes | -- | Selection callback |
showIcons | boolean | No | true | Display asset icons |
showInactive | boolean | No | false | Show inactive pairs |
style | ViewStyle | No | -- | Container style |
itemStyle | ViewStyle | No | -- | Individual item style |
testID | string | No | -- | Test ID |
With Custom Styling
import { OnePairSelector } from '@one_deploy/sdk';
function StyledPairSelector() {
return (
<OnePairSelector
strategyId="strat_abc123"
chainId={8453}
showIcons={true}
showInactive={false}
style={{
backgroundColor: '#1a1a2e',
borderRadius: 12,
padding: 16,
}}
itemStyle={{
paddingVertical: 12,
borderBottomWidth: 1,
borderBottomColor: '#2d2d44',
}}
onSelect={(pair) => console.log('Pair:', pair.symbol)}
/>
);
}
Using Pair Icons in a Custom List
If you need full control over the UI, fetch pairs via the API and use PAIR_ICONS for icons.
import { useState, useEffect } from 'react';
import { OneEngineClient, PAIR_ICONS } from '@one_deploy/sdk';
import type { TradingPair } from '@one_deploy/sdk';
function CustomPairList({ engine }: { engine: OneEngineClient }) {
const [pairs, setPairs] = useState<TradingPair[]>([]);
useEffect(() => {
engine.getTradingPairs().then(setPairs);
}, []);
return (
<FlatList
data={pairs.filter((p) => p.isActive)}
keyExtractor={(item) => item.symbol}
renderItem={({ item }) => (
<View style={styles.row}>
<Image source={{ uri: PAIR_ICONS[item.baseAsset] }} style={styles.icon} />
<Text style={styles.symbol}>{item.baseAsset}/{item.quoteAsset}</Text>
<Text style={styles.detail}>
Min: {item.minOrderSize} {item.quoteAsset}
</Text>
</View>
)}
/>
);
}
Next Steps
- Investment Cycles -- choose a lock period after selecting a pair.
- Creating Orders -- use the selected pair to create an order.
- OnePairSelector Reference -- full component API reference.