本文整理汇总了C#中SessionID类的典型用法代码示例。如果您正苦于以下问题:C# SessionID类的具体用法?C# SessionID怎么用?C# SessionID使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SessionID类属于命名空间,在下文中一共展示了SessionID类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: testSetGetSessionID
public void testSetGetSessionID()
{
Dictionary dictionary1 = new Dictionary();
dictionary1.setString( "ConnectionType", "initiator" );
Dictionary dictionary2 = new Dictionary();
dictionary2.setString( "ConnectionType", "acceptor" );
SessionID sessionID1 = new SessionID( "FIX.4.0", "SENDER1", "TARGET1" );
SessionID sessionID2 = new SessionID( "FIX.4.0", "SENDER2", "TARGET2" );
SessionID sessionID3 = new SessionID( "FIX.4.0", "SENDER3", "TARGET3" );
testObject.set( sessionID1, dictionary1 );
testObject.set( sessionID2, dictionary2 );
dictionary1 = testObject.get( sessionID1 );
dictionary2 = testObject.get( sessionID2 );
Assert.AreEqual( "initiator", dictionary1.getString("ConnectionType") );
Assert.AreEqual( "acceptor", dictionary2.getString("ConnectionType") );
try
{
testObject.get( sessionID3 );
Assert.Fail();
}
catch( ConfigError ) {}
}
示例2: process
public void process(Message message, SessionID sessionID)
{
Message echo = (Message)message;
PossResend possResend = new PossResend(false);
if (message.getHeader().isSetField(possResend))
message.getHeader().getField(possResend);
ClOrdID clOrdID = new ClOrdID();
message.getField(clOrdID);
Pair pair = new Pair(clOrdID, sessionID);
if (possResend.getValue() == true)
{
if (orderIDs.Contains(pair))
return;
}
if(!orderIDs.Contains(pair))
orderIDs.Add(pair, pair);
try
{
Session.sendToTarget(echo, sessionID);
}
catch (SessionNotFound) { }
}
示例3: ScreenLog
public ScreenLog(SessionID sessionID, bool logIncoming, bool logOutgoing, bool logEvent)
{
sessionID_ = sessionID;
logIncoming_ = logIncoming;
logOutgoing_ = logOutgoing;
logEvent_ = logEvent;
}
示例4: Session
public Session(
IApplication app, IMessageStoreFactory storeFactory, SessionID sessID, DataDictionaryProvider dataDictProvider,
SessionSchedule sessionSchedule, int heartBtInt, ILogFactory logFactory, IMessageFactory msgFactory, string senderDefaultApplVerID)
{
this.Application = app;
this.SessionID = sessID;
this.DataDictionaryProvider = new DataDictionaryProvider(dataDictProvider);
this.schedule_ = sessionSchedule;
this.msgFactory_ = msgFactory;
this.SenderDefaultApplVerID = senderDefaultApplVerID;
this.SessionDataDictionary = this.DataDictionaryProvider.GetSessionDataDictionary(this.SessionID.BeginString);
if (this.SessionID.IsFIXT)
this.ApplicationDataDictionary = this.DataDictionaryProvider.GetApplicationDataDictionary(this.SenderDefaultApplVerID);
else
this.ApplicationDataDictionary = this.SessionDataDictionary;
ILog log;
if (null != logFactory)
log = logFactory.Create(sessID);
else
log = new NullLog();
state_ = new SessionState(log, heartBtInt)
{
MessageStore = storeFactory.Create(sessID)
};
// Configuration defaults.
// Will be overridden by the SessionFactory with values in the user's configuration.
this.PersistMessages = true;
this.ResetOnDisconnect = false;
this.SendRedundantResendRequests = false;
this.ValidateLengthAndChecksum = true;
this.CheckCompID = true;
this.MillisecondsInTimeStamp = true;
this.EnableLastMsgSeqNumProcessed = false;
this.MaxMessagesInResendRequest = 0;
this.SendLogoutBeforeTimeoutDisconnect = false;
this.IgnorePossDupResendRequests = false;
this.RequiresOrigSendingTime = true;
this.CheckLatency = true;
this.MaxLatency = 120;
if (!IsSessionTime)
Reset("Out of SessionTime (Session construction)");
else if (IsNewSession)
Reset("New session");
lock (sessions_)
{
sessions_[this.SessionID] = this;
}
this.Application.OnCreate(this.SessionID);
this.Log.OnEvent("Created session");
}
示例5: onMessage
public override void onMessage(QuickFix43.SecurityDefinition message, SessionID sessionID)
{
QuickFix43.SecurityDefinition echo = message;
try
{
Session.sendToTarget(echo, sessionID);
}
catch (SessionNotFound) { }
}
示例6: onCreate
public void onCreate( SessionID sessionID )
{
Session session = Session.lookupSession( sessionID );
try
{
if ( session != null ) session.reset();
}
catch( Exception ) {}
}
示例7: Create
/// <summary>
/// Creates a file-based message store
/// </summary>
/// <param name="sessionID">session ID for the message store</param>
/// <returns></returns>
public Log Create(SessionID sessionID)
{
Dictionary sessionSettings = settings_.Get(sessionID);
bool RotateLog = false; //default if undefined
int RotateLogNumToKeep = 1; //default if undefined
if (sessionSettings.Has(SessionSettings.FILE_LOG_ROTATE_ON_NEW_SESSION))
RotateLog = sessionSettings.GetBool(SessionSettings.FILE_LOG_ROTATE_ON_NEW_SESSION);
if (sessionSettings.Has(SessionSettings.FILE_LOG_ROTATE_NUM_TO_KEEP))
RotateLogNumToKeep = sessionSettings.GetInt(SessionSettings.FILE_LOG_ROTATE_NUM_TO_KEEP);
return new FileLog(sessionSettings.GetString(SessionSettings.FILE_LOG_PATH), sessionID, RotateLog, RotateLogNumToKeep);
}
示例8: FromApp
public void FromApp(QuickFix.Message msg, SessionID sessionID)
{
Console.WriteLine("FromApp - " + msg.ToString() + "@" + sessionID.ToString());
try
{
Crack(msg, sessionID);
}
catch (Exception ex)
{
Console.WriteLine("==Cracker exception==");
Console.WriteLine(ex.ToString());
Console.WriteLine(ex.StackTrace);
}
}
示例9: OnMessage
public void OnMessage(MarketDataIncrementalRefresh msg, SessionID sessionID)
{
FIX44XMLParser parser = new FIX44XMLParser();
Console.WriteLine("==========Header::==========");
Console.WriteLine(parser.getFieldName(Tags.BeginString.ToString()) + ":: " + msg.Header.GetString(Tags.BeginString));
Console.WriteLine(parser.getFieldName(Tags.BodyLength.ToString()) + ":: " + msg.Header.GetString(Tags.BodyLength));
Console.WriteLine(parser.getFieldName(Tags.MsgType.ToString()) + ":: MarketDataIncrementalRefresh (" + msg.Header.GetString(Tags.MsgType) + ")");
Console.WriteLine(parser.getFieldName(Tags.MsgSeqNum.ToString()) + ":: " + msg.Header.GetString(Tags.MsgSeqNum));
Console.WriteLine(parser.getFieldName(Tags.SenderCompID.ToString()) + ":: " + msg.Header.GetString(Tags.SenderCompID));
Console.WriteLine(parser.getFieldName(Tags.SendingTime.ToString()) + ":: " + msg.Header.GetString(Tags.SendingTime));
Console.WriteLine(parser.getFieldName(Tags.TargetCompID.ToString()) + ":: " + msg.Header.GetString(Tags.TargetCompID));
Console.WriteLine("==========Body:: ==========");
Console.WriteLine(parser.getFieldName(Tags.NoMDEntries.ToString()) + ":: " + msg.GetString(Tags.NoMDEntries));
MarketDataIncrementalRefresh.NoMDEntriesGroup g0 = new MarketDataIncrementalRefresh.NoMDEntriesGroup();
for (int grpIndex = 1; grpIndex <= msg.GetInt(Tags.NoMDEntries); grpIndex += 1)
{
Console.WriteLine("---------- ----------");
msg.GetGroup(grpIndex, g0);
// Console.WriteLine(parser.getFieldName(Tags.MDUpdateAction.ToString())+":: "+g0.GetString(Tags.MDUpdateAction));
Console.WriteLine(parser.getFieldName(Tags.MDUpdateAction.ToString()) + ":: " +
parser.getFieldName(Tags.MDUpdateAction.ToString(), g0.GetString(Tags.MDUpdateAction).ToString()) +
"(" + g0.GetString(Tags.MDUpdateAction) + ")"
);
Console.WriteLine(parser.getFieldName(Tags.MDEntryType.ToString()) + ":: " +
parser.getFieldName(Tags.MDEntryType.ToString(), g0.GetString(Tags.MDEntryType).ToString()) +
"(" + g0.GetString(Tags.MDEntryType) + ")"
);
try
{
Console.WriteLine(parser.getFieldName(Tags.MDEntryPx.ToString()) + ":: " + g0.GetString(Tags.MDEntryPx));
}
catch (Exception ex)
{
Console.WriteLine(parser.getFieldName(Tags.MDEntrySize.ToString()) + ":: " + g0.GetString(Tags.MDEntrySize));
}
Console.WriteLine(parser.getFieldName(Tags.MDEntryDate.ToString()) + ":: " + g0.GetString(Tags.MDEntryDate));
Console.WriteLine(parser.getFieldName(Tags.MDEntryTime.ToString()) + ":: " + g0.GetString(Tags.MDEntryTime));
}
Console.WriteLine("==========Trailer:: ==========");
Console.WriteLine(parser.getFieldName(Tags.CheckSum.ToString()) + ":: " + msg.Trailer.GetString(Tags.CheckSum));
}
示例10: FileLog
public FileLog(string fileLogPath, SessionID sessionID)
{
sessionID_ = sessionID;
if (!System.IO.Directory.Exists(fileLogPath))
System.IO.Directory.CreateDirectory(fileLogPath);
string fname = new System.Text.StringBuilder(sessionID_.BeginString)
.Append('-').Append(sessionID_.SenderCompID)
.Append('-').Append(sessionID_.TargetCompID)
.Append(".fixme.log")
.ToString();
fname = System.IO.Path.Combine(fileLogPath, fname);
file_ = new System.IO.StreamWriter(fname);
}
示例11: Prefix
public static string Prefix(SessionID sessionID)
{
System.Text.StringBuilder prefix = new System.Text.StringBuilder(sessionID.BeginString)
.Append('-').Append(sessionID.SenderCompID);
if (SessionID.IsSet(sessionID.SenderSubID))
prefix.Append('_').Append(sessionID.SenderSubID);
if (SessionID.IsSet(sessionID.SenderLocationID))
prefix.Append('_').Append(sessionID.SenderLocationID);
prefix.Append('-').Append(sessionID.TargetCompID);
if (SessionID.IsSet(sessionID.TargetSubID))
prefix.Append('_').Append(sessionID.TargetSubID);
if (SessionID.IsSet(sessionID.TargetLocationID))
prefix.Append('_').Append(sessionID.TargetLocationID);
if(sessionID.SessionQualifier.Length!=0)
prefix.Append('-').Append(sessionID.SessionQualifier);
return prefix.ToString();
}
示例12: Create
public ILog Create(SessionID sessionID)
{
bool logIncoming = logIncoming_;
bool logOutgoing = logOutgoing_;
bool logEvent = logEvent_;
if(settings_ != null && settings_.Has(sessionID))
{
Dictionary dict = settings_.Get(sessionID);
if (dict.Has(SCREEN_LOG_SHOW_INCOMING))
logIncoming = dict.GetBool(SCREEN_LOG_SHOW_INCOMING);
if (dict.Has(SCREEN_LOG_SHOW_OUTGOING))
logOutgoing = dict.GetBool(SCREEN_LOG_SHOW_OUTGOING);
if (dict.Has(SCREEN_LOG_SHOW_EVENTS))
logEvent = dict.GetBool(SCREEN_LOG_SHOW_EVENTS);
}
return new ScreenLog(sessionID, logIncoming, logOutgoing, logEvent);
}
示例13: testOrderSend
public void testOrderSend()
{
SessionNotFound exception = null;
NewOrderSingle order = new NewOrderSingle();
try
{
Session.sendToTarget(order);
}
catch(SessionNotFound e)
{
exception = e;
}
Assert.IsNotNull( exception, "no exception thrown" );
exception = null;
SessionID sessionID = new SessionID
("FIX.4.2", "TW", "ISLD");
order.set(new ClOrdID("12345"));
order.set(new Symbol("LNUX"));
order.set(new HandlInst('1'));
order.set(new Side(Side.BUY));
order.set(new OrdType(OrdType.MARKET));
order.set(new TransactTime());
try
{
Assert.IsTrue(Session.sendToTarget(order, sessionID));
QuickFix.Message message = application.getMessage();
Assert.IsNotNull(message, "Message not received");
//Assert.IsTrue("Message not a NewOrderSingle",
// message instanceof NewOrderSingle);
Assert.IsTrue(Session.sendToTarget(order, sessionID));
}
catch(SessionNotFound e)
{
exception = e;
}
Assert.IsNull(exception, "exception thrown");
}
示例14: FromApp
public void FromApp(Message message, SessionID sessionID)
{
}
示例15: Create
/// <summary>
/// Creates a file-based message store
/// </summary>
/// <param name="sessionID">session ID for the message store</param>
/// <returns></returns>
public ILog Create(SessionID sessionID)
{
return new FileLog(settings_.Get(sessionID).GetString(SessionSettings.FILE_LOG_PATH), sessionID);
}