本文整理匯總了C#中QuickFix.SessionSettings類的典型用法代碼示例。如果您正苦於以下問題:C# SessionSettings類的具體用法?C# SessionSettings怎麽用?C# SessionSettings使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
SessionSettings類屬於QuickFix命名空間,在下文中一共展示了SessionSettings類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: SetUp
public void SetUp()
{
application = new ApplicationImpl();
SessionSettings settings = new SessionSettings( "c:\\development\\quickfix\\test\\cfg\\at_client.cfg" );
MessageStoreFactory messageStoreFactory =
new MemoryStoreFactory();
QuickFix42.MessageFactory messageFactory = new QuickFix42.MessageFactory();
initiator = new SocketInitiator
(application, messageStoreFactory, settings, messageFactory);
server = new Process();
server.StartInfo.FileName = "c:\\development\\quickfix\\test\\debug\\at\\at";
server.StartInfo.Arguments = "-f c:\\development\\quickfix\\test\\cfg\\at.cfg";
server.Start();
Thread quickFixThread = new Thread(RunThread);
quickFixThread.Start();
for(int i = 0;i < 50;++i)
{
if(application.isLoggedOn())
{
break;
}
Thread.Sleep(1000);
}
if(!application.isLoggedOn())
{
throw new Exception();
}
}
示例2: Main
static void Main(string[] args)
{
Console.WriteLine("=============");
Console.WriteLine("This is only an example program, meant to be used with the TradeClient example.");
Console.WriteLine("=============");
if (args.Length != 1)
{
Console.WriteLine("usage: Executor CONFIG_FILENAME");
System.Environment.Exit(2);
}
try
{
SessionSettings settings = new SessionSettings(args[0]);
IApplication executorApp = new Executor();
IMessageStoreFactory storeFactory = new FileStoreFactory(settings);
ILogFactory logFactory = new FileLogFactory(settings);
ThreadedSocketAcceptor acceptor = new ThreadedSocketAcceptor(executorApp, storeFactory, settings, logFactory);
acceptor.Start();
Console.WriteLine("press <enter> to quit");
Console.Read();
acceptor.Stop();
}
catch (System.Exception e)
{
Console.WriteLine("==FATAL ERROR==");
Console.WriteLine(e.ToString());
}
}
示例3: Main
static void Main(string[] args)
{
if (args.Length != 1)
{
Console.WriteLine("usage: SimpleAcceptor CONFIG_FILENAME");
System.Environment.Exit(2);
}
try
{
SessionSettings settings = new SessionSettings(args[0]);
Application app = new SimpleAcceptorApp();
MessageStoreFactory storeFactory = new FileStoreFactory(settings);
LogFactory logFactory = new FileLogFactory(settings);
IAcceptor acceptor = new ThreadedSocketAcceptor(app, storeFactory, settings, logFactory);
acceptor.Start();
Console.WriteLine("press <enter> to quit");
Console.Read();
acceptor.Stop();
}
catch (System.Exception e)
{
Console.WriteLine("==FATAL ERROR==");
Console.WriteLine(e.ToString());
}
}
示例4: Main
static void Main(string[] args)
{
Console.WriteLine("=============");
Console.WriteLine("This is for evaluating new QF/n builds and features.");
Console.WriteLine("It's designed to communicate with PilotInitiator44.");
Console.WriteLine("=============");
if (args.Length != 1)
{
Console.WriteLine("usage: PilotAcceptorr44 CONFIG_FILENAME");
System.Environment.Exit(2);
}
try
{
SessionSettings settings = new SessionSettings(args[0]);
IApplication myApp = new PilotAcc44App();
IMessageStoreFactory storeFactory = new FileStoreFactory(settings);
ILogFactory logFactory = new FileLogFactory(settings);
ThreadedSocketAcceptor acceptor = new ThreadedSocketAcceptor(myApp, storeFactory, settings, logFactory);
acceptor.Start();
Console.WriteLine("press <enter> to quit");
Console.Read();
acceptor.Stop();
}
catch (System.Exception e)
{
Console.WriteLine("==FATAL ERROR==");
Console.WriteLine(e.ToString());
}
}
示例5: Main
static void Main(string[] args)
{
Console.WriteLine("=============");
Console.WriteLine("This is for evaluating new QF/n builds and features.");
Console.WriteLine("It's designed to communicate with PilotAcceptor44.");
Console.WriteLine("=============");
if (args.Length != 1)
{
System.Console.WriteLine("usage: PilotInitiator44.exe CONFIG_FILENAME");
System.Environment.Exit(2);
}
string file = args[0];
try
{
QuickFix.SessionSettings settings = new QuickFix.SessionSettings(file);
PilotInit44App myApp = new PilotInit44App();
QuickFix.IMessageStoreFactory storeFactory = new QuickFix.FileStoreFactory(settings);
QuickFix.ILogFactory logFactory = new QuickFix.FileLogFactory(settings);
QuickFix.Transport.SocketInitiator initiator = new QuickFix.Transport.SocketInitiator(myApp, storeFactory, settings, logFactory);
initiator.Start();
myApp.Run();
initiator.Stop();
}
catch (System.Exception e)
{
Console.WriteLine(e.Message);
Console.WriteLine(e.StackTrace);
}
}
示例6: Main
static void Main( string[] args )
{
if ( args.Length != 1 )
{
Console.WriteLine( "usage: executor_csharp FILE." );
return ;
}
try
{
SessionSettings settings = new SessionSettings( args[ 0 ] );
Application application = new Application();
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 <enter> to quit");
Console.Read();
acceptor.stop();
}
catch ( Exception e )
{
Console.WriteLine( e );
}
}
示例7: Connect
public void Connect(IApplication application)
{
var settings = new SessionSettings("session.config");
var myApp = application;
var storeFactory = new FileStoreFactory(settings);
var logFactory = new FileLogFactory(settings);
initiator = new SocketInitiator(myApp, storeFactory, settings, logFactory);
initiator.Start();
}
示例8: ThreadedSocketAcceptor
public ThreadedSocketAcceptor(SessionFactory sessionFactory, SessionSettings settings)
{
try
{
CreateSessions(settings, sessionFactory);
}
catch (System.Exception e)
{
throw new ConfigError(e.Message, e);
}
}
示例9: Main
static void Main(string[] args)
{
if (args.Length != 1)
{
System.Console.WriteLine("usage: AcceptanceTest CONFIG_FILENAME");
System.Environment.Exit(2);
}
FileLog debugLog = new FileLog("log", new SessionID("AT", "Application", "Debug"));
ThreadedSocketAcceptor acceptor = null;
try
{
ATApplication testApp = new ATApplication(debugLog);
testApp.StopMeEvent += new System.Action(delegate() { _stopMe = true; });
SessionSettings settings = new SessionSettings(args[0]);
IMessageStoreFactory storeFactory = new FileStoreFactory(settings);
ILogFactory logFactory = null;
if (settings.Get().Has("Verbose") && settings.Get().GetBool("Verbose"))
logFactory = new FileLogFactory(settings);
acceptor = new ThreadedSocketAcceptor(testApp, storeFactory, settings, logFactory);
acceptor.Start();
while (true)
{
System.Console.WriteLine("o hai "+System.DateTime.Now.ToString());
System.Threading.Thread.Sleep(1000);
// for tests of logout
if (_stopMe)
{
// this doesn't seem to work
// after stop, it doesn't seem to start up again
/*
acceptor.Stop();
Thread.Sleep(5 * 1000);
_stopMe = false;
acceptor.Start();
*/
}
}
}
catch (System.Exception e)
{
debugLog.OnEvent(e.ToString());
}
finally
{
if(acceptor != null)
acceptor.Stop();
}
}
示例10: AbstractInitiator
public AbstractInitiator(
IApplication app, IMessageStoreFactory storeFactory, SessionSettings settings, ILogFactory logFactory, IMessageFactory messageFactory)
{
_app = app;
_storeFactory = storeFactory;
_settings = settings;
_logFactory = logFactory;
_msgFactory = messageFactory;
HashSet<SessionID> definedSessions = _settings.GetSessions();
if (0 == definedSessions.Count)
throw new ConfigError("No sessions defined");
}
示例11: Main
static void Main(string[] args)
{
string file = "server.cfg";
SessionSettings settings = new SessionSettings(file);
IApplication executorApp = new Server();
IMessageStoreFactory storeFactory = new FileStoreFactory(settings);
ThreadedSocketAcceptor acceptor = new ThreadedSocketAcceptor(executorApp, storeFactory, settings);
acceptor.Start();
Console.WriteLine("press <enter> to quit");
Console.Read();
acceptor.Stop();
}
示例12: Load
public void Load()
{
string configuration = new System.Text.StringBuilder()
.AppendLine("[DEFAULT]")
.AppendLine("ConnectionType=initiator")
.AppendLine("BeginString=FIX.4.0")
.AppendLine("Value=4")
.AppendLine("Empty=")
.AppendLine(partialConfiguration.ToString())
.ToString();
SessionSettings settings = new SessionSettings(new System.IO.StringReader(configuration));
SessionID session1 = new SessionID("FIX.4.2", "ISLD", "TW");
SessionID session2 = new SessionID("FIX.4.1", "ISLD", "WT");
SessionID session3 = new SessionID("FIX.4.0", "ARCA", "TW");
SessionID session4 = new SessionID("FIX.4.0", "ARCA", "WT");
SessionID session5 = new SessionID("FIX.4.0", "NYSE", "TW", "QUAL1");
SessionID session6 = new SessionID("FIX.4.0", "NYSE", "TW", "QUAL2");
Assert.That(settings.Get().GetString( "Empty" ), Is.EqualTo("") );
Assert.That(settings.Get().GetLong( "Value" ), Is.EqualTo(4) );
Assert.That(settings.Get(session1).GetLong("Value"), Is.EqualTo(1));
Assert.That(settings.Get(session2).GetLong("Value"), Is.EqualTo(2));
Assert.That(settings.Get(session3).GetLong("Value"), Is.EqualTo(3));
Assert.That(settings.Get(session4).GetLong("Value"), Is.EqualTo(4));
Assert.That(settings.Get(session5).GetLong("Value"), Is.EqualTo(5));
Assert.That(settings.Get(session6).GetLong("Value"), Is.EqualTo(6));
// case insensitivity
Assert.That(settings.Get().GetLong("value"), Is.EqualTo(4));
Assert.That(settings.Get(session1).GetLong("value"), Is.EqualTo(1));
Assert.That(settings.Get(session2).GetLong("value"), Is.EqualTo(2));
Assert.That(settings.Get(session3).GetLong("value"), Is.EqualTo(3));
Assert.That(settings.Get(session4).GetLong("value"), Is.EqualTo(4));
Assert.That(settings.Get(session5).GetLong("value"), Is.EqualTo(5));
Assert.That(settings.Get(session6).GetLong("value"), Is.EqualTo(6));
Assert.That(settings.Get().GetLong("VALUE"), Is.EqualTo(4));
Assert.That(settings.Get(session1).GetLong("VALUE"), Is.EqualTo(1));
Assert.That(settings.Get(session2).GetLong("VALUE"), Is.EqualTo(2));
Assert.That(settings.Get(session3).GetLong("VALUE"), Is.EqualTo(3));
Assert.That(settings.Get(session4).GetLong("VALUE"), Is.EqualTo(4));
Assert.That(settings.Get(session5).GetLong("VALUE"), Is.EqualTo(5));
Assert.That(settings.Get(session6).GetLong("VALUE"), Is.EqualTo(6));
}
示例13: Main
static void Main(string[] args)
{
var settingsFile = "FixAtServer.cfg";
if (args.Length >= 1)
{
settingsFile = args[0];
}
Console.WriteLine("Starting server ...");
try
{
var settings = new SessionSettings(settingsFile);
var server = new ServerApplication(Console.WriteLine);
var storeFactory = new FileStoreFactory(settings);
var logFactory = new FileLogFactory(settings);
var acceptor = new ThreadedSocketAcceptor(server,
storeFactory,
settings,
logFactory);
acceptor.Start();
Console.WriteLine("Server started");
Console.WriteLine("Press Ctrl-C to quit");
// TODO A better stop mechanism!
// http://stackoverflow.com/questions/177856/how-do-i-trap-ctrl-c-in-a-c-sharp-console-app
Console.CancelKeyPress += (sender, e) =>
{
Console.WriteLine("Stopping server ...");
acceptor.Stop();
server.Stop();
Console.WriteLine("Server stopped");
};
while (true)
{
System.Threading.Thread.Sleep(1000);
}
}
catch (Exception e)
{
Console.WriteLine("Error: {0}", e);
}
}
示例14: OnLoad
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
// FIX app settings and related
var settings = new SessionSettings("C:\\initiator.cfg");
// FIX application setup
MessageStoreFactory storeFactory = new FileStoreFactory(settings);
LogFactory logFactory = new FileLogFactory(settings);
_client = new FixClient50Sp2(settings);
IInitiator initiator = new SocketInitiator(_client, storeFactory, settings, logFactory);
_client.Initiator = initiator;
_client.OnProgress += _client_OnProgress;
_client.LogonEvent += ClientLogonEvent;
_client.MessageEvent += ClientMessageEvent;
_client.LogoutEvent += ClientLogoutEvent;
_client.OnMarketDataIncrementalRefresh += Client_OnMarketDataIncrementalRefresh;
}
示例15: Main
static void Main(string[] args)
{
string file = "";
if( args.Length >= 2 && args[0].Equals("-f") && args[1] != null )
{
file = args[1];
}
else
{
Console.WriteLine( "usage: at" + " -f FILE [-t]" );
return;
}
SessionSettings settings = new SessionSettings(file);
at_application application = new at_application();
FileStoreFactory factory = new FileStoreFactory(settings);
Acceptor acceptor = new SocketAcceptor
( application, factory, settings, new DefaultMessageFactory() );
acceptor.start();
while( true ) Thread.Sleep( 1000 );
}