@@ -269,7 +269,7 @@ maxAsk maxBid minAsk minBid
269269The cross process aggregations also work with groupings and freeformby keys, for example
270270
271271```
272- q)querydict1:`tablename`starttime`endtime`aggregations`ordering`head !(`quote;2021.03.16D01:00:00.000000000;2021.03.17D18:00:00.000000000;"sym";`max`min!(`ask`bid;`ask`bid);`desc`maxAsk;-2)
272+ q)querydict1:`tablename`starttime`endtime`freeformby` aggregations`ordering`sublist !(`quote;2021.03.16D01:00:00.000000000;2021.03.17D18:00:00.000000000;"sym";`max`min!(`ask`bid;`ask`bid);`desc`maxAsk;-2)
273273q)g(`.dataaccess.getdata;querydict1)
274274sym | maxAsk maxBid minAsk minBid
275275----| ---------------------------
@@ -278,7 +278,7 @@ DOW | 24.52 23.48 2.56 1.55
278278```
279279Such behaviour is not demonstrated when using freeform queries, for example:
280280```
281- q)querydict2:`tablename`starttime`endtime`aggregations` freeformcolumn!(`quote;2021.02.08D00:00:00.000000000;2021.02.09D09:00:00.000000000;"max ask,min ask,max bid, min bid")
281+ q)querydict2:`tablename`starttime`endtime`freeformcolumn!(`quote;2021.02.08D00:00:00.000000000;2021.02.09D09:00:00.000000000;"max ask,min ask,max bid, min bid")
282282q)g(`.dataaccess.getdata;querydict2)
283283ask bid ask1 bid1
284284-----------------------
@@ -570,8 +570,7 @@ querynumber| user starttime endtime h
5705702 | admin 2021.03.25D14:52:20.546227000 2021.03.25D14:52:20.546341000 11 `tablename`starttime`endtime`aggregations`grouping!(`quote;2021.02.12D00:00:00.000000000;15;(,`max)!,`ask`bid;`sym) 0 `endtime input type incorrect - valid type(s):-12 -14 -15h - input type:-7h
571571
572572// The bad query errored out in the gateway, consequently only the good query is seen in the rdb logs
573-
574- q).dataaccess.stats
573+ q)g".dataaccess.stats"
575574querynumber| user starttime endtime handle request success error
576575-----------| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
5775761 | gateway 2021.03.25D14:52:03.381980000 2021.03.25D14:52:03.407870000 10 `tablename`starttime`endtime`aggregations`grouping`checksperformed`procs!(`quote;2021.02.12D00:00:00.000000000;2021.03.25D14:52:03.380478000;(,`max)!,`ask`bid;`sym;1b;`hdb`rdb) 1
@@ -638,7 +637,7 @@ For every key in the dictionary the following examples provide a query, output a
638637If the time column isn't specified it defaults to the value of ``` `primaryattributecolumn ```
639638
640639```
641- getdata`tablename`starttime`endtime!(`quote;2021.01.20D0;2021.01.23D0)
640+ q) getdata`tablename`starttime`endtime!(`quote;2021.01.20D0;2021.01.23D0)
642641date time sym bid ask bsize asize mode ex src
643642----------------------------------------------------------------------------------
6446432021.01.21 2021.01.21D13:36:45.714478000 AAPL 84.01 84.87 77 33 A N BARX
@@ -657,7 +656,7 @@ date time sym bid ask bsize asize mode ex sr
657656Use the ``` `instruments ``` parameter to filter for ``` sym=`AAPL ```
658657
659658```
660- getdata`tablename`starttime`endtime`instruments!(`quote;2021.01.20D0;2021.01.23D0;`AAPL)
659+ q) getdata`tablename`starttime`endtime`instruments!(`quote;2021.01.20D0;2021.01.23D0;`AAPL)
661660date time sym bid ask bsize asize mode ex src
662661----------------------------------------------------------------------------------
6636622021.01.21 2021.01.21D13:36:45.714478000 AAPL 84.01 84.87 77 33 A N BARX
@@ -676,7 +675,7 @@ q).dataaccess.buildquery `tablename`starttime`endtime`instruments!(`quote;2021.0
676675Use the ``` `columns ``` parameter to extract the following columns - ``` `sym`time`bid ```
677676
678677```
679- getdata`tablename`starttime`endtime`columns!(`quote;2021.01.20D0;2021.01.23D0;`sym`time`bid)
678+ q) getdata`tablename`starttime`endtime`columns!(`quote;2021.01.20D0;2021.01.23D0;`sym`time`bid)
680679sym time bid
681680----------------------------------------
682681AAPL 2021.01.21D13:36:45.714478000 84.01
@@ -696,7 +695,7 @@ q).dataaccess.buildquery `tablename`starttime`endtime`columns!(`quote;2021.01.20
696695Run a free form select using the ``` `freeformcolumn ``` parameter
697696
698697```
699- getdata`tablename`starttime`endtime`freeformcolumn!(`quote;2021.01.20D0;2021.01.23D0;"sym,time,mid:0.5*bid+ask")
698+ q) getdata`tablename`starttime`endtime`freeformcolumn!(`quote;2021.01.20D0;2021.01.23D0;"sym,time,mid:0.5*bid+ask")
700699sym time mid
701700-----------------------------------------
702701AAPL 2021.01.21D13:36:45.714478000 84.44
@@ -734,7 +733,7 @@ q).dataaccess.buildquery `tablename`starttime`endtime`freeformcolumn`grouping!(`
734733Group average ``` `mid ``` , by ``` instru:sym ``` using the ``` `freeformby ``` parameter
735734
736735```
737- getdata`tablename`starttime`endtime`freeformcolumn`freeformby!(`quote;2021.01.20D0;2021.01.23D0;"avgmid:avg 0.5*bid+ask";"instr: sym")
736+ q) getdata`tablename`starttime`endtime`freeformcolumn`freeformby!(`quote;2021.01.20D0;2021.01.23D0;"avgmid:avg 0.5*bid+ask";"sym")
738737instr| avgmid
739738-----| --------
740739AAPL | 70.63876
@@ -743,8 +742,8 @@ AMD | 36.46488
743742DELL | 8.34496
744743DOW | 22.8436
745744
746- q).dataaccess.buildquery `tablename`starttime`endtime`freeformcolumn`freeformby!(`quote;2021.01.20D0;2021.01.23D0;"avgmid:avg 0.5*bid+ask";"instr: sym")
747- ? `quote ,(within;`time;2021.01.20D00:00:00.000000000 2021.01.23D00:00:00.000000000) (,`instr )!,`sym (,`avgmid)!,(avg;(*;0.5;(+;`bid;`ask)))
745+ q).dataaccess.buildquery `tablename`starttime`endtime`freeformcolumn`freeformby!(`quote;2021.01.20D0;2021.01.23D0;"avgmid:avg 0.5*bid+ask";"sym")
746+ ? `quote ,(within;`time;2021.01.20D00:00:00.000000000 2021.01.23D00:00:00.000000000) (,`sym )!,`sym (,`avgmid)!,(avg;(*;0.5;(+;`bid;`ask)))
748747
749748```
750749
@@ -753,7 +752,7 @@ q).dataaccess.buildquery `tablename`starttime`endtime`freeformcolumn`freeformby!
753752Group max ask by 6 hour buckets using the ``` `timebar ``` parameter
754753
755754```
756- getdata(`tablename`starttime`endtime`aggregations`instruments`timebar)!(`quote;2021.01.21D1;2021.01.28D23;(enlist(`max))!enlist(enlist(`ask));`AAPL;(6;`hour;`time))
755+ q) getdata(`tablename`starttime`endtime`aggregations`instruments`timebar)!(`quote;2021.01.21D1;2021.01.28D23;(enlist(`max))!enlist(enlist(`ask));`AAPL;(6;`hour;`time))
757756time | maxAsk
758757-----------------------------| ------
7597582021.01.21D12:00:00.000000000| 98.99
@@ -775,7 +774,7 @@ Max of both ``` `bidprice ``` and ``` `askprice ```
775774
776775
777776```
778- getdata`tablename`starttime`endtime`aggregations!(`quote;2021.01.20D0;2021.01.23D0;((enlist `max)!enlist `ask`bid))
777+ q) getdata`tablename`starttime`endtime`aggregations!(`quote;2021.01.20D0;2021.01.23D0;((enlist `max)!enlist `ask`bid))
779778maxAsk maxBid
780779-------------
781780109.5 108.6
@@ -791,7 +790,7 @@ q).dataaccess.buildquery `tablename`starttime`endtime`aggregations!(`quote;2021.
791790Use the ``` `filters ``` parameter to execute a functional select style where clause
792791
793792```
794- getdata`tablename`starttime`endtime`filters!(`quote;2021.01.20D0;2021.01.23D0;(enlist(`src))!enlist enlist(in;`GETGO`DB))
793+ q) getdata`tablename`starttime`endtime`filters!(`quote;2021.01.20D0;2021.01.23D0;(enlist(`src))!enlist enlist(in;`GETGO`DB))
795794date time sym bid ask bsize asize mode ex src
796795---------------------------------------------------------------------------------
7977962021.01.21 2021.01.21D13:36:45.714478000 AAPL 83.1 84.52 58 84 Y N DB
@@ -811,7 +810,7 @@ q).dataaccess.buildquery `tablename`starttime`endtime`filters!(`quote;2021.01.20
811810Use the ``` `freefromwhere ``` parameter to execute the same filter as above
812811
813812```
814- getdata`tablename`starttime`endtime`freeformwhere!(`quote;2021.01.20D0;2021.01.23D0;"src in `DB`GETGO")
813+ q) getdata`tablename`starttime`endtime`freeformwhere!(`quote;2021.01.20D0;2021.01.23D0;"src in `DB`GETGO")
815814date time sym bid ask bsize asize mode ex src
816815---------------------------------------------------------------------------------
8178162021.01.21 2021.01.21D13:36:45.714478000 AAPL 83.1 84.52 58 84 Y N DB
@@ -831,7 +830,7 @@ q).dataaccess.buildquery `tablename`starttime`endtime`freeformwhere!(`quote;2021
831830Use the ``` `ordering ``` parameter to sort results by column ascending or descending
832831
833832```
834- getdata`tablename`starttime`endtime`ordering!(`quote;2000.01.01D00:00:00.000000000;2000.01.06D10:00:00.000000000;enlist(`asc`asksize))
833+ q) getdata`tablename`starttime`endtime`ordering!(`quote;2000.01.01D00:00:00.000000000;2000.01.06D10:00:00.000000000;enlist(`asc`asksize))
835834sym time sourcetime bidprice bidsize askprice asksize
836835----------------------------------------------------------------------------------------------------
837836AAPL 2000.01.01D02:24:00.000000000 2000.01.01D02:24:00.000000000 90.9 932.4 111.1 1139.6
@@ -850,7 +849,7 @@ q).dataaccess.buildquery `tablename`starttime`endtime`ordering!(`quote;2000.01.0
850849Use the ``` `renamecolumn ``` parameter to rename the columns
851850
852851```
853- getdata (`tablename`starttime`endtime`freeformby`freeformcolumn`instruments`renamecolumn)!(`trade;2021.01.18D0;2021.01.20D0;"sym,date";"max price";`IBM`AAPL`INTC;`sym`price`date!`newsym`newprice`newdate)
852+ q) getdata (`tablename`starttime`endtime`freeformby`freeformcolumn`instruments`renamecolumn)!(`trade;2021.01.18D0;2021.01.20D0;"sym,date";"max price";`IBM`AAPL`INTC;`sym`price`date!`newsym`newprice`newdate)
854853newdate newsym| newprice
855854-----------------| --------
8568552021.01.18 IBM | 69.64
@@ -859,24 +858,27 @@ newdate newsym| newprice
8598582021.01.19 AAPL | 111.67
8608592021.01.18 INTC | 70.77
8618602021.01.19 INTC | 65.6
861+ q).dataaccess.buildquery (`tablename`starttime`endtime`freeformby`freeformcolumn`instruments`renamecolumn)!(`trade;2021.01.18D0;2021.01.20D0;"sym,date";"max price";`IBM`AAPL`INTC;`sym`price`date!`newsym`newprice`newdate)
862+ ? `trade ((=;`sym;,`IBM);(within;`time;2021.01.18D00:00:00.000000000 2021.01.20D00:00:00.000000000)) `date`sym!`time.date`sym (,`price)!,(max;`price)
863+ ? `trade ((=;`sym;,`AAPL);(within;`time;2021.01.18D00:00:00.000000000 2021.01.20D00:00:00.000000000)) `date`sym!`time.date`sym (,`price)!,(max;`price)
864+ ? `trade ((=;`sym;,`INTC);(within;`time;2021.01.18D00:00:00.000000000 2021.01.20D00:00:00.000000000)) `date`sym!`time.date`sym (,`price)!,(max;`price)
862865```
863866
864867** Postprocessing**
865868
866869Use the ``` `postproccessing ``` key to under go post proccessing on a table for example flipping the table into a dictionary
867870
868871```
869- q)getdata`tablename`starttime`endtime`aggregations`postback !(`quote;2021.02.12D0;2021.02.12D12;((enlist `max)!enlist `ask`bid);{flip x})
872+ q)getdata`tablename`starttime`endtime`aggregations`postprocessing !(`quote;2021.02.12D0;2021.02.12D12;((enlist `max)!enlist `ask`bid);{flip x})
870873maxAsk| 91.74
871874maxBid| 90.65
872875
873- q).dataaccess.buildquery `tablename`starttime`endtime`aggregations`postback !(`quote;2021.02.12D0;2021.02.12D12;((enlist `max)!enlist `ask`bid);{flip x})
876+ q).dataaccess.buildquery `tablename`starttime`endtime`aggregations`postprocessing !(`quote;2021.02.12D0;2021.02.12D12;((enlist `max)!enlist `ask`bid);{flip x})
874877? `quote ,(within;`time;2021.02.12D00:00:00.000000000 2021.02.12D12:00:00.000000000) 0b `maxAsk`maxBid!((max;`ask);(max;`bid))
875878
876879```
877880More complex example collecting the avg price across multiple processes in the gateway g
878881```
879-
880882q)g".dataaccess.getdata`tablename`starttime`endtime`aggregations`postprocessing!(`quote;2021.02.12D0;.z.p;(`sum`count)!2#`ask;{flip x})"
881883sumAsk | 1.288549e+09
882884countAsk| 28738958
@@ -892,17 +894,17 @@ avgprice
892894Use the ``` `sublist ``` key to return the first n rows of a table, for example we get the first 2 rows of the table.
893895
894896```
895- q)getdata `tablename`starttime`endtime`freeformby`aggregations`ordering`sublist!(`quote;00:00+2021.02.17D10;.z.d+18:00;\"sym\";(`max`min)!((`ask`bid);(`ask`bid));enlist(`desc;`maxAsk);2)
896897
898+ q)getdata `tablename`starttime`endtime`freeformby`aggregations`ordering`sublist!(`quote;00:00+2021.02.17D10;.z.d+18:00;"sym";(`max`min)!((`ask`bid);(`ask`bid));enlist(`desc;`maxAsk);2)
897899sym | maxAsk maxBid minAsk minBid
898900----| ---------------------------
899901AAPL| 171.23 170.36 56.35 55.32
900902GOOG| 101.09 99.96 45.57 44.47
901903
902- q).dataaccess.buildquery `tablename`starttime`endtime`freeformby`aggregations`ordering`head !(`quote;00:00+2021.02.17D10;.z.d+18:00;\ "sym\ ";(`max`min)!((`ask`bid);(`ask`bid));enlist(`desc;`maxAsk);2)
904+ q).dataaccess.buildquery `tablename`starttime`endtime`freeformby`aggregations`ordering`sublist !(`quote;00:00+2021.02.17D10;.z.d+18:00;"sym";(`max`min)!((`ask`bid);(`ask`bid));enlist(`desc;`maxAsk);2)
903905? `quote ,(within;`time;2021.02.17D10:00:00.000000000 2021.03.03D18:00:00.000000000) (,`sym)!,`sym `maxAsk`maxBid`minAsk`minBid!((max;`ask);(max;`bid);(min;`ask);(min;`bid))
904906
905- q)getdata `tablename`starttime`endtime`freeformby`aggregations`ordering`sublist!(`quote;00:00+2021.02.17D10;.z.d+18:00;\ "sym\ ";(`max`min)!((`ask`bid);(`ask`bid));enlist(`desc;`maxAsk);2 3)"
907+ q)getdata `tablename`starttime`endtime`freeformby`aggregations`ordering`sublist!(`quote;00:00+2021.02.17D10;.z.d+18:00;"sym";(`max`min)!((`ask`bid);(`ask`bid));enlist(`desc;`maxAsk);3)
906908sym | maxAsk maxBid minAsk minBid
907909----| ---------------------------
908910INTC| 68.51 67.56 44.59 43.63
0 commit comments