示例#1
0
 public bool Equals(CalendarInfo other)
 {
     if (object.ReferenceEquals((object)null, (object)other))
     {
         return(false);
     }
     if (object.ReferenceEquals((object)this, (object)other))
     {
         return(true);
     }
     return(other._startTime.Equals(this._startTime) && other._expiryTime.Equals((object)this._expiryTime) && (other._open.Equals(this._open) && (other._close.Equals(this._close) && object.Equals((object)other._timeZone, (object)this._timeZone))) && CalendarInfo.CompareDaysOfWeek(other._tradingDays, this._tradingDays));
 }
示例#2
0
 public bool Equals(CalendarInfo other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(other._startTime.Equals(_startTime) && other._expiryTime.Equals(_expiryTime) && other._open.Equals(_open) && other._close.Equals(_close) && Equals(other._timeZone, _timeZone) && CompareDaysOfWeek(other._tradingDays, _tradingDays));
 }
示例#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;
 }
 ///<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;
 }
        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));
            }
        }
 public bool Equals(CalendarInfo other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return other._startTime.Equals(_startTime) && other._expiryTime.Equals(_expiryTime) && other._open.Equals(_open) && other._close.Equals(_close) && Equals(other._timeZone, _timeZone) && CompareDaysOfWeek(other._tradingDays, _tradingDays);
 }