/// <summary> /// Make sure that a valid order ID is received from JTS. /// Must be called before connection requested and awaited before a call to <see cref="GetNewOrderId"/>. /// </summary> /// <returns> /// An observable stream that completes when an order ID is available. /// The stream value is the next valid order ID as reported by TWS. /// Note that this value is useful for debugging purposes only. /// For new orders, use <see cref="GetNewOrderId"/>. /// </returns> public IObservable <int> OrderIdAvailable() { var subj = new AsyncSubject <int>(); _orderIdSubj = subj; return(subj.MergeErrors( Errors.Where(err => err.Item2.IsError()) .Select(err => new ApplicationException(err.Item2.Message)) .AsError() )); }