Click here to Skip to main content
11,487,406 members (73,243 online)
Click here to Skip to main content

Tagged as

How to create dynamic FIX sessions using Quick Fix

, 1 Mar 2012 CPOL 14.4K
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 Kaushik 1980
Architect Initto Technologies India Pvt Ltd
India India
• Technical Architect with 9 years of Application development experience
• Good knowledge and expertise on multiple areas of technologies and their business applications
• Strong experience in high performance and business critical applications.
• Experience in creating framework, Code generators, and UML diagrams.
• Developed messaging framework for Algo Trading, technical analysis tool, market feed client Api, Payment Solutions for SWIFT, Internationalization for Core Banking Solution product etc.
• Practical knowledge of building and practicing agile delivery methodologies (SCRUM & TDD).
• Proven ability in producing technical documentation and presentation to clients.
• Active participation in trainings, article writing & taking initiatives.
• Passion to get knowledge from various resources acquires best practices.
• Good understanding of financial domain especially in investment banking and banking domain.
Specialties

Technical Architectures, Multi-threading Architecture, Algo Trading systems, Messaging Framework, FIX Implementation, Technical Analysis & Charting, ActiveMQ, MSMQ, C#, WinForms, ASP.NET MVC, Jquery, WCF, Sql Server 2008, Oracle, TFS, TDD, QuickFix, Open Source Tools & Framework.
Follow on   Twitter

Comments and Discussions

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

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    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
Web01 | 2.8.150520.1 | Last Updated 1 Mar 2012
Article Copyright 2012 by Neeraj Kaushik 1980
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid