So I'm trying to make a platform that takes for example 2% fee for converting Fiat to Crypto or vice versa, and want to calculate the fees for both options, when user wants to convert from crypto to fiat, to show him the value in fiat, also when it wants to convert fiat to crypto to show the value in fiat.
Example:
1BTC = x amount and the fee will be $29
// The pairs are all against USD , e.g. 1 BTC = 40,000$
export const cryptocurrencies = [
{
Name: 'Bitcoin',
Symbol: 'BTC',
Rate: 40000,
},
{
Name: 'Tether',
Symbol: 'USDT',
Rate: 1,
},
];
export const fiat = [
{
Name: 'US Dollar',
Symbol: 'USD',
Rate: 1,
},
{
Name: 'Euro',
Symbol: 'EUR',
Rate: 0.9258, // USD to EUR
},
];
I have no idea on how this can be done.