Example #1
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Id != null)
         {
             hashCode = hashCode * 59 + Id.GetHashCode();
         }
         if (Instrument != null)
         {
             hashCode = hashCode * 59 + Instrument.GetHashCode();
         }
         if (Qty != null)
         {
             hashCode = hashCode * 59 + Qty.GetHashCode();
         }
         if (Side != null)
         {
             hashCode = hashCode * 59 + Side.GetHashCode();
         }
         if (Type != null)
         {
             hashCode = hashCode * 59 + Type.GetHashCode();
         }
         if (FilledQty != null)
         {
             hashCode = hashCode * 59 + FilledQty.GetHashCode();
         }
         if (AvgPrice != null)
         {
             hashCode = hashCode * 59 + AvgPrice.GetHashCode();
         }
         if (LimitPrice != null)
         {
             hashCode = hashCode * 59 + LimitPrice.GetHashCode();
         }
         if (StopPrice != null)
         {
             hashCode = hashCode * 59 + StopPrice.GetHashCode();
         }
         if (ParentId != null)
         {
             hashCode = hashCode * 59 + ParentId.GetHashCode();
         }
         if (ParentType != null)
         {
             hashCode = hashCode * 59 + ParentType.GetHashCode();
         }
         if (Duration != null)
         {
             hashCode = hashCode * 59 + Duration.GetHashCode();
         }
         if (Status != null)
         {
             hashCode = hashCode * 59 + Status.GetHashCode();
         }
         return(hashCode);
     }
 }
Example #2
0
 /// <summary>
 /// Returns a string that represents the current object.
 /// </summary>
 /// <returns>
 /// A string that represents the current object.
 /// </returns>
 /// <filterpriority>2</filterpriority>
 public override string ToString()
 {
     return(string.Format("{0} at limit {1}", base.ToString(), LimitPrice.SmartRounding()));
 }
Example #3
0
        /// <summary>
        /// Returns true if Order instances are equal
        /// </summary>
        /// <param name="other">Instance of Order to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Order other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                     ) &&
                 (
                     Instrument == other.Instrument ||
                     Instrument != null &&
                     Instrument.Equals(other.Instrument)
                 ) &&
                 (
                     Qty == other.Qty ||
                     Qty != null &&
                     Qty.Equals(other.Qty)
                 ) &&
                 (
                     Side == other.Side ||
                     Side != null &&
                     Side.Equals(other.Side)
                 ) &&
                 (
                     Type == other.Type ||
                     Type != null &&
                     Type.Equals(other.Type)
                 ) &&
                 (
                     FilledQty == other.FilledQty ||
                     FilledQty != null &&
                     FilledQty.Equals(other.FilledQty)
                 ) &&
                 (
                     AvgPrice == other.AvgPrice ||
                     AvgPrice != null &&
                     AvgPrice.Equals(other.AvgPrice)
                 ) &&
                 (
                     LimitPrice == other.LimitPrice ||
                     LimitPrice != null &&
                     LimitPrice.Equals(other.LimitPrice)
                 ) &&
                 (
                     StopPrice == other.StopPrice ||
                     StopPrice != null &&
                     StopPrice.Equals(other.StopPrice)
                 ) &&
                 (
                     ParentId == other.ParentId ||
                     ParentId != null &&
                     ParentId.Equals(other.ParentId)
                 ) &&
                 (
                     ParentType == other.ParentType ||
                     ParentType != null &&
                     ParentType.Equals(other.ParentType)
                 ) &&
                 (
                     Duration == other.Duration ||
                     Duration != null &&
                     Duration.Equals(other.Duration)
                 ) &&
                 (
                     Status == other.Status ||
                     Status != null &&
                     Status.Equals(other.Status)
                 ));
        }
