mirror of https://github.com/ghostfolio/ghostfolio
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.3 KiB
39 lines
1.3 KiB
import { IsAfter1970Constraint } from '@ghostfolio/common/validator-constraints/is-after-1970';
|
|
import { IsSplitRatioConstraint } from '@ghostfolio/common/validator-constraints/is-split-ratio';
|
|
|
|
import { IsInt, IsISO8601, Validate } from 'class-validator';
|
|
|
|
export class CreateAssetProfileSplitDto {
|
|
/**
|
|
* The date the split becomes effective. Activities before this date are
|
|
* adjusted by the ratio.
|
|
*/
|
|
@IsISO8601()
|
|
@Validate(IsAfter1970Constraint)
|
|
date: string;
|
|
|
|
/**
|
|
* The number of shares held before the split, for example 1 for a 4:1 split
|
|
* or 10 for a 1:10 reverse split.
|
|
*/
|
|
@IsInt()
|
|
denominator: number;
|
|
|
|
/**
|
|
* The number of shares held after the split, for example 4 for a 4:1 split
|
|
* or 1 for a 1:10 reverse split.
|
|
*
|
|
* The resulting split factor is numerator / denominator. Both parts are kept
|
|
* so that the ratio stays exact, for example 1/3 for a 1:3 reverse split.
|
|
*
|
|
* Activities are adjusted by this ratio: the quantity is multiplied by it and
|
|
* the unit price divided by it, so that the total value of an activity stays
|
|
* the same.
|
|
*
|
|
* Market data is already split-adjusted by the data providers and must not be
|
|
* adjusted again.
|
|
*/
|
|
@IsInt()
|
|
@Validate(IsSplitRatioConstraint)
|
|
numerator: number;
|
|
}
|
|
|