Browse Source

Move currency removal from cryptocurrency names to general availability

pull/7650/head
Thomas Kaul 17 hours ago
parent
commit
a3e8cb0e53
  1. 15
      apps/api/src/services/data-provider/data-provider.service.ts
  2. 15
      libs/common/src/lib/helper.ts

15
apps/api/src/services/data-provider/data-provider.service.ts

@ -17,6 +17,7 @@ import { CreateOrderDto } from '@ghostfolio/common/dtos';
import { SubscriptionType } from '@ghostfolio/common/enums';
import {
DATE_FORMAT,
formatAssetProfileName,
getAssetProfileIdentifier,
getCurrencyFromSymbol,
getStartOfUtcDate,
@ -125,7 +126,11 @@ export class DataProviderService implements OnModuleInit {
symbol,
dataSource: DataSource[dataSource]
})
] = { ...assetProfile, symbol };
] = {
...assetProfile,
symbol,
name: formatAssetProfileName(assetProfile)
};
}
})
);
@ -897,13 +902,7 @@ export class DataProviderService implements OnModuleInit {
lookupItem.dataProviderInfo.isPremium = false;
}
if (lookupItem.assetSubClass === 'CRYPTOCURRENCY') {
// Remove DEFAULT_CURRENCY at the end of cryptocurrency names
lookupItem.name = lookupItem.name.replace(
new RegExp(` ${DEFAULT_CURRENCY}$`),
''
);
}
lookupItem.name = formatAssetProfileName(lookupItem);
return lookupItem;
})

15
libs/common/src/lib/helper.ts

@ -261,6 +261,21 @@ export function extractNumberFromString({
}
}
export function formatAssetProfileName({
assetSubClass,
name
}: {
assetSubClass?: AssetSubClass;
name?: string;
}) {
if (assetSubClass === 'CRYPTOCURRENCY') {
// Remove DEFAULT_CURRENCY at the end of cryptocurrency names
return name?.replace(new RegExp(` ${DEFAULT_CURRENCY}$`), '');
}
return name;
}
export function formatMonthAndYear({
date,
locale

Loading…
Cancel
Save