39 lines
1.3 KiB
TypeScript
39 lines
1.3 KiB
TypeScript
import { Controller, Get, Param, Query } from '@nestjs/common';
|
|
import { ApiTags, ApiOperation } from '@nestjs/swagger';
|
|
import { SharesService } from './shares.service';
|
|
|
|
@ApiTags('Shares')
|
|
@Controller('securities/shares')
|
|
export class SharesController {
|
|
constructor(private readonly sharesService: SharesService) {}
|
|
|
|
@Get(':secid')
|
|
@ApiOperation({ summary: 'Получить спецификацию акции' })
|
|
async getShare(@Param('secid') secid: string) {
|
|
const share = await this.sharesService.getShare(secid);
|
|
return { data: share, meta: { cachedAt: null, fromCache: false } };
|
|
}
|
|
|
|
@Get(':secid/marketdata')
|
|
@ApiOperation({ summary: 'Получить рыночные данные акции' })
|
|
async getMarketData(@Param('secid') secid: string) {
|
|
return this.sharesService.getMarketData(secid);
|
|
}
|
|
|
|
@Get(':secid/dividends')
|
|
@ApiOperation({ summary: 'Получить дивиденды' })
|
|
async getDividends(@Param('secid') secid: string) {
|
|
return this.sharesService.getDividends(secid);
|
|
}
|
|
|
|
@Get(':secid/history')
|
|
@ApiOperation({ summary: 'Получить дневную историю торгов акции' })
|
|
async getHistory(
|
|
@Param('secid') secid: string,
|
|
@Query('from') from: string,
|
|
@Query('till') till: string,
|
|
) {
|
|
return this.sharesService.getHistory(secid, from, till);
|
|
}
|
|
}
|