public Receiver(string uniqueName, string itemName, ITicker ticker) { Initialize(uniqueName, itemName); this.ticker = ticker; ticker.Tick += OnTick; ticker.Start(); }
public OrderBook(ITicker owner) { Owner = owner; Bids = new List <OrderBookEntry>(); Asks = new List <OrderBookEntry>(); Updates = new List <OrderBookUpdateInfo>(); }
public ITicker NewEndNode <T>(ITicker node) where T : class { var endNode = new ActionNode <T>(); ((IOut <T>)node).AddChild(endNode); return(endNode); }
public static void Unsubscribe(ITicker ticker) { if (_instance != null) { _instance._tikers.Remove(ticker); } }
public static void UpdateHistoryItem(ITicker item) { TickerHistoryItem last = item.History.Count == 0 ? null : item.History.Last(); if (item.History.Count > 36000) { item.History.RemoveAt(0); } if (last != null) { if (last.Ask == item.LowestAsk && last.Bid == item.HighestBid && last.Current == item.Last) { return; } item.Change = ((item.Last - last.Current) / last.Current) * 100; if (last.Bid != item.HighestBid) { item.BidChange = (item.HighestBid - last.Bid) * 100; } if (last.Ask != item.LowestAsk) { item.AskChange = item.LowestAsk - last.Ask; } } item.History.Add(new TickerHistoryItem() { Time = item.Time, Ask = item.LowestAsk, Bid = item.HighestBid, Current = item.Last }); item.RaiseHistoryItemAdded(); }
/// <summary>Build() 的測試虛設常式</summary> public ITicker BuildTest(Builder target) { ITicker result = target.Build(); return(result); // TODO: 將判斷提示加入 方法 BuilderTest.BuildTest(Builder) }
public ErrorRateLimiter(int maxErrors, TimeSpan windowLength, TimeSpan blockOutTime, ITicker ticker = null) { MaxErrors = maxErrors; WindowLength = windowLength; BlockOutTime = blockOutTime; this.ticker = ticker ?? ClockTicker.Default; }
public async Task <IOrder> CheckOrder(string uuid, string symbol) { var timestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString(); string totalParams = string.Format("symbol={0}&orderId={1}×tamp={2}", symbol, uuid, timestamp); string sign = CalculateSignature(totalParams, _config.Secret); var data = new Dictionary <string, object> { { "symbol", symbol }, { "orderId", uuid }, { "timestamp", timestamp }, { "signature", sign } }; var order = await _binance.GetOrder(_config.ApiKey, data); var trades = await GetTrades(symbol, order.time); ITicker bnbTicker = null; if (symbol.Contains("BTC")) { bnbTicker = await Ticker("BNBBTC"); } else if (symbol.Contains("ETH")) { bnbTicker = await Ticker("BNBETH"); } return(new Order(order, trades.Where(t => t.time == order.time), bnbTicker)); }
public StandardBehavior(Entity entiry) { _Equipment = new InventoryProxy(); _Bag = new InventoryProxy(); var type = entiry.GetVisible().EntityType; _Messages = new Queue <string>(); _FPS = new FPSCounter(); _UsableSkills = new List <ACTOR_STATUS_TYPE>(); _EntityImperils = _InitialImperil(type); _ActorMind = new ActorMind(type); _DecisionTime = 0.5f; _FieldOfVision = new List <IVisible>(); _Entiry = entiry; _Random = Regulus.Utility.Random.Instance; //asin(2 / sqrt(2 ^ 2 + 10 ^ 2)) _Node = _BuildNode(); }
public void AddTicker() { ITicker ticker = _tickerFactory.GetTicker(_newName); _tickers.Add(new TickerViewModel(ticker)); OnPropertyChanged("CanRemoveTicker"); }
public static void Subscribe(ITicker ticker) { if (_instance != null) { _instance._tikers.Add(ticker); } }
public ITicker NewStartNode <T>(T payload, ITicker node) where T : class { var startNode = new ActionNode <T>(); startNode.In(new Token <T>(payload)); startNode.AddChild((IIn <T>)node); return(startNode); }
public TickerManager(int refreshRate = 2, ILogger <ITicker> logger = null) { _logger = logger ?? new NullLogger <ITicker>(); _ticker = new Ticker(this, refreshRate, logger); _entries = new List <ITickerManagerEntry>(); _ticker.Start(); }
void IParent.Add(ITicker ticker) { if (_Ticker != null) { throw new Exception("Inverse nodes only support a single node."); } _Ticker = ticker; }
private void Start() { _textContainer = GetComponent <TextMeshProUGUI>(); _textModifiersFactory = new TextModifiersFactory(_textContainer); _markersConverter = new MarkersConverter(); _ticker = ticker.GetComponent <ITicker>(); _ticker.OnTick += RevealNextCharacter; }
public UnboundedLocalCache(Caffeine <K, V> builder, bool isAsync, int concurrencyLevel) { this.data = new ConcurrentDictionary <K, V>(concurrencyLevel, builder.InitialCapacity); this.statsCounter = builder.StatsCounter.Get(); this.removalListener = builder.RemovalListener; this.isRecordingStats = builder.IsRecordingStats; this.writer = builder.Writer; this.ticker = builder.Ticker; }
private Builder _Add(ITicker ticker) { if (_Stack.Count <= 0) { throw new Exception("Can't create an unnested ActionNode, it must be a leaf node."); } _Stack.Peek().Add(ticker); return(this); }
void ITicker.Reset() { if (_RunninTicker != null) { _RunninTicker.Reset(); _RunninTicker = null; } _Queue.Clear(); }
public TickerViewModel(ITicker ticker) { _ticker = ticker; _name = _ticker.Name; _price = _ticker.Price; _priceChange = 0; _ticker.PriceChanged += Price_Changed; }
public TickerHub(ITicker ticker, DataContext dataContext) { this.ticker = ticker; this.dataContext = dataContext; if (dataContext == null) { throw new ArgumentNullException("DataContext dataContext == null"); } }
//Testing SparkleShare #region IDisposable Support public void Dispose() { if (_ticker != null) { _ticker.PriceChanged -= Price_Changed; _ticker.Dispose(); _ticker = null; } }
public static TickerData FromTicker(ITicker ticker) { return(new TickerData { Pair = ticker.Pair, BidPrice = ticker.BidPrice, AskPrice = ticker.AskPrice, LastPrice = ticker.LastPrice }); }
/// <summary> /// Determines whether this instance has ticker the specified ticker. /// </summary> /// <returns><c>true</c> if this instance has ticker the specified ticker; otherwise, <c>false</c>.</returns> /// <param name="ticker">Ticker.</param> public bool HasTicker(ITicker ticker){ for (int i = 0; i < tickerList.Count; i++) { TickVO t = tickerList[i] as TickVO; if (t.ticker == ticker) { return true; } } return false; }
void UnsubscribeEvents(ITicker prev) { prev.OrderBook.OnChanged -= OnTickerOrderBookChanged; prev.Changed -= OnTickerChanged; prev.HistoryItemAdd -= OnTickerHistoryItemAdded; prev.TradeHistoryAdd -= OnTickerTradeHistoryAdd; prev.UnsubscribeOrderBookUpdates(); prev.UnsubscribeTickerUpdates(); prev.UnsubscribeTradeUpdates(); }
string GetDownloadString(ITicker ticker, string address) { try { return(ticker.DownloadString(address)); } catch (Exception e) { Console.WriteLine("WebClient exception = " + e.ToString()); return(string.Empty); } }
/// <summary> /// Removes the ticker. /// </summary> /// <param name="ticker">Ticker.</param> public void RemoveTicker(ITicker ticker) { for (int i = 0; i < tickerList.Count; i++) { TickVO t = tickerList[i] as TickVO; if (t.ticker == ticker) { t.ticker = null; } } }
public void Dispose() { if (IsBusy) { Stop(); } ticker = null; GC.SuppressFinalize(this); }
/// <summary> /// Log into td ameritrade /// </summary> /// <param name="token">OAuth2 Account Token</param> /// <returns>Is Successful</returns> public bool Login(string token) { //Store the token _AccountToken = token; //Setup Subclasses Ticker = new AmeritradeTicker(); ((AmeritradeTicker)Ticker).SetToken(_AccountToken); return(true); }
/// <summary> /// Determines whether this instance has ticker the specified ticker. /// </summary> /// <returns><c>true</c> if this instance has ticker the specified ticker; otherwise, <c>false</c>.</returns> /// <param name="ticker">Ticker.</param> public bool HasTicker(ITicker ticker) { for (int i = 0; i < tickerList.Count; i++) { TickVO t = tickerList[i] as TickVO; if (t.ticker == ticker) { return(true); } } return(false); }
public void Remove(ITicker item) { if (item.IsInTickerListFlag == TickerFlag.TICK_FLAG_IN_LIST) { item.IsInTickerListFlag = TickerFlag.TICK_FLAG_NONE; } else if (item.IsInTickerListFlag == TickerFlag.TICK_FLAG_IN_BUFFER) { item.IsInTickerListFlag = TickerFlag.TICK_FLAG_NONE; m_lsAddBuffer.Remove(item); } }
public TICKRESULT Tick(float delta) { if (_RunninTicker != null) { var resultRunner = _RunninTicker.Tick(delta); if (resultRunner == TICKRESULT.RUNNING) { return(TICKRESULT.RUNNING); } _RunninTicker = null; if (resultRunner == TICKRESULT.FAILURE) { _Queue.Clear(); return(TICKRESULT.FAILURE); } if (_Queue.Count == 0) { return(TICKRESULT.SUCCESS); } } if (_Queue.Count == 0) { _Reload(); } _CurrentTicker = _Queue.Dequeue(); var result = _CurrentTicker.Tick(delta); if (result == TICKRESULT.FAILURE) { _Queue.Clear(); return(TICKRESULT.FAILURE); } if (result == TICKRESULT.RUNNING) { _RunninTicker = _CurrentTicker; return(TICKRESULT.RUNNING); } if (_Queue.Count == 0) { return(TICKRESULT.SUCCESS); } return(TICKRESULT.RUNNING); }
/// <summary> /// Adds the ticker. /// </summary> /// <param name="ticker">Ticker.</param> /// <param name="delayMSTime">Delay MS time.</param> public void AddTicker(ITicker ticker, int delayMSTime = -1){ uint lastMSTimeStamp = (uint)(Time.realtimeSinceStartup * 1000); TickVO tempTicker; if (HasTicker(ticker)) { //如果已经存在,那么更新下他 tempTicker = GetTicker(ticker); } else { //没有则新建一个 tempTicker = new TickVO(); tickerList.Add(tempTicker); } tempTicker.ticker = ticker; tempTicker.delayMSTime = delayMSTime; tempTicker.lastMSTimeStamp = lastMSTimeStamp; }
public TICKRESULT Tick(float delta) { if (_RunninTicker != null) { var resultRunner = _RunninTicker.Tick(delta); if (resultRunner == TICKRESULT.RUNNING) return TICKRESULT.RUNNING; _RunninTicker = null; if (resultRunner == TICKRESULT.FAILURE) { _Queue.Clear(); return TICKRESULT.FAILURE; } if (_Queue.Count == 0) { return TICKRESULT.SUCCESS; } } if (_Queue.Count == 0) { _Reload(); } var ticker = _Queue.Dequeue(); var result = ticker.Tick(delta); if (result == TICKRESULT.FAILURE) { _Queue.Clear(); return TICKRESULT.FAILURE; } if (result == TICKRESULT.RUNNING) { _RunninTicker = ticker; return TICKRESULT.RUNNING; } if (_Queue.Count == 0) return TICKRESULT.SUCCESS; return TICKRESULT.RUNNING; }
public void Add(ITicker ticker) { _Childs.Add(ticker); }
void IParent.Add(ITicker ticker) { if(_Ticker != null) throw new Exception("Inverse nodes only support a single node."); _Ticker = ticker; }
/// <summary> /// Removes the ticker. /// </summary> /// <param name="ticker">Ticker.</param> public void RemoveTicker(ITicker ticker){ for (int i = 0; i < tickerList.Count; i++) { TickVO t = tickerList[i] as TickVO; if (t.ticker == ticker) { t.ticker = null; } } }
private TickVO GetTicker(ITicker ticker){ if (tickerList == null) { return null; } for (int i = 0; i < tickerList.Count; i++) { TickVO t = tickerList[i] as TickVO; if (t.ticker == ticker) { return t; } } return null; }
public void Add(ITicker child) { _Childs.Add(child); }
public StandardWisdom(Entity entiry) { _Equipment = new InventoryProxy(); _Bag = new InventoryProxy(); var type = entiry.GetVisible().EntityType; _Messages = new Queue<string>(); _FPS = new FPSCounter(); _UsableSkills = new List<ACTOR_STATUS_TYPE>(); _EntityImperils = _InitialImperil(type); _ActorMind = new ActorMind(type); _DecisionTime = 0.5f; _FieldOfVision = new List<IVisible>(); _Entiry = entiry; _Random = Regulus.Utility.Random.Instance; //asin(2 / sqrt(2 ^ 2 + 10 ^ 2)) _Node = _BuildNode(); }