Hi,
I am writing a simple algorithm using Typescript that executes buy and sell orders with a limit.
Such orders may be partially filled and may receive multiple trade updates until complete
Order example:
const order = await this.alpaca.placeOrder({
client_order_id: myId,
qty: qtyToBuy,
time_in_force: 'day',
side: 'buy',
limit_price: limitPrice,
type: 'limit',
symbol: tickerId,
});
I also register to the Alpaca Websocket API to get trade updates for the order. (see here for the API I use)
IIUC, the events I care about are of type "partial_fill’ and ‘fill’. I have a few questions:
-
If the order was partially filled and later filled, will I receive a ‘fill’ event at the end? And, will I receive ‘partial_fill’ for the last execution and then a ‘fill’ event or does the ‘fill’ event replaces the last ‘partial_fill’ ?
-
If the order was partially filled, can I tell at what price and what quantity was partially filled ? (from the ‘partial_fill’ event?
The current documentation just lists the different events but it doesn’t answer these quesitons.
Thank you in advance!