Esempio n. 1
0
        //Methods
        public List <PNWF.Trade> GetNextTrade(string fish_filter)
        {
            //Wait for trades
            TradeEventGenerator.WaitForTrades();

            //Recover thread specific trade queue
            ConcurrentQueue <PNWF.Trade> trades = TradeEventGenerator.GetTrades();

            //Move the trades into the return list an return it to the client
            List <PNWF.Trade> returnTrades = new List <PNWF.Trade>();

            PNWF.Trade trade;
            while (trades.TryDequeue(out trade))
            {
                if (fish_filter.Length == 0 || fish_filter.CompareTo(trade.Fish) == 0)
                {
                    returnTrades.Add(trade);
                }
            }
            return(returnTrades);
        }
Esempio n. 2
0
 public void deleteContext(Object serverContext, Thrift.Protocol.TProtocol input, Thrift.Protocol.TProtocol output)
 {
     Console.WriteLine("Client disconnected");
     TradeEventGenerator.Unsubscribe();
 }
Esempio n. 3
0
 public Object createContext(Thrift.Protocol.TProtocol input, Thrift.Protocol.TProtocol output)
 {
     Console.WriteLine("Client connected");
     TradeEventGenerator.Subscribe(new ConcurrentQueue <PNWF.Trade>());
     return(null);
 }