Esempio n. 1
0
        public void CheckSell(string Symbol, decimal StockPrice)
        {
            var SellStock = this[Symbol]["SELL"];

            while (SellStock.Count > 0 && SellStock.Min.Price <= StockPrice)
            {
                var sell = SellStock.Min;

                JObject twigTrigger = new JObject();
                JObject twigParams  = new JObject();
                twigTrigger.Add("usr", sell.User);
                twigTrigger.Add("cmd", "COMMIT_SELL_TRIGGER");
                twigTrigger.Add("queue", sell.Queue);
                twigParams.Add("stock", Symbol);
                twigParams.Add("price", StockPrice);
                twigTrigger.Add("params", twigParams);
                RabbitHelper.PushTrigger(twigTrigger);

                SellStock.Remove(sell);
            }
        }
Esempio n. 2
0
        public void CheckBuy(string Symbol, decimal StockPrice)
        {
            var BuyStock = this[Symbol]["BUY"];

            while (BuyStock.Count > 0 && BuyStock.Max.Price >= StockPrice)
            {
                var buy = BuyStock.Max;

                JObject twigTrigger = new JObject();
                JObject twigParams  = new JObject();
                twigTrigger.Add("usr", buy.User);
                twigTrigger.Add("cmd", "COMMIT_BUY_TRIGGER");
                twigTrigger.Add("queue", buy.Queue);
                twigParams.Add("stock", Symbol);
                twigParams.Add("price", StockPrice);
                twigTrigger.Add("params", twigParams);
                RabbitHelper.PushTrigger(twigTrigger);

                BuyStock.Remove(buy);
            }
        }