Processing Data (dccd.process_data)¶
Functions to clean, sort and other process data.
- set_marketdepth(book, t=None)[source]¶
Set a market depth dataframe with list of order books.
- Parameters:
- bookdict
Orderbook as dict, where keys is the price (positive=bid, negative=ask) and value is the amount.
- Returns:
- pl.DataFrame
Order book as flat dataframe with columns
['TS', 'side', 'rank', 'price', 'cum_amount', 'vwab'].
- set_ohlc(trades, ts=60)[source]¶
Aggregate and set a dataframe with list of trades.
- Parameters:
- tradeslist
Historical trades tick by tick as list.
- tsint, optional
Timestep in seconds to aggregate data, default is 60.
- Returns:
- pl.DataFrame
Aggregated trades as OHLC dataframe with columns
['TS', 'open', 'high', 'low', 'close', 'volume'].