Exemplo n.º 1
0
        public IActionResult ActualizarMonedas()
        {
            var client =
                new ForexDataClient("i3drSZDmC8Kis9rruVPtCciybrr3ut3s");

            var symbols = client.GetSymbols();
            var quotes  = client.GetQuotes(symbols);

            foreach (var symbol in symbols)
            {
                var abreviatura = symbol.Substring(0, 3);
                _repositorio.CrearMoneda(new Moneda {
                    Abreviatura = abreviatura
                });
            }
            foreach (var quote in quotes)
            {
                var monedaOrigen  = quote.symbol.Substring(0, 3);
                var monedaDestino = quote.symbol.Substring(3, 3);
                _repositorio.CrearFactor(new FactorConversion {
                    IdMonedaOrigen  = _repositorio.BuscarMonedaPorNombre(monedaOrigen),
                    IdMonedaDestino = _repositorio.BuscarMonedaPorNombre(monedaDestino),
                    Factor          = (decimal)quote.price
                });
            }

            ViewBag.NumeroMonedas = symbols.Length;
            return(View());
        }
Exemplo n.º 2
0
        public IActionResult About()
        {
            var client  = new ForexDataClient("iq5IFnq426n3QufDY24SOxMOoDTQJftO");
            var symbols = client.GetSymbols();

            foreach (var symbol in symbols)
            {
                _RepositorioFunc.Extraer(symbol, 0);
                _RepositorioFunc.Extraer(symbol, 3);
            }

            var factores = client.GetQuotes(client.GetSymbols());

            foreach (var q in factores)
            {
                Conversión conversor = new Conversión();
                conversor.Origensiglas     = q.symbol.Substring(0, 3);
                conversor.Destinosiglas    = q.symbol.Substring(3, 3);
                conversor.Factorconversion = q.price;
                _Repositorio.InsertFactor(conversor);
            }
            _Repositorio.InsertPaises(RellenoBD.CrearListaPaises());
            ViewData["Message"] = "Your application description page.";
            return(View());
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            var client = new ForexDataClient("xtczkx5SyiottjHUHQavK1U5io8K7F9e");
            List <FactorConversion> lista  = new List <FactorConversion>();
            FactorConversion        factor = new FactorConversion();
            int count = 0;

            var symbols = client.GetSymbols();

            foreach (var symbol in symbols)
            {
                string from_coin = symbol.Substring(0, 3);
                string to_coin   = symbol.Substring(3, 3);

                string[] stringArray = new string[1];


                stringArray[0] = symbol;
                var impreso = client.GetQuotes(stringArray);
                var valor   = impreso[0].price;

                count = count++;

                factor.Id = count;
                factor.IdMonedaDestino = count++;
                factor.IdMonedaDestino = count++;
                factor.denominacion    = symbol;
                factor.Factor          = (decimal)valor;

                Console.WriteLine("Conversion:" + factor.denominacion + "/Valor:" + factor.Factor);
            }
            Console.Read();
        }
Exemplo n.º 4
0
        //Forex


        public void CargarFactores()
        {
            List <FactorConversion> lista = new List <FactorConversion>();
            //List<string> factores = new List<string>();


            var symbols  = client.GetSymbols();
            var factores = client.GetQuotes(symbols);



            foreach (var fact in factores)
            {
                FactorConversion fact_help = new FactorConversion();

                string from_coin   = fact.symbol.Substring(0, 3);
                string to_coin     = fact.symbol.Substring(3, 3);
                Moneda Moneda_to   = BuscarMonedaPorIdentificador(to_coin);
                Moneda Moneda_from = BuscarMonedaPorIdentificador(from_coin);

                fact_help.denominacion    = fact.symbol;
                fact_help.IdMonedaDestino = Moneda_to.Id;
                fact_help.IdMonedaOrigen  = Moneda_from.Id;
                fact_help.Factor          = (decimal)fact.price;



                IntroducirFactores(fact_help);
            }
        }
Exemplo n.º 5
0
        public IActionResult ActualizarFactores()
        {
            var client  = new ForexDataClient("UqGdNXCYs3QMuKLRfzURoseh8okx8hAY");
            var symbols = client.GetSymbols();
            var quotes  = client.GetQuotes(symbols);

            foreach (var quote in quotes)
            {
                UpdateQuote(quote);
            }
            return(View());
        }
Exemplo n.º 6
0
        public async void Test()
        {
            var client = new ForexDataClient("i3drSZDmC8Kis9rruVPtCciybrr3ut3s");

            // Get the list of available symbols
            var symbols = client.GetSymbols();

            foreach (var symbol in symbols)
            {
                Console.WriteLine(symbol);
            }

            // Console.Read();


            // Get quotes for specified symbols
            var quotes = client.GetQuotes(new[] { "EURUSD", "GBPJPY", "BTCUSD" });

            foreach (var quote in quotes)
            {
                Console.WriteLine(quote);
            }

            // Console.Read();

            // Convert from one currency to another:

            var conversion = client.Convert("EUR", "USD", 100);

            Console.WriteLine(conversion);

            //Console.Read();


            // Check if the market is open:

            var marketStatus = client.GetMarketStatus();

            Console.WriteLine(marketStatus.marketIsOpen ? "The market is open!" : "The market is closed!");

            // Quota used

            var quota = client.GetQuota();

            Console.WriteLine(quota);
        }
        public IActionResult ActualizarMonedas()
        {
            var client  = new ForexDataClient("3xVV9NYiGNoskWLSHaQuBWH7ItkxECBQ");
            var symbols = client.GetSymbols();

            foreach (var simbolo in symbols)
            {
                Extraer(simbolo, 0);
                Extraer(simbolo, 3);
            }

            var valores = client.GetQuotes(symbols);

            ViewBag.resultado = symbols.Length;

            return(View());
        }
        public IActionResult ActualizarFactor()
        {
            var client  = new ForexDataClient("3xVV9NYiGNoskWLSHaQuBWH7ItkxECBQ");
            var symbols = client.GetSymbols();
            var quotes  = client.GetQuotes(symbols);

            foreach (var symbol in symbols)
            {
                Extraer(symbol, 0);
                Extraer(symbol, 3);
            }

            foreach (var quote in quotes)
            {
                UpdateQuote(quote);
            }
            ViewBag.NumeroMonedas = symbols.Length;
            return(View());
        }
Exemplo n.º 9
0
        public IActionResult ActualizarMonedas()
        {
            var client  = new ForexDataClient("UqGdNXCYs3QMuKLRfzURoseh8okx8hAY");
            var symbols = client.GetSymbols();
            var quotes  = client.GetQuotes(symbols);

            foreach (var symbol in symbols)
            {
                Extraer(symbol, 0);
                Extraer(symbol, 3);
            }

            foreach (var quote in quotes)
            {
                UpdateQuote(quote);
            }
            ViewBag.NumeroMonedas = symbols.Length;
            return(View());
        }