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); } }
//! [tickprice] public virtual void tickPrice(int tickerId, int field, double price, TickAttrib attribs) { if (field == (int)TickType.BidPrice || field == (int)TickType.AskPrice) { var symbol = subscription.GetSymbolNameByRequestId(tickerId); var tickType = (TickType)field; quotes.AddOrUpdate(symbol, s => new Quote { Time = DateTimeOffset.UtcNow, Symbol = symbol, Ask = tickType == TickType.AskPrice ? price : 0, Bid = tickType == TickType.BidPrice ? price : 0 }, (s, q) => new Quote { Time = DateTimeOffset.UtcNow, Symbol = symbol, Ask = tickType == TickType.AskPrice ? price : q.Ask, Bid = tickType == TickType.BidPrice ? price : q.Bid }); if (quotes.TryGetValue(symbol, out Quote quote)) { if (quote.IsFilled()) { queue.AddItem(quote); } } } }
public virtual void tickPrice(int tickerId, int field, double price, TickAttrib attribs) { switch (field) { case 1: { if (_priceUpdate.Bid != price) { _priceUpdate.Bid = price; PriceUpdateReceived?.Invoke(this, _priceUpdate); } break; } case 2: { if (_priceUpdate.Ask != price) { _priceUpdate.Ask = price; PriceUpdateReceived?.Invoke(this, _priceUpdate); } break; } } }
public TickPriceArg(int tickerId, int field, double price, TickAttrib attribs) { this.tickerId = tickerId; this.field = field; this.price = price; this.attribs = attribs; }
//! [tickprice] public virtual void tickPrice(int tickerId, int field, double price, TickAttrib attribs) { _messages.Add($"Price: {price}"); Console.WriteLine("Tick Price. Ticker Id:" + tickerId + ", Field: " + field + ", Price: " + price + ", CanAutoExecute: " + attribs.CanAutoExecute + ", PastLimit: " + attribs.PastLimit + ", PreOpen: " + attribs.PreOpen); }
public TWSTickEventArgs(TWSSubscription subscription, int field, double price, TickAttrib attribs = null) : this(subscription) { Field = field; DoubleValue = price; Attribs = attribs; }
public TickPrice(int tickerId, int field, double price, TickAttrib tickAttribs) { TickerId = tickerId; Field = field; Price = price; TickAttribs = tickAttribs; }
/// <summary> /// Initializes a new instance of the <see cref="TickPriceEventArgs"/> class. /// </summary> /// <param name="tickerId">The ticker id</param> /// <param name="field">The ticker field</param> /// <param name="price">The price</param> /// <param name="attribs">The price attributes</param> public TickPriceEventArgs(int tickerId, int field, double price, TickAttrib attribs) { this.TickerId = tickerId; this.Field = field; this.Price = price; this.Attribs = attribs; }
internal PriceTick(ResponseReader r) { r.RequireVersion(3); RequestId = r.ReadInt(); TickType = r.ReadEnum <TickType>(); Price = r.ReadDouble(); Size = r.ReadLong(); TickAttrib = new TickAttrib(r); }
public virtual void tickPrice(int tickerId, int field, double price, TickAttrib attribs) { Console.WriteLine("Tick Price. Ticker Id:" + tickerId + ", Field: " + field + ", Price: " + price + ", CanAutoExecute: " + attribs.CanAutoExecute + ", PastLimit: " + attribs.PastLimit + ", PreOpen: " + attribs.PreOpen); TickPrice tickPrice = new TickPrice(tickerId, field, price, attribs); RaiseTickPriceUpdatedEvent(new TickPriceArgs(tickPrice)); }
//! [tickprice] public virtual void tickPrice(int tickerId, int field, double price, TickAttrib attribs) { if (field == 4) { // Console.WriteLine("Tick Price. Ticker Id:" + tickerId + ", Field: " + field + ", Price: " + price + // ", CanAutoExecute: " + attribs.CanAutoExecute + // ", PastLimit: " + attribs.PastLimit + ", PreOpen: " + attribs.PreOpen); } }
void EWrapper.tickPrice(int tickerId, int field, double price, TickAttrib attribs) { var tmp = TickPrice; if (tmp != null) { FireEvent(t => tmp(new TickPriceMessage(tickerId, field, price, attribs)), null); } }
public TickByTickBidAskMessage(int reqId, long time, double bidPrice, double askPrice, long bidSize, long askSize, TickAttrib attribs) { ReqId = reqId; Time = time; BidPrice = bidPrice; AskPrice = askPrice; BidSize = bidSize; AskSize = askSize; Attribs = attribs; }
void EWrapper.tickPrice(int tickerId, int field, double price, TickAttrib attribs) { var tmp = TickPrice; if (tmp != null) { new Task(() => tmp(new TickPriceMessage(tickerId, field, price, attribs)) ).RunSynchronously(scheduler); } }
public TickByTickAllLastMessage(int reqId, int tickType, long time, double price, long size, TickAttrib attribs, string exchange, string specialConditions) { RequestId = reqId; TickType = tickType; Time = time; Price = price; Size = size; Attribs = attribs; Exchange = exchange; SpecialConditions = specialConditions; }
public virtual void tickPrice(int tickerId, int field, double price, TickAttrib attribs) { //Console.WriteLine("Tick Price. Ticker Id:"+tickerId+", Field: "+field+", Price: "+price+", CanAutoExecute: "+attribs.CanAutoExecute + ", PastLimit" + attribs.PastLimit); var now = DateTime.Now; if (now.Minute == 25 && now.Second <= 10) { var s = "Tick Price. Ticker Id:" + tickerId + ", Field: " + field + ", Price: " + price + ", CanAutoExecute: " + attribs.CanAutoExecute + ", PastLimit" + attribs.PastLimit; log.Debug(s); } }
public void tickPrice(int tickerId, int field, double price, TickAttrib attribs) { var now = DateTime.Now; //var message = "Tick Price. Ticker Id:" + tickerId + ", Field: " + field + ", Price: " + price + ", CanAutoExecute: " + attribs.CanAutoExecute + // ", PastLimit: " + attribs.PastLimit + ", PreOpen: " + attribs.PreOpen; var message = now.ToString("MMdd hh:mm:ss:ffff") + "-" + field + "-" + price + "-" + attribs.toString(); //OnMarketDataTicked("tickPrice", message); Console.WriteLine(message); }
public void tickPrice(int tickerId, TickType field, double price, TickAttrib attribs) { if (mTickers[tickerId]?.ContractDetails == null) { // the market depth stream has been stopped but this // update was already on its way return; } var formatPrice = mTickers[tickerId].FormatPrice; switch (field) { case TickType.Ask: showTickerValue(tickerId, TickerColumnAsk, formatPrice(price)); break; case TickType.Bid: showTickerValue(tickerId, TickerColumnBid, formatPrice(price)); break; case TickType.Last: showTickerValue(tickerId, TickerColumnLast, formatPrice(price)); break; case TickType.Open: showTickerValue(tickerId, TickerColumnOpen, formatPrice(price)); break; case TickType.High: showTickerValue(tickerId, TickerColumnHigh, formatPrice(price)); break; case TickType.Low: showTickerValue(tickerId, TickerColumnLow, formatPrice(price)); break; case TickType.Close: showTickerValue(tickerId, TickerColumnClose, formatPrice(price)); break; default: logMessage($"tickPrice: id={tickerId}; field={getField(field)}; value={formatPrice(price)}"); break; } }
public void tickPrice(int tickerId, int tickType, double price, TickAttrib attribs) { var cd = mTickers[tickerId].ContractDetails; switch (tickType) { case IBApi.TickType.ASK: showTickerValue(tickerId, TickerColumnAsk, PriceFormatter.FormatPrice(price, cd.Contract.SecType, cd.MinTick * cd.PriceMagnifier)); break; case IBApi.TickType.BID: showTickerValue(tickerId, TickerColumnBid, PriceFormatter.FormatPrice(price, cd.Contract.SecType, cd.MinTick * cd.PriceMagnifier)); break; case IBApi.TickType.LAST: showTickerValue(tickerId, TickerColumnLast, PriceFormatter.FormatPrice(price, cd.Contract.SecType, cd.MinTick * cd.PriceMagnifier)); break; } }
public void tickByTickAllLast(int reqId, int tickType, long time, double price, int size, TickAttrib attribs, string exchange, string specialConditions) { try { throw new NotImplementedException(); } catch (Exception ex) { Error("Exception in tickByTickAllLast", ex); } }
public TickPriceMessage(int requestId, int field, double price, TickAttrib attribs) : base(requestId, field) { this.price = price; this.attribs = attribs; }
//! [historicaltickslast] //! [tickbytickalllast] public void tickByTickAllLast(int reqId, int tickType, long time, double price, int size, TickAttrib attribs, string exchange, string specialConditions) { Console.WriteLine("Tick-By-Tick. Request Id: {0}, TickType: {1}, Time: {2}, Price: {3}, Size: {4}, Exchange: {5}, Special Conditions: {6}, PastLimit: {7}, Unreported: {8}", reqId, tickType == 1 ? "Last" : "AllLast", Util.UnixSecondsToString(time, "yyyyMMdd-HH:mm:ss zzz"), price, size, exchange, specialConditions, attribs.PastLimit, attribs.Unreported); }
//! [tickbytickalllast] //! [tickbytickbidask] public void tickByTickBidAsk(int reqId, long time, double bidPrice, double askPrice, int bidSize, int askSize, TickAttrib attribs) { Console.WriteLine("Tick-By-Tick. Request Id: {0}, TickType: BidAsk, Time: {1}, BidPrice: {2}, AskPrice: {3}, BidSize: {4}, AskSize: {5}, BidPastLow: {6}, AskPastHigh: {7}", reqId, Util.UnixSecondsToString(time, "yyyyMMdd-HH:mm:ss zzz"), bidPrice, askPrice, bidSize, askSize, attribs.BidPastLow, attribs.AskPastHigh); }
public virtual void tickPrice(int tickerId, int field, double price, TickAttrib attribs) { OnManagedTickPrice?.Invoke(this, new TickPriceArg(tickerId, field, price, attribs)); }
void EWrapper.tickByTickBidAsk(int reqId, long time, double bidPrice, double askPrice, int bidSize, int askSize, TickAttrib attribs) { var tmp = tickByTickBidAsk; if (tmp != null) { sc.Post((t) => tmp(new TickByTickBidAskMessage(reqId, time, bidPrice, askPrice, bidSize, askSize, attribs)), null); } }
/// <inheritdoc/> public void tickPrice(int tickerId, int field, double price, TickAttrib attribs) { var eventArgs = new TickPriceEventArgs(tickerId, field, price, attribs); this.TickPriceEvent?.Invoke(this, eventArgs); }
public void tickPrice(int tickerId, int field, double price, /*unused*/ TickAttrib attribs) { SetTopicValue(tickerId, field, price); }
internal PriceTick() { TickAttrib = new TickAttrib(); }
/// <inheritdoc/> public void tickPrice(int tickerId, int field, double price, TickAttrib attribs) { throw new NotImplementedException(); }
public void tickByTickBidAsk(int reqId, long time, double bidPrice, double askPrice, int bidSize, int askSize, TickAttrib attribs) { try { throw new NotImplementedException(); } catch (Exception ex) { Error("Exception in tickByTickBidAsk", ex); } }