|
|
@ -365,6 +365,32 @@ export class PortfolioController { |
|
|
|
return { dividends }; |
|
|
|
} |
|
|
|
|
|
|
|
@Get('holding/:dataSource/:symbol') |
|
|
|
@UseInterceptors(RedactValuesInResponseInterceptor) |
|
|
|
@UseInterceptors(TransformDataSourceInRequestInterceptor) |
|
|
|
@UseInterceptors(TransformDataSourceInResponseInterceptor) |
|
|
|
@UseGuards(AuthGuard('jwt'), HasPermissionGuard) |
|
|
|
public async getHolding( |
|
|
|
@Headers(HEADER_KEY_IMPERSONATION.toLowerCase()) impersonationId: string, |
|
|
|
@Param('dataSource') dataSource: DataSource, |
|
|
|
@Param('symbol') symbol: string |
|
|
|
): Promise<PortfolioHoldingDetail> { |
|
|
|
const holding = await this.portfolioService.getPosition( |
|
|
|
dataSource, |
|
|
|
impersonationId, |
|
|
|
symbol |
|
|
|
); |
|
|
|
|
|
|
|
if (!holding) { |
|
|
|
throw new HttpException( |
|
|
|
getReasonPhrase(StatusCodes.NOT_FOUND), |
|
|
|
StatusCodes.NOT_FOUND |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
return holding; |
|
|
|
} |
|
|
|
|
|
|
|
@Get('holdings') |
|
|
|
@UseGuards(AuthGuard('jwt'), HasPermissionGuard) |
|
|
|
@UseInterceptors(RedactValuesInResponseInterceptor) |
|
|
@ -583,6 +609,9 @@ export class PortfolioController { |
|
|
|
return performanceInformation; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @deprecated |
|
|
|
*/ |
|
|
|
@Get('position/:dataSource/:symbol') |
|
|
|
@UseInterceptors(RedactValuesInResponseInterceptor) |
|
|
|
@UseInterceptors(TransformDataSourceInRequestInterceptor) |
|
|
@ -634,7 +663,7 @@ export class PortfolioController { |
|
|
|
} |
|
|
|
|
|
|
|
@HasPermission(permissions.updateOrder) |
|
|
|
@Put('position/:dataSource/:symbol/tags') |
|
|
|
@Put('holding/:dataSource/:symbol/tags') |
|
|
|
@UseInterceptors(TransformDataSourceInRequestInterceptor) |
|
|
|
@UseGuards(AuthGuard('jwt'), HasPermissionGuard) |
|
|
|
public async updateHoldingTags( |
|
|
@ -664,4 +693,39 @@ export class PortfolioController { |
|
|
|
userId: this.request.user.id |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @deprecated |
|
|
|
*/ |
|
|
|
@HasPermission(permissions.updateOrder) |
|
|
|
@Put('position/:dataSource/:symbol/tags') |
|
|
|
@UseInterceptors(TransformDataSourceInRequestInterceptor) |
|
|
|
@UseGuards(AuthGuard('jwt'), HasPermissionGuard) |
|
|
|
public async updatePositionTags( |
|
|
|
@Body() data: UpdateHoldingTagsDto, |
|
|
|
@Headers(HEADER_KEY_IMPERSONATION.toLowerCase()) impersonationId: string, |
|
|
|
@Param('dataSource') dataSource: DataSource, |
|
|
|
@Param('symbol') symbol: string |
|
|
|
): Promise<void> { |
|
|
|
const holding = await this.portfolioService.getPosition( |
|
|
|
dataSource, |
|
|
|
impersonationId, |
|
|
|
symbol |
|
|
|
); |
|
|
|
|
|
|
|
if (!holding) { |
|
|
|
throw new HttpException( |
|
|
|
getReasonPhrase(StatusCodes.NOT_FOUND), |
|
|
|
StatusCodes.NOT_FOUND |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
await this.portfolioService.updateTags({ |
|
|
|
dataSource, |
|
|
|
impersonationId, |
|
|
|
symbol, |
|
|
|
tags: data.tags, |
|
|
|
userId: this.request.user.id |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|