Exemplo n.º 1
0
 public bool Equals(RiskInfo other)
 {
     if (object.ReferenceEquals((object)null, (object)other))
     {
         return(false);
     }
     if (object.ReferenceEquals((object)this, (object)other))
     {
         return(true);
     }
     return(other._marginRate == this._marginRate && other._maximumPosition == this._maximumPosition);
 }
Exemplo n.º 2
0
 public bool Equals(RiskInfo other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(other._marginRate == _marginRate && other._maximumPosition == _maximumPosition);
 }
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;
 }
        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.º 6
0
 public bool Equals(RiskInfo other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return other._marginRate == _marginRate && other._maximumPosition == _maximumPosition;
 }