/// <summary> /// This is used to apply topic stream updates to the local dictionary. /// </summary> /// <param name="type">The update may be a snapshot or a delta.</param> /// <param name="currency">The base currency.</param> /// <param name="targetCurrency">The target currency.</param> /// <param name="bid">The bid rate.</param> /// <param name="ask">The ask rate.</param> public static void ApplyUpdate(TopicUpdateType type, string currency, string targetCurrency, string bid, string ask) { Currency currencyObject; lock ( SyncLock ) { if (Currencies.ContainsKey(currency)) { currencyObject = Currencies[currency]; } else { currencyObject = new Currency(); Currencies.Add(currency, currencyObject); } } var rates = type == TopicUpdateType.SNAPSHOT ? currencyObject.SetRate(targetCurrency, bid, ask) : currencyObject.UpdateRate(targetCurrency, bid, ask); _listener.OnNewRate(currency, targetCurrency, rates.BidRate, rates.AskRate); }
/// <summary> /// This is used to apply topic stream updates to the local dictionary. /// </summary> /// <param name="type">The update may be a snapshot or a delta.</param> /// <param name="currency">The base currency.</param> /// <param name="targetCurrency">The target currency.</param> /// <param name="bid">The bid rate.</param> /// <param name="ask">The ask rate.</param> public static void ApplyUpdate( TopicUpdateType type, string currency, string targetCurrency, string bid, string ask ) { Currency currencyObject; lock ( SyncLock ) { if ( Currencies.ContainsKey( currency ) ) { currencyObject = Currencies[ currency ]; } else { currencyObject = new Currency(); Currencies.Add( currency, currencyObject ); } } var rates = type == TopicUpdateType.SNAPSHOT ? currencyObject.SetRate( targetCurrency, bid, ask ) : currencyObject.UpdateRate( targetCurrency, bid, ask ); _listener.OnNewRate( currency, targetCurrency, rates.BidRate, rates.AskRate ); }