Click here to Skip to main content
15,881,625 members
Articles / Programming Languages / C#
Tip/Trick

How to create dynamic FIX sessions using Quick Fix

Rate me:
Please Sign up or sign in to vote.
3.00/5 (1 vote)
1 Mar 2012CPOL 36.5K   1   6
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:

C#
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)


Written By
Architect Saxo Bank A/S
Denmark Denmark
• Solution Architect /Principle Lead Developer with 12 years of IT experience with more emphasize on Capital Domain and Investment banking domain.
• Strong experience in Continuous Integration, Delivery and DevOps solutions.
• Strong experience in drafting solutions, stakeholder communications and risk management.
• Proved strong coding and designing skills with agile approaches (TDD, XP framework, Pair Programming).
• Delivered many projects with involvement from inception to delivery phase.
• Strong experience in high performance, multithreaded, low latency applications.
• Ability to communicate with the business and technical stake holders effectively.
• Have extensive experience in Capital Market Domain: Front Office & BackOffice (Algorithm Trading tools, messaging framework, Enterprise bus, integration of FIX APIs and many trading APIs).
• Functional knowledge of Portfolio/Wealth Management, Equities, Fixed Income, Derivatives, Forex.
• Practical knowledge of building and practicing agile delivery methodologies (SCRUM, TDD, Kanban).

Technical Skills

• Architectural: Solution Design, Architectural Presentations (Logical, Component, Physical, UML diagrams)
• Languages: C#, C++
• Server Technologies: WCF, Web API,
• Middle Ware: ActiveMQ, RabbitMQ, Enterprise Service Bus
• UI Technologies: Winforms and WPF
• Web Technologies: Asp.Net Mvc, KnockOutJS, JQuery, Advance Java Scripts Concepts
• Databases: Sql Server 2008 +, MySQL
• Tools/Frameworks: TFS, SVN, NUnit, Rhino Mocks, Unity, NAnt, QuickFix/n, Nhibernate, LINQ, JIRA,

Functional Skills

• Wealth Management System, Trade Life Cycle, Trading Components and their integrations
• Working knowledge of Stocks, Bonds, CFDs,Forex, Futures and Options
• Pricing Systems, Market Data Management,
• BackOffice Processes : Settlement Processes, Netting, Tax, Commissions, Corporate Actions Handling,
• Reporting Solutions : OLTP and OLAP Data model designing
• FIX Engine implementation and integration

Comments and Discussions

 
GeneralMy vote of 3 Pin
Pradeep Manohar20-Jan-15 9:10
Pradeep Manohar20-Jan-15 9:10 
QuestionSingle quickfix session for sending and receivng messages ? Pin
Member 310194110-Feb-14 7:51
Member 310194110-Feb-14 7:51 
AnswerRe: Single quickfix session for sending and receivng messages ? Pin
Neeraj Kaushik198010-Feb-14 8:08
Neeraj Kaushik198010-Feb-14 8:08 
QuestionSuggestions for sending and receiving messages using QuickFix Pin
Member 310194129-Jan-14 5:33
Member 310194129-Jan-14 5:33 
AnswerRe: Suggestions for sending and receiving messages using QuickFix Pin
Neeraj Kaushik198029-Jan-14 11:34
Neeraj Kaushik198029-Jan-14 11:34 
It depends up on how broker support sessions. If vendors support separate session for quotes and trades then you will have to create 2 sessions and quickfix will automatically handle that else you can use one session for trades and quotes.
QuestionBroken Link Pin
MalcolmCudworth20-Apr-12 0:57
MalcolmCudworth20-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.