コード例 #1
0
        public decimal GetPortfolioValue()
        {
            var      securities = GetCurrentUserSecurities().ToArray();
            DateTime to         = DateTime.UtcNow;
            DateTime from       = to.AddHours(-1);

            var quotes = quotationService.GetQuotations(securities, from, to);

            return(quotes.Sum(q => q.BidPrice));
        }
コード例 #2
0
        private static void DisplayQuotationsByExchange()
        {
            Console.WriteLine("Displaying Quotations by Exchange code.");
            string exchange = ConsoleEx.AskInput <string>("Enter the exchange code: "); //NYSE

            IQuotationService srv = ServiceLocator.Current.GetInstance <IQuotationService>();
            var quotations        = srv.GetQuotations(exchange, string.Empty, DateTime.Now, DateTime.Now);

            quotations.ForEach(ConsoleEx.WriteEntity);

            ConsoleWriteSeparator();
        }
コード例 #3
0
        public IActionResult List(string s, int page = 1)
        {
            TempData["Active"]  = "quotation";
            ViewBag.CurrentPage = page;
            int totalPage;

            ViewBag.SearchedWord = s;
            var quotations = _quotationService.GetQuotations(out totalPage, s, page);

            ViewBag.TotalPage = totalPage;
            quotations.ShuffleMethod();
            return(View(quotations));
        }
コード例 #4
0
        public void PlaceSellLimitOrder(string securityCode, decimal sellingPrice, DateTime validUntil)
        {
            List <LimitOrder> limitOrders = new List <LimitOrder>();
            var todayQuotations           = quotationService.GetQuotations(securityCode, DateTime.Today.AddDays(-1), DateTime.Today);

            foreach (var quotation in todayQuotations)
            {
                if (quotation.AskPrice >= sellingPrice)
                {
                    limitOrders.Add(new LimitOrder
                    {
                        SecurityCode = securityCode,
                        PlacedAt     = DateTime.UtcNow,
                        Type         = OrderType.Sell,
                        Price        = sellingPrice,
                        ValidUntil   = validUntil
                    });
                }
            }

            repository.SaveAll(limitOrders);
        }
コード例 #5
0
 public IEnumerable <Quotation> GetByExchange(string exchange, string instrument, DateTime @from, DateTime to)
 {
     return(quotationService.GetQuotations(exchange, instrument, from, to));
 }
コード例 #6
0
ファイル: QuotationController.cs プロジェクト: NLTDIndia/AMS
        // GET: Quotation
        public ActionResult ManageQuotation()
        {
            var quotations = _quotationService.GetQuotations();

            return(View(quotations));
        }
コード例 #7
0
        public IViewComponentResult Invoke()
        {
            RightModel model = new RightModel();


            List <Comment> listComment = new List <Comment>();


            List <User> listUser = new List <User>();


            List <Book> listBook = new List <Book>();


            List <Quotation> listQuotation = new List <Quotation>();


            var users = _appUserService.GetNotAdmin();

            users.ShuffleMethod();
            var fiveUsers = users.Take(3);

            foreach (var fiveUser in fiveUsers)
            {
                User user = new User();
                user.UserName         = fiveUser.UserName;
                user.FirstName        = fiveUser.FirstName;
                user.LastName         = fiveUser.LastName;
                user.ProfileImageFile = fiveUser.ProfileImageFile;
                user.Description      = fiveUser.Description;
                listUser.Add(user);
            }

            model.Users = listUser;


            var books = _bookService.GetList();

            books.ShuffleMethod();
            var fiveBooks = books.Take(4);

            foreach (var fiveBook in fiveBooks)
            {
                Book book = new Book();
                book.Title         = fiveBook.Title;
                book.Id            = fiveBook.Id;
                book.BookImageUrl  = fiveBook.BookImageUrl;
                book.BookPublisher = fiveBook.BookPublisher;
                book.DatePublished = fiveBook.DatePublished;
                listBook.Add(book);
            }

            model.Books = listBook;

            var comments = _commentService.GetComments();

            comments.ShuffleMethod();
            var fiveComments = comments.Take(3);

            foreach (var fivecomment in fiveComments)
            {
                Comment comment = new Comment();
                comment.Id         = fivecomment.Id;
                comment.ReviewText = fivecomment.ReviewText;
                comment.Rating     = fivecomment.Rating;
                comment.HeadLine   = fivecomment.HeadLine;
                comment.CreatedOn  = fivecomment.CreatedOn;
                comment.BookStatus = fivecomment.BookStatus;
                comment.BookId     = fivecomment.BookId;
                comment.AppUserId  = fivecomment.AppUserId;
                comment.Book       = new Book
                {
                    Title        = fivecomment.Book.Title,
                    BookImageUrl = fivecomment.Book.BookImageUrl
                };
                comment.User = new User
                {
                    UserName  = fivecomment.AppUser.UserName,
                    FirstName = fivecomment.AppUser.FirstName,
                    LastName  = fivecomment.AppUser.LastName
                };
                comment.User.LastName = fivecomment.AppUser.LastName;
                listComment.Add(comment);
            }

            model.Comments = listComment;



            var quotations = _quotationService.GetQuotations();

            quotations.ShuffleMethod();
            var fivequotations = quotations.Take(3);

            foreach (var fivequotation in fivequotations)
            {
                Quotation quotation = new Quotation();
                quotation.AppUserId     = fivequotation.AppUserId;
                quotation.Id            = fivequotation.Id;
                quotation.QuotationText = fivequotation.QuotationText;
                quotation.CurrentPage   = fivequotation.CurrentPage;
                quotation.BookId        = fivequotation.BookId;
                quotation.CreatedOn     = fivequotation.CreatedOn;
                quotation.Book          = new Book
                {
                    Title        = fivequotation.Book.Title,
                    BookImageUrl = fivequotation.Book.BookImageUrl
                };
                quotation.User = new User
                {
                    UserName  = fivequotation.AppUser.UserName,
                    FirstName = fivequotation.AppUser.FirstName,
                    LastName  = fivequotation.AppUser.LastName
                };
                listQuotation.Add(quotation);
            }

            model.Quotations = listQuotation;

            return(View(model));
        }
コード例 #8
0
 public async Task <ActionResult <IEnumerable <QuotationDto> > > Get()
 {
     return(await _quotationService.GetQuotations());
 }