Serving the Quantitative Finance Community

 
User avatar
vincegata
Topic Author
Posts: 0
Joined: January 2nd, 2011, 8:24 pm

Looking for recommendation for Architecture/Best Practices/Examples building auto-trading system in C++?

July 26th, 2012, 10:25 pm

Hello,I've started writing a system for full auto or semi auto trading. Currently my system is trading in Forex but it can be adapted for equities. I am using C++ on Ubuntu. I am good with C++ but this is the first time I am writing trading software hence I'd like to know if I've made the right architectural decisions. My main source of information are books by Richard Stevens on programming in Unix environment.Could someone recommend me a book, papers, or point me to some source of information on writing such system using C++, preferably on Linux/UNIX platform. I've looked so far at source code of QuickFix and Marketcetera, both seems bloated. Marketcetera is also written in Java but I am looking for C++ code. Briefly my system consists of two executables:system1 is a multitreaded app that:thread1: monitors socket to download ticks in real time.thread2: processes ticks to generate buy/sell signals, places new_order_message to FIFO (named pipe) to be read by system2, saves orders.thread3: monitors FIFO for order confirmation messages from system2.system2 is pretty much a FIX engine that is a single threaded app that:monitors socket for a new FIX messages from a broker, if order confirmation arrived place it into FIFO to be read by system1.monitors FIFO for new orders from system1, if a new_order_message arrived convert it into FIX format and send to broker. Thank you.
Last edited by vincegata on July 26th, 2012, 10:00 pm, edited 1 time in total.
 
User avatar
vincegata
Topic Author
Posts: 0
Joined: January 2nd, 2011, 8:24 pm

Looking for recommendation for Architecture/Best Practices/Examples building auto-trading system in C++?

July 26th, 2012, 11:08 pm

Could Admins move it into Programming and Software subforum. Thank you.
 
User avatar
lexington
Posts: 0
Joined: November 16th, 2008, 5:04 am

Looking for recommendation for Architecture/Best Practices/Examples building auto-trading system in C++?

July 28th, 2012, 4:46 pm

system 2 is just a FIX client. Look at the source code in QuickFix.What C++ libraries do you use? Try ACE
 
User avatar
vincegata
Topic Author
Posts: 0
Joined: January 2nd, 2011, 8:24 pm

Looking for recommendation for Architecture/Best Practices/Examples building auto-trading system in C++?

July 28th, 2012, 7:33 pm

I do not use any libraries, I developed all from scratch. Thx for ACE, I am looking into it.
 
User avatar
vincegata
Topic Author
Posts: 0
Joined: January 2nd, 2011, 8:24 pm

Looking for recommendation for Architecture/Best Practices/Examples building auto-trading system in C++?

August 3rd, 2012, 3:22 pm

ACE might be an overkill for the moment. Any pointers how to build an execution system in C++ without using third party libraries?
 
User avatar
lexington
Posts: 0
Joined: November 16th, 2008, 5:04 am

Looking for recommendation for Architecture/Best Practices/Examples building auto-trading system in C++?

August 4th, 2012, 4:47 pm

QuoteOriginally posted by: vincegataACE might be an overkill for the moment. Any pointers how to build an execution system in C++ without using third party libraries?what do you want? source code?
 
User avatar
Cuchulainn
Posts: 22935
Joined: July 16th, 2004, 7:38 am

Looking for recommendation for Architecture/Best Practices/Examples building auto-trading system in C++?

August 5th, 2012, 9:42 pm

QuoteOriginally posted by: vincegataHello,I've started writing a system for full auto or semi auto trading. Currently my system is trading in Forex but it can be adapted for equities. I am using C++ on Ubuntu. I am good with C++ but this is the first time I am writing trading software hence I'd like to know if I've made the right architectural decisions. My main source of information are books by Richard Stevens on programming in Unix environment.Could someone recommend me a book, papers, or point me to some source of information on writing such system using C++, preferably on Linux/UNIX platform. I've looked so far at source code of QuickFix and Marketcetera, both seems bloated. Marketcetera is also written in Java but I am looking for C++ code. Briefly my system consists of two executables:system1 is a multitreaded app that:thread1: monitors socket to download ticks in real time.thread2: processes ticks to generate buy/sell signals, places new_order_message to FIFO (named pipe) to be read by system2, saves orders.thread3: monitors FIFO for order confirmation messages from system2.system2 is pretty much a FIX engine that is a single threaded app that:monitors socket for a new FIX messages from a broker, if order confirmation arrived place it into FIFO to be read by system1.monitors FIFO for new orders from system1, if a new_order_message arrived convert it into FIX format and send to broker. Thank you.This looks like a data and event-driven tracking application which is well known area in general. On Windows, Microsoft's PPL and Intel's TBB libs should provide a lot of the plumbing. I reckon you should be able to get a prototype running in a few days.Don't know what Linux offers in this area. In general, I think ACE and Stevens are more suitable for network (byte-level) programming?What is the level of fault tolerance? Can you lose packets? Last but not least, you need a good design and a modern version of Command is a good start.
Last edited by Cuchulainn on August 5th, 2012, 10:00 pm, edited 1 time in total.
 
User avatar
playerjoe
Posts: 0
Joined: August 2nd, 2012, 1:38 pm

Looking for recommendation for Architecture/Best Practices/Examples building auto-trading system in C++?

August 9th, 2012, 7:47 pm

