Exemplo n.º 1
0
        internal virtual void Update(IDBRow dataRow)
        {
            this._maxDQLot      = dataRow.GetColumn <decimal>("MaxDQLot");
            this._maxOtherLot   = dataRow.GetColumn <decimal>("MaxOtherLot");
            this._dqQuoteMinLot = dataRow.GetColumn <decimal>("DQQuoteMinLot");

            this._autoDQMaxLot      = dataRow.GetColumn <decimal>("AutoDQMaxLot");
            this._acceptDQVariation = dataRow.GetColumn <int>("AcceptDQVariation");

            this._autoLmtMktMaxLot        = dataRow.GetColumn <decimal>("AutoLmtMktMaxLot");
            this._acceptLmtVariation      = dataRow.GetColumn <int>("AcceptLmtVariation");
            this._acceptCloseLmtVariation = dataRow.GetColumn <int>("AcceptCloseLmtVariation");

            this._cancelLmtVariation = dataRow.GetColumn <int>("CancelLmtVariation");
            this._autoDQDelay        = TimeSpan.FromSeconds(dataRow.GetColumn <Int16>("AutoDQDelay"));

            this._autoAcceptMaxLot = dataRow.GetColumn <decimal>("AutoAcceptMaxLot");
            this._autoCancelMaxLot = dataRow.GetColumn <decimal>("AutoCancelMaxLot");

            this._hitPriceVariationForSTP = dataRow.GetColumn <int>("HitPriceVariationForSTP");
            this._allowedNewTradeSides    = (AllowedOrderSides)dataRow.GetColumn <byte>("AllowedNewTradeSides");
            if (dataRow.Contains("PlaceSptMktTimeSpan"))
            {
                this._placeSptMktTimeSpan = TimeSpan.FromSeconds((int)dataRow["PlaceSptMktTimeSpan"]);
            }
        }
Exemplo n.º 2
0
        internal Instrument(IDBRow instrumentRow)
        {
            this._id         = (Guid)instrumentRow["ID"];
            this._currencyId = (Guid)instrumentRow["CurrencyID"];
            this._code       = (string)instrumentRow["Code"];
            _originCode      = instrumentRow.GetColumn <string>("OriginCode");

            this._isActive           = instrumentRow.GetColumn <bool>("IsActive");
            this._lastAcceptTimeSpan = instrumentRow.GetColumn <int>("LastAcceptTimeSpan");
            this._orderTypeMask      = instrumentRow.GetColumn <int>("OrderTypeMask");
            this._mit = instrumentRow.GetColumn <bool>("MIT");

            this.AutoAcceptMaxLot = instrumentRow.GetColumn <decimal>("AutoAcceptMaxLot");
            this.AutoCancelMaxLot = instrumentRow.GetColumn <decimal>("AutoCancelMaxLot");
            this._isAutoFill      = instrumentRow.GetColumn <bool>("IsAutoFill");

            this._maxMinAdjust = instrumentRow.GetColumn <int>("MaxMinAdjust");

            this._interestFormula  = (InterestFormula)instrumentRow.GetColumn <byte>("InterestFormula");
            this._interestYearDays = instrumentRow.GetColumn <int>("InterestYearDays");
            this._useSettlementPriceForInterest = instrumentRow.GetColumn <bool>("UseSettlementPriceForInterest");
            this.InactiveTime = instrumentRow.GetColumn <int>("OriginInactiveTime");

            this._isBetterPrice    = instrumentRow.GetColumn <bool>("IsBetterPrice");
            this._hitTimes         = instrumentRow.GetColumn <short>("HitTimes");
            this._penetrationPoint = instrumentRow.GetColumn <int>("PenetrationPoint");

            this._isPriceEnabled = instrumentRow.GetColumn <bool>("IsPriceEnabled");

            this.SpotPaymentTime = instrumentRow.GetColumn <DateTime?>("SpotPaymentTime");

            this._canPlacePendingOrderAtAnyTime = instrumentRow.GetColumn <bool>("CanPlacePendingOrderAtAnyTime");
            this._allowedSpotTradeOrderSides    = (AllowedOrderSides)instrumentRow.GetColumn <byte>("AllowedSpotTradeOrderSides");

            this.HitPriceVariationForSTP = instrumentRow.GetColumn <int>("HitPriceVariationForSTP");

            if (instrumentRow.ExistsColumn("ExternalExchangeCode"))
            {
                if (instrumentRow["ExternalExchangeCode"] != DBNull.Value)
                {
                    this._exchangeSystem = (ExchangeSystem)Enum.Parse(typeof(ExchangeSystem), (string)(instrumentRow["ExternalExchangeCode"]), true);
                }
            }

            this.AutoDQDelay      = TimeSpan.FromSeconds(instrumentRow.GetColumn <Int16>("AutoDQDelay"));
            this._summaryQuantity = instrumentRow.GetColumn <decimal>("SummaryQuantity");
            this.PLValueDay       = instrumentRow.GetColumn <Int16>("PLValueDay");

            if (instrumentRow.ExistsColumn("UseAlertLevel4WhenClosed"))
            {
                this.UseAlertLevel4WhenClosed = instrumentRow["UseAlertLevel4WhenClosed"] == DBNull.Value ? false : (bool)instrumentRow["UseAlertLevel4WhenClosed"];
            }
            if (instrumentRow.ExistsColumn("HolidayAlertDayPolicyID"))
            {
                Guid policyId = Guid.Empty;
                if (Guid.TryParse(instrumentRow["HolidayAlertDayPolicyID"].ToString(), out policyId))
                {
                    this.HolidayAlertDayPolicyId = policyId;
                }
            }
            if (instrumentRow.ExistsColumn("AcceptIfDoneVariation"))
            {
                this._acceptIfDoneVariation = instrumentRow.GetColumn <int>("AcceptIfDoneVariation");
            }
            if (instrumentRow.Contains("PlaceSptMktTimeSpan"))
            {
                _placeSptMktTimeSpan = TimeSpan.FromSeconds((int)instrumentRow["PlaceSptMktTimeSpan"]);
            }

            if (instrumentRow.Contains("FirstOrderTime"))
            {
                _firstOrderTime = (int)instrumentRow["FirstOrderTime"];
            }

            this.Update(instrumentRow);
        }
