Browse Source

Custom cryptocurrencies

Added custom cryptocurrencies to helper.ts
pull/432/head
Davin 4 years ago
parent
commit
77eb0bee3a
  1. 3
      libs/common/src/lib/customCryptocurrencies.json
  2. 6
      libs/common/src/lib/helper.ts

3
libs/common/src/lib/customCryptocurrencies.json

@ -0,0 +1,3 @@
{
"SHIB": "Shiba Inu"
}

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

@ -5,6 +5,9 @@ import { ghostfolioScraperApiSymbolPrefix } from './config';
const cryptocurrencies = require('cryptocurrencies'); 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 const DEMO_USER_ID = '9b112b4d-3b7d-4bad-9bdd-3b0f7b4dac2f';
export function capitalize(aString: string) { export function capitalize(aString: string) {
@ -81,8 +84,7 @@ export function groupBy<T, K extends keyof T>(
export function isCrypto(aSymbol = '') { export function isCrypto(aSymbol = '') {
const cryptocurrencySymbol = aSymbol.substring(0, aSymbol.length - 3); const cryptocurrencySymbol = aSymbol.substring(0, aSymbol.length - 3);
return cryptocurrencies.symbols().includes(cryptocurrencySymbol) || customSymbolList.symbols().includes(cryptocurrencySymbol);
return cryptocurrencies.symbols().includes(cryptocurrencySymbol);
} }
export function isCurrency(aSymbol = '') { export function isCurrency(aSymbol = '') {

Loading…
Cancel
Save