|
|
@ -1014,6 +1014,9 @@ export class PortfolioService {
|
|
|
|
filters?: Filter[];
|
|
|
|
filters?: Filter[];
|
|
|
|
impersonationId: string;
|
|
|
|
impersonationId: string;
|
|
|
|
}): Promise<{ hasErrors: boolean; positions: Position[] }> {
|
|
|
|
}): Promise<{ hasErrors: boolean; positions: Position[] }> {
|
|
|
|
|
|
|
|
const searchQuery = filters.find(({ type }) => {
|
|
|
|
|
|
|
|
return type === 'SEARCH_QUERY';
|
|
|
|
|
|
|
|
})?.id;
|
|
|
|
const userId = await this.getUserId(impersonationId, this.request.user.id);
|
|
|
|
const userId = await this.getUserId(impersonationId, this.request.user.id);
|
|
|
|
|
|
|
|
|
|
|
|
const { portfolioOrders, transactionPoints } =
|
|
|
|
const { portfolioOrders, transactionPoints } =
|
|
|
@ -1042,9 +1045,9 @@ export class PortfolioService {
|
|
|
|
const currentPositions =
|
|
|
|
const currentPositions =
|
|
|
|
await portfolioCalculator.getCurrentPositions(startDate);
|
|
|
|
await portfolioCalculator.getCurrentPositions(startDate);
|
|
|
|
|
|
|
|
|
|
|
|
const positions = currentPositions.positions.filter(
|
|
|
|
let positions = currentPositions.positions.filter(({ quantity }) => {
|
|
|
|
(item) => !item.quantity.eq(0)
|
|
|
|
return !quantity.eq(0);
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
const dataGatheringItems = positions.map(({ dataSource, symbol }) => {
|
|
|
|
const dataGatheringItems = positions.map(({ dataSource, symbol }) => {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
@ -1067,6 +1070,17 @@ export class PortfolioService {
|
|
|
|
symbolProfileMap[symbolProfile.symbol] = symbolProfile;
|
|
|
|
symbolProfileMap[symbolProfile.symbol] = symbolProfile;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (searchQuery) {
|
|
|
|
|
|
|
|
positions = positions.filter(({ symbol }) => {
|
|
|
|
|
|
|
|
const enhancedSymbolProfile = symbolProfileMap[symbol];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
|
|
enhancedSymbolProfile.isin?.toLowerCase().startsWith(searchQuery) ||
|
|
|
|
|
|
|
|
enhancedSymbolProfile.name?.toLowerCase().startsWith(searchQuery)
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
hasErrors: currentPositions.hasErrors,
|
|
|
|
hasErrors: currentPositions.hasErrors,
|
|
|
|
positions: positions.map((position) => {
|
|
|
|
positions: positions.map((position) => {
|
|
|
|