forked from fin-hypergrid/core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added url and table attributes to q behavior
- Loading branch information
1 parent
2e6bc45
commit 0e348f9
Showing
10 changed files
with
183 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// load this script into your q script for | ||
// a simple interface to the hypergrid using the q behavior | ||
|
||
$[.z.K<3.19999;0N! "You need version 3.2 or later for this, please download a more recent version of q";] | ||
\p 5000 | ||
|
||
features:flip ( | ||
(`sorting; 0b); | ||
(`columnReordering; 0b) | ||
); | ||
|
||
features:features[0]!features[1]; | ||
|
||
window:{[tableName;start;num] | ||
ii: start + til num; | ||
([]row:ii),'(value tableName)[ii]} | ||
|
||
.z.ws:{ | ||
message: .j.c x; | ||
@[`$message`cmd;message`data]; | ||
} | ||
|
||
fetchTableRowCount: { | ||
count (value x`table)} | ||
|
||
fetchTableData: { | ||
json: .j.j (`data`rows`headers`features)!(value each window[(x`table);`long$(x`start);`long$(x`num)];fetchTableRowCount x;(enlist (`row;"j")),(value each select c,t from meta (value x`table));features); | ||
neg[.z.w] json; //negating a handle makes the sending of data async | ||
} | ||
|
||
sf:parse "delete av from `av xasc update av:abs quantity from `myTable" | ||
sortTable: { | ||
$[0~count x`sort; | ||
[]; | ||
[sf[1;2;4;`av]:(`$x`sort); | ||
sf[1;2;1;0]:`$(x`table); | ||
$[x`abs; | ||
$[11h~type ((value x`table)`$x`sort);;sf[1;2;4]:(enlist`av)!enlist (abs;`$x`sort)]; | ||
()]; | ||
sf[1;0]:$[x`asc;xasc;xdesc]; | ||
eval sf] | ||
]; | ||
fetchTableData[x]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// this example script creates a sortable 1MM row table | ||
|
||
\p 5000 | ||
|
||
\l hypergrid-support.q | ||
|
||
//turn on sorting | ||
features[`sorting]:1b; | ||
|
||
holdingId:`abcde`bcdef`cdefgh`defgh`efghi`fghij`ghijk; | ||
symbol:`msft`amat`csco`intc`yhoo`aapl; | ||
trader:`chico`harpo`groucho`zeppo`moe`larry`curly`shemp`abbott`costello; | ||
sector:`energy`materials`industrials`financials`healthcare`utilities`infotech; | ||
strategy:`statarb`pairs`mergerarb`house`chart`indexarb | ||
|
||
n:1000000; | ||
trade:([] | ||
tradeId:til n; | ||
holdingId:n ? holdingId; | ||
symbol:n ? symbol; | ||
sector:n ? sector; | ||
trader:n ? trader; | ||
strategy:n ? strategy; | ||
time:09:30:00.0+n?23000000; | ||
price:50 + .23 * n ? 400; | ||
quantity:(100 * 10 + n ? 20) - 2000; | ||
date:2000.01.01 + asc n ? 365; | ||
price1:50 + .23 * n ? 400; | ||
amount1:n ? 1.0; | ||
price2:50 + .23 * n ? 400; | ||
amount2:(20*til n)_((n*20)?100); | ||
date2:2000.01.01 + asc n ? 365; | ||
price3:50 + .23 * n ? 400; | ||
amount3:(20*til n)_((n*20)?100); | ||
date3:2000.01.01 + asc n ? 365; | ||
price4:50 + .23 * n ? 400; | ||
amount4:100 * 10 + n ? 20; | ||
date4:2000.01.01 + asc n ? 365; | ||
amount5:100 * 10 + n ? 20); |
Oops, something went wrong.