Click here to Skip to main content
12,396,951 members (38,000 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as

Stats

17.9K views
Posted

How to create dynamic FIX sessions using Quick Fix

, 1 Mar 2012 CPOL
Rate this:
Please Sign up or sign in to vote.
Dynamic creation of Fix sessions

I am explaining about how we can create sessions dynamically through code using QuickFix. My earlier examples were using configuration files. But we can also create session dynamically, this might be helpful when application maintains many sessions, so we can keep session metadata information in xml or database to track or maintain sessions.

You can find code which describe fix initiator and fix acceptor in my earlier post.

Below is code which creates multiple listener sessions in Fix Acceptor:

SessionSettings settings = new SessionSettings();
 
                SessionID id1 = new SessionID(new BeginString("FIX.4.2"), 
			new SenderCompID("FixServer"), 
			new TargetCompID("Client1"), "Session1");
                Dictionary d = new Dictionary();
 
                d.setString("ConnectionType", "acceptor");
                d.setLong("SocketAcceptPort", 5001);
                d.setString("FileLogPath", "Log");
                d.setString("StartTime", "00:00:00");
                d.setString("EndTime", "00:00:00");
                d.setString("FileStorePath", @"c:\fixfiles");
                d.setBool("UseDataDictionary", true);
                d.setString("DataDictionary", @"FIX42.xml");
 
                settings.set(id1,d);
 
                id1= new SessionID(new BeginString("FIX.4.2"), 
			new SenderCompID("FixServer"), 
			new TargetCompID("Client2"), "Session2");
                d = new Dictionary();
 
                d.setString("ConnectionType", "acceptor");
                d.setLong("SocketAcceptPort", 5001);
                d.setString("FileLogPath", "Log");
                d.setString("StartTime", "00:00:00");
                d.setString("EndTime", "00:00:00");
                d.setString("FileStorePath", @"c:\fixfiles");
                d.setBool("UseDataDictionary", true);
                d.setString("DataDictionary", @"FIX42.xml");
 
                settings.set(id1, d);
 
                                                
                FixServerApplication application = new FixServerApplication();
                FileStoreFactory storeFactory = new FileStoreFactory(settings);
                ScreenLogFactory logFactory = new ScreenLogFactory(settings);
                MessageFactory messageFactory = new DefaultMessageFactory();
                SocketAcceptor acceptor
                  = new SocketAcceptor(application, storeFactory, settings, 
			logFactory, messageFactory);
 
                acceptor.start();
                Console.WriteLine("press  to quit");
                Console.Read();
                acceptor.stop();

SessionSettings instance accepts dictionary object and SessionID to create new session. Dictionary class maintain key value pair. We can find more about FIX configuration details here.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Neeraj Kaushik1980
Architect Saxo India Pvt Ltd
India India
• Solution Architect /Sr. Lead Developer with 11+ years of professional experience with more emphasize on .net technology and open for any emerging technologies.
• Strong experience in drafting solutions, stakeholder communications and risk management.
• Proved strong coding and designing skills with agile approach (TDD, XP framework).
• Delivered many projects with involvement from inception to delivery phase.
• Strong experience in high performance, multithreaded, low latency applications.
• Have strong experience in web oriented technologies.
• Playing vital role in technical foundation of projects and delivery.
• Ability to communicate with the business and technical stake holders effectively.
• Strong experience in technologies for Capital Market Domain: Front Office & BackOffice (Algorithm Trading tools, messaging framework, Enterprise bus, integration of FIX APIs and many proprietary trading APIs).
• Functional knowledge of Wealth Management System, Equities, Fixed Income, Derivatives, Forex.
• Practical knowledge of building and practicing agile delivery methodologies (SCRUM & TDD).


Technical Expertise: Solution Architectures, Low Latency applications, Algo/ Properietary Trading Systems, Messaging Framework, Integration via FIX protocol APIs (QuickFix, QuickFix/N), ActiveMQ, MSMQ, C#, WinForms, ASP.NET MVC, Jquery, WCF, Sql Server 2008, TFS, TDD

You may also be interested in...

Comments and Discussions

 
GeneralMy vote of 3 Pin
Pradeep Manohar20-Jan-15 9:10
memberPradeep Manohar20-Jan-15 9:10 
QuestionSingle quickfix session for sending and receivng messages ? Pin
Member 310194110-Feb-14 7:51
memberMember 310194110-Feb-14 7:51 
AnswerRe: Single quickfix session for sending and receivng messages ? Pin
Neeraj Kaushik 198010-Feb-14 8:08
memberNeeraj Kaushik 198010-Feb-14 8:08 
QuestionSuggestions for sending and receiving messages using QuickFix Pin
Member 310194129-Jan-14 5:33
memberMember 310194129-Jan-14 5:33 
AnswerRe: Suggestions for sending and receiving messages using QuickFix Pin
Neeraj Kaushik 198029-Jan-14 11:34
memberNeeraj Kaushik 198029-Jan-14 11:34 
QuestionBroken Link Pin
MalcolmCudworth20-Apr-12 0:57
memberMalcolmCudworth20-Apr-12 0:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160721.1 | Last Updated 1 Mar 2012
Article Copyright 2012 by Neeraj Kaushik1980
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid