Exemplo n.º 1
0
 public bool Equals(CommercialInfo other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(other._minimumCommission == _minimumCommission && other._aggressiveCommissionRate.Equals(_aggressiveCommissionRate) && other._passiveCommissionRate.Equals(_passiveCommissionRate) && other._aggressiveCommissionPerContract.Equals(_aggressiveCommissionPerContract) && other._passiveCommissionPerContract.Equals(_passiveCommissionPerContract) && Equals(other._fundingBaseRate, _fundingBaseRate) && other._dailyInterestRateBasis == _dailyInterestRateBasis && other._fundingRate == _fundingRate);
 }
Exemplo n.º 2
0
 public bool Equals(CommercialInfo other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(other._minimumCommission == _minimumCommission && other._aggressiveCommissionRate.Equals(_aggressiveCommissionRate) && other._passiveCommissionRate.Equals(_passiveCommissionRate) && other._aggressiveCommissionPerContract.Equals(_aggressiveCommissionPerContract) && other._passiveCommissionPerContract.Equals(_passiveCommissionPerContract) && Equals(other._fundingBaseRate, _fundingBaseRate) && other._dailyInterestRateBasis == _dailyInterestRateBasis && other._fundingPremiumPercentage == _fundingPremiumPercentage && other._fundingReductionPercentage == _fundingReductionPercentage && other._longSwapPoints == _longSwapPoints && other._shortSwapPoints == _shortSwapPoints);
 }
Exemplo n.º 3
0
 ///<summary>
 /// Create a new instrument (e.g. security definition)
 ///</summary>
 ///<param name="id">The unique identifier of the instrument</param>
 ///<param name="name">The readable name of the instrument</param>
 ///<param name="underlying">The information about the underlying instrument</param>
 ///<param name="calendar">Contains information about trading dates and times</param>
 ///<param name="risk">Details on how to calculate risk for this instrument</param>
 ///<param name="orderBook">Information relating to the order book</param>
 ///<param name="contract">The contract information about this instrument</param>
 ///<param name="commercial">Data to calculate the commercials for this instrument</param>
 public Instrument(long id, string name, UnderlyingInfo underlying, CalendarInfo calendar,
                   RiskInfo risk, OrderBookInfo orderBook, ContractInfo contract,
                   CommercialInfo commercial)
 {
     _id         = id;
     _name       = name;
     _underlying = underlying;
     _calendar   = calendar;
     _risk       = risk;
     _orderBook  = orderBook;
     _contract   = contract;
     _commercial = commercial;
 }
Exemplo n.º 4
0
 ///<summary>
 /// Create a new instrument (e.g. security definition)
 ///</summary>
 ///<param name="id">The unique identifier of the instrument</param>
 ///<param name="name">The readable name of the instrument</param>
 ///<param name="underlying">The information about the underlying instrument</param>
 ///<param name="calendar">Contains information about trading dates and times</param>
 ///<param name="risk">Details on how to calculate risk for this instrument</param>
 ///<param name="orderBook">Information relating to the order book</param>
 ///<param name="contract">The contract information about this instrument</param>
 ///<param name="commercial">Data to calculate the commercials for this instrument</param>
 public Instrument(long id, string name, UnderlyingInfo underlying, CalendarInfo calendar, 
                   RiskInfo risk, OrderBookInfo orderBook, ContractInfo contract,
                   CommercialInfo commercial)
 {
     _id = id;
     _name = name;
     _underlying = underlying;
     _calendar = calendar;
     _risk = risk;
     _orderBook = orderBook;
     _contract = contract;
     _commercial = commercial;
 }
Exemplo n.º 5
0
        public bool Equals(CommercialInfo other)
        {
            if (object.ReferenceEquals((object)null, (object)other))
            {
                return(false);
            }
            if (object.ReferenceEquals((object)this, (object)other))
            {
                return(true);
            }
            int num;

            if (other._minimumCommission == this._minimumCommission && other._aggressiveCommissionRate.Equals((object)this._aggressiveCommissionRate) && (other._passiveCommissionRate.Equals((object)this._passiveCommissionRate) && other._aggressiveCommissionPerContract.Equals((object)this._aggressiveCommissionPerContract)) && (other._passiveCommissionPerContract.Equals((object)this._passiveCommissionPerContract) && object.Equals((object)other._fundingBaseRate, (object)this._fundingBaseRate) && other._dailyInterestRateBasis == this._dailyInterestRateBasis))
            {
                Decimal?nullable1       = other._fundingPremiumPercentage;
                Decimal valueOrDefault1 = nullable1.GetValueOrDefault();
                Decimal?nullable2       = this._fundingPremiumPercentage;
                Decimal valueOrDefault2 = nullable2.GetValueOrDefault();
                if ((!(valueOrDefault1 == valueOrDefault2) ? 0 : (nullable1.HasValue == nullable2.HasValue ? 1 : 0)) != 0)
                {
                    nullable1 = other._fundingReductionPercentage;
                    Decimal valueOrDefault3 = nullable1.GetValueOrDefault();
                    nullable2 = this._fundingReductionPercentage;
                    Decimal valueOrDefault4 = nullable2.GetValueOrDefault();
                    if ((!(valueOrDefault3 == valueOrDefault4) ? 0 : (nullable1.HasValue == nullable2.HasValue ? 1 : 0)) != 0)
                    {
                        nullable1 = other._longSwapPoints;
                        Decimal valueOrDefault5 = nullable1.GetValueOrDefault();
                        nullable2 = this._longSwapPoints;
                        Decimal valueOrDefault6 = nullable2.GetValueOrDefault();
                        if ((!(valueOrDefault5 == valueOrDefault6) ? 0 : (nullable1.HasValue == nullable2.HasValue ? 1 : 0)) != 0)
                        {
                            nullable1 = other._shortSwapPoints;
                            Decimal valueOrDefault7 = nullable1.GetValueOrDefault();
                            nullable2 = this._shortSwapPoints;
                            Decimal valueOrDefault8 = nullable2.GetValueOrDefault();
                            num = !(valueOrDefault7 == valueOrDefault8) ? 0 : (nullable1.HasValue == nullable2.HasValue ? 1 : 0);
                            goto label_10;
                        }
                    }
                }
            }
            num = 0;
label_10:
            return(num != 0);
        }
        public override void EndElement(string endElement)
        {
            if ("instrument" == endElement)
            {
                long id = GetLongValue(Id, 0L);
                String name = GetStringValue(Name);

                string symbol = GetStringValue(Symbol);
                string isin = GetStringValue(UnderlyingIsin);
                string assetClass = GetStringValue(AssetClass);

                UnderlyingInfo underlying = new UnderlyingInfo(symbol, isin, assetClass);

                DateTime startTime = GetDateTime(StartTime, DateTime.MinValue);
                DateTime? expiryTime = GetDateTime(EndTime);
                TimeSpan openOffset = GetTimeSpan(OpeningOffset, TimeSpan.MinValue);
                TimeSpan closeOffset = GetTimeSpan(ClosingOffset, TimeSpan.MinValue);
                string timeZone = GetStringValue(Timezone);
                List<DayOfWeek> daysOfWeek = GetDaysOfWeek();

                CalendarInfo calendarInfo = new CalendarInfo(startTime, expiryTime, openOffset, closeOffset, timeZone, daysOfWeek);

                decimal marginRate = GetDecimalValue(Margin, 0);
                decimal maximumPosition = GetDecimalValue(MaximumPositionThreshold, 0);

                RiskInfo riskInfo = new RiskInfo(marginRate, maximumPosition);

                decimal priceIncrement = GetDecimalValue(PriceIncrement, 0);
                decimal quantityIncrement = GetDecimalValue(OrderQuantityIncrement, 0);
                decimal volatilityBandPercentage = GetDecimalValue(RetailVolatilityBandPercentage, 0);

                OrderBookInfo orderBookInfo = new OrderBookInfo(priceIncrement, quantityIncrement, volatilityBandPercentage);

                string currency = GetStringValue(Currency);
                decimal unitPrice = GetDecimalValue(UnitPrice, 0);
                string unitOfMeasure = GetStringValue(ContractUnitMeasure);
                decimal contractSize = GetDecimalValue(ContractSize, 0);

                ContractInfo contractInfo = new ContractInfo(currency, unitPrice, unitOfMeasure, contractSize);

                decimal minimumCommission = GetDecimalValue(MinimumCommission, 0);
                decimal? aggressiveCommissionRate = GetDecimalValue(AggressiveCommisionRate);
                decimal? passiveCommissionRate = GetDecimalValue(PassiveCommissionRate);
                decimal? aggressiveCommissionPerContract = GetDecimalValue(AggressiveCommissionPerContract);
                decimal? passiveCommissionPerContract = GetDecimalValue(PassiveCommissionPerContract);
                string fundingBaseRate = GetStringValue(FundingBaseRate);
                int dailyInterestRateBasis = GetIntValue(DailyInteresetRateBasis, 0);
                decimal fundingRate = GetDecimalValue(FundingRatePercentage, 0);

                CommercialInfo commercialInfo = new CommercialInfo(minimumCommission, aggressiveCommissionRate, passiveCommissionRate,
                                                                   aggressiveCommissionPerContract, passiveCommissionPerContract,
                                                                   fundingBaseRate, dailyInterestRateBasis, fundingRate);

                _instruments.Add(new Instrument(id, name, underlying, calendarInfo, riskInfo, orderBookInfo, contractInfo, commercialInfo));
            }
        }
Exemplo n.º 7
0
 public bool Equals(CommercialInfo other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return other._minimumCommission == _minimumCommission && other._aggressiveCommissionRate.Equals(_aggressiveCommissionRate) && other._passiveCommissionRate.Equals(_passiveCommissionRate) && other._aggressiveCommissionPerContract.Equals(_aggressiveCommissionPerContract) && other._passiveCommissionPerContract.Equals(_passiveCommissionPerContract) && Equals(other._fundingBaseRate, _fundingBaseRate) && other._dailyInterestRateBasis == _dailyInterestRateBasis && other._fundingRate == _fundingRate;
 }