示例#1
0
        public async Task <List <PositionContract> > PositionHistory(
            [FromQuery] string accountId, [FromQuery] string instrument, [FromQuery] DateTime?eventDateFrom, [FromQuery] DateTime?eventDateTo)
        {
            var positions = (await _positionsHistoryRepository.GetAsync(accountId, instrument, eventDateFrom, eventDateTo))
                            .Where(x => x.HistoryType == PositionHistoryType.Close || x.HistoryType == PositionHistoryType.PartiallyClose)
                            .ToDictionary(x => x.DealId);
            var deals = (await _dealsRepository.GetAsync(accountId, instrument))
                        .ToDictionary(x => x.DealId);

            return(deals.Keys.Select(x => Convert(positions, deals, x)).Where(d => d != null).ToList());
        }
示例#2
0
        public async Task <List <PositionEventContract> > PositionHistory([FromQuery] string accountId, [FromQuery] string instrument, [FromQuery] DateTime?eventDateFrom, [FromQuery] DateTime?eventDateTo)
        {
            var orders = await _positionsHistoryRepository.GetAsync(accountId, instrument, eventDateFrom, eventDateTo);

            return(orders.Select(Convert).Where(d => d != null).ToList());
        }