added functions to compute balances and extract series from data.tables