Example #4
0
        public void SetData(String[] resStr, int offset)
        {
            int pos = 6 + offset;

            ///经纪公司代码
            BrokerID = resStr[pos + 0];
            ///投资者代码
            InvestorID = resStr[pos + 1];
            ///合约代码
            InstrumentID = resStr[pos + 2];
            ///报单引用
            OrderRef = resStr[pos + 3];
            ///用户代码
            UserID = resStr[pos + 4];
            ///报单价格条件
            OrderPriceType = resStr[pos + 5];
            ///买卖方向
            Direction = resStr[pos + 6];
            ///组合开平标志
            CombOffsetFlag = resStr[pos + 7];
            ///组合投机套保标志
            CombHedgeFlag = resStr[pos + 8];
            ///价格
            LimitPrice = double.Parse(resStr[pos + 9]);
            ///数量
            VolumeTotalOriginal = long.Parse(resStr[pos + 10]);
            ///有效期类型
            TimeCondition = resStr[pos + 11];
            ///GTD日期
            GTDDate = resStr[pos + 12];
            ///成交量类型
            VolumeCondition = resStr[pos + 13];
            ///最小成交量
            MinVolume = long.Parse(resStr[pos + 14]);
            ///触发条件
            ContingentCondition = resStr[pos + 15];
            ///止损价
            StopPrice = double.Parse(resStr[pos + 16]);
            ///强平原因
            ForceCloseReason = resStr[pos + 17];
            ///自动挂起标志
            IsAutoSuspend = resStr[pos + 18];
            ///业务单元
            BusinessUnit = resStr[pos + 19];
            ///请求编号
            RequestID = resStr[pos + 20];
            ///本地报单编号
            OrderLocalID = resStr[pos + 21];
            ///交易所代码
            ExchangeID = resStr[pos + 22];
            ///会员代码
            ParticipantID = resStr[pos + 23];
            ///客户代码
            ClientID = resStr[pos + 24];
            ///合约在交易所的代码
            ExchangeInstID = resStr[pos + 25];
            ///交易所交易员代码
            TraderID = resStr[pos + 26];
            ///安装编号
            InstallID = long.Parse(resStr[pos + 27]);
            ///报单提交状态
            OrderSubmitStatus = resStr[pos + 28];
            ///报单提示序号
            NotifySequence = long.Parse(resStr[pos + 29]);
            ///交易日
            TradingDay = resStr[pos + 30];
            ///结算编号
            SettlementID = long.Parse(resStr[pos + 31]);
            ///报单编号
            OrderSysID = resStr[pos + 32];
            ///报单来源
            OrderSource = resStr[pos + 33];
            ///报单状态
            OrderStatus = resStr[pos + 34];
            ///报单类型
            OrderType = resStr[pos + 35];
            ///今成交数量
            VolumeTraded = long.Parse(resStr[pos + 36]);
            ///剩余数量
            VolumeTotal = long.Parse(resStr[pos + 37]);
            ///报单日期
            InsertDate = resStr[pos + 38];
            ///委托时间
            InsertTime = resStr[pos + 39];
            ///激活时间
            ActiveTime = resStr[pos + 40];
            ///挂起时间
            SuspendTime = resStr[pos + 41];
            ///最后修改时间
            UpdateTime = resStr[pos + 42];
            ///撤销时间
            CancelTime = resStr[pos + 43];
            ///最后修改交易所交易员代码
            ActiveTraderID = resStr[pos + 44];
            ///结算会员编号
            ClearingPartID = resStr[pos + 45];
            ///序号
            SequenceNo = long.Parse(resStr[pos + 46]);
            ///前置编号
            FrontID = long.Parse(resStr[pos + 47]);
            ///会话编号
            SessionID = long.Parse(resStr[pos + 48]);
            ///用户端产品信息
            UserProductInfo = resStr[pos + 49];
            ///状态信息
            StatusMsg = resStr[pos + 50];
            ///用户强评标志
            UserForceClose = resStr[pos + 51];
            ///操作用户代码
            ActiveUserID = resStr[pos + 52];
            ///经纪公司报单编号
            BrokerOrderSeq = long.Parse(resStr[pos + 53]);
            ///相关报单
            RelativeOrderSysID = resStr[pos + 54];
            ///郑商所成交数量
            ZCETotalTradedVolume = long.Parse(resStr[pos + 55]);
            ///互换单标志
            IsSwapOrder = long.Parse(resStr[pos + 56]);

            Console.WriteLine("InsertTime:" + InsertTime + " LimitPrice:" + LimitPrice.ToString()
                              + " OrderStatus:" + OrderStatus
                              + " CombOffsetFlag:" + CombOffsetFlag
                              + " CombHedgeFlag:" + CombHedgeFlag
                              + " StatusMsg:" + StatusMsg
                              + " OrderLocalID:" + OrderLocalID
                              + " OrderSysID is: " + OrderSysID
                              );

            if (!this.OrderSysID.Equals(""))
            {
                // AddToDatatable();
            }
        }
Example #5
0
 /// <summary>
 /// Returns a string that represents the current object.
 /// </summary>
 /// <returns>
 /// A string that represents the current object.
 /// </returns>
 /// <filterpriority>2</filterpriority>
 public override string ToString()
 {
     return(Invariant(
                $"{base.ToString()} at trigger {TriggerPrice.SmartRounding()} limit {LimitPrice.SmartRounding()}"));
 }
Example #6
0
 /// <summary>
 /// Returns a string that represents the current object.
 /// </summary>
 /// <returns>
 /// A string that represents the current object.
 /// </returns>
 /// <filterpriority>2</filterpriority>
 public override string ToString()
 {
     return(string.Format("{0} order for {1} unit{2} of {3} at limit {4}", Type, Quantity, Quantity == 1 ? "" : "s", Symbol, LimitPrice.SmartRounding()));
 }
Example #7
0
 public string ToString(int decimals)
 {
     if (IsFilled)
     {
         return(base.ToString());
     }
     return((Direction == Direction.Long ? "Long" : "Short") + UnsignedSize + " " + Symbol + "@" + (Type == OrderType.Market ? "Mkt" : (Type == OrderType.Limit || Type == OrderType.StopLimit ? LimitPrice.ToString("N" + decimals) : StopPrice.ToString("N" + decimals) + "stp")) + " [" + AccountName + "] " + Id + (Type == OrderType.Stop || Type == OrderType.StopLimit ? " stop: " + StopPrice.ToString("N" + decimals) : string.Empty));
 }