Ejemplo n.º 1
0
 public void tickPrice(int tickerId, int field, double price, TickAttrib attribs)
 {
     try
     {
         TWSSubscription subscription = TWSSubscriptionManager.GetById(tickerId);
         if (subscription != null)
         {
             TWSTickEventArgs args = new TWSTickEventArgs(subscription, field, price, attribs);
             if (m_twsTickEventHandler != null)
             {
                 if (args.DoubleValue >= 0)
                 {
                     m_twsTickEventHandler(this, args);
                 }
                 else
                 {
                     Info(String.Format("Ignoring tick price: {0}", args.ToString()));
                 }
             }
         }
         else
         {
             Info(String.Format("Error - tick received for unknown ticker id {0}", tickerId));
         }
     }
     catch (Exception ex) { Error("Exception in tickPrice callback", ex); }
 }
Ejemplo n.º 2
0
 public void tickString(int tickerId, int field, string value)
 {
     try
     {
         TWSSubscription subscription = TWSSubscriptionManager.GetById(tickerId);
         if (subscription != null)
         {
             TWSTickEventArgs args = new TWSTickEventArgs(subscription, field, value);
             if (m_twsTickEventHandler != null)
             {
                 m_twsTickEventHandler(this, args);
             }
         }
         else
         {
             Info(String.Format("Error - tick received for unknown ticker id {0}", tickerId));
         }
     }
     catch (Exception ex) { Error("Exception in tickString callback", ex); }
 }
Ejemplo n.º 3
0
 public void tickOptionComputation(int tickerId, int field, double impliedVolatility, double delta, double optPrice, double pvDividend, double gamma, double vega, double theta, double undPrice)
 {
     try
     {
         // ignore Bid and Ask computations
         if ((field == TickType.MODEL_OPTION) || (field == TickType.DELAYED_MODEL_OPTION))
         {
             TWSSubscription subscription = TWSSubscriptionManager.GetById(tickerId);
             if (subscription != null)
             {
                 TWSTickEventArgs args = new TWSTickEventArgs(subscription, field, impliedVolatility, delta, optPrice, pvDividend, gamma, vega, theta, undPrice);
                 if (m_twsTickEventHandler != null)
                 {
                     m_twsTickEventHandler(this, args);
                 }
             }
             else
             {
                 Info(String.Format("Error - tick received for unknown ticker id {0}", tickerId));
             }
         }
     }
     catch (Exception ex) { Error("Exception in tickOptionComputation callback", ex); }
 }