I think this request should be a straight forward task since alpaca already has a .df option.
For 1min agg data, it’s standard that the OHLCV and vwap is available, but I am noticing that the only way to get more detailed information (e.g. an aggregate volume traded at the bid / ask) has to be done by loading in the full trade logs and aggregating certain things myself. This is unfortunate since I’ll likely end up resampling the tick data information to 30sec or 1min bars, when all I needed was an aggregate of certain columns. I’m assuming the vwap calculation is resampled by day, not by the aggregate minute bar that was requested.
What I mean by aggregating certain fields is if we can send a request that shows OHLCV, vwap by specified resample_period, but also have parameters (and/or a single parameter to return all aggregates) that shows the aggregates of each returned value.
For example, if return_all_mean_aggs == True, then e.g. pd.resample.mean() to return:
mean_bid_volume and mean_ask_volume, mean_bid_size, mean_ask_size, mean_bid_price, mean_ask_price (etc…),
or if return_all_sum_aggs == True then pd.resample.sum() to return sum_bid_volume and sum_ask_volume, etc…
Similarly, we can have a parameter if return_all_aggs == True then return the mean, median, sum, standard_dev, min, max, mode, counts, etc… (all pandas groupby / resample attributes)
So for all columns it will basically be the same line of code:
df.resample(period = requested_period).sum(), .mean(), .count(), etc…
Doing this for the bid and ask will return
median_bid_volume, median_ask_volume etc…
Is this within the scope of alpaca?
Lastly, if we want to go slightly further, since vwap is calculated by day only, what about including:
Looking forward to hearing from you guys, thanks!