/// <summary> /// handle structure update /// </summary> /// <param name="FIXMsg"></param> public void ReceiveStructureUpdate(EASYROUTERCOMCLIENTLib.IFIXMessage FIXMsg) { m_bSubscribedAdditionalInfo = true; int nNumber = FIXMsg.get_AsNumber(EASYROUTERCOMCLIENTLib.FIXTagConstants.esFIXTagESDecimalPlaces); int nPrefRiskValue = 0; if (FIXMsg.GetNumber(out nPrefRiskValue, EASYROUTERCOMCLIENTLib.FIXTagConstants.esFIXTagESPreferredRiskArrayType)) m_nFIXTagESPreferredRiskArrayType = nPrefRiskValue; if(nNumber != 0) m_nESDecimalPlaces = nNumber; double dPriceMovement = 0.0; if (FIXMsg.GetDouble(out dPriceMovement, EASYROUTERCOMCLIENTLib.FIXTagConstants.esFIXTagESPriceMovement )) m_nFIXTagESPreferredRiskArrayType = nPrefRiskValue; if (dPriceMovement != 0) m_dPriceMovement = dPriceMovement; string sStrategyCode = FIXMsg.get_AsString(EASYROUTERCOMCLIENTLib.FIXTagConstants.esFIXTagESStrategyCode); if (sStrategyCode != string.Empty) m_sStrategyCode = sStrategyCode; string sSecurityID = FIXMsg.get_AsString(EASYROUTERCOMCLIENTLib.FIXTagConstants.esFIXTagSecurityID); if (sSecurityID != string.Empty) m_sSecurityID = sSecurityID; string sIDSource = FIXMsg.get_AsString(EASYROUTERCOMCLIENTLib.FIXTagConstants.esFIXTagIDSource); if (sIDSource != string.Empty) m_sIDSource = sIDSource; string sCombinedCommodityCode = FIXMsg.get_AsString(EASYROUTERCOMCLIENTLib.FIXTagConstants.esFIXTagESCombinedCommodityCode); if (sCombinedCommodityCode != string.Empty) m_sCombinedCommodityCode = sCombinedCommodityCode; string sClearingHouse = FIXMsg.get_AsString(EASYROUTERCOMCLIENTLib.FIXTagConstants.esFIXTagESClearingHouse); if (sClearingHouse != string.Empty) { m_sClearingHouse = sClearingHouse; System.Diagnostics.Debug.WriteLine(this.ESTickerMnemonic + " " + m_sClearingHouse); } int nOptionType = 0; if (FIXMsg.GetNumber(out nOptionType, EASYROUTERCOMCLIENTLib.FIXTagConstants.esFIXTagPutOrCall)) { //defaults to 1 - call if never here m_nOptionType = nOptionType; } //RISK ARRAYS string sRiskArray = string.Empty; int nRiskArrayType = 0; if (FIXMsg.HasGroup(EASYROUTERCOMCLIENTLib.FIXTagConstants.esFIXTagESNoRiskArrays)) { EASYROUTERCOMCLIENTLib.IFIXGroup defaultGroup = FIXMsg.GetGroupByTag(EASYROUTERCOMCLIENTLib.FIXTagConstants.esFIXTagESNoRiskArrays, null); if (defaultGroup != null) { int nDefaultCount = defaultGroup.get_NumberOfGroups(null); for (int j = 0; j < nDefaultCount; j++) { EASYROUTERCOMCLIENTLib.IFIXGroup singleDefaultGroup = defaultGroup.GetGroupByIndex(j); int nValue = singleDefaultGroup.get_AsNumber(EASYROUTERCOMCLIENTLib.FIXTagConstants.esFIXTagESRiskArrayType); if (nValue != nRiskArrayType) { CreateRiskArray(nValue, sRiskArray); nRiskArrayType = nValue; } string sValue = singleDefaultGroup.get_AsString(EASYROUTERCOMCLIENTLib.FIXTagConstants.esFIXTagESRiskArrayValue); if (sValue != null) { sRiskArray = sRiskArray + sValue + "\\"; } } } } CreateRiskArray(nRiskArrayType, sRiskArray); }
/// <summary> /// Recieve account and logon message /// </summary> /// <param name="FIXMsg"></param> void m_Router_RecvGeneralMsg(EASYROUTERCOMCLIENTLib.IFIXMessage FIXMsg) { EASYROUTERCOMCLIENTLib.FIXMsgConstants type = FIXMsg.MsgType; switch (type) { case EASYROUTERCOMCLIENTLib.FIXMsgConstants.esFIXMsgESAccount: System.Diagnostics.Debug.WriteLine(type.ToString()); break; case EASYROUTERCOMCLIENTLib.FIXMsgConstants.esFIXMsgLogon: { Logon logon = new Logon(); if(FIXMsg.HasGroup(EASYROUTERCOMCLIENTLib.FIXTagConstants.esFIXTagText)) { string sMessage = FIXMsg.get_AsString(EASYROUTERCOMCLIENTLib.FIXTagConstants.esFIXTagText); string[] split = sMessage.Split('|'); if (split.Length > 0) logon.Error = split[0]; else logon.Error = "Logon Error Undefined"; logon.ErrorCode = FIXMsg.get_AsNumber(EASYROUTERCOMCLIENTLib.FIXTagConstants.esFIXTagESLogonFailureCode); logon.LoggedOn = false; } else { System.Diagnostics.Trace.WriteLine(type.ToString()); RequestStructure("0"); logon.LoggedOn = true; LoadSystemSettings(); } logon.ConnectionType = (Logon.ConnectionTypes)FIXMsg.get_AsNumber(EASYROUTERCOMCLIENTLib.FIXTagConstants.esFIXTagESEasyRouterType); logon.ConnectionDescription = FIXMsg.get_AsString(EASYROUTERCOMCLIENTLib.FIXTagConstants.esFIXTagESEasyRouterDesc); if (RecvGeneralMsgEvent != null) RecvGeneralMsgEvent(this, logon); break; } case EASYROUTERCOMCLIENTLib.FIXMsgConstants.esFIXMsgEHControl: break; case EASYROUTERCOMCLIENTLib.FIXMsgConstants.esFIXMsgESComponentStatus: UpdateComponentStatus(FIXMsg); break; case EASYROUTERCOMCLIENTLib.FIXMsgConstants.esFIXMsgLogout: { Logon logoff = new Logon(); logoff.Error = "Successfully Logged Out"; logoff.LoggedOn = false; logoff.LoggedOff = true; if (RecvGeneralMsgEvent != null) RecvGeneralMsgEvent(this, logoff); break; } default: System.Diagnostics.Debug.WriteLine(type.ToString()); break; } }
/// <summary> /// Get Process Account Details from FIX message /// </summary> /// <param name="FIXMsg"></param> public void ProcessAccount(EASYROUTERCOMCLIENTLib.IFIXMessage FIXMsg) { //repeats ESNoSecurityExchanges=2 m_nAccountID = FIXMsg.get_AsNumber(EASYROUTERCOMCLIENTLib.FIXTagConstants.esFIXTagESAccountID); m_sAccountName = FIXMsg.get_AsString(EASYROUTERCOMCLIENTLib.FIXTagConstants.esFIXTagESAccountName); bool bHasGroup = FIXMsg.HasGroup(EASYROUTERCOMCLIENTLib.FIXTagConstants.esFIXTagESNoSecurityExchanges); //note pass null EASYROUTERCOMCLIENTLib.IFIXGroup group = FIXMsg.GetGroupByTag(EASYROUTERCOMCLIENTLib.FIXTagConstants.esFIXTagESNoSecurityExchanges, null); if (group != null) { int nCount = group.get_NumberOfGroups(null); for(int i = 0; i < nCount; i++) { EASYROUTERCOMCLIENTLib.IFIXGroup singleGroup = group.GetGroupByIndex(i); string sExchange = singleGroup.get_AsString(EASYROUTERCOMCLIENTLib.FIXTagConstants.esFIXTagSecurityExchange); AddTicker(sExchange, singleGroup); } } }