Exemplo n.º 3
0
        internal override void Update(XElement instrumentNode)
        {
            base.Update(instrumentNode);

            foreach (XAttribute attribute in instrumentNode.Attributes())
            {
                switch (attribute.Name.ToString())
                {
                case "ID":
                    this._id = XmlConvert.ToGuid(attribute.Value);
                    break;

                case "CurrencyID":
                    this._currencyId = XmlConvert.ToGuid(attribute.Value);
                    break;

                case "Code":
                    this._code = attribute.Value;
                    break;

                case "OriginCode":
                    _originCode = attribute.Value;
                    break;

                case "OriginInactiveTime":
                    this.InactiveTime = XmlConvert.ToInt32(attribute.Value);
                    break;

                case "Category":
                    this._category = (InstrumentCategory)XmlConvert.ToInt32(attribute.Value);
                    break;

                case "NumeratorUnit":
                    this._numeratorUnit = XmlConvert.ToInt32(attribute.Value);
                    break;

                case "Denominator":
                    this._denominator = XmlConvert.ToInt32(attribute.Value);
                    break;

                case "IsActive":
                    this._isActive = XmlConvert.ToBoolean(attribute.Value);
                    break;

                case "LastAcceptTimeSpan":
                    this._lastAcceptTimeSpan = XmlConvert.ToInt32(attribute.Value);
                    break;

                case "OrderTypeMask":
                    this._orderTypeMask = XmlConvert.ToInt32(attribute.Value);
                    break;

                case "MIT":
                    this._mit = XmlConvert.ToBoolean(attribute.Value);
                    break;

                case "AutoAcceptMaxLot":
                    this.AutoAcceptMaxLot = XmlConvert.ToDecimal(attribute.Value);
                    break;

                case "AutoCancelMaxLot":
                    this.AutoCancelMaxLot = XmlConvert.ToDecimal(attribute.Value);
                    break;

                case "IsAutoFill":
                    this._isAutoFill = XmlConvert.ToBoolean(attribute.Value);
                    break;

                case "MaxMinAdjust":
                    this._maxMinAdjust = XmlConvert.ToInt32(attribute.Value);
                    break;

                case "DayOpenTime":
                    this.DayOpenTime = Convert.ToDateTime(attribute.Value);
                    break;

                case "DayCloseTime":
                    this.DayCloseTime = Convert.ToDateTime(attribute.Value);
                    break;

                case "EndTime":
                    _endTime = Convert.ToDateTime(attribute.Value);
                    break;

                case "ValueDate":
                    this.ValueDate = Convert.ToDateTime(attribute.Value);
                    break;

                case "NextDayOpenTime":
                    this.NextDayOpenTime = Convert.ToDateTime(attribute.Value);
                    break;

                case "CommissionFormula":
                    this._commissionFormula = (FeeFormula)XmlConvert.ToByte(attribute.Value);
                    break;

                case "LevyFormula":
                    this._levyFormula = (FeeFormula)XmlConvert.ToByte(attribute.Value);
                    break;

                case "OtherFeeFormula":
                    _otherFeeFormula = (FeeFormula)XmlConvert.ToByte(attribute.Value);
                    break;

                case "MarginFormula":
                    this._marginFormula = (MarginFormula)XmlConvert.ToByte(attribute.Value);
                    break;

                case "TradePLFormula":
                    this._tradePLFormula = (TradePLFormula)XmlConvert.ToByte(attribute.Value);
                    break;

                case "InterestFormula":
                    this._interestFormula = (InterestFormula)XmlConvert.ToByte(attribute.Value);
                    break;

                case "InterestYearDays":
                    this._interestYearDays = XmlConvert.ToInt32(attribute.Value);
                    break;

                case "IsNormal":
                    this._isNormal = XmlConvert.ToBoolean(attribute.Value);
                    break;

                case "HitTimes":
                    this._hitTimes = XmlConvert.ToInt32(attribute.Value);
                    break;

                case "PenetrationPoint":
                    this._penetrationPoint = XmlConvert.ToInt32(attribute.Value);
                    break;

                case "UseSettlementPriceForInterest":
                    this._useSettlementPriceForInterest = XmlConvert.ToBoolean(attribute.Value);
                    break;

                case "CanPlacePendingOrderAtAnyTime":
                    this._canPlacePendingOrderAtAnyTime = XmlConvert.ToBoolean(attribute.Value);
                    break;

                case "AllowedSpotTradeOrderSides":
                    this._allowedSpotTradeOrderSides = (AllowedOrderSides)XmlConvert.ToInt32(attribute.Value);
                    break;

                case "PlaceSptMktTimeSpan":
                    _placeSptMktTimeSpan = TimeSpan.FromSeconds(XmlConvert.ToInt32(attribute.Value));
                    break;

                case "HitPriceVariationForSTP":
                    this.HitPriceVariationForSTP = XmlConvert.ToInt32(attribute.Value);
                    break;

                case "AcceptIfDoneVariation":
                    this._acceptIfDoneVariation = XmlConvert.ToInt32(attribute.Value);
                    break;

                case "FirstOrderTime":
                    _firstOrderTime = XmlConvert.ToInt32(attribute.Value);
                    break;

                case "IsPriceEnabled":
                    this._isPriceEnabled = XmlConvert.ToBoolean(attribute.Value);
                    _priceEnableTime     = DateTime.Now;
                    break;

                case "AutoDQDelay":
                    this.AutoDQDelay = TimeSpan.FromSeconds(XmlConvert.ToInt16(attribute.Value));
                    break;

                case "HolidayAlertDayPolicyID":
                    this.HolidayAlertDayPolicyId = XmlConvert.ToGuid(attribute.Value);
                    break;

                case "SummaryQuantity":
                    this._summaryQuantity = XmlConvert.ToDecimal(attribute.Value);
                    break;

                case "SpotPaymentTime":
                    this.SpotPaymentTime = attribute.Value.Get <DateTime?>();
                    break;
                }
            }
        }
