Ejemplo n.º 1
0
        public TWSMarketDataSnapshot(TWSMarketDataSnapshot that)
        {
            _askSize  = that._askSize;
            _bidSize  = that._bidSize;
            _lastSize = that._lastSize;
            _volume   = that._volume;

            Contract        = that.Contract;
            Ask             = that.Ask;
            Bid             = that.Bid;
            Close           = that.Close;
            Open            = that.Open;
            High            = that.High;
            Low             = that.Low;
            Last            = that.Last;
            SyntheticVolume = that.SyntheticVolume;
            VolumeEvents    = that.VolumeEvents;
            VolumeMisses    = that.VolumeMisses;
            TradeEvents     = that.TradeEvents;
            TradeDups       = that.TradeDups;
            BidEvents       = that.BidEvents;
            AskEvents       = that.AskEvents;
            AskDups         = that.AskDups;
            BidDups         = that.BidDups;
            TradeTimeStamp  = that.TradeTimeStamp;
            BidTimeStamp    = that.BidTimeStamp;
            AskTimeStamp    = that.AskTimeStamp;
            Delta           = that.Delta;
            ImpliedVol      = that.ImpliedVol;
            BidDelta        = that.BidDelta;
            BidImpliedVol   = that.BidImpliedVol;
            AskDelta        = that.AskDelta;
            AskImpliedVol   = that.AskImpliedVol;
            PVDividend      = that.PVDividend;
            ModelPrice      = that.ModelPrice;
        }
Ejemplo n.º 2
0
    public TWSMarketDataSnapshot(TWSMarketDataSnapshot that)
    {
      _askSize = that._askSize;
      _bidSize = that._bidSize;
      _lastSize = that._lastSize;
      _volume = that._volume;

      Contract = that.Contract;
      Ask = that.Ask;
      Bid = that.Bid;
      Close = that.Close;
      Open = that.Open;
      High = that.High;
      Low = that.Low;
      Last = that.Last;
      SyntheticVolume = that.SyntheticVolume;
      VolumeEvents = that.VolumeEvents;
      VolumeMisses = that.VolumeMisses;
      TradeEvents = that.TradeEvents;
      TradeDups = that.TradeDups;
      BidEvents = that.BidEvents;
      AskEvents = that.AskEvents;
      AskDups = that.AskDups;
      BidDups = that.BidDups;
      TradeTimeStamp = that.TradeTimeStamp;
      BidTimeStamp = that.BidTimeStamp;
      AskTimeStamp = that.AskTimeStamp;
      Delta = that.Delta;
      ImpliedVol = that.ImpliedVol;
      BidDelta = that.BidDelta;
      BidImpliedVol = that.BidImpliedVol;
      AskDelta = that.AskDelta;
      AskImpliedVol = that.AskImpliedVol;
      PVDividend = that.PVDividend;
      ModelPrice = that.ModelPrice;
    }
Ejemplo n.º 3
0
 protected void OnMarketData(TWSMarketDataSnapshot snapshot, IBTickType tickType)
 {
   if (MarketData != null)
     MarketData(this, new TWSMarketDataEventArgs(this)
       {
         Snapshot =  snapshot,
         TickType = tickType
       });
 }
Ejemplo n.º 4
0
    private void UpdateGridRow(TWSMarketDataSnapshot s, IBTickType t)
    {
      var record = _symbolDataMap[s.Contract];

      record.Snapshot = s;
      // Make sure we don't crash and burn on the first invocation
      if (record.PreviousSnapshot == null)
        record.PreviousSnapshot = record.Snapshot;

      var g = record.Grid;
      var r = record.Row;
      var p = record.PreviousSnapshot;

      try {
        UnHighlightCells(record);

        if (s.LastTimeStamp != p.LastTimeStamp) SetValue(record, IBGridColumn.UpdateTime, s.LastTimeStamp);
        if (s.Last != p.Last) SetValue(record, IBGridColumn.LastPrice, s.Last);
        if (s.LastSize != p.LastSize) SetValue(record, IBGridColumn.LastSize, s.LastSize);
        if (s.Volume != p.Volume) SetValue(record, IBGridColumn.Volume, s.Volume);
        if (s.VolumeEvents != p.VolumeEvents) SetValue(record, IBGridColumn.VolumeEvents, s.VolumeEvents);
        if (s.VolumeMisses != p.VolumeMisses) SetValue(record, IBGridColumn.VolumeMisses, s.VolumeMisses);

        if (s.TradeDups != p.TradeDups) SetValue(record, IBGridColumn.TradeDups, s.TradeDups);
        if (s.BidDups != p.BidDups) SetValue(record, IBGridColumn.BidDups, s.BidDups);
        if (s.AskDups != p.AskDups) SetValue(record, IBGridColumn.AskDups, s.AskDups);

        if (s.Bid != p.Bid) SetValue(record, IBGridColumn.BidPrice, s.Bid);
        if (s.Ask != p.Ask) SetValue(record, IBGridColumn.AskPrice, s.Ask);
        if (s.BidSize != p.BidSize) SetValue(record, IBGridColumn.BidSize, s.BidSize);
        if (s.AskSize != p.AskSize) SetValue(record, IBGridColumn.AskSize, s.AskSize);
        if (s.Close != p.Close) SetValue(record, IBGridColumn.Close, s.Close);
        if (s.High != p.High) SetValue(record, IBGridColumn.High, s.High);
        if (s.Low != p.Low) SetValue(record, IBGridColumn.Low, s.Low);
        if (s.SyntheticVolume != p.SyntheticVolume) SetValue(record, IBGridColumn.SyntheticVolume, s.SyntheticVolume);
        if (s.TradeEvents != p.TradeEvents) SetValue(record, IBGridColumn.TradeEvents, s.TradeEvents);
        if (s.BidEvents != p.BidEvents) SetValue(record, IBGridColumn.BidEvents, s.BidEvents);
        if (s.AskEvents != p.AskEvents) SetValue(record, IBGridColumn.AskEvents, s.AskEvents);

        if (s.Contract.SecurityType != IBSecurityType.Option &&
            s.Contract.SecurityType != IBSecurityType.FutureOption)
          return;

        if (s.AskImpliedVol != p.AskImpliedVol) SetValue(record, IBGridColumn.AskImpVol, s.AskImpliedVol);
        if (s.BidImpliedVol != p.BidImpliedVol) SetValue(record, IBGridColumn.BidImpVol, s.BidImpliedVol);
        if (s.AskDelta != p.AskDelta) SetValue(record, IBGridColumn.AskDelta, s.AskDelta);
        if (s.BidDelta != p.BidDelta) SetValue(record, IBGridColumn.BidDelta, s.BidDelta);
        if (s.Delta != p.Delta) SetValue(record, IBGridColumn.Delta, s.Delta);
        if (s.ImpliedVol != p.ImpliedVol) SetValue(record, IBGridColumn.Volatility, s.ImpliedVol);
        if (s.ModelPrice != p.ModelPrice) SetValue(record, IBGridColumn.Price, s.ModelPrice);
        if (s.PVDividend != p.PVDividend) SetValue(record, IBGridColumn.PVDividend, s.PVDividend);
      }
      catch (Exception ex)
      {
        MessageBox.Show(ex.Message);
      }
      finally
      {
        record.PreviousSnapshot = record.Snapshot;
        record.Snapshot = null;
      }

    }