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


C# SmartQuant.Instrument类代码示例

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


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

示例1: Subscribe

 public override void Subscribe(Instrument instrument)
 {
     if (instrument.Parent != null)
     {
         this.strategyBySynthInstrument[instrument.Id] = this.strategyBySynthInstrument[instrument.Parent.Id];
         this.strategyBySynthInstrument[instrument.Id].OnSubscribe(instrument);
         return;
     }
     SellSideInstrumentStrategy sellSideInstrumentStrategy = (SellSideInstrumentStrategy)Activator.CreateInstance(base.GetType(), new object[]
     {
         this.framework,
         string.Concat(new object[]
         {
             base.Name,
             "(",
             instrument,
             ")"
         })
     });
     this.SetupStrategy(sellSideInstrumentStrategy);
     sellSideInstrumentStrategy.Instrument = instrument;
     this.strategyBySynthInstrument[instrument.Id] = sellSideInstrumentStrategy;
     sellSideInstrumentStrategy.OnSubscribe(instrument);
     sellSideInstrumentStrategy.dataProvider = base.DataProvider;
     sellSideInstrumentStrategy.executionProvider = base.ExecutionProvider;
     sellSideInstrumentStrategy.raiseEvents = true;
     base.AddStrategy(sellSideInstrumentStrategy, false);
     sellSideInstrumentStrategy.OnStrategyStart();
 }
开发者ID:ForTrade,项目名称:CSharp,代码行数:29,代码来源:SellSideInstrumentStrategy.cs

示例2: GetData_Instrument

        // 从分类好的目录中取中所有合约
        private SortedDictionary<int, FileInfo> GetData_Instrument(Instrument inst)
        {
            SortedDictionary<int, FileInfo> resultList = new SortedDictionary<int, FileInfo>();

            if (string.IsNullOrEmpty(DataPath_Instrument))
                return resultList;            

            // 直接查找某一目录是否存在
            string instrument = inst.Symbol;
            int i = inst.Symbol.IndexOf('.');
            if(i>=0)
            {
                instrument = instrument.Substring(0,i);
            }

            var di = new DirectoryInfo(DataPath_Instrument);

            if (!di.Exists)
                return resultList;

            var list = di.GetDirectories(instrument, System.IO.SearchOption.AllDirectories);
            foreach(var l in list)
            {
                UnionAndUpdate(resultList, GetFiles(l, inst.Symbol));
            }

            return resultList;
        }
开发者ID:kandsy,项目名称:QuantBox.DataSimulator,代码行数:29,代码来源:ProtobufDataZeroReader.cs

示例3: HistoricalDataRequest

 public HistoricalDataRequest(Instrument instrument, DateTime dateTime1, DateTime dateTime2, byte dataType)
 {
     this.Instrument = instrument;
     this.DateTime1 = dateTime1;
     this.DateTime2 = dateTime2;
     this.DataType = dataType;
 }
开发者ID:hack1t,项目名称:SmartQuant.dll,代码行数:7,代码来源:HistoricalDataRequest.cs

示例4: BarFactoryItem

		protected BarFactoryItem(Instrument instrument, BarType barType, long barSize)
		{
			this.factory = null;
			this.instrument = instrument;
			this.barType = barType;
			this.barSize = barSize;
		}
开发者ID:ForTrade,项目名称:CSharp,代码行数:7,代码来源:BarFactoryItem.cs

示例5: OnInit

 protected override void OnInit()
 {
   this.instrument = (Instrument) this.args[0];
   this.InitDataSeriesList();
   this.InitDataSeriesViewer();
   this.Text = string.Format("Data [{0}]", (object) this.instrument.Symbol);
 }
开发者ID:fastquant,项目名称:fastquant.dll,代码行数:7,代码来源:InstrumentData.cs

示例6: Read

		public override object Read(BinaryReader reader)
		{
			reader.ReadByte();
			int id = reader.ReadInt32();
			InstrumentType type = (InstrumentType)reader.ReadByte();
			string symbol = reader.ReadString();
			string description = reader.ReadString();
			byte currencyId = reader.ReadByte();
			string exchange = reader.ReadString();
			Instrument instrument = new Instrument(id, type, symbol, description, currencyId, exchange);
			instrument.tickSize = reader.ReadDouble();
			instrument.maturity = new DateTime(reader.ReadInt64());
			instrument.factor = reader.ReadDouble();
			instrument.strike = reader.ReadDouble();
			instrument.putcall = (PutCall)reader.ReadByte();
			instrument.margin = reader.ReadDouble();
			int num = reader.ReadInt32();
			for (int i = 0; i < num; i++)
			{
				AltId altId = new AltId();
				altId.providerId = reader.ReadByte();
				altId.symbol = reader.ReadString();
				altId.exchange = reader.ReadString();
				instrument.altId.Add(altId);
			}
			return instrument;
		}
开发者ID:ForTrade,项目名称:CSharp,代码行数:27,代码来源:InstrumentStreamer.cs