Exemplo n.º 4
0
        internal virtual void Update(XElement xmlNode)
        {
            foreach (XAttribute attribute in xmlNode.Attributes())
            {
                switch (attribute.Name.ToString())
                {
                case "MaxDQLot":
                    this._maxDQLot = XmlConvert.ToDecimal(attribute.Value);
                    break;

                case "MaxOtherLot":
                    this._maxOtherLot = XmlConvert.ToDecimal(attribute.Value);
                    break;

                case "DQQuoteMinLot":
                    this._dqQuoteMinLot = XmlConvert.ToDecimal(attribute.Value);
                    break;

                case "AutoDQMaxLot":
                    this._autoDQMaxLot = XmlConvert.ToDecimal(attribute.Value);
                    break;

                case "AcceptDQVariation":
                    this._acceptDQVariation = XmlConvert.ToInt32(attribute.Value);
                    break;

                case "AutoLmtMktMaxLot":
                    this._autoLmtMktMaxLot = XmlConvert.ToDecimal(attribute.Value);
                    break;

                case "AcceptLmtVariation":
                    this._acceptLmtVariation = XmlConvert.ToInt32(attribute.Value);
                    break;

                case "AcceptCloseLmtVariation":
                    this._acceptCloseLmtVariation = XmlConvert.ToInt32(attribute.Value);
                    break;

                case "CancelLmtVariation":
                    this._cancelLmtVariation = XmlConvert.ToInt32(attribute.Value);
                    break;

                case "AutoDQDelay":
                    this._autoDQDelay = TimeSpan.FromSeconds(XmlConvert.ToInt16(attribute.Value));
                    break;

                case "AutoAcceptMaxLot":
                    this._autoAcceptMaxLot = XmlConvert.ToDecimal(attribute.Value);
                    break;

                case "PlaceSptMktTimeSpan":
                    this._placeSptMktTimeSpan = TimeSpan.FromSeconds(XmlConvert.ToInt32(attribute.Value));
                    break;

                case "AutoCancelMaxLot":
                    this._autoCancelMaxLot = XmlConvert.ToDecimal(attribute.Value);
                    break;

                case "HitPriceVariationForSTP":
                    this._hitPriceVariationForSTP = XmlConvert.ToInt32(attribute.Value);
                    break;

                case "AllowedNewTradeSides":
                    this._allowedNewTradeSides = (AllowedOrderSides)XmlConvert.ToInt32(attribute.Value);
                    break;
                }
            }
        }