HOME FORUMS BROKERS SOFTWARE BOOKS CONTACT US
Elite Trader Your Account  •  Become a Member  •  Help  •  Search    
    Forums ›› Technically Speaking ›› Programming ›› Caveman question on programming logic for ATS  


Post A Reply
    Page 1 of 3:   1  2  3  
jtrader33
 

Registered: Jun 2005
Posts: 285

 

01-05-12 07:37 PM

I was hoping someone was feeling charitable and could give me a rough idea of how the programming logic behind high frequency automated strategies work; this is partly out of idle curiosity but also so I can better understand how various trading applications work. I'm not interested in strategy logic, just how receiving market data and checking for signals is prioritized / triggered. Ultimately, I'm curious about how this is properly done on a large scale (say 1000s of symbols) but I think I need to start with baby steps and basic concepts.

I currently use Amibroker to autotrade and that will loop through all symbols and check for signals on a fixed time interval. Could be wrong, but I'm guessing that the HFT space is entirely event driven rather than endless looping. Having said that, I can see the one potential advantage to the looping approach is that you evaluate the latest market data when you're ready for it (whenever each loop executes) rather than getting a backlog of tick events that you're signal checking code may not be able to keep up with. I guess that's the gist of my question:

-If you're using a tick event driven model and you receive 5 tick events in the time it takes to process the strategy logic once, how is that typically handled? Does it:

1) Finish executing the code in response to the first tick then ignore the 2nd,3rd, and 4th and go to the 5th (most recent)?

2) Execute the code in response to every single tick (2nd,3rd,4th,5th) and have to play catch up?

If it's #1, then I can't see much of a reason to ever use the interval approach...at least not on a single symbol -- that much isn't clear to me yet on a large multi-symbol portfolio but that's a question I'll save for now. Appreciate any insight on the above.

    Edit/Delete Quote Complain
rosy2
 

Registered: Aug 2006
Posts: 1399

 

01-05-12 07:43 PM

1) connect to market data and consume
2) distribute that data over a middleware( 29west, tibco, homegrown)
3) write lots of bots that consume off middleware and generate signals/orders

    Edit/Delete Quote Complain
jtrader33
 

Registered: Jun 2005
Posts: 285

 

01-05-12 08:49 PM

Thanks for the post rosy, but I'm having trouble deciphering an answer to my question from what you wrote (and the link). Any way you could dumb it down a little within the context of my example? Again, I'm just trying to understand how things work on a practical level.

    Edit/Delete Quote Complain
jtrader33
 

Registered: Jun 2005
Posts: 285

 

01-05-12 09:29 PM

Have any pictures that explain how a backlog of tick events are handled (as explained in my original post)?

    Edit/Delete Quote Complain
uexkuell
 

Registered: May 2006
Posts: 292

 

01-05-12 09:30 PM


Quote from bs2167:

... I currently use Amibroker to autotrade and that will loop through all symbols and check for signals on a fixed time interval.

.....

-If you're using a tick event driven model and you receive 5 tick events in the time it takes to process the strategy logic once, how is that typically handled? Does it:

1) Finish executing the code in response to the first tick then ignore the 2nd,3rd, and 4th and go to the 5th (most recent)?

2) Execute the code in response to every single tick (2nd,3rd,4th,5th) and have to play catch up?

If it's #1, then I can't see much of a reason to ever use the interval approach...at least not on a single symbol -- that much isn't clear to me yet on a large multi-symbol portfolio but that's a question I'll save for now. Appreciate any insight on the above.




Probably most used approach:
- create a new object (consumer or whatever you choose to call it) for every symbol tracked
- let the objects work independently
- react to every new tick received immediately


This usually isn't time critical if coded properly (with modern CPU power).


I assume that most HFT algos work
- on tick basis (not some arbitrary units like 1min, 15min..)
- interface directly to some trading API (like FIX or brokers proprietary APIs)


Possibly the question arises from working with a platform like Amibroker which adds extreme amounts of overhead (for the CPU, goes unnoticed for the user) for rather simple computations.

    Edit/Delete Quote Complain
jtrader33
 

Registered: Jun 2005
Posts: 285

 

01-05-12 10:37 PM


Quote from uexkuell:

Probably most used approach:
- create a new object (consumer or whatever you choose to call it) for every symbol tracked
- let the objects work independently
- react to every new tick received immediately


This usually isn't time critical if coded properly (with modern CPU power).


I assume that most HFT algos work
- on tick basis (not some arbitrary units like 1min, 15min..)
- interface directly to some trading API (like FIX or brokers proprietary APIs)


Possibly the question arises from working with a platform like Amibroker which adds extreme amounts of overhead (for the CPU, goes unnoticed for the user) for rather simple computations.




Thanks uexkuell, this is helpful. If I understand you correctly, the tick backlog isn't generally a concern since modern CPUs can execute the strategy before the next tick arrives. As a way to learn, I'm trying to verify how that would work here with some simple math but I need help with a couple assumptions/data points.

To run my strategy logic in Amibroker it takes ~ .002sec per symbol. No clue if that's good or bad -- I'm sure it's highly dependent on complexity (mine is quite simple), but any ballpark idea on how long something simple, well written, and standalone would take? Just looking for a rough idea to run some numbers with.

Again if I understood correctly, if one were trading 1000 symbols, they would create 1000 threads. How does this work get distributed across cores? As an example, I have an i7 950, so 8 total cores. Am I correct in assuming that one core would be dedicated to receiving market data and updating the quote arrays, leaving the other 7 to execute strategy logic in response to tick events? If so, then only 7 tick events can be processed simultaneously?

Sorry for the novice questions - it's tough to find information on this that addresses the subject in an ATS context but isn't way over my head.

    Edit/Delete Quote Complain
    Page 1 of 3:   1  2  3  
Post A Reply


Receive an email whenever a new post is added to this thread by subscribing to it.
 
Rate This Thread:

Forum Jump:
 

 

   Conduct Rules  -  Privacy Policy  -  Day Trader -  Day Trader Forum -  Best Trading Software -  Sitemap Copyright © 2013, Elite Trader. All rights reserved.    
 
WHILE YOU'RE HERE, TAKE A MINUTE TO VISIT SOME OF OUR SPONSORS:
Advantage Futures
Futures Brokerage & Clearing
AMP Global Clearing
Futures and FX Trading
Bright Trading
Professional Equities Trading
CTS
Futures Trading Software
DaytradingBias.com
Professional Trading Analytics
ECHOtrade
Professional Trading Firm
eSignal
Trading Software Provider
FXCM
Forex Trading Services
Global Futures
Futures, Options & FX Trading
Interactive Brokers
Pro Gateway to World Markets
JC Trading Group
Direct Access Trading
MB Trading
Direct Access Trading
MultiCharts
Trading Software Provider
NinjaTrader
Trading Software Provider
OANDA
Currency Trading
optionshouse
Option Trading & Education
Rithmic
Futures Trade Execution Platform
SpeedTrader
Direct Access Trading
SpreadProfessor
Spread Trading Instruction
thinkorswim by TD Ameritrade
Direct Access TradingAdvertisement
TradersStudio
System Building & Backtesting
Trading Technologies
Trading Software Provider
Trend Following
Trading Systems Provider