Beispiel #1
0
 public bool IsNeighbourTo(SideKey sideKey)
 {
     if (sideKey.DateTime.Year == DateTime.Year)
         return Math.Abs(sideKey.DateTime.Month - DateTime.Month) < 2;
     if (sideKey.DateTime.Year - DateTime.Year == 1)
         return sideKey.DateTime.Month == 1 && DateTime.Month == 12;
     if (DateTime.Year - sideKey.DateTime.Year == 1)
         return DateTime.Month == 1 && sideKey.DateTime.Month == 12;
     return false;
 }
Beispiel #2
0
        public static SideKey Get(DateTime dateTime, EntryType type)
        {
            SideKey result = null;
            if (bids.TryGetValue(dateTime,out result))
                return type == EntryType.Bid ? result : result.Opposite;

            SideKey bid = new SideKey(dateTime,EntryType.Bid);
            SideKey offer = new SideKey(dateTime, EntryType.Offer);
            bid.Opposite = offer;
            offer.Opposite = bid;

            bids.Add(dateTime, bid);

            return type == EntryType.Bid ? bid : offer;
        }