Click here to Skip to main content
Click here to Skip to main content

Tagged as

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 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

 
QuestionSingle quickfix session for sending and receivng messages ? [modified] PinmemberMember 310194110-Feb-14 8:51 
AnswerRe: Single quickfix session for sending and receivng messages ? PinmemberNeeraj Kaushik 198010-Feb-14 9:08 
QuestionSuggestions for sending and receiving messages using QuickFix PinmemberMember 310194129-Jan-14 6:33 
AnswerRe: Suggestions for sending and receiving messages using QuickFix PinmemberNeeraj Kaushik 198029-Jan-14 12:34 
QuestionBroken Link PinmemberMalcolmCudworth20-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.1411023.1 | Last Updated 1 Mar 2012
Article Copyright 2012 by Neeraj Kaushik 1980
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid