public PositionMessage(string account, IBApi.Contract contract, double pos, double avgCost) { Account = account; Contract = contract; Position = pos; AverageCost = avgCost; }
public OpenOrderMessage(int orderId, IBApi.Contract contract, IBApi.Order order, OrderState orderState) { OrderId = orderId; Contract = contract; Order = order; OrderState = orderState; }
public OrderStatusMessage(int orderId, Contract contract, IBApi.Order order, OrderState orderstate) { MessageType = MessageType.OrderStatus; OrderId = orderId; Contract = contract; Order = order; OrderState = orderstate; }
private MarketDepthSubscription CreateMarketDepthSubscription() { var contract = new Contract(); var marketDepthSubscription = new MarketDepthSubscription(this.connectionHelper.Connection(), this.connectionHelper.Dispenser(), this.observerMock.Object, contract); return marketDepthSubscription; }
public ExecutionMessage(int reqId, Contract contract, Execution execution) { MessageType = MessageType.ExecutionDetails; ReqId = reqId; Contract = contract; Execution = execution; }
public PositionMultiMessage(int reqId, string account, string modelCode, IBApi.Contract contract, double pos, double avgCost) { ReqId = reqId; Account = account; ModelCode = modelCode; Contract = contract; Position = pos; AverageCost = avgCost; }
public UpdatePortfolioMessage(IBApi.Contract contract, double position, double marketPrice, double marketValue, double averageCost, double unrealizedPNL, double realizedPNL, string accountName) { Contract = contract; Position = position; MarketPrice = marketPrice; MarketValue = marketValue; AverageCost = averageCost; UnrealizedPNL = unrealizedPNL; RealizedPNL = realizedPNL; AccountName = accountName; }
public Contract GetIBContract() { var c = new Contract(); c.Symbol = InteractiveBrokersDetails.Symbol; c.Currency = InteractiveBrokersDetails.Currency; c.SecType = InteractiveBrokersDetails.SecType; c.Exchange = InteractiveBrokersDetails.Exchange; c.Expiry = InteractiveBrokersDetails.Expiry; return c; }
/// <summary> /// Place order. /// Order must have contract field. /// </summary> public void PlaceOrder(Order o) { if ((!o.IsValid) || (string.IsNullOrEmpty(o.FullSymbol))) { OnDebug("Order is not valid."); return; } IBApi.Order order = new IBApi.Order(); order.AuxPrice = o.IsTrail ? (double)o.TrailPrice : (double)o.StopPrice; order.LmtPrice = (double)o.LimitPrice; // Only MKT, LMT, STP, and STP LMT, TRAIL, TRAIL LIMIT are supported order.OrderType = o.OrderType; order.TotalQuantity = o.UnsignedSize; order.Action = o.OrderSide ? "BUY" : "SELL"; // SSHORT not supported here // order.Account = Account; order.Tif = o.TIF.ToString(); order.OutsideRth = true; //order.OrderId = (int)o.id; order.Transmit = true; if (string.IsNullOrEmpty(o.Account)) { order.Account = Account; } else { order.Account = o.Account; } // Set up IB order Id if (o.Id == 0) { throw new ArgumentOutOfRangeException("Order id is missing."); } else // TODO: elimitate situation where strategy Order Id already exists { //order.OrderId = System.Threading.Interlocked.Increment(ref _nextValidIBID); // it returns the incremented id order.OrderId = (int)o.Id; _iborderIdToOrderInfo.Add(order.OrderId, new OrderInfo(o.Id, order.Account, false)); } IBApi.Contract contract = SecurityFullNameToContract(o.FullSymbol); _ibSocket.placeOrder(order.OrderId, contract, order); }
public Contract(int id, string symbol, string type, string exchange, string currency, string primaryExchange, int multiplier, string expiry, decimal strike, string right, string secIdType, string secId, string tradingClass, PositiveInteger lotSize) { IBContract = new IB.Contract(); Id = id; Symbol = symbol; Type = type; Exchange = exchange; PrimaryExchange = primaryExchange; Currency = currency; Multiplier = multiplier; LastTradeDateOrContractMonth = expiry; Strike = (double)strike; Right = right; SecIdType = secIdType; SecId = secId; TradingClass = tradingClass; }
public ExecutionMessage(int reqId, IBApi.Contract contract, Execution execution) { ReqId = reqId; Contract = contract; Execution = execution; }
private QuoteSubscription CreateQuoteSubscription() { var contract = new Contract(); var quoteSucription = new QuoteSubscription(this.connectionHelper.Connection(), this.connectionHelper.Dispenser(), this.observerMock.Object, contract); return quoteSucription; }
public CompletedOrderMessage(IBApi.Contract contract, IBApi.Order order, OrderState orderState) { Contract = contract; Order = order; OrderState = orderState; }