Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Add custom crypto currencies (#432)

Davine24e5e1c4400
diff --git a/libs/common/src/lib/customCryptocurrencies.json b/libs/common/src/lib/customCryptocurrencies.json
new file mode 100644
index 0000000000..342414d0d2
--- /dev/null
+++ b/libs/common/src/lib/customCryptocurrencies.json
@@ -0,0 +1,11 @@
+{
+ "SHIB": "SHIBA INU USD",
+ "SOL1": "Solana",
+ "DOT1": "Polkadot",
+ "LUNA1": "Terra",
+ "AVAX": "Avalanche",
+ "MATIC": "MaticNetwork",
+ "ATOM1": "Cosmos",
+ "FTT1": "FTXToken",
+ "1INCH": "1inch"
+}
diff --git a/libs/common/src/lib/helper.ts b/libs/common/src/lib/helper.ts
index c4f593dd9f..157d932ea7 100644
--- a/libs/common/src/lib/helper.ts
+++ b/libs/common/src/lib/helper.ts
@@ -5,6 +5,9 @@ import { ghostfolioScraperApiSymbolPrefix } from './config';
const cryptocurrencies = require('cryptocurrencies');
+const customSymbolList = require('./customCryptocurrencies.json')
+customSymbolList.symbols = () => Object.keys(customSymbolList);
+
export const DEMO_USER_ID = '9b112b4d-3b7d-4bad-9bdd-3b0f7b4dac2f';
export function capitalize(aString: string) {
@@ -81,8 +84,7 @@ export function groupBy<T, K extends keyof T>(
export function isCrypto(aSymbol = '') {
const cryptocurrencySymbol = aSymbol.substring(0, aSymbol.length - 3);
-
- return cryptocurrencies.symbols().includes(cryptocurrencySymbol);
+ return cryptocurrencies.symbols().includes(cryptocurrencySymbol) || customSymbolList.symbols().includes(cryptocurrencySymbol);
}
export function isCurrency(aSymbol = '') {