// converts amount in baseSymbol to amount in quoteSymbol
        public static BigInteger GetTokenQuoteV1(IRuntime runtime, string baseSymbol, string quoteSymbol, BigInteger amount)
        {
            if (baseSymbol == quoteSymbol)
            {
                return(amount);
            }

            // old
            var basePrice = runtime.GetTokenPrice(baseSymbol);

            var baseToken = runtime.GetToken(baseSymbol);
            var fiatToken = runtime.GetToken(DomainSettings.FiatTokenSymbol);

            // this gives how many dollars is "amount"
            BigInteger result = runtime.ConvertBaseToQuote(amount, basePrice, baseToken, fiatToken);

            if (quoteSymbol == DomainSettings.FiatTokenSymbol)
            {
                return(result);
            }

            var quotePrice = runtime.GetTokenPrice(quoteSymbol);
            var quoteToken = runtime.GetToken(quoteSymbol);

            result = runtime.ConvertQuoteToBase(result, quotePrice, quoteToken, fiatToken);
            return(result);
        }
        public static BigInteger GetTokenQuoteV2(IRuntime runtime, string baseSymbol, string quoteSymbol, BigInteger amount)
        {
            if (baseSymbol == quoteSymbol)
            {
                return(amount);
            }

            var basePrice = runtime.GetTokenPrice(baseSymbol);

            var baseToken = runtime.GetToken(baseSymbol);

            if (quoteSymbol == DomainSettings.FiatTokenSymbol)
            {
                var fiatToken = runtime.GetToken(DomainSettings.FiatTokenSymbol);

                // this gives how many dollars is "amount"
                BigInteger result = runtime.ConvertBaseToQuote(amount, basePrice, baseToken, fiatToken);

                return(result);
            }
            else
            {
                var quotePrice = runtime.GetTokenPrice(quoteSymbol);
                var quoteToken = runtime.GetToken(quoteSymbol);

                if (quoteToken.Decimals <= baseToken.Decimals)
                {
                    var result = ((basePrice * amount) / quotePrice);

                    var diff = baseToken.Decimals - quoteToken.Decimals;
                    var pow  = BigInteger.Pow(10, diff);
                    result /= pow;

                    return(result);
                }
                else // here we invert order of calculations for improved precision
                {
                    var diff = quoteToken.Decimals - baseToken.Decimals;
                    var pow  = BigInteger.Pow(10, diff);

                    amount *= pow;

                    var result = ((basePrice * amount) / quotePrice);

                    return(result);
                }
            }
        }