A trading system has $n$ colocated uplinks to TCP order entry gateways $g_1, \dots, g_n$ on a given exchange. Each gateway $g_i$ has a different order entry delay function $d_i(t)$ as a function of time $t$. (Note that I don't explicitly know the $d_i(t)$.)

The game is to build a sample function $S(t)$ which picks a gateway $g_i$ minimising order entry delay at time $t$.

What realtime statistical tests can be applied to the gateways to build a good sampling function $S$? (With TCP, it's easy to measure round-trip times since every message is ACKed.)

  • 1
    $\begingroup$ This is not my area of expertise but I do wonder: don't you want to specify some loss function? Maybe you want to punish long delays more or after a certain amount of delay it doesn't matter any more. $\endgroup$
    – Bob Jansen
    Nov 11, 2013 at 13:30

2 Answers 2


If I understand correctly the TCP roundtrip time can be used as a posteriori proxi for the order entry gateway delay.

So assuming the roundtrip time is composed of gate delay and independent other delays $RTT_g(t) = dT_g(t) + d_g(t)$ with assumed $Cov(dT_g,d_g)=0$ and $Cov(d_i,d_j)=0$. Minimizing the this combination of gate delay and other delays is leading to the same goal.

Perhaps a univariate modeling of this $RTT_g(t)$ based on historical observed observations is suitable. Could be that a simple rolling mean/median and (robust) dispersion metric is enough?

I found this http://www.eecis.udel.edu/~bohacek/Papers/paper579.pdf paper about video streaming and congestion. They estimate a Cox-Ingersoll-Ross model (https://en.wikipedia.org/wiki/Cox%E2%80%93Ingersoll%E2%80%93Ross_model) to estimate and predict delays.

$dRTT_g = a (b-RTT_g)dt+\sigma\sqrt{RTT_g}dW_t$ with $dW_t$ brownian.

for this CIR there exist close form solutions for predictions which are chi-square family. so something like $S(t)=\text{argmin}_g \hat{RTT_g}(t+1)$

Note that i dont know if these gateway independence assumptions are not too strong, and i wonder if the gateway delay is not also a function of e.g. ordersize or previous usage. Good luck!


I think just picking minimum value for $d_i(t)$ will work optimal here, just how calculate that $d()$ function matters more, this can be last order delay from that gateway or some EMA of last X order delays. Important is query each gateway every some amount of time to prevent blocking gateway by one big anomaly delay that prevent $S(t)$ function from selecting that gateway in future. $$ S(t) = g(\operatorname{argmin}_g d_g(t)) $$

  • $\begingroup$ I don't know the $d_i(t)$! I need statistical tests to model them. That's basically the question. $\endgroup$
    – Randomblue
    Nov 9, 2013 at 12:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.