Browse Source
Feature/expose profile data gathering by symbol endpoint (#611)
* Expose profile data gathering by symbol endpoint
* Update changelog
pull/612/head
Thomas Kaul
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with
60 additions and
0 deletions
-
CHANGELOG.md
-
apps/api/src/app/admin/admin.controller.ts
-
apps/client/src/app/components/admin-market-data/admin-market-data.component.ts
-
apps/client/src/app/components/admin-market-data/admin-market-data.html
-
apps/client/src/app/services/admin.service.ts
|
|
@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 |
|
|
|
|
|
|
|
## Unreleased |
|
|
|
|
|
|
|
### Added |
|
|
|
|
|
|
|
- Exposed the profile data gathering by symbol as an endpoint |
|
|
|
|
|
|
|
### Changed |
|
|
|
|
|
|
|
- Improved the portfolio analysis page: show the y-axis and extend the chart in relation to the days in market |
|
|
|
|
|
@ -96,6 +96,29 @@ export class AdminController { |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
@Post('gather/profile-data/:dataSource/:symbol') |
|
|
|
@UseGuards(AuthGuard('jwt')) |
|
|
|
public async gatherProfileDataForSymbol( |
|
|
|
@Param('dataSource') dataSource: DataSource, |
|
|
|
@Param('symbol') symbol: string |
|
|
|
): Promise<void> { |
|
|
|
if ( |
|
|
|
!hasPermission( |
|
|
|
this.request.user.permissions, |
|
|
|
permissions.accessAdminControl |
|
|
|
) |
|
|
|
) { |
|
|
|
throw new HttpException( |
|
|
|
getReasonPhrase(StatusCodes.FORBIDDEN), |
|
|
|
StatusCodes.FORBIDDEN |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
this.dataGatheringService.gatherProfileData([{ dataSource, symbol }]); |
|
|
|
|
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
@Post('gather/:dataSource/:symbol') |
|
|
|
@UseGuards(AuthGuard('jwt')) |
|
|
|
public async gatherSymbol( |
|
|
|
|
|
@ -43,6 +43,19 @@ export class AdminMarketDataComponent implements OnDestroy, OnInit { |
|
|
|
this.fetchAdminMarketData(); |
|
|
|
} |
|
|
|
|
|
|
|
public onGatherProfileDataBySymbol({ |
|
|
|
dataSource, |
|
|
|
symbol |
|
|
|
}: { |
|
|
|
dataSource: DataSource; |
|
|
|
symbol: string; |
|
|
|
}) { |
|
|
|
this.adminService |
|
|
|
.gatherProfileDataBySymbol({ dataSource, symbol }) |
|
|
|
.pipe(takeUntil(this.unsubscribeSubject)) |
|
|
|
.subscribe(() => {}); |
|
|
|
} |
|
|
|
|
|
|
|
public onGatherSymbol({ |
|
|
|
dataSource, |
|
|
|
symbol |
|
|
|
|
|
@ -38,6 +38,13 @@ |
|
|
|
> |
|
|
|
Gather Data |
|
|
|
</button> |
|
|
|
<button |
|
|
|
i18n |
|
|
|
mat-menu-item |
|
|
|
(click)="onGatherProfileDataBySymbol({dataSource: item.dataSource, symbol: item.symbol})" |
|
|
|
> |
|
|
|
Gather Profile Data |
|
|
|
</button> |
|
|
|
</mat-menu> |
|
|
|
</td> |
|
|
|
</tr> |
|
|
|
|
|
@ -20,6 +20,19 @@ export class AdminService { |
|
|
|
return this.http.post<void>(`/api/admin/gather/profile-data`, {}); |
|
|
|
} |
|
|
|
|
|
|
|
public gatherProfileDataBySymbol({ |
|
|
|
dataSource, |
|
|
|
symbol |
|
|
|
}: { |
|
|
|
dataSource: DataSource; |
|
|
|
symbol: string; |
|
|
|
}) { |
|
|
|
return this.http.post<void>( |
|
|
|
`/api/admin/gather/profile-data/${dataSource}/${symbol}`, |
|
|
|
{} |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
public gatherSymbol({ |
|
|
|
dataSource, |
|
|
|
date, |
|
|
|