Pregunta

As you know, trading strategies take actions based on real time feed, such as when the bid or the last trade price changes. A data feed provider streams quotes to our desktop application asynchronously in a separate thread from the main thread. This data feed thread is spawned when you make a request to the data feed provider and lives until you explictly send a request to stop the streaming.

As it stands, the data feed thread executes trading strategies because most of them are designed to enter or update orders upon tick data. Do you see any problem with this approach? Is this design common in trading applications?

I'm using Java.

¿Fue útil?

Solución

You definitely don't want to execute a trading strategy on the data feed thread, particularly if the execution takes a while. That execution should happen on a different thread. I am not that familiar with Java, but I assume you could make use of a thread pool there. In C# a very powerful way to spread out work over multiple threads would be using Tasks.

Another thing you might want to think about is what to do when there are new ticks for an instrument while you are still processing the previous tick. In many cases it makes sense to only process the most recent one. I have written up a little post on what I termed the most recent update pattern with a sample implementation in C#. Maybe you find that useful.

Otros consejos

As it stands, the data feed thread executes trading strategies because most of them are designed to enter or update orders upon tick data.

Not quite. The data feed thread triggers the execution of trading strategies. You don't want any other processing to slow down the data feed thread.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top