IASC的真实世界用例并在q kdb中排名

时间:2019-06-06 16:59:33

标签: kdb

我付出了很多努力来理解并记住iasc和q kdb的等级,并寻找在某些地方使用它们的机会,有人可以让我们知道iasc和rank的实际使用情况。 预先感谢!

2 个答案:

答案 0 :(得分:3)

按列t对表c进行排序:t iasc t`c

在该列中找到第二个最小值的行:t rank[t`c]?1

答案 1 :(得分:1)

在这种情况下,如何使用idec定位并从全天变化的书中提取最佳出价的示例。

q)t:([]t:.z.d+10?.z.n;bidPrices:a?\:10f;bidSizes:(a:10?10)?\:100)
q)update  bestBid:bidPrices@'bidIdx, bestBidSize:bidSizes@'bidIdx from update  bidIdx:({first idesc x}each bidPrices) from t
t                             bidPrices                                                                        bidSizes                  bidIdx bestBid  bestBidSize
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
2019.06.06D02:14:33.894603000 2.993873 1.208589 8.580936 9.179564 3.066645 2.791904 5.504552 5.792775 3.213027 36 68 37 32 37 51 95 13 1 3      9.179564 32
2019.06.06D02:20:21.634713522 0.6212362 6.411941 1.724467 2.80355                                              30 5 70 46                1      6.411941 5
2019.06.06D14:27:48.221686951 3.464977 7.902852 1.751907 9.028504 4.602883 6.513394 5.250004                   33 80 34 12 58 99 25      3      9.028504 12
2019.06.06D06:02:52.488340364 8.667757 1.200717 4.089565 5.700753 0.8786376 4.219038 9.105513 9.069392         94 2 97 57 22 45 53 67    6      9.105513 53
2019.06.06D19:13:19.169877521 0.5447537 3.563764 6.369824 6.462344 6.504396                                    22 67 69 40 26            4      6.504396 26
2019.06.06D13:07:02.008067857 3.478646 2.041581 3.192108 5.685267 4.988226 8.207332 6.44946 3.695111           45 32 82 81 44 11 50 15   5      8.207332 11
2019.06.06D08:28:02.054188480 6.620432 9.094126 2.988477 4.54063 1.56942 0.4699265                             10 68 35 61 91 16         1      9.094126 68
2019.06.06D18:54:38.242827303 9.591257 7.967731 2.641912 3.144961 2.948282 1.954953                            84 90 7 62 89 15          0      9.591257 84
2019.06.06D19:04:44.520627530 8.792454 8.056686 0.9071203 4.778097                                             9 37 23 31                0      8.792454 9
2019.06.06D06:36:31.306959361 7.825156 5.571575 5.040468 3.013724 3.022587 9.058382 0.9598075 7.136615         71 58 40 76 61 80 50 32   5      9.058382 80
q)