示例7: Subscribe

 public void Subscribe(IDataProvider provider, Instrument instrument)
 {
     if (provider.Status != ProviderStatus.Connected)
     {
         provider.Connect();
     }
     Dictionary<Instrument, int> dictionary = null;
     if (!this.subscriptions.TryGetValue((int)provider.Id, out dictionary))
     {
         dictionary = new Dictionary<Instrument, int>();
         this.subscriptions[(int)provider.Id] = dictionary;
     }
     int num = 0;
     bool flag = false;
     if (!dictionary.TryGetValue(instrument, out num))
     {
         flag = true;
         num = 1;
     }
     else
     {
         if (num == 0)
         {
             flag = true;
         }
         num++;
     }
     dictionary[instrument] = num;
     if (flag)
     {
         provider.Subscribe(instrument);
     }
 }
开发者ID:ForTrade,项目名称:CSharp,代码行数:33,代码来源:SubscriptionManager.cs

示例8: ImportTask

 public ImportTask(Instrument instrument)
 {
   this.Instrument = instrument;
   this.State = ImportTaskState.Pending;
   this.Count = 0;
   this.TotalNum = 0;
   this.Message = string.Empty;
 }
开发者ID:fastquant,项目名称:fastquant.dll,代码行数:8,代码来源:ImportTask.cs

示例9: textBox_Instrument_Validating

 private void textBox_Instrument_Validating(object sender, CancelEventArgs e)
 {
     Instrument = SmartQuant.Shared.Global.Framework.InstrumentManager.Get((sender as TextBox).Text);
     errorProvider1.Clear();
     if (Instrument == null)
     {
         errorProvider1.SetError(textBox_Instrument,"合约不存在");
     }
 }
开发者ID:kandsy,项目名称:DemoDock,代码行数:9,代码来源:ChangePositionForm.cs

示例10: Delete

		public void Delete(Instrument instrument)
		{
			this.instruments.Remove(instrument);
			if (this.server != null && instrument.isPersistent)
			{
				this.server.Delete(instrument);
			}
			this.framework.eventServer.OnInstrumentDeleted(instrument);
		}
开发者ID:ForTrade,项目名称:CSharp,代码行数:9,代码来源:InstrumentManager.cs

示例11: GetById

		public Instrument GetById(int id)
		{
			Instrument instrument = this.instruments.GetById(id);
			if (instrument == null)
			{
				instrument = new Instrument(id, InstrumentType.Synthetic, Guid.NewGuid().ToString(), "", 1);
				this.instruments.Add(instrument);
			}
			return instrument;
		}
开发者ID:ForTrade,项目名称:CSharp,代码行数:10,代码来源:InstrumentManager.cs

示例12: InstrumentViewItem

 public InstrumentViewItem(Instrument instrument)
   : base(new string[5])
 {
   this.Instrument = instrument;
   this.SubItems[0].Text = instrument.Symbol;
   this.SubItems[1].Text = instrument.Type.ToString();
   this.SubItems[2].Text = instrument.Exchange;
   this.SubItems[3].Text = CurrencyId.GetName(instrument.CurrencyId);
   this.SubItems[4].Text = instrument.Maturity == DateTime.MinValue ? string.Empty : instrument.Maturity.ToShortDateString();
 }
开发者ID:fastquant,项目名称:fastquant.dll,代码行数:10,代码来源:InstrumentViewItem.cs

示例13: Order

 public Order(IExecutionProvider provider, Instrument instrument, OrderType type, OrderSide side, double qty, double price = 0.0, double stopPx = 0.0, TimeInForce timeInForce = TimeInForce.Day, string text = "")
     : this()
 {
     this.provider = provider;
     this.instrument = instrument;
     this.type = type;
     this.side = side;
     this.qty = qty;
     this.price = price;
     this.stopPx = stopPx;
     this.timeInForce = timeInForce;
     this.text = text;
     this.portfolio = null;
 }
开发者ID:ForTrade,项目名称:CSharp,代码行数:14,代码来源:Order.cs

示例14: Add

		public void Add(Instrument instrument, bool save = true)
		{
			if (this.Contains(instrument.symbol))
			{
				throw new ApplicationException("Instrument with the same symbol is already present in the framework : " + instrument.symbol);
			}
			instrument.Id = this.next_id;
			this.next_id++;
			this.instruments.Add(instrument);
			if (save && this.server != null)
			{
				this.server.Save(instrument);
			}
			this.framework.eventServer.OnInstrumentAdded(instrument);
		}
开发者ID:ForTrade,项目名称:CSharp,代码行数:15,代码来源:InstrumentManager.cs

示例15: AddInstance

		public void AddInstance(Instrument instrument, InstrumentStrategy strategy)
		{
			strategy.instruments.Add(instrument);
			strategy.instrument = instrument;
			strategy.raiseEvents = true;
			strategy.dataProvider = this.dataProvider;
			strategy.executionProvider = this.executionProvider;
			this.Add(strategy);
			if (base.Instruments.GetById(instrument.id) == null)
			{
				base.Instruments.Add(instrument);
			}
			strategy.status = StrategyStatus.Running;
			strategy.OnStrategyStart();
		}
开发者ID:ForTrade,项目名称:CSharp,代码行数:15,代码来源:InstrumentStrategy.cs


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