예제 #1
0
        public override void toAdmin(QuickFix.Message message, QuickFix.SessionID sessionID)
        {
            base.toAdmin(message, sessionID);

            if (message is QuickFix42.Logon)
            {
                message.setField(new ResetSeqNumFlag(true));

                GSFIX gsfix = provider as GSFIX;

                string encrypt_pwd = gsfix.Password;
                byte[] encrypt_pwd_byte = new byte[128];
                switch (gsfix.EncryptType)
                {
                    case EncryptType.NONE:
                        message.setField(new EncryptMethod(EncryptMethod.NONE));
                        break;
                    case EncryptType.DESECB:
                        gsEncrypt(2, gsfix.Password, gsfix.Password.Length, gsfix.PublicKey, encrypt_pwd_byte, 128);
                        encrypt_pwd = Encoding.ASCII.GetString(encrypt_pwd_byte);
                        message.setField(new EncryptMethod(EncryptMethod.DESECBMODE));
                        break;
                    case EncryptType.BlowFish:
                        gsEncrypt(101, gsfix.Password, gsfix.Password.Length, gsfix.PublicKey, encrypt_pwd_byte, 128);
                        encrypt_pwd = Encoding.ASCII.GetString(encrypt_pwd_byte);
                        message.setField(new EncryptMethod((int)EncryptType.BlowFish));
                        break;
                    default:
                        break;
                }

                if (!string.IsNullOrEmpty(gsfix.Account) && !string.IsNullOrEmpty(gsfix.CreditAccount))
                {
                    message.setField(new RawData(string.Format("T:{0},{1}:{2}:", gsfix.Account, gsfix.CreditAccount, encrypt_pwd.ToString())));
                }
                else if (!string.IsNullOrEmpty(gsfix.Account))
                {
                    message.setField(new RawData(string.Format("Z:{0}:{1}:", gsfix.Account, encrypt_pwd.ToString())));
                }
                else if (!string.IsNullOrEmpty(gsfix.CreditAccount))
                {
                    message.setField(new RawData(string.Format("X:{0}:{1}:", gsfix.CreditAccount, encrypt_pwd.ToString())));
                }
                else
                {
                    message.setField(new RawData(string.Format("T:{0},{1}:{2}:", gsfix.Account, gsfix.CreditAccount, encrypt_pwd.ToString())));
                }
            }
        }
예제 #2
0
 private static void fillFixMessageStructure(Dictionary<EFixTags,string> tagMap, ref QuickFix.Message fixMessage)
 {
     foreach (KeyValuePair<EFixTags, string> kvp in tagMap)
     {
         Fix.Out(string.Format("Tag {0}: {1}={2}", (int)kvp.Key, kvp.Key.ToString(), kvp.Value));
         fixMessage.setField((int)kvp.Key, kvp.Value);
     }
 }
예제 #3
0
		protected void SetUserDefinedFields(FIXMessage Message, QuickFix.Message message)
		{
			foreach (FIXField fixField in Message.Fields)
			{
				if (fixField.Tag >= 500)
				{
					switch (fixField.FIXType)
					{
						case FIXType.Bool:
							message.setField(new BooleanField(fixField.Tag, ((FIXBoolField)fixField).Value));
							continue;
						case FIXType.Int:
							message.setField(new IntField(fixField.Tag, ((FIXIntField)fixField).Value));
							continue;
						case FIXType.Double:
							message.setField(new DoubleField(fixField.Tag, ((FIXDoubleField)fixField).Value));
							continue;
						case FIXType.Char:
							message.setField(new CharField(fixField.Tag, ((FIXCharField)fixField).Value));
							continue;
						case FIXType.String:
							message.setField(new StringField(fixField.Tag, ((FIXStringField)fixField).Value));
							continue;
						case FIXType.DateTime:
							message.setField((UtcDateOnlyField)new UtcDateField(fixField.Tag, ((FIXDateTimeField)fixField).Value));
							continue;
						default:
							continue;
					}
				}
			}
		}