Features
Trading objects
Draw positions, orders, and brackets, and turn drags into broker-neutral intents.
How it works
Your application supplies the authoritative positions, working orders, bracket and OCO links, executions, and instrument details. Aeris draws them, labels them on the price axis, hit-tests them, and previews drags. A drag never rewrites confirmed broker state. Instead, the chart emits a typed intent, and you decide what to send to the broker.
Apply state
apply_snapshot
const trading = chart.trading();
trading.apply_snapshot({
instrument: { tick_size: 0.25, price_precision: 2, point_value: 50, currency: "USD" },
positions: [{ id: "position-1", side: "long", average_price: 5230, quantity: 2 }],
orders: [{
id: "target-1", side: "sell", kind: "limit", role: "take_profit", status: "working",
price: 5240, quantity: 2, position_id: "position-1", oco_group_id: "bracket-1", revision: 4,
}],
});Handle intents
Intents
trading.set_confirmation_mode("manual"); // default "instant"
trading.subscribe_intents(async (intent) => {
const accepted = await routeToBroker(intent);
trading.resolve_intent(intent.sequence, accepted);
// On acceptance, push the new order or position state with apply_snapshot.
});In instant mode, releasing a drag emits one intent. In manual mode, the preview waits behind inline Confirm and Discard controls. Risk and reward fills appear only on active previews.
Brackets from position drawings
place_bracket_order
const plan = chart.selected_drawing();
if (plan && (plan.kind() === "long_position" || plan.kind() === "short_position")) {
// Entry, take-profit, and stop come from the drawing; quantity is yours.
trading.place_bracket_order(plan.id, quantity);
}Runtime only
Trading objects, previews, and intent queues belong to one chart at runtime. They are not included in export_state().