当前位置: 首页>>代码示例>>C#>>正文


C# Instrument.Save方法代码示例

本文整理汇总了C#中FreeQuant.Instruments.Instrument.Save方法的典型用法代码示例。如果您正苦于以下问题:C# Instrument.Save方法的具体用法?C# Instrument.Save怎么用?C# Instrument.Save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FreeQuant.Instruments.Instrument的用法示例。


在下文中一共展示了Instrument.Save方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ctxInstruments_AddNew_Click

    private void ctxInstruments_AddNew_Click(object sender, EventArgs e)
    {
      NewInstrumentForm newInstrumentForm = new NewInstrumentForm();
      TreeNode selectedNode = this.trvInstruments.SelectedNode;
      string str1 = (string) null;
      if (selectedNode is InstrumentNode)
        str1 = ((FIXInstrument) (selectedNode as InstrumentNode).Instrument).SecurityType;
      if (selectedNode is GroupNode)
      {
        SortedList<string, bool> sortedList = new SortedList<string, bool>();
        foreach (Instrument instrument in (selectedNode as GroupNode).Instruments)
          sortedList[((FIXInstrument) instrument).SecurityType] = true;
        if (sortedList.Count == 1)
          str1 = sortedList.Keys[0];
      }
      if (str1 != null)
        newInstrumentForm.InstrumentType = APITypeConverter.InstrumentType.Convert(str1);
      while (newInstrumentForm.ShowDialog((IWin32Window) this) == DialogResult.OK)
      {
        string symbol = newInstrumentForm.Symbol;
        string str2 = APITypeConverter.InstrumentType.Convert(newInstrumentForm.InstrumentType);
        string exchange = newInstrumentForm.Exchange;
        string currency = newInstrumentForm.Currency;
        DateTime maturity = newInstrumentForm.Maturity;
        PutOrCall putOrCall = APITypeConverter.PutCall.Convert(newInstrumentForm.PutCall);
        double strike = newInstrumentForm.Strike;
        if (InstrumentManager.Instruments.Contains(symbol))
        {
          int num = (int) MessageBox.Show((IWin32Window) this, string.Format("Instrument {0} already exists!", symbol), "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
        }
        else
        {
          Instrument instrument = new Instrument(symbol, str2);
          if (!string.IsNullOrEmpty(exchange))
						((FIXInstrument) instrument).SecurityExchange= exchange;
          if (!string.IsNullOrEmpty(currency))
						instrument.Currency = currency;
          if (str2 == "FUT" || str2 == "OPT" || str2 == "FOP")
          {
						((FIXInstrument) instrument).MaturityDate = maturity;
            if (str2 == "OPT" || str2 == "FOP")
            {
							instrument.PutOrCall = putOrCall;
							((FIXInstrument) instrument).StrikePrice = strike;
            }
          }
          instrument.Save();
          break;
        }
      }
      newInstrumentForm.Dispose();
    }
开发者ID:smther,项目名称:FreeOQ,代码行数:52,代码来源:InstrumentListWindow.cs

示例2: QmHMIFYlFO

 private void QmHMIFYlFO([In] object obj0, [In] EventArgs obj1)
 {
   this.jA3M607Con(false);
   this.Cursor = Cursors.WaitCursor;
   this.jdxMcrTVkr.Minimum = 0;
   this.jdxMcrTVkr.Value = 0;
   this.jdxMcrTVkr.Maximum = this.Av6MXcQF5Z.CheckedItems.Count;
   int num1 = 0;
   int num2 = 0;
   foreach (SecurityDefinitionViewItem definitionViewItem in this.Av6MXcQF5Z.CheckedItems)
   {
     string symbol = this.DsUMrBufkW(definitionViewItem.SecurityDefinition);
     if (!InstrumentManager.Instruments.Contains(symbol))
     {
       Instrument instrument = new Instrument(symbol, definitionViewItem.SecurityDefinition.SecurityType);
       foreach (FIXField field in definitionViewItem.SecurityDefinition.Fields)
       {
         if (field.Tag != 55 && field.Tag != 167)
           instrument.AddField(field);
       }
       if (!instrument.ContainsField(541))
       {
         DateTime result = DateTime.MinValue;
         string str = instrument.ContainsField(205) ? instrument.MaturityDay : RNaihRhYEl0wUmAftnB.aYu7exFQKN(32660);
         if (str.Length == 1)
           str = RNaihRhYEl0wUmAftnB.aYu7exFQKN(32668) + str;
         if (DateTime.TryParseExact(instrument.MaturityMonthYear + str, RNaihRhYEl0wUmAftnB.aYu7exFQKN(32674), (IFormatProvider) CultureInfo.InvariantCulture, DateTimeStyles.None, out result))
           instrument.MaturityDate = result;
       }
       if ((int) this.ElZM5QiWFt.Id == 10)
       {
         instrument.AddSymbol(definitionViewItem.SecurityDefinition.Symbol, definitionViewItem.SecurityDefinition.SecurityExchange, RNaihRhYEl0wUmAftnB.aYu7exFQKN(32694));
         instrument.AddSymbol(definitionViewItem.SecurityDefinition.Symbol, definitionViewItem.SecurityDefinition.SecurityExchange, RNaihRhYEl0wUmAftnB.aYu7exFQKN(32710));
       }
       if ((int) this.ElZM5QiWFt.Id == 21)
         instrument.AddSymbol(definitionViewItem.SecurityDefinition.SecurityID, definitionViewItem.SecurityDefinition.SecurityExchange, this.ElZM5QiWFt.Name);
       if ((int) this.ElZM5QiWFt.Id == 22)
       {
         instrument.AddSymbol(definitionViewItem.SecurityDefinition.SecurityID, definitionViewItem.SecurityDefinition.SecurityExchange, this.ElZM5QiWFt.Name);
         instrument.RemoveField(48);
       }
       instrument.Save();
       ++num1;
     }
     else
       ++num2;
     ++this.jdxMcrTVkr.Value;
     Application.DoEvents();
   }
   this.jA3M607Con(true);
   this.Cursor = Cursors.Default;
   int num3 = (int) MessageBox.Show(string.Format(RNaihRhYEl0wUmAftnB.aYu7exFQKN(32726) + Environment.NewLine + RNaihRhYEl0wUmAftnB.aYu7exFQKN(32788), (object) num1, (object) num2), RNaihRhYEl0wUmAftnB.aYu7exFQKN(32828), MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
 }
开发者ID:heber,项目名称:FreeOQ,代码行数:53,代码来源:SecurityDefinitionListForm.cs

示例3: AddInstrument

    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;
    }
开发者ID:smther,项目名称:FreeOQ,代码行数:58,代码来源:ProcessImportForm.cs

示例4: GetInstrument

    private Instrument GetInstrument(string symbol)
    {
			Instrument instrument = InstrumentManager.Instruments[symbol];
      switch (this.settings.SymbolOption)
      {
        case SymbolOption.All:
          if (instrument == null)
          {
            instrument = new Instrument(symbol);
            instrument.Save();
            break;
          }
          else
            break;
        case SymbolOption.Custom:
          if (!this.ContainsSymbol(symbol))
          {
            instrument = (Instrument) null;
            break;
          }
          else
            break;
      }
      return instrument;
    }
开发者ID:smther,项目名称:FreeOQ,代码行数:25,代码来源:ImportEngine.cs


注:本文中的FreeQuant.Instruments.Instrument.Save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。