Exemplo n.º 1
0
 public SecurityDefinitionViewItem(FIXSecurityDefinition securityDefinition, byte providerId)
   : base(new string[5])
 {
   this.securityDefinition = securityDefinition;
   this.SubItems[0].Text = SecurityDefinitionHelper.GetSymbol(securityDefinition, providerId);
   this.SubItems[1].Text = ((object) APITypeConverter.InstrumentType.Convert(securityDefinition.SecurityType)).ToString();
   this.SubItems[2].Text = securityDefinition.SecurityExchange;
   this.SubItems[3].Text = securityDefinition.Currency;
   DateTime? nullable;
   if (((FIXGroup) securityDefinition).ContainsField(541))
     nullable = new DateTime?(securityDefinition.MaturityDate);
   else if (((FIXGroup) securityDefinition).ContainsField(200))
   {
     try
     {
       nullable = new DateTime?(new DateTime(int.Parse(securityDefinition.MaturityMonthYear.Substring(0, 4), (IFormatProvider) CultureInfo.InvariantCulture), int.Parse(securityDefinition.MaturityMonthYear.Substring(4, 2), (IFormatProvider) CultureInfo.InvariantCulture), 1));
     }
     catch
     {
       nullable = new DateTime?();
     }
   }
   else
     nullable = new DateTime?();
   this.SubItems[4].Text = !nullable.HasValue ? "" : nullable.Value.ToShortDateString();
 }
Exemplo n.º 2
0
		private static string GetSymbol_IB(FIXSecurityDefinition definition)
		{
			switch (definition.SecurityType)
			{
				case "FOR":
					if (!string.IsNullOrEmpty(definition.Currency))
						return string.Format("{0}/{1}", definition.Symbol, definition.Currency);
					else
						return definition.Symbol;
				case "FUT":
				case "OPT":
				case "FOP":
					List<string> list = new List<string>();
					list.Add(definition.Symbol);
					if (((FIXGroup)definition).ContainsField(541))
						list.Add(definition.MaturityDate.ToString("MMMyy", (IFormatProvider)CultureInfo.InvariantCulture));
					if (((FIXGroup)definition).ContainsField(202))
						list.Add(definition.StrikePrice.ToString((IFormatProvider)CultureInfo.InvariantCulture).Replace('.', '\''));
					if (((FIXGroup)definition).ContainsField(201))
					{
						switch (definition.PutOrCall)
						{
							case 0:
								list.Add("P");
								break;
							case 1:
								list.Add("C");
								break;
						}
					}
					return string.Join(" ", list);
				default:
					return definition.Symbol;
			}
		}
Exemplo n.º 3
0
 public SecurityDefinitionViewItem(string symbol, FIXSecurityDefinition securityDefinition)
 {
   eX4XcIhHpDXt70u2x3N.k8isAcYzkUOGF();
   // ISSUE: explicit constructor call
   base.\u002Ector(new string[5]);
   this.spCHSgVpLT = securityDefinition;
   this.SubItems[0].Text = symbol;
   this.SubItems[1].Text = securityDefinition.SecurityType;
   this.SubItems[2].Text = securityDefinition.SecurityID;
   this.SubItems[3].Text = securityDefinition.SecurityExchange;
   this.SubItems[4].Text = securityDefinition.Currency;
 }
Exemplo n.º 4
0
		public static string GetSymbol(FIXSecurityDefinition definition, byte providerId)
		{
			switch (providerId)
			{
				case FreeQuant.Providers.ProviderId.IB:  // 4
					return SecurityDefinitionHelper.GetSymbol_IB(definition);
				case FreeQuant.Providers.ProviderId.TTFIX:
					return SecurityDefinitionHelper.GetSymbol_TTFIX(definition);
				case FreeQuant.Providers.ProviderId.OpenECry: // 22:
					return SecurityDefinitionHelper.GetSymbol_OEC(definition);
				default:
					return definition.Symbol;
			}
		}
