public IOrder addAsk(double price, int volume, IAgent owner) { IList <IOrder_Mutable> val; if (!_asksDict.TryGetValue(price, out val)) { val = new List <IOrder_Mutable>(); _asksDict.Add(price, val); _asks.Add(price, val); } IOrder_Mutable order = new Order(false, price, volume, owner); val.Add(order); _numAsks++; _logger.DebugLog(SOURCE, "Orderbook addAsk " + order); if (_matcher != null) { this.Send(_matcher, new NotifyMatcherEvent(this, new OrderbookEvent_AddOrder(order)), 0.0); } foreach (IOrderbookObserver obs in _obsList) { this.Send(obs, new NotifyObserverEvent(this, new OrderbookEvent_AddOrder(order)), 0.0); } /* * if (isNonDegenerate()) * _price = (getHighestBid () + getLowestAsk ())/2.0; */ getPrice(); // updates _price return(order); }
private void TouchOtherRegions(DumpReaderLogger readerLogger, ClrRuntime runtime) { // Touch all threads, stacks, frames foreach (var t in runtime.Threads) { foreach (var f in t.StackTrace) { try { var ip = f.InstructionPointer; } catch (Exception) { } } } // Touch all modules runtime.Modules.Count(); // Touch all heap regions, roots, types var heap = runtime.GetHeap(); heap.EnumerateRoots(enumerateStatics: false).Count(); heap.EnumerateTypes().Count(); // TODO Check if it's faster to construct sorted inside ReaderWrapper foreach (var kvp in readerLogger.Ranges) { _otherClrRegions.Add(kvp.Key, kvp.Value); } }
private Orderbook(Orderbook orig) { _bidsDict = new Dictionary <double, IList <IOrder_Mutable> >(); _bids = new C5.TreeDictionary <double, IList <IOrder_Mutable> >(); foreach (double p in orig._bidsDict.Keys) { IList <IOrder_Mutable> v = orig._bidsDict[p]; IList <IOrder_Mutable> v2 = new List <IOrder_Mutable>(); foreach (IOrder_Mutable o in v) { v2.Add(o.clone()); } _bidsDict.Add(p, v2); _bids.Add(p, v2); } _asksDict = new Dictionary <double, IList <IOrder_Mutable> >(); _asks = new C5.TreeDictionary <double, IList <IOrder_Mutable> >(); foreach (double p in orig._asksDict.Keys) { IList <IOrder_Mutable> v = orig._asksDict[p]; IList <IOrder_Mutable> v2 = new List <IOrder_Mutable>(); foreach (IOrder o in v) { v2.Add(o.clone()); } _asksDict.Add(p, v2); _asks.Add(p, v2); } _numBids = orig._numBids; _numAsks = orig._numAsks; _matcher = orig._matcher; _matcher.reset(); _obsList = new List <IOrderbookObserver>(); foreach (IOrderbookObserver obs in orig._obsList) { _obsList.Add(obs); } }
public void add(double time, double val) { if ((this.BurninTime > 0.0) && (time < this.BurninTime * 3600.0)) { return; } SingletonLogger.Instance().DebugLog(typeof(Trajectory), "Trajectory " + this.Name + " attempts add " + time + "->" + val); double historicallyAdjustedValue = ComputeHistoricallyAdjustedValue(time, val); // throttle data explosion if (!AboveTemporalGranularityThreshold(time)) { return; } // maintain function property if (_values.Contains(time)) { _values.Remove(time); } _values.Add(time, historicallyAdjustedValue); SingletonLogger.Instance().DebugLog(typeof(Trajectory), "Trajectory " + this.Name + " adds " + time + "->" + val); _lastTimestampOutput = time; // adjust min and max times if (time < _mint) { _mint = time; } if (time > _maxt) { _maxt = time; } }
private void AddCLRRegions(ClrRuntime runtime) { foreach (var region in runtime.EnumerateMemoryRegions()) { // We don't need reserved memory in our dump if (region.Type == ClrMemoryRegionType.ReservedGCSegment) { continue; } ulong address = region.Address; ulong endAddress = region.Address + region.Size; ulong existingEndAddress; if (_majorClrRegions.Find(ref address, out existingEndAddress)) { _majorClrRegions.Update(region.Address, Math.Max(existingEndAddress, endAddress)); } else { _majorClrRegions.Add(region.Address, endAddress); } } }
public void Add(K key, T value) { KToTMap.Add(key, value); TToKMap.Add(value, key); }
/// <summary> /// Add the specified item to the collection. /// </summary> /// <param name="item"> /// Th eitem to add to the collection. /// </param> /// <exception cref="Exceptions.OverlappingRangesException"> /// The range represented by <paramref name="item"/> overlaps with a range already in the collection. /// <see cref="OverlappingRangesException.FirstItem"/> will contain <paramref name="item"/> /// </exception> public void Add(V item) { CheckOverlapping(item); _dictionary.Add(GetItemKey(item), item); }