QuoteOriginally posted by: vincegata ACE might be an overkill for the moment. Any pointers how to build an execution system in C++ without using third party libraries?You don't need ACE, perhaps it makes sense to refresh your memory how to use interprocess communication on linux, pthreads, sockets, shared memory. Learning how to use ACE properly might take longer than just having clear understanding of the basics. Realistically, there is no practical way to do anything useful without third party libraries. You were not going to write execution and feed handlers from scratch, were you?
Last edited by playerjoe on August 8th, 2012, 10:00 pm, edited 1 time in total.
 
User avatar
vincegata
Topic Author
Posts: 0
Joined: January 2nd, 2011, 8:24 pm

Looking for recommendation for Architecture/Best Practices/Examples building auto-trading system in C++?

August 12th, 2012, 3:53 pm

@Cuchulainn - Microsoft's PPL looks like something that I would use but it's Win and I am on Linux. Intel's TBB does run on Linux but I am trying to stay away from third party libs for my platform. Command pattern will be useful once I decide to develop UI, right now it's all command line. I cannot loose the packets, those are the ticks, new order, and order confirmation messages. THX for input.
 
User avatar
vincegata
Topic Author
Posts: 0
Joined: January 2nd, 2011, 8:24 pm

Looking for recommendation for Architecture/Best Practices/Examples building auto-trading system in C++?

August 12th, 2012, 4:25 pm

QuoteOriginally posted by: playerjoeYou don't need ACE, perhaps it makes sense to refresh your memory how to use interprocess communication on linux, pthreads, sockets, shared memory. Learning how to use ACE properly might take longer than just having clear understanding of the basics.These are exactly my thoughts. Hence I am looking for some tips how such ATS are usually implemented from scratch for mid-frequency - I'll be looking at 1 second bars. Namely, how many executables and how they communicate considering 1 second bar data. I am using FIFO right now but is it fast enough? Should I spawn a thread for each security? -- things like that.Quote Realistically, there is no practical way to do anything useful without third party libraries. You were not going to write execution and feed handlers from scratch, were you?Excuse for using wrong term, by execution I meant the executing platform that does all the plumbing which is 85% done, minus strategy execution module. I want to create a platform without using third-parties, for strategy execution I'll definitely use some math libraries.
 
User avatar
Cuchulainn
Posts: 22935
Joined: July 16th, 2004, 7:38 am

Looking for recommendation for Architecture/Best Practices/Examples building auto-trading system in C++?

August 14th, 2012, 6:53 pm

QuoteOriginally posted by: vincegata@Cuchulainn - Microsoft's PPL looks like something that I would use but it's Win and I am on Linux. Intel's TBB does run on Linux but I am trying to stay away from third party libs for my platform. Command pattern will be useful once I decide to develop UI, right now it's all command line. I cannot loose the packets, those are the ticks, new order, and order confirmation messages. THX for input.Command pattern is rather general and does not rely on UI even though the textbook GOF examples are UI.Some Boost libs like Signals and Function could be useful.
 
User avatar
farmer
Posts: 63
Joined: December 16th, 2002, 7:09 am

Looking for recommendation for Architecture/Best Practices/Examples building auto-trading system in C++?

August 20th, 2012, 9:36 pm

Just write a program to put huge limit orders right inside the no-cancel zone. Knock on some doors to get enough backing to hold stocks there the next time some idiot's program goes crazy. Then buy a big-screen TV, a little humidor, and wait.
Antonin Scalia Library http://antoninscalia.com
 
User avatar
vincegata
Topic Author
Posts: 0
Joined: January 2nd, 2011, 8:24 pm

Looking for recommendation for Architecture/Best Practices/Examples building auto-trading system in C++?

August 21st, 2012, 3:35 pm

QuoteOriginally posted by: farmerJust write a program to put huge limit orders right inside the no-cancel zone. Knock on some doors to get enough backing to hold stocks there the next time some idiot's program goes crazy. Then buy a big-screen TV, a little humidor, and wait.Yeaah that's how flash crash happens.
Last edited by vincegata on August 20th, 2012, 10:00 pm, edited 1 time in total.
 
User avatar
Stutch
Posts: 0
Joined: October 30th, 2006, 10:16 am

Looking for recommendation for Architecture/Best Practices/Examples building auto-trading system in C++?

August 24th, 2012, 7:48 am

QuoteOriginally posted by: vincegataHello,I've started writing a system for full auto or semi auto trading. Currently my system is trading in Forex but it can be adapted for equities. I am using C++ on Ubuntu. I am good with C++ but this is the first time I am writing trading software hence I'd like to know if I've made the right architectural decisions. My main source of information are books by Richard Stevens on programming in Unix environment..There are different reasons for using different architectures and the time spent on each has to be justified.Stevens is a good technical book but not an architecture book. I think you are looking for middleware to glue your algo's/trading code together and phrasing the right questions can be difficult so the responses you get will be of limited value.Is this a bit of fun, a front office hack or are you building an enterprise system ?
Last edited by Stutch on August 23rd, 2012, 10:00 pm, edited 1 time in total.
 
User avatar
farmer
Posts: 63
Joined: December 16th, 2002, 7:09 am

Looking for recommendation for Architecture/Best Practices/Examples building auto-trading system in C++?

August 24th, 2012, 10:37 am

The biggest problem I always have is collecting and storing and retrieving data. This problem has been at least 3 times as big as any logic or backtesting or whatever you want, and 10 times as big as order management.
Antonin Scalia Library http://antoninscalia.com