PEAK merger with DOC and wrong daily SIP data

PEAK acquired DOC on Thursday, 2024-02-29.

With this naturally DOC stopped trading and PEAK traded next date on Friday, 2024-03-01 under symbol PEAK.

On Monday 2024-03-04 PEAK changed its symbol to DOC and continue trading under this symbol.

Looking at daily price and volume data, I see that Alpaca removed all DOC data prior to 2024-02-29 (before merger) and replaced PEAK symbol with DOC in all PEAK data.

Can we correct this?

@jafarov You are asking about the merger of DOC and PEAK and the subsequent symbol change to DOC and stated “Alpaca removed all DOC data prior to 2024-02-29 (before merger) and replaced PEAK symbol with DOC in all PEAK data.” That isn’t exactly correct. All the data is still there. One simply needs to use the as_of parameter to get to it.

A diagram may help. Basically, Healthpeak Properties (PEAK) existed before 2024-03-01. Physicians Realty Trust (DOC) then merged with Healthpeak Properties on 2024-03-01 and continues to do business as Healthpeak Properties to this day. A small wrinkle is that Healthpeak Properties changed its stock symbol to DOC after the merger and now trades under that symbol. Physicians Realty Trust ceased trading as an independent company on 2024-03-01. Below is a graphic depicting this.

To get the historical prices of Healthpeak Properties, use the current symbol DOC. The API will default to account for any symbol changes. Notice the close on 2024-01-02 and 2026-03-13 are 20.03 and 16.98, respectively, as expected for Healthpeak Properties. You generally do not need to know that there were any symbol changes.

https://data.alpaca.markets/v2/stocks/bars?symbols=DOC&timeframe=1Day&start=2024-01-01&end=2026-03-29

If you want to know the prices of DOC before the merger, then you can provide an as_of parameter. What that does is instruct the API to look up the first price it finds before that date and use the associated security. The API then fetches data as normal for that security. The as_of parameter does not impact the timeframe of returned bars. It is simply used to set a date that the API uses to look up the symbol. If you want the price of DOC before the merger, simply supply an as-of parameter for a date before the merger. Let’s use 2024-02-01.

https://data.alpaca.markets/v2/stocks/bars?symbols=DOC&timeframe=1Day&start=2024-01-01&end=2026-03-29&adjustment=raw&asof=2024-02-01

Notice that even though we requested bars until 2026-03-13 the last bar returned was 2024-02-29. That is because it was the last day on which the company Physicians Realty Trust, which then traded under the symbol DOC, traded. Alpaca didn’t remove DOC data prior to 2024-02-29. It simply requires instructing the API to return data associated with that symbol before that date.

There is also another option. Instead of supplying an as_of date, one can use the special “minus” symbol -. This instructs the API not to do any symbol conversion. It simply returns all bars associated with the requested symbol, regardless of symbol changes. The following is the same request as above, but with as_of=- .

https://data.alpaca.markets/v2/stocks/bars?symbols=DOC&timeframe=1Day&start=2024-01-01end=2026-03-29adjustment=raw&asof=-

This returns any bars that had a symbol DOC.

The interesting thing in this case is that DOC stopped trading on 2024-02-29, but the symbol didn’t change from PEAK to DOC until 2024-03-04. Therefore, the symbol DOC technically didn’t trade on 2024-03-01. This is evident in the data returned from the previous call. There is a forward-filled bar on that date with 0 volume and 0 trades.

Hope that helps explain how to fetch data for symbols before and after mergers.

1 Like

@Dan_Whitnable_Alpaca My problem was not using as_of parameter. You clarified everything well. Thank you!