简体   繁体   English

FIX消息速率监控

[英]FIX message rate monitoring

I am a newby to the site, have limited scripting skills, but able to pick my way through scripts without a problem. 我是该站点的新手,脚本技能有限,但是可以毫无问题地选择脚本。 I would like to write a script to monitor the FIX messages coming through a number of log files in real time; 我想编写一个脚本来监视通过多个日志文件实时发送的FIX消息; segregated by account & symbol. 按帐户和符号分隔。 The rate needs to be calculated on a per-minute basis. 费率需要按分钟计算。 At the moment I am not sure whether this is a minute by minute calculation or a rolling 60 seconds calculation. 目前,我不确定这是一分钟一分钟的计算还是60秒的滚动计算。 I haven't written anything yet, I am just looking to see if this is possible and if anyone can give me some pointers as to what would be the best scripting language to employ. 我还没有写任何东西,我只是想看看这是否有可能,是否有人可以给我一些使用哪种最佳脚本语言的指导。 Thanks 谢谢

Here is a brutal solution in gawk. 这是gawk中的残酷解决方案。 If there is a 35=D on the line we use regexes to split interesting parts out, the timestamp (without the seconds so entries fall into equivalence classes on the minute level), and the two tags and dump it into a 'multidimensional' array, meaning we use these as indices of the array. 如果线上有35 = D,我们使用正则表达式将感兴趣的部分分离出来,加上时间戳(没有秒,因此条目在分钟级别上属于等效类),然后将这两个标记转储到“多维”数组中,这意味着我们将它们用作数组的索引。 Once we went through all the messages we scan the array, in no particular order, and dump the counters. 浏览完所有消息后,我们将以无特定顺序扫描阵列,并转储计数器。 It is terribly ugly..the three 'match' functions should be written as one, and perhaps the output sorted, but that's trivial in the shell with 'sort'. 这非常丑陋。三个“匹配”函数应该写为一个,也许输出是排序的,但这在带有“排序”的shell中是微不足道的。

#!/usr/bin/awk -f

#Out_Vec__PWKBVSP-LE2__0 [ 601] : timestamp=2013-08-12-13:00:01.235605858 :: latency=1323.3460000000 :: 8=FIX.4.4|9=0253|35=D|34=0000601|52=20130812-13:00:01.235|49=SENDER|56=RECEIVER|‌​57=SOR|50=TRADER|128=SPSE|11=ORDERID1|453=3|448=16|447=D|452=7|448=DMA1|447=D|452‌​=54|448=ABC|447=D|452=36|1=ACCOUNT123|55=LPSB3|54=1|60=20130812-13:00:00.000|38=6‌​400|40=2|44=17.8700|15=BRL|59=0|10=010| :: aux_len=0,

/35=D/ {
    n=match($0, /.*\|1=([^\|]+)\|.*/, tmp1);
    n=match($0, /.*\|55=([^\|]+)\|.*/, tmp2);
    n=match($0, /[^:]+: timestamp=([[:digit:]]+)-([[:digit:]]+)-([[:digit:]]+)-([[:digit:]]+):([[:digit:]]+).*/, ts);
#    print tmp1[1], tmp2[1], ts[1], ts[2], ts[3], ts[4], ts[5];
    aggr[tmp1[1], tmp2[1], ts[1], ts[2], ts[3], ts[4], ts[5]]++;
}

END {
    for (i in aggr)
    print i, aggr[i];
}

For the samples I get: 对于样品,我得到:

ACCOUNT123PSSA3201308121301 3
ACCOUNT123CPFE3201308121301 1
ACCOUNT123LPSB3201308121300 1
ACCOUNT123GETI4201308121301 1

which could be further processed. 可以进一步处理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM