diff --git a/apps/backend/src/modules/tbank/dto/broker-envelope.dto.ts b/apps/backend/src/modules/tbank/dto/broker-envelope.dto.ts index d98eb0a..a718486 100644 --- a/apps/backend/src/modules/tbank/dto/broker-envelope.dto.ts +++ b/apps/backend/src/modules/tbank/dto/broker-envelope.dto.ts @@ -2,6 +2,7 @@ import { ApiProperty } from '@nestjs/swagger'; import { BrokerAccountResponseDto } from './broker-account-response.dto'; import { BrokerOperationSyncResponseDto } from './broker-operation-sync-query.dto'; import { BrokerOperationsPageResponseDto } from './broker-operation-response.dto'; +import { BrokerPositionsPageResponseDto } from './broker-positions-page-response.dto'; import { BrokerPortfolioResponseDto } from './broker-portfolio-response.dto'; export class BrokerResponseMetaDto { @@ -36,6 +37,14 @@ export class BrokerOperationsEnvelopeDto { meta!: BrokerResponseMetaDto; } +export class BrokerPositionsEnvelopeDto { + @ApiProperty({ type: BrokerPositionsPageResponseDto }) + data!: BrokerPositionsPageResponseDto; + + @ApiProperty({ type: BrokerResponseMetaDto }) + meta!: BrokerResponseMetaDto; +} + export class BrokerOperationSyncEnvelopeDto { @ApiProperty({ type: BrokerOperationSyncResponseDto }) data!: BrokerOperationSyncResponseDto; diff --git a/apps/backend/src/modules/tbank/dto/broker-operation-response.dto.ts b/apps/backend/src/modules/tbank/dto/broker-operation-response.dto.ts index d6b365d..e2a5afc 100644 --- a/apps/backend/src/modules/tbank/dto/broker-operation-response.dto.ts +++ b/apps/backend/src/modules/tbank/dto/broker-operation-response.dto.ts @@ -28,6 +28,9 @@ export class BrokerOperationResponseDto { @ApiProperty({ nullable: true }) description!: string | null; + @ApiProperty({ nullable: true }) + name!: string | null; + @ApiProperty({ nullable: true }) state!: string | null; diff --git a/apps/backend/src/modules/tbank/dto/broker-portfolio-response.dto.ts b/apps/backend/src/modules/tbank/dto/broker-portfolio-response.dto.ts index e86f56c..c06b5cc 100644 --- a/apps/backend/src/modules/tbank/dto/broker-portfolio-response.dto.ts +++ b/apps/backend/src/modules/tbank/dto/broker-portfolio-response.dto.ts @@ -2,50 +2,6 @@ import { ApiProperty } from '@nestjs/swagger'; import { BrokerAccountResponseDto } from './broker-account-response.dto'; import { BrokerMoneyDto } from './broker-money.dto'; -export class BrokerPositionResponseDto { - @ApiProperty({ nullable: true }) - figi!: string | null; - - @ApiProperty({ nullable: true }) - instrumentUid!: string | null; - - @ApiProperty({ nullable: true }) - positionUid!: string | null; - - @ApiProperty({ nullable: true }) - ticker!: string | null; - - @ApiProperty({ nullable: true }) - classCode!: string | null; - - @ApiProperty({ nullable: true }) - instrumentType!: string | null; - - @ApiProperty({ nullable: true }) - name!: string | null; - - @ApiProperty({ nullable: true }) - quantity!: number | null; - - @ApiProperty({ nullable: true }) - blockedLots!: number | null; - - @ApiProperty({ type: BrokerMoneyDto, nullable: true }) - currentPrice!: BrokerMoneyDto | null; - - @ApiProperty({ type: BrokerMoneyDto, nullable: true }) - currentValue!: BrokerMoneyDto | null; - - @ApiProperty({ type: BrokerMoneyDto, nullable: true }) - averagePositionPrice!: BrokerMoneyDto | null; - - @ApiProperty({ nullable: true }) - expectedYieldPercent!: number | null; - - @ApiProperty({ type: BrokerMoneyDto, nullable: true }) - dailyYield!: BrokerMoneyDto | null; -} - export class BrokerPortfolioTotalsDto { @ApiProperty({ type: BrokerMoneyDto, nullable: true }) shares!: BrokerMoneyDto | null; @@ -102,9 +58,6 @@ export class BrokerPortfolioResponseDto { @ApiProperty({ type: [BrokerMoneyDto] }) blockedCash!: BrokerMoneyDto[]; - @ApiProperty({ type: [BrokerPositionResponseDto] }) - positions!: BrokerPositionResponseDto[]; - @ApiProperty() asOf!: string; } diff --git a/apps/backend/src/modules/tbank/dto/broker-position-response.dto.ts b/apps/backend/src/modules/tbank/dto/broker-position-response.dto.ts new file mode 100644 index 0000000..655d553 --- /dev/null +++ b/apps/backend/src/modules/tbank/dto/broker-position-response.dto.ts @@ -0,0 +1,46 @@ +import { ApiProperty } from '@nestjs/swagger'; +import { BrokerMoneyDto } from './broker-money.dto'; + +export class BrokerPositionResponseDto { + @ApiProperty({ nullable: true }) + figi!: string | null; + + @ApiProperty({ nullable: true }) + instrumentUid!: string | null; + + @ApiProperty({ nullable: true }) + positionUid!: string | null; + + @ApiProperty({ nullable: true }) + ticker!: string | null; + + @ApiProperty({ nullable: true }) + classCode!: string | null; + + @ApiProperty({ nullable: true }) + instrumentType!: string | null; + + @ApiProperty({ nullable: true }) + name!: string | null; + + @ApiProperty({ nullable: true }) + quantity!: number | null; + + @ApiProperty({ nullable: true }) + blockedLots!: number | null; + + @ApiProperty({ type: BrokerMoneyDto, nullable: true }) + currentPrice!: BrokerMoneyDto | null; + + @ApiProperty({ type: BrokerMoneyDto, nullable: true }) + currentValue!: BrokerMoneyDto | null; + + @ApiProperty({ type: BrokerMoneyDto, nullable: true }) + averagePositionPrice!: BrokerMoneyDto | null; + + @ApiProperty({ nullable: true }) + expectedYieldPercent!: number | null; + + @ApiProperty({ type: BrokerMoneyDto, nullable: true }) + dailyYield!: BrokerMoneyDto | null; +} diff --git a/apps/backend/src/modules/tbank/dto/broker-positions-page-response.dto.ts b/apps/backend/src/modules/tbank/dto/broker-positions-page-response.dto.ts new file mode 100644 index 0000000..71decea --- /dev/null +++ b/apps/backend/src/modules/tbank/dto/broker-positions-page-response.dto.ts @@ -0,0 +1,19 @@ +import { ApiProperty } from '@nestjs/swagger'; +import { BrokerPositionResponseDto } from './broker-position-response.dto'; + +export class BrokerPositionsPageResponseDto { + @ApiProperty() + accountId!: string; + + @ApiProperty({ type: [BrokerPositionResponseDto] }) + items!: BrokerPositionResponseDto[]; + + @ApiProperty({ nullable: true }) + nextCursor!: string | null; + + @ApiProperty() + hasNext!: boolean; + + @ApiProperty() + asOf!: string; +} diff --git a/apps/backend/src/modules/tbank/types/broker.types.ts b/apps/backend/src/modules/tbank/types/broker.types.ts index 113a77e..cd74fa0 100644 --- a/apps/backend/src/modules/tbank/types/broker.types.ts +++ b/apps/backend/src/modules/tbank/types/broker.types.ts @@ -51,7 +51,14 @@ export type BrokerPortfolio = { }; cash: BrokerMoney[]; blockedCash: BrokerMoney[]; - positions: BrokerPosition[]; + asOf: string; +}; + +export type BrokerPositionsPage = { + accountId: string; + items: BrokerPosition[]; + nextCursor: string | null; + hasNext: boolean; asOf: string; }; @@ -66,6 +73,7 @@ export type BrokerOperation = { type: string; category: BrokerOperationCategory; description: string | null; + name: string | null; state: string | null; instrumentUid: string | null; figi: string | null;