Feature/add benchmarks to twitter bot service (#959)

* Extend benchmarks with market condition and adapt twitter bot service

* Update changelog
This commit is contained in:
Thomas Kaul
2022-05-27 10:03:37 +02:00
committed by GitHub
parent 3498ed8549
commit c3768a882d
9 changed files with 103 additions and 3 deletions

View File

@@ -3,6 +3,7 @@ import { DataSource } from '@prisma/client';
import { getDate, getMonth, getYear, parse, subDays } from 'date-fns';
import { ghostfolioScraperApiSymbolPrefix, locale } from './config';
import { Benchmark } from './interfaces';
export function capitalize(aString: string) {
return aString.charAt(0).toUpperCase() + aString.slice(1).toLowerCase();
@@ -178,6 +179,18 @@ export function resolveFearAndGreedIndex(aValue: number) {
}
}
export function resolveMarketCondition(
aMarketCondition: Benchmark['marketCondition']
) {
if (aMarketCondition === 'BEAR_MARKET') {
return { emoji: '🐻' };
} else if (aMarketCondition === 'BULL_MARKET') {
return { emoji: '🐮' };
} else {
return { emoji: '⚪' };
}
}
export const DATE_FORMAT = 'yyyy-MM-dd';
export function parseDate(date: string) {

View File

@@ -1,6 +1,7 @@
import { EnhancedSymbolProfile } from './enhanced-symbol-profile.interface';
export interface Benchmark {
marketCondition: 'BEAR_MARKET' | 'BULL_MARKET' | 'NEUTRAL_MARKET';
name: EnhancedSymbolProfile['name'];
performances: {
allTimeHigh: {