Documentation for the TradeUpdate web socket event


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:

  1. 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’ ?

  2. 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!

I see that the returned object has the actual order together with additional fields (see here

It is not clear whether the filled_qty and filled_avg_price are calculated for each partial fill separately or each time they contain the aggregated data for the order until now.