Next topic

Tools (dccd.tools)

Processing Data (dccd.process_data)

Functions to clean, sort and other process data.

dccd.process_data.set_marketdepth(book, t=None)

Set a market depth dataframe with list of order books.

Parameters:
book : dict

Orderbook as dict, where keys is the price and value is the amount.

Returns:
pd.DataFrame

Order book as dataframe.

dccd.process_data.set_ohlc(trades, ts=60)

Aggregate and set a dataframe with list of trades.

Parameters:
trades : list

Historical trades tick by tick as list.

ts : int, optional

Timestep in seconds to aggregate data, default is 60.

Returns:
pd.DataFrame

Aggregated trades as OHLC, dataframe is indexed by timestamp and columns contains ‘open’, ‘high’, ‘low’, ‘close’, and ‘volume’.

dccd.process_data.set_orders(orders, t=None)

Set a dataframe with list of each order.

Parameters:
orders : list

Each orders in a list.

Returns:
pd.DataFrame

List of orders as dataframe.

dccd.process_data.set_trades(trades)

Set a dataframe with list of trades.

Parameters:
trades : list

Historical trades tick by tick as list.

Returns:
pd.DataFrame

Historical trades tick by tick as dataframe.