Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Hook for creating and managing take-profit and stop-loss (TP/SL) algo orders on positions.
declare function useTPSLOrder( position: Partial<API.PositionTPSLExt> & Pick<API.PositionTPSLExt, "symbol" | "average_open_price" | "position_qty">, options?: { defaultOrder?: API.AlgoOrder; } ): [ ComputedAlgoOrder, { setValue: (key: string, value: number | string) => void; setValues: (values: Partial<ComputedAlgoOrder>) => void; submit: () => Promise<void>; errors: ValidateError | null; validate: () => Promise< AlgoOrderEntity<AlgoOrderRootType.POSITIONAL_TP_SL | AlgoOrderRootType.TP_SL> >; } ];
const [ComputedAlgoOrder, { submit }] = useTPSLOrder(position, { defaultOrder // Must pass in order data });
useOrderStream
const [_, { updateTPSLOrder }] = useOrderStream(); updateTPSLOrder(orderId, childOrders);
const [_, { cancelAllTPSLOrders }] = useOrderStream();
const [_, { cancelTPSLChildOrder }] = useOrderStream(); cancelTPSLChildOrder(childOrderId, rootAlgoOrderId);
const [orders] = useOrderStream({ includes: [AlgoOrderRootType.TP_SL, AlgoOrderRootType.POSITIONAL_TP_SL] // Show only TP/SL orders //excludes:[AlgoOrderRootType.TP_SL, AlgoOrderRootType.POSITIONAL_TP_SL],// Do not show TP/SL orders });