Esempio n. 1
0
        public void UpdateData(ITradeRepo repo)
        {
            // List<OrderObject> orders = new List<OrderObject>();
            List<FillObject> fills = new List<FillObject>();
            int fillId = 1;
            Random r = new Random();

            while (true)
            {
                try
                {
                    //get any new orders
                    var orders = new List<OrderObject>(repo.GetOrders(LastOrderId));

                    //get what the last orderid is
                    LastOrderId = orders.Any() ? orders.Max(m => m.Id) : LastOrderId;

                    //generate fills
                    foreach (var o in orders)
                    {
                        MessageBus.Send(new FillObject { AddedBy = Environment.UserName, DateAdded = DateTime.Now, Id = fillId, OrderId = o.Id, Quantity = o.Quantity, Price = (decimal)(.1 + (r.NextDouble() * (100 - .1))) });
                        fillId++;
                    }

                    Thread.Sleep(5000);
                }
                catch (Exception ex)
                {
                    //log exception
                }
            }
        }
 public TradeService(ITradeRepo repo,
                     ITradeSummaryAuditRepo tradeSummaryAuditRepo,
                     ITradeSummaryRepo tradeSummaryRepo) : base(repo)
 {
     //this.repo = repo;
     this.tradeSummaryAuditRepo = tradeSummaryAuditRepo;
     this.tradeSummaryRepo      = tradeSummaryRepo;
 }
Esempio n. 3
0
        public TradeEntryViewModel(IReferenceDataRepo refRepo, ITradeRepo tradeRepo)
        {
            BuySell = new ObservableCollection<string> { "B", "S" };
            Products = new ObservableCollection<ProductObject>(refRepo.GetProducts());
            Instruments = new ObservableCollection<InstrumentObject>();
            Order = new OrderObject();

            TradeRepo = tradeRepo;
            RefRepo = refRepo;

            AddTradeCommand = new RelayCommand(OnAddTrade, CanAddTrade);
            ProductChangedEvent = new RelayCommand<ProductObject>(OnProductChanged);
        }
Esempio n. 4
0
 public TradeController(ITradeRepo tradeRepo, IUserRepo userRepo, ICardRepo cardRepo)
 {
     _tradeRepo = tradeRepo;
     _userRepo  = userRepo;
     _cardRepo  = cardRepo;
 }
Esempio n. 5
0
 public TradesController(ITradeRepo repo)
 {
     this.repo = repo;
 }