add current position calculation with holding period return calculation

This commit is contained in:
Valentin Zickner
2021-07-26 22:13:09 +02:00
committed by Thomas
parent ee89822bfe
commit 852902d1ab
7 changed files with 257 additions and 77 deletions

View File

@@ -1,5 +1,5 @@
import { Currency } from '@prisma/client';
import { getDate, getMonth, getYear, subDays } from 'date-fns';
import { getDate, getMonth, getYear, parse, subDays } from 'date-fns';
import { ghostfolioScraperApiSymbolPrefix } from './config';
@@ -137,3 +137,9 @@ export function resolveFearAndGreedIndex(aValue: number) {
return { emoji: '🤪', text: 'Extreme Greed' };
}
}
export const DATE_FORMAT = 'yyyy-MM-dd';
export function parseDate(date: string) {
return parse(date, DATE_FORMAT, new Date());
}