HiDavid<o:p></o:p>
<u1:p class=‘“”’> <o:p></o:p></u1:p>
Thebest option for this will be a real time subscriber process, subscribed to yourtickerplant to track the necessary data and perform the calculations of thesemetrics as required.<o:p></o:p>
<u1:p class=‘“”’> <o:p></o:p></u1:p>
Wehave developed a real time subscriber to achieve this. I have attached the codefor this process. This code will work with a standard kdb+tick setup (or withthe kdb+ framework setup you mentioned).<o:p></o:p>
<u1:p class=‘“”’> <o:p></o:p></u1:p>
Thesubscriber will subscribe to the TP, and will recover historical messages byreplaying the log file up until the point of subsciption.<o:p></o:p>
<u1:p class=‘“”’> <o:p></o:p></u1:p>
Inorder to get this up & running, you will need to modify the connectiondetails for the TP in the init function. <o:p></o:p>Youmay also need to modify the column names in the following line in the upd functionto match the schema for your trade table:
<o:p></o:p>
<u1:p class=‘“”’></u1:p>
<u1:p class=‘“”’> <o:p></o:p></u1:p>
x: flip time
symprice
sizestop
cond`ex!x
<u1:p class=‘“”’></u1:p>
<u1:p class=‘“”’> <o:p></o:p></u1:p>
Thewindows for calcuation of the metrics can be defined in the "windows"variable at the top of the file, though thesubscriber is flexible enough to calculate VWAP + TWAP over any period, e.g.you could also use it to calculate the VWAP/TWAP from 20 minutes ago until 5minutes to go. <o:p></o:p>
<u1:p class=‘“”’> <o:p></o:p></u1:p>
Toobtain the metrics at any time, call the metrics function with a list of symsas the argument e.g. metrics[AAPL
MSFT]<o:p></o:p>
<o:p> </o:p>
You also posted this on our other google group - well post aslightly modified version over there.
<u1:p class=‘“”’> <o:p></o:p></u1:p>
Hopethis helps<o:p></o:p>
Jonathon<o:p></o:p>
On Wednesday, November 2, 2016 at 9:20:39 AM UTC, dave.smit...@gmail.com wrote:
All,
I would like to find the most efficient way to calculate a series of time weighted average prices from a trade and quote table such as those supplied by kx for kdb+ tick
What is the optimum design layout for this type of set up?
Questions I would help with::
a) The TWAP and VWAP windows will be fixed at the start of day with values such as “allay” “5 minutes” "1 hour " and so on
b) I have a simple FIX robot sending quotes to a Torq based ticker plant from https://github.com/AquaQAnalytics
c) Are we better performing these calculations as soon as the robot gets a relevant update, or should I have a dedicated engine to calculate these metrics
d) Do we advise any issues publishing updates from multiple sources into a single ticker plant?
e) Does anyone have any advice on how I should proceed? I like to create a simple strategy to identify momentum price shifts, as well as spot simple arbitrage opportunities
Thanks for help
D