Overview
TheTradeInterface component is the primary trading view that combines the price chart and order book depth display in a responsive grid layout. It provides traders with a comprehensive view of market data.
Component Structure
The trading interface uses a grid layout that adapts to different screen sizes:TradeInterface.tsx
Layout Breakdown
Grid Layout
Grid Layout
The interface uses CSS Grid with responsive breakpoints:
- Mobile: Single column layout with chart on top
- Desktop: Two-column layout with 3:1 ratio (chart:depth)
- Chart height: Fixed at 600px for optimal viewing
Child Components
TradeView
Real-time candlestick charts with multiple timeframes (1m, 1H, 1D, 1W)
Depth
Order book visualization with bids/asks and recent trades
TradeView Component
The chart component provides interactive price visualization:TradeView.tsx
Key Features
- Timeframe Selection
- Data Fetching
- Chart Management
Users can switch between multiple timeframes:
- 1m: 1-minute candles
- 1H: 1-hour candles
- 1D: Daily candles
- 1W: Weekly candles
Real-Time Updates
Both the chart and order book receive real-time updates through WebSocket connections managed by the
WsManager singleton.Usage Example
Props
| Prop | Type | Description |
|---|---|---|
market | string | Market identifier (e.g., “SOL_USDC”) |
Responsive Behavior
Best Practices
Related Components
- Order Book - Depth visualization and recent trades
- Charts - Chart manager and candlestick implementation
- Swap Interface - Order placement interface