select cs_histogram(Close, 0, 100, 10) from Quote_get('IBM'); cs_histogram ---------------------------- int8:{0,1,1,1,1,1,0,0,0,0} (1 row) select cs_cross(Open-Close, 0) from Quote_get('IBM'); cs_cross ------------ int8:{1,4} (1 row) select cs_extrema(cs_parse('{1,2,3,2,1,0,0,1,1,2,4,0}','int4'), 0); cs_extrema --------------- int8:{2,6,10} (1 row) select cs_extrema(cs_parse('{1,2,3,2,1,0,0,1,1,2,4,0}','int4'), 1); cs_extrema ------------- int8:{2,10} (1 row) select cs_extrema(cs_parse('{1,2,3,2,1,0,0,1,1,2,4,0}','int4'), -1); cs_extrema ------------ int8:{6} (1 row) select cs_stretch(cs_parse('{1,2,3,4,5}','int4'), cs_parse('{2,4}','int4'), cs_parse('{1.1,2.2}','float8'), 1.0); cs_stretch -------------------------- float8:{1.1,2.2,2.2,1,1} (1 row) select cs_stretch0(cs_parse('{1,2,3,5}','int8'), cs_parse('{2,3,4}','int8'), cs_parse('{1.1,1.2,1.3}','float4'), 0.0); cs_stretch0 -------------------------- float4:{0,1.1,1.2,1.3,0} (1 row) select cs_asof_join(cs_parse('{4,9}','int4'), cs_parse('{1,3,6,10}','int4'), cs_parse('{0.1,0.3,0.6,1.0}','float8')); cs_asof_join ---------------- float8:{0.3,1} (1 row) select cs_asof_join_pos('int8:{4,9}', 'int8:{1,3,6,10}'); cs_asof_join_pos ------------------ int8:{2,2} (1 row) select (Quote_project(q.*,'date:{31-Oct-2013,03-Nov-2013}'->Day)).* from Quote_get('IBM') q; symbol | day | open | high | low | close | volume --------+------------+------+------+-----+-------+-------- IBM | 11-01-2013 | 10.2 | 11 | 10 | 10.5 | 100 IBM | 11-04-2013 | 30.5 | 31 | 30 | 30.2 | 300 (2 rows) select (Quote_project(q.*,'date:{1-Nov-2013,2-Nov-2013,03-Nov-2013,04-Nov-2013}'<->Day)).* from Quote_get('IBM') q; symbol | day | open | high | low | close | volume --------+------------+------+------+------+-------+-------- IBM | 11-01-2013 | 10.2 | 11 | 10 | 10.5 | 100 IBM | 11-02-2013 | 20.2 | 20.2 | 20.2 | 20.2 | 200 IBM | 11-04-2013 | 30.5 | 31 | 30 | 30.2 | 300 (3 rows) select cs_join('date:{1-Nov-2013,2-Nov-2013,03-Nov-2013,04-Nov-2013}', Day, Close) from Quote_get('IBM'); cs_join ------------------------- float4:{10.5,20.2,30.2} (1 row) select (Quote_project(Quote_get('IBM'), Quote_join('IBM', 'date:{2-Nov-2013,4-Nov-2013,03-Nov-2013,01-Nov-2013}'))).*; symbol | day | open | high | low | close | volume --------+------------+------+------+------+-------+-------- IBM | 11-02-2013 | 20.2 | 20.2 | 20.2 | 20.2 | 200 IBM | 11-04-2013 | 30.5 | 31 | 30 | 30.2 | 300 IBM | 11-04-2013 | 30.5 | 31 | 30 | 30.2 | 300 IBM | 11-01-2013 | 10.2 | 11 | 10 | 10.5 | 100 (4 rows) select (Quote_project(Quote_get('IBM'), Quote_join('IBM', 'date:{2-Nov-2013,4-Nov-2013,03-Nov-2013,01-Nov-2013}', 1))).*; symbol | day | open | high | low | close | volume --------+------------+------+------+------+-------+-------- IBM | 11-02-2013 | 20.2 | 20.2 | 20.2 | 20.2 | 200 IBM | 11-04-2013 | 30.5 | 31 | 30 | 30.2 | 300 IBM | 11-04-2013 | 30.5 | 31 | 30 | 30.2 | 300 IBM | 11-01-2013 | 10.2 | 11 | 10 | 10.5 | 100 (4 rows) select (Quote_project(Quote_get('IBM'), Quote_join('IBM', 'date:{2-Nov-2013,4-Nov-2013,03-Nov-2013,01-Nov-2013}', 0))).*; ERROR: no matching timestamp in timeseries select (Quote_project(Quote_get('IBM'), Quote_join('IBM', 'date:{2-Nov-2013,4-Nov-2013,03-Nov-2013,01-Nov-2013}', -1))).*; symbol | day | open | high | low | close | volume --------+------------+------+------+------+-------+-------- IBM | 11-02-2013 | 20.2 | 20.2 | 20.2 | 20.2 | 200 IBM | 11-04-2013 | 30.5 | 31 | 30 | 30.2 | 300 IBM | 11-02-2013 | 20.2 | 20.2 | 20.2 | 20.2 | 200 IBM | 11-01-2013 | 10.2 | 11 | 10 | 10.5 | 100 (4 rows)