Exemple #1
0
        private async Task ValidatePnLThresholdAsync(IEnumerable <OrderBook> orderBooks, Instrument instrument)
        {
            if (instrument.PnLThreshold == 0)
            {
                return;
            }

            IReadOnlyCollection <SummaryReport> summaryReports = (await _summaryReportService.GetAllAsync())
                                                                 .Where(o => o.AssetPairId == instrument.AssetPairId)
                                                                 .ToArray();

            decimal totalPnL = summaryReports.Select(o => o.PnL).DefaultIfEmpty(0).Sum();

            if (summaryReports.Count > 0 && totalPnL < 0 && instrument.PnLThreshold < Math.Abs(totalPnL))
            {
                SetError(orderBooks.SelectMany(o => o.LimitOrders), LimitOrderError.LowPnL);
            }
        }
Exemple #2
0
        public async Task <IReadOnlyCollection <SummaryReportModel> > GetSummaryReportAsync()
        {
            IReadOnlyCollection <SummaryReport> summaryReports = await _summaryReportService.GetAllAsync();

            return(Mapper.Map <SummaryReportModel[]>(summaryReports));
        }