public IBContractDetails() { Summary = new IBContract(); ValidExchanges = OrderTypes = Multiplier = TradingClass = MarketName = null; PriceMagnifier = Conid = 0; MinTick = 0; }
public override bool Equals(object obj) { if ((obj == null) || !(obj is IBContract)) { return(false); } IBContract other = obj as IBContract; if (other.ComboLegs.Count != this.ComboLegs.Count) { return(false); } return((other.Exchange == Exchange) && (other.Symbol == Symbol) && (other.Currency == Currency) && (other.Expiry == Expiry) && (other.SecType == SecType) && (other.Strike == Strike) && (other.Multiplier == Multiplier)); }
private void ProcessMarketDepthRequest() { try { var reqVersion = _enc.DecodeInt(); var reqId = _enc.DecodeInt(); int numRows = 0; var contract = new IBContract(); contract.Symbol = _enc.DecodeString(); contract.SecType = _enc.DecodeSecType(); contract.Expiry = _enc.DecodeExpiryDate(); contract.Strike = _enc.DecodeDouble(); contract.Right = _enc.DecodeString(); if (ServerInfo.Version >= 15) contract.Multiplier = _enc.DecodeInt(); contract.Exchange = _enc.DecodeString(); contract.Currency = _enc.DecodeString(); contract.LocalSymbol =_enc.DecodeString(); if (ServerInfo.Version >= 19) numRows = _enc.DecodeInt(); OnMarketDepthRequest(reqId, contract, numRows); } catch (Exception e) { OnError(TWSErrors.FAIL_SEND_REQMKTDEPTH); OnError(e.Message); Disconnect(); } }
private void ProcessMarketDataRequest() { int reqId = -1; try { int reqVersion = _enc.DecodeInt(); reqId = _enc.DecodeInt(); var contract = new IBContract(); contract.Symbol = _enc.DecodeString(); contract.SecType = _enc.DecodeSecType(); contract.Expiry = _enc.DecodeExpiryDate(); contract.Strike = _enc.DecodeDouble(); contract.Right = _enc.DecodeString(); if (ServerInfo.Version >= 15) contract.Multiplier = _enc.DecodeInt(); contract.Exchange = _enc.DecodeString(); if (ServerInfo.Version >= 14) contract.PrimaryExch = _enc.DecodeString(); contract.Currency = _enc.DecodeString(); if (ServerInfo.Version >= 2) contract.LocalSymbol = _enc.DecodeString(); if (ServerInfo.Version >= 8 && (contract.SecType == IBSecType.BAG)) { int comboLegCount = _enc.DecodeInt(); for (var i = 0; i < comboLegCount; i++) { IBComboLeg leg = new IBComboLeg(); leg.ConId = _enc.DecodeInt(); leg.Ratio = _enc.DecodeInt(); leg.Action = _enc.DecodeAction(); leg.Exchange = _enc.DecodeString(); contract.ComboLegs.Add(leg); } } if (ServerInfo.Version >= 31) { string genericTickList = _enc.DecodeString(); if (genericTickList != null && genericTickList.Length > 0) { var list = new List<IBGenericTickType>(); foreach (var s in genericTickList.Split(',')) list.Add((IBGenericTickType)Enum.Parse(typeof(IBGenericTickType), s)); } } OnMarketDataRequest(reqId, contract); } catch (Exception e) { OnError(reqId, TWSErrors.FAIL_SEND_REQMKT); OnError(e.Message); Disconnect(); } }
private void ProcessContractDataRequest() { try { // send req mkt data msg var reqVersion = _enc.DecodeInt(); var contract = new IBContract(); contract.Symbol = _enc.DecodeString(); contract.SecType = _enc.DecodeSecType(); contract.Expiry = _enc.DecodeExpiryDate(); contract.Strike = _enc.DecodeDouble(); contract.Right = _enc.DecodeString(); if (ServerInfo.Version >= 15) { contract.Multiplier = _enc.DecodeInt(); } contract.Exchange = _enc.DecodeString(); contract.Currency = _enc.DecodeString(); contract.LocalSymbol = _enc.DecodeString(); if (ServerInfo.Version >= 31) { contract.IncludeExpired = _enc.DecodeBool(); } OnContractDataRequest(contract); } catch (Exception e) { OnError(TWSErrors.FAIL_SEND_REQCONTRACT); OnError(e.Message); Disconnect(); } }
private void OnMarketDepthRequest(int reqId, IBContract contract, int numRows) { if (Server != null) Server.OnMarketDepthRequest(this, reqId, contract, numRows); if (MarketDepthRequest != null) MarketDepthRequest(this, new TWSMarketDepthRequestEventArgs(this, reqId, contract, numRows)); }
private void OnMarketDataRequest(int reqId, IBContract contract) { if (Server != null) Server.OnMarketDataRequest(this, reqId, contract); if (MarketDataRequest != null) MarketDataRequest(this, new TWSMarketDataRequestEventArgs(this, reqId, contract)); _marketDataSubscriptions.Add(reqId, contract); }
private void OnContractDataRequest(IBContract contract) { if (Server != null) Server.OnContractDetailsRequest(this, contract); }