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:
@@ -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) {
|
||||
|
@@ -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: {
|
||||
|
Reference in New Issue
Block a user