StockBud.io Trading Schema
Schema for trading operations and order management in StockBud.io
📈 StockBud.io Trading Schema
Version: 1.0.0
Schema for trading operations and order management in StockBud.io
Overview
This schema defines 4 data structures:
Order- Trading order structure...Trade- Executed trade record...TradingSignal- AI-generated trading signal...TradingStrategy- Trading strategy configuration...
Definitions
Order
Trading order structure
Properties
| Property | Type | Required | Description |
|---|---|---|---|
order_id | string | ✓ | Unique order identifier |
client_order_id | string | Client-generated order identifier | |
symbol | string | ✓ | Stock symbol |
quantity | number | ✓ | Order quantity |
side | enum: 'buy', 'sell' | ✓ | Order side |
order_type | enum: 'market', 'limit', 'stop', 'stop_limit', 'trailing_stop' | ✓ | Order type |
status | enum: 'new', 'partially_filled', 'filled', 'done_for_day', 'canceled', 'expired', 'replaced', 'pending_cancel', 'pending_replace', 'pending_review', 'accepted', 'pending_new', 'accepted_for_bidding', 'stopped', 'rejected', 'suspended', 'calculated' | ✓ | Order status |
time_in_force | enum: 'day', 'gtc', 'opg', 'cls', 'ioc', 'fok' | Time in force | |
limit_price | number | Limit price (for limit orders) | |
stop_price | number | Stop price (for stop orders) | |
trail_percent | number | Trail percentage (for trailing stop orders) | |
trail_price | number | Trail price (for trailing stop orders) | |
filled_quantity | number | Quantity filled | |
average_fill_price | number | Average fill price | |
extended_hours | boolean | Extended hours trading enabled | |
order_class | enum: 'simple', 'bracket', 'oco', 'oto' | Advanced order class | |
legs | Array<Record<string, unknown>> | Order legs for multi-leg orders (bracket, OCO, OTO) | |
submitted_at | string | Order submission timestamp | |
updated_at | string | Last order update timestamp | |
filled_at | string | Order fill timestamp | |
canceled_at | string | Order cancellation timestamp | |
expired_at | string | Order expiration timestamp | |
commission | number | Commission charged for the order | |
hwm | number | High water mark (for trailing stops) |
TypeScript
Trade
Executed trade record
Properties
| Property | Type | Required | Description |
|---|---|---|---|
trade_id | string | ✓ | Unique trade identifier |
order_id | string | ✓ | Associated order identifier |
symbol | string | ✓ | Stock symbol |
quantity | number | ✓ | Trade quantity |
price | number | ✓ | Trade price |
side | enum: 'buy', 'sell' | ✓ | Trade side |
timestamp | string | ✓ | Trade execution timestamp |
commission | number | Commission paid | |
fees | number | Additional fees | |
net_amount | number | Net amount (price * quantity - commission - fees) |
TypeScript
TradingSignal
AI-generated trading signal
Properties
| Property | Type | Required | Description |
|---|---|---|---|
signal_id | string | Unique signal identifier | |
symbol | string | ✓ | Stock symbol |
signal_type | enum: 'momentum', 'mean_reversion', 'value', 'growth', 'quality', 'sentiment', 'technical', 'fundamental', 'statistical_arbitrage' | ✓ | Type of trading signal |
direction | enum: 'long', 'short', 'flat', 'hold' | ✓ | Signal direction |
strength | number | ✓ | Signal strength (-1 to 1) |
confidence | number | ✓ | Signal confidence (0 to 1) |
target_price | number | Target price for the signal | |
stop_loss | number | Suggested stop loss price | |
take_profit | number | Suggested take profit price | |
position_size | number | Suggested position size as percentage of portfolio | |
time_horizon | enum: 'intraday', 'short_term', 'medium_term', 'long_term' | Expected signal duration | |
rationale | string | Explanation of the signal | |
indicators | object | Technical indicators supporting the signal | |
timestamp | string | ✓ | Signal generation timestamp |
expires_at | string | Signal expiration timestamp | |
strategy_name | string | Name of strategy that generated the signal |
TypeScript
TradingStrategy
Trading strategy configuration
Properties
| Property | Type | Required | Description |
|---|---|---|---|
name | string | ✓ | Strategy name |
strategy_type | enum: 'momentum', 'mean_reversion', 'pairs_trading', 'market_making', 'trend_following', 'swing_trading', 'day_trading', 'scalping', 'arbitrage', 'multi_factor' | ✓ | Type of trading strategy |
description | string | Strategy description | |
parameters | object | ✓ | Strategy-specific parameters |
universe | Array<string> | Trading universe (symbols) | |
risk_parameters | object | ||
schedule | string | Cron-style schedule for strategy execution | |
enabled | boolean | Whether the strategy is enabled | |
created_at | string | Strategy creation timestamp | |
updated_at | string | Last update timestamp |