@Joffrey It appears your orders filled correctly at the listing exchange open auction price. You can fetch all the opening auction prices from any/all exchanges posting opening data by using auctions endpoint. as below.
the curl --request GET \
--url 'https://data.alpaca.markets/v2/stocks/auctions?symbols=UBER%2CORCL&start=2024-07-19T00%3A00%3A00Z&limit=1000&feed=sip&sort=asc' \
--header 'APCA-API-KEY-ID: xxxxx' \
--header 'APCA-API-SECRET-KEY: xxxxx' \
--header 'accept: application/json'
See the response below.
The first thing to understand is bar data should be excluding any trades with a trade condition Q ‘Market Center Official Open’. It’s a bit counterintuitive but that is really a duplicate transaction for information only. The trades with trade condition O ‘Market Center Opening Trade’ are actual trades. Notice the open price of UBER was $66.56 and the open price of ORCL was $138.52 and both executed on their primary listing exchange of the New York Stock Exchange -exchange code N.
There can be multiple opening auctions. UBER for example participated in an open auction on the NASDAQ Int Exchange - exchange code T. There it traded at $66.78. However a couple of things, that isn’t the listing exchange, moreover the size of that auction was only 359 shares. But it was the ‘first’ trade which is why data providers will use that as the ‘open’. The primary exchange auction traded a short time later with a volume of 614454 shares which is where your order executed.
A similar situation occurred with ORCL. Physically, the first trade executed at $138.35 on some exchange so that is considered the open of the bar. However, the opening auction on the New York Stock Exchange -exchange code N happened later so it wasn’t listed as the ‘open’. The open is strictly the first valid trade of the day and doesn’t always correspond to an opening auction price which is where OPG orders fill and get the auction price.
{
"auctions": {
"UBER": [
{"o": [
{
"c": "O",
"p": 66.78,
"s": 359,
"t": "2024-07-19T13:30:00.163833088Z",
"x": "T"
},
{
"c": "Q",
"p": 66.78,
"s": 359,
"t": "2024-07-19T13:30:00.163860224Z",
"x": "T"
},
{
"c": "Q",
"p": 66.78,
"s": 178,
"t": "2024-07-19T13:30:00.394840064Z",
"x": "P"
},
{
"c": "Q",
"p": 66.56,
"s": 614454,
"t": "2024-07-19T13:30:01.025048064Z",
"x": "N"
},
{
"c": "O",
"p": 66.56,
"s": 614454,
"t": "2024-07-19T13:30:01.025048064Z",
"x": "N"
}
]
}
],
"ORCL": [
"o": [
{
"c": "Q",
"p": 138.36,
"s": 20,
"t": "2024-07-19T13:30:00.745796864Z",
"x": "P"
},
{
"c": "Q",
"p": 138.38,
"s": 20,
"t": "2024-07-19T13:30:00.746343936Z",
"x": "T"
},
{
"c": "O",
"p": 138.52,
"s": 378823,
"t": "2024-07-19T13:31:47.666527744Z",
"x": "N"
},
{
"c": "Q",
"p": 138.52,
"s": 378823,
"t": "2024-07-19T13:31:47.666530816Z",
"x": "N"
}
Look at the auctions endpoint
to get the price an OPG order will fill at. Hope that makes sense.