本文整理汇总了C#中Wombat.MamaMsg.iterateFields方法的典型用法代码示例。如果您正苦于以下问题:C# MamaMsg.iterateFields方法的具体用法?C# MamaMsg.iterateFields怎么用?C# MamaMsg.iterateFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Wombat.MamaMsg
的用法示例。
在下文中一共展示了MamaMsg.iterateFields方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: updateTradeFields
private void updateTradeFields(MamaMsg msg)
{
mTradeCache.mGotPartId = false;
mTradeCache.mLastGenericMsgWasTrade = false;
mTradeCache.mGotTradeTime = false;
mTradeCache.mGotTradePrice = false;
mTradeCache.mGotTradeSize = false;
mTradeCache.mGotTradeCount = false;
mTradeCache.mGotIssueSymbol = false;
lock (this)
{
msg.iterateFields(mFieldIterator, null, null);
}
if (mTradeCache.mGotIssueSymbol)
{
mTradeCache.mSymbol = mTradeCache.mIssueSymbol;
mTradeCache.mSymbolFieldState = MamdaFieldState.MODIFIED;
}
if (mTradeCache.mIsIrregular)
{
mTradeCache.mTradePrice = mTradeCache.mIrregPrice;
mTradeCache.mTradePriceFieldState = MamdaFieldState.MODIFIED;
mTradeCache.mTradeVolume = mTradeCache.mIrregVolume;
mTradeCache.mTradeVolumeFieldState = MamdaFieldState.MODIFIED;
mTradeCache.mTradePartId = mTradeCache.mIrregPartId;
mTradeCache.mTradePartIdFieldState = MamdaFieldState.MODIFIED;
if (mTradeCache.mIrregTime == DateTime.MinValue)
{
mTradeCache.mEventTime = mTradeCache.mLastTime;
mTradeCache.mEventTimeFieldState = MamdaFieldState.MODIFIED;
}
else
{
mTradeCache.mEventTime = mTradeCache.mIrregTime;
mTradeCache.mEventTimeFieldState = MamdaFieldState.MODIFIED;
}
}
else
{
mTradeCache.mTradePrice = mTradeCache.mLastPrice;
mTradeCache.mTradePriceFieldState = MamdaFieldState.MODIFIED;
mTradeCache.mTradeVolume = mTradeCache.mLastVolume;
mTradeCache.mTradeVolumeFieldState = MamdaFieldState.MODIFIED;
mTradeCache.mTradePartId = mTradeCache.mLastPartId;
mTradeCache.mTradePartIdFieldState = MamdaFieldState.MODIFIED;
mTradeCache.mEventTime = mTradeCache.mLastTime;
mTradeCache.mEventTimeFieldState = MamdaFieldState.MODIFIED;
}
if (mTradeCache.mGotPartId == false)
{
// No explicit part ID in message, but maybe in symbol.
if (mTradeCache.mSymbol != null)
{
int lastDot = mTradeCache.mSymbol.IndexOf(".");
if (lastDot != -1)
{
lastDot++;
if (lastDot != mTradeCache.mSymbol.Length)
{
mTradeCache.mPartId =
mTradeCache.mSymbol.Substring(lastDot);
mTradeCache.mPartIdFieldState = MamdaFieldState.MODIFIED;
mTradeCache.mGotPartId = true;
}
}
}
}
if (mTradeCache.mGotTradeTime || mTradeCache.mGotTradePrice
|| mTradeCache.mGotTradeSize)
{
mTradeCache.mLastGenericMsgWasTrade = true;
}
}
示例2: updateOrderImbalanceFields
private void updateOrderImbalanceFields(
MamdaSubscription subscription,
MamaMsg msg,
mamaMsgType msgType)
{
string securityStatus = null;
lock (this)
{
MamaMsgField msgField = null;
/*The wSecStatusQual will not always be in the message
so you need to account for this by checking for it.
*/
try
{
msgField = msg.getField(MamdaOrderImbalanceFields.SECURITY_STATUS_QUAL, null);
}
catch (MamdaDataException ex)
{
throw new MamaException(MamaStatus.mamaStatus.MAMA_STATUS_PLATFORM, ex.Message);
}
if (msgField == null) //does not exist
return;
securityStatus = msgField.getString();
if (isImbalanceType(securityStatus))
{
clearCache(mOrderImbalanceCache);
}
msg.iterateFields(mFieldIterator, null,null);
}
switch (msgType)
{
case mamaMsgType.MAMA_MSG_TYPE_INITIAL:
case mamaMsgType.MAMA_MSG_TYPE_RECAP:
handleRecap(subscription, msg);
break;
case mamaMsgType.MAMA_MSG_TYPE_UPDATE:
{
int value = 0;
if (securityStatus != null)
{
value = MamdaOrderImbalanceType.stringToValue(securityStatus);
if (MamdaOrderImbalanceType.isMamdaImbalanceOrder(value))
{
handleOrderImbalance(subscription,msg);
}
else
{
handleNoOrderImbalance(subscription, msg);
}
}
}
break;
default:
break;
}
}
示例3: onMsg
/// <summary>
/// Implementation of MamdaListener interface.
/// </summary>
public void onMsg(
MamdaSubscription subscription,
MamaMsg msg,
mamaMsgType msgType)
{
// If msg is a trade-related message, invoke the
// appropriate callback:
updateFieldStates();
lock (this)
{
mUpdated = false;
msg.iterateFields(mFieldIterator, null, null);
}
switch (msgType)
{
case mamaMsgType.MAMA_MSG_TYPE_INITIAL:
case mamaMsgType.MAMA_MSG_TYPE_RECAP:
handleRecap(subscription, msg);
break;
case mamaMsgType.MAMA_MSG_TYPE_PREOPENING:
case mamaMsgType.MAMA_MSG_TYPE_SEC_STATUS:
case mamaMsgType.MAMA_MSG_TYPE_UPDATE:
case mamaMsgType.MAMA_MSG_TYPE_QUOTE:
case mamaMsgType.MAMA_MSG_TYPE_TRADE:
case mamaMsgType.MAMA_MSG_TYPE_BOOK_UPDATE:
handleSecurityStatus(subscription, msg);
break;
}
}
示例4: updateQuoteFields
private void updateQuoteFields(MamaMsg msg)
{
mLastGenericMsgWasQuote = false;
mQuoteCache.mGotBidPrice = false;
mQuoteCache.mGotAskPrice = false;
mQuoteCache.mGotBidSize = false;
mQuoteCache.mGotAskSize = false;
mQuoteCache.mGotBidDepth = false;
mQuoteCache.mGotAskDepth = false;
mQuoteCache.mGotPartId = false;
mQuoteCache.mGotBidPartId = false;
mQuoteCache.mGotAskPartId = false;
mQuoteCache.mGotQuoteCount = false;
// Iterate over all of the fields in the message.
lock (this)
{
msg.iterateFields(mFieldIterator, null, null);
}
// Check certain special fields.
if (mQuoteCache.mGotBidSize || mQuoteCache.mGotAskSize ||
mQuoteCache.mGotBidDepth || mQuoteCache.mGotAskDepth ||
mQuoteCache.mGotBidPrice || mQuoteCache.mGotAskPrice ||
mQuoteCache.mGotBidPartId || mQuoteCache.mGotAskPartId)
{
mLastGenericMsgWasQuote = true;
}
if (mQuoteCache.mGotPartId == false && mQuoteCache.mSymbol != null)
{
// No explicit part ID in message, but maybe in symbol.
int lastDot = mQuoteCache.mSymbol.IndexOf(".");
if (lastDot != -1)
{
lastDot++;
int lastChar = mQuoteCache.mSymbol.Length;
if (lastDot != lastChar)
{
mQuoteCache.mPartId =
mQuoteCache.mSymbol.Substring(lastDot, lastChar - lastDot);
mQuoteCache.mGotPartId = true;
mQuoteCache.mPartIdFieldState = MamdaFieldState.MODIFIED;
}
}
}
}
示例5: handleAuctionMessage
private void handleAuctionMessage(
MamdaSubscription subscription,
MamaMsg msg,
mamaMsgType msgType)
{
updateFieldStates();
lock (this)
{
msg.iterateFields(mFieldIterator, null, null);
}
switch(msgType)
{
case mamaMsgType.MAMA_MSG_TYPE_INITIAL:
case mamaMsgType.MAMA_MSG_TYPE_RECAP:
handleRecap(subscription, msg);
break;
case mamaMsgType.MAMA_MSG_TYPE_UPDATE:
handleUpdate(subscription, msg);
break;
default:
break;
}
}
示例6: onMsg
public void onMsg(MamaSubscription subscription, MamaMsg msg)
{
// Create a field callback class to display the field contents
ListenerFieldCallback fieldCallback = new ListenerFieldCallback(m_dictionary, m_iterator, m_quietness);
if (m_quietness < 2)
{
Console.WriteLine(subscription.subscSource + "." +
subscription.subscSymbol + " TYPE: " +
msg.getType() + " Status: " +
msg.getStatus());
}
if (m_quietness < 1)
{
if (m_iterator)
{
// Set the iterator to the beginning of the message
msg.begin(ref m_messageIterator);
// Keep going until there are no more fields
MamaMsgField field = m_messageIterator.getField();
while (field != null)
{
// Display the field
fieldCallback.displayField(field, 0);
m_messageIterator++;
// Get the next field
field = m_messageIterator.getField();
}
}
else
{
// Otherwise use the iteration function on the message itself
int indentlevel = 0;
msg.iterateFields(fieldCallback, m_dictionary, indentlevel);
}
}
}