Exemplo n.º 5
0
		private static string GetSymbol_TTFIX(FIXSecurityDefinition definition)
		{
			List<string> list = new List<string>();
			list.Add(definition.Symbol);
			if (definition.SecurityType == "FUT" || definition.SecurityType == "OPT")
			{
				if (((FIXGroup)definition).ContainsField(200))
				{
					int year = int.Parse(definition.MaturityMonthYear.Substring(0, 4), (IFormatProvider)CultureInfo.InvariantCulture);
					int month = int.Parse(definition.MaturityMonthYear.Substring(4, 2), (IFormatProvider)CultureInfo.InvariantCulture);
					list.Add(new DateTime(year, month, 1).ToString("MMMyy", (IFormatProvider)CultureInfo.InvariantCulture));
				}
				else if (((FIXGroup)definition).ContainsField(541))
					list.Add(definition.MaturityDate.ToString("MMMyy", (IFormatProvider)CultureInfo.InvariantCulture));
				if (definition.SecurityType == "OPT")
				{
					if (((FIXGroup)definition).ContainsField(202))
						list.Add(definition.StrikePrice.ToString((IFormatProvider)CultureInfo.InvariantCulture));
					if (((FIXGroup)definition).ContainsField(201))
					{
						if (definition.PutOrCall == 0)
							list.Add("P");
						else
							list.Add("C");
					}
				}
			}
			if (definition.SecurityType == "MLEG")
			{
				for (int index = 0; index < definition.NoUnderlyings; ++index)
				{
					FIXUnderlyingsGroup underlyingsGroup = definition.GetUnderlyingsGroup(index);
					if (((FIXGroup)underlyingsGroup).ContainsField(313))
					{
						int year = int.Parse(underlyingsGroup.UnderlyingMaturityMonthYear.Substring(0, 4), (IFormatProvider)CultureInfo.InvariantCulture);
						int month = int.Parse(underlyingsGroup.UnderlyingMaturityMonthYear.Substring(4, 2), (IFormatProvider)CultureInfo.InvariantCulture);
						list.Add(new DateTime(year, month, 1).ToString("MMMyy", CultureInfo.InvariantCulture));
					}
				}
			}
			return string.Join(" ", (IEnumerable<string>)list);
		}
Exemplo n.º 6
0
 public void Init(FIXSecurityDefinition definition)
 {
   this.definition = definition;
 }
 public FIXSecurityDefinitionEventArgs(FIXSecurityDefinition securityDefinition)
 {
     this.SecurityDefinition = securityDefinition;
 }
Exemplo n.º 8
0
		protected void EmitSecurityDefinition(FIXSecurityDefinition definition)
		{
			if (this.deONmY5cm == null)
				return;
			this.deONmY5cm((object)this, new FIXSecurityDefinitionEventArgs(definition));
		}
Exemplo n.º 9
0
		public SecurityDefinitionEventArgs(FIXSecurityDefinition definition) : base()
		{
			this.SecurityDefinition = definition; 
		}
Exemplo n.º 10
0
		new public void onMessage(QuickFix.FIX43.SecurityDefinition definition, SessionID sessionID)
		{
			FIXSecurityDefinition definition1 = new FIXSecurityDefinition();
			this.ConvertMessage((QuickFix.Message)definition, (FIXMessage)definition1);
			this.EmitSecurityDefinition(definition1);
		}
 public SecurityDefinitionTypeDescriptor(FIXSecurityDefinition definition)
 {
   this.definition = definition;
 }
Exemplo n.º 12
0
 private void UpdateSecurityDefinitionList(FIXSecurityDefinition[] securityDefinitions)
 {
   this.Cursor = Cursors.WaitCursor;
   this.ltvSecurityDefinitions.BeginUpdate();
   this.ltvSecurityDefinitions.Items.Clear();
   foreach (FIXSecurityDefinition securityDefinition in securityDefinitions)
     this.ltvSecurityDefinitions.Items.Add((ListViewItem) new SecurityDefinitionViewItem(securityDefinition, ((IProvider) this.provider).Id));
   this.ltvSecurityDefinitions.EndUpdate();
   this.statusStrip.Items[1].Text = securityDefinitions.Length.ToString("n0");
   this.statusStrip.Items[3].Text = "0";
   this.selectedCount = 0;
   this.Cursor = Cursors.Default;
 }
Exemplo n.º 13
0
		protected void EmitSecurityDefinition(FIXSecurityDefinition definition)
		{
			if (this.CsYL4u5r6 == null)
				return;
			this.CsYL4u5r6((object)this, new FIXSecurityDefinitionEventArgs(definition));
		}
Exemplo n.º 14
0
 public void Init(IInstrumentProvider provider, FIXSecurityDefinition[] securityDefinitions)
 {
   this.provider = provider;
   this.securityDefinitions = securityDefinitions;
   this.numSuccessfully = 0;
   this.numSkipped = 0;
   this.UpdateProgress();
   this.btnClose.Visible = false;
 }
Exemplo n.º 15
0
		private static string GetSymbol_OEC(FIXSecurityDefinition definition)
		{
			string str = definition.Symbol;
			if (definition.SecurityType == "FUT" || definition.SecurityType == "OPT")
			{
				if (((FIXGroup)definition).ContainsField(541))
					str = str + " " + definition.MaturityDate.ToString("MMMyy", (IFormatProvider)CultureInfo.InvariantCulture);
				if (definition.SecurityType == "OPT")
				{
					if (((FIXGroup)definition).ContainsField(202))
						str = str + (object)" " + (string)(object)definition.StrikePrice;
					if (((FIXGroup)definition).ContainsField(201))
					{
						switch (definition.PutOrCall)
						{
							case 0:
								str = str + " P";
								break;
							case 1:
								str = str + " C";
								break;
						}
					}
				}
			}
			return str;
		}
Exemplo n.º 16
0
    private bool AddInstrument(FIXSecurityDefinition securityDefinition)
    {
      string symbol = SecurityDefinitionHelper.GetSymbol(securityDefinition, ((IProvider) this.provider).Id);
      if (InstrumentManager.Instruments.Contains(symbol))
        return false;
      Instrument instrument = new Instrument(symbol, securityDefinition.SecurityType);
      foreach (FIXField fixField in ((FIXGroup) securityDefinition).Fields)
      {
        switch ((int) fixField.Tag)
        {
          case 320:
          case 322:
          case 323:
          case 393:
          case 55:
          case 167:
            goto case 320;
          default:
            ((FIXGroup) instrument).AddField(fixField);
            goto case 320;
        }
      }
      for (int index = 0; index < securityDefinition.NoSecurityAltID; ++index)
        ((FIXInstrument) instrument).AddGroup(securityDefinition.GetSecurityAltIDGroup(index));
      switch (((IProvider) this.provider).Id)
      {
        case (byte) 4:
          if (((FIXInstrument) instrument).Symbol != securityDefinition.Symbol)
            instrument.AddSymbol(securityDefinition.Symbol, securityDefinition.SecurityExchange, ((IProvider) this.provider).Name);
          ((FIXGroup) instrument).RemoveField(48);
          break;
        case (byte) 10:
          instrument.AddSymbol(string.Format("{0}|{1}|1.0", (object) securityDefinition.Symbol, securityDefinition.SecurityID), securityDefinition.SecurityExchange, ((IProvider) this.provider).Name);
          ((FIXGroup) instrument).RemoveField(48);
          instrument.AddSymbol(securityDefinition.Symbol, securityDefinition.SecurityExchange, "TT API");
          break;
        case (byte) 21:
          instrument.AddSymbol(securityDefinition.SecurityID, securityDefinition.SecurityExchange, ((IProvider) this.provider).Name);
          break;
        case (byte) 22:
          if (((FIXInstrument) instrument).Symbol != securityDefinition.Symbol)
          {
            instrument.AddSymbol(securityDefinition.SecurityID, securityDefinition.SecurityExchange, ((IProvider) this.provider).Name);
            ((FIXGroup) instrument).RemoveField(48);
            break;
          }
          else
            break;
      }
      if ((((FIXInstrument) instrument).SecurityType == "FUT" || ((FIXInstrument) instrument).SecurityType == "OPT" || ((FIXInstrument) instrument).SecurityType == "MLEG") && (!((FIXGroup) instrument).ContainsField(541) && ((FIXGroup) instrument).ContainsField(200)))
      {
        int year = int.Parse(securityDefinition.MaturityMonthYear.Substring(0, 4), (IFormatProvider) CultureInfo.InvariantCulture);
        int month = int.Parse(securityDefinition.MaturityMonthYear.Substring(4, 2), (IFormatProvider) CultureInfo.InvariantCulture);
				((FIXInstrument) instrument).MaturityDate = new DateTime(year, month, 1);
      }
      instrument.Save();
      return true;
    }
Exemplo n.º 17
0
		public FIXSecurityDefinitionEventArgs(FIXSecurityDefinition securityDefinition)
		{
			this.SecurityDefinition = securityDefinition;
		}