Something like the following will work:
ans:hdl({select count i by date,sym from trade where date=xxx, sym in x};res)
@mollmerx is correct about having res defined locally and not on the remote process, although my query above is preferable to a functional select.