|
@ -33,32 +33,6 @@ export class BenchmarkController { |
|
|
@Inject(REQUEST) private readonly request: RequestWithUser |
|
|
@Inject(REQUEST) private readonly request: RequestWithUser |
|
|
) {} |
|
|
) {} |
|
|
|
|
|
|
|
|
@Get() |
|
|
|
|
|
@UseInterceptors(TransformDataSourceInRequestInterceptor) |
|
|
|
|
|
@UseInterceptors(TransformDataSourceInResponseInterceptor) |
|
|
|
|
|
public async getBenchmark(): Promise<BenchmarkResponse> { |
|
|
|
|
|
return { |
|
|
|
|
|
benchmarks: await this.benchmarkService.getBenchmarks() |
|
|
|
|
|
}; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Get(':dataSource/:symbol/:startDateString') |
|
|
|
|
|
@UseGuards(AuthGuard('jwt')) |
|
|
|
|
|
@UseInterceptors(TransformDataSourceInRequestInterceptor) |
|
|
|
|
|
public async getBenchmarkMarketDataBySymbol( |
|
|
|
|
|
@Param('dataSource') dataSource: DataSource, |
|
|
|
|
|
@Param('startDateString') startDateString: string, |
|
|
|
|
|
@Param('symbol') symbol: string |
|
|
|
|
|
): Promise<BenchmarkMarketDataDetails> { |
|
|
|
|
|
const startDate = new Date(startDateString); |
|
|
|
|
|
|
|
|
|
|
|
return this.benchmarkService.getMarketDataBySymbol({ |
|
|
|
|
|
dataSource, |
|
|
|
|
|
startDate, |
|
|
|
|
|
symbol |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Post() |
|
|
@Post() |
|
|
@UseGuards(AuthGuard('jwt')) |
|
|
@UseGuards(AuthGuard('jwt')) |
|
|
public async addBenchmark(@Body() { dataSource, symbol }: UniqueAsset) { |
|
|
public async addBenchmark(@Body() { dataSource, symbol }: UniqueAsset) { |
|
@ -135,4 +109,30 @@ export class BenchmarkController { |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Get() |
|
|
|
|
|
@UseInterceptors(TransformDataSourceInRequestInterceptor) |
|
|
|
|
|
@UseInterceptors(TransformDataSourceInResponseInterceptor) |
|
|
|
|
|
public async getBenchmark(): Promise<BenchmarkResponse> { |
|
|
|
|
|
return { |
|
|
|
|
|
benchmarks: await this.benchmarkService.getBenchmarks() |
|
|
|
|
|
}; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Get(':dataSource/:symbol/:startDateString') |
|
|
|
|
|
@UseGuards(AuthGuard('jwt')) |
|
|
|
|
|
@UseInterceptors(TransformDataSourceInRequestInterceptor) |
|
|
|
|
|
public async getBenchmarkMarketDataBySymbol( |
|
|
|
|
|
@Param('dataSource') dataSource: DataSource, |
|
|
|
|
|
@Param('startDateString') startDateString: string, |
|
|
|
|
|
@Param('symbol') symbol: string |
|
|
|
|
|
): Promise<BenchmarkMarketDataDetails> { |
|
|
|
|
|
const startDate = new Date(startDateString); |
|
|
|
|
|
|
|
|
|
|
|
return this.benchmarkService.getMarketDataBySymbol({ |
|
|
|
|
|
dataSource, |
|
|
|
|
|
startDate, |
|
|
|
|
|
symbol |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|