private void addNewTab(ShowingCurrencyClass showingCurrency)
        {
            TabItem        tabItem = new TabItem();
            CartesianChart cart    = new CartesianChart();

            ChartValues <double> vals   = new ChartValues <double>();
            List <string>        labels = new List <string>();

            string title = "";
            string time  = "";
            int    step  = 0;

            switch (showingCurrency.Type)
            {
            case CurrencyIntervalType.TIME_SERIES_INTRADAY:
            case CurrencyIntervalType.TIME_SERIES_DAILY:
            case CurrencyIntervalType.TIME_SERIES_WEEKLY:
            case CurrencyIntervalType.TIME_SERIES_MONTHLY:
                string[] lista = showingCurrency.Metadata["1. Information"].Split(' ');
                if (showingCurrency.Type == CurrencyIntervalType.TIME_SERIES_INTRADAY)
                {
                    time = lista[0] + lista[1];
                }
                else
                {
                    time = lista[0];
                }
                step  = 4;
                title = showingCurrency.Metadata["2. Symbol"] + "(" + time + ")";
                foreach (string key in showingCurrency.Timeseries.Keys)
                {
                    labels.Add(key);
                    labels.Add("");
                    labels.Add("");
                    labels.Add("");
                    vals.Add(showingCurrency.Timeseries[key]["1. open"]);
                    vals.Add(showingCurrency.Timeseries[key]["2. high"]);
                    vals.Add(showingCurrency.Timeseries[key]["3. low"]);
                    vals.Add(showingCurrency.Timeseries[key]["4. close"]);
                }
                break;

            case CurrencyIntervalType.DIGITAL_CURRENCY_DAILY:
            case CurrencyIntervalType.DIGITAL_CURRENCY_MONTHLY:
            case CurrencyIntervalType.DIGITAL_CURRENCY_WEEKLY:
                string[] listing = showingCurrency.Metadata["1. Information"].Split(' ');
                if (showingCurrency.Type == CurrencyIntervalType.DIGITAL_CURRENCY_INTRADAY)
                {
                    time = listing[0] + listing[1];
                }
                else
                {
                    time = listing[0];
                }
                step  = 4;
                title = showingCurrency.Metadata["2. Digital Currency Code"] + "(" + time + ")";
                foreach (string key in showingCurrency.Timeseries.Keys)
                {
                    labels.Add(key);
                    labels.Add("");
                    labels.Add("");
                    labels.Add("");
                    vals.Add(showingCurrency.Timeseries[key]["1a. open (" + referentCurrency.Symbol + ")"]);
                    vals.Add(showingCurrency.Timeseries[key]["2a. high (" + referentCurrency.Symbol + ")"]);
                    vals.Add(showingCurrency.Timeseries[key]["3a. low (" + referentCurrency.Symbol + ")"]);
                    vals.Add(showingCurrency.Timeseries[key]["4a. close (" + referentCurrency.Symbol + ")"]);
                }
                break;

            case CurrencyIntervalType.DIGITAL_CURRENCY_INTRADAY:
                string[] listej = showingCurrency.Metadata["1. Information"].Split(' ');
                if (showingCurrency.Type == CurrencyIntervalType.DIGITAL_CURRENCY_INTRADAY)
                {
                    time = listej[0] + listej[1];
                }
                else
                {
                    time = listej[0];
                }
                step  = 1;
                title = showingCurrency.Metadata["2. Digital Currency Code"] + "(" + time + ")";
                foreach (string key in showingCurrency.Timeseries.Keys)
                {
                    labels.Add(key);
                    vals.Add(showingCurrency.Timeseries[key]["1a. price (" + referentCurrency.Symbol + ")"]);
                }
                break;
            }

            LiveCharts.SeriesCollection sers = new LiveCharts.SeriesCollection
            {
                new LineSeries
                {
                    Title  = title,
                    Values = vals
                }
            };
            //cart.LegendLocation = LiveCharts.LegendLocation.Right;
            cart.AxisX.Add(new LiveCharts.Wpf.Axis
            {
                Labels    = labels,
                Separator = new LiveCharts.Wpf.Separator
                {
                    Step = step
                },
                LabelsRotation = 15
            });

            cart.Series = sers;

            cart.Width = vals.Count * 10;
            if (step == 1)
            {
                cart.Width = vals.Count * 50;
            }


            ScrollViewer skrol = new ScrollViewer();

            skrol.HorizontalScrollBarVisibility = System.Windows.Controls.ScrollBarVisibility.Visible;

            ContextMenu cm = new ContextMenu();
            MenuItem    mi = new MenuItem();

            mi.Header = "Close";

            mi.Click += new RoutedEventHandler((sender, e) => menuItemClicked(sender, e, title));
            cm.Items.Add(mi);

            tabItem.ContextMenu = cm;
            tabItem.Header      = title;
            skrol.Content       = cart;
            tabItem.Content     = skrol;
            tabControl.Items.Add(tabItem);
            tabControl.SelectedItem = tabItem;
        }
        //npr DIGITAL_CURRENCY_MONTHLY, BTC -> za mesecni bitcoin
        private void loadJSON(CurrencyIntervalType interval, string symbol)
        {
            LoadJSON client           = new LoadJSON();
            string   link             = string.Empty;
            string   keyForTimeseries = string.Empty;

            switch (interval)
            {
            case CurrencyIntervalType.DIGITAL_CURRENCY_INTRADAY:
                link             = "https://www.alphavantage.co/query?function=DIGITAL_CURRENCY_INTRADAY&symbol=" + symbol + "&market=" + referentCurrency.Symbol + "&apikey=9P2LP0T1YR34LBSK";
                keyForTimeseries = "Time Series (Digital Currency Intraday)";
                break;

            case CurrencyIntervalType.DIGITAL_CURRENCY_DAILY:
                link             = "https://www.alphavantage.co/query?function=DIGITAL_CURRENCY_DAILY&symbol=" + symbol + "&market=" + referentCurrency.Symbol + "&apikey=9P2LP0T1YR34LBSK";
                keyForTimeseries = "Time Series (Digital Currency Daily)";
                break;

            case CurrencyIntervalType.DIGITAL_CURRENCY_WEEKLY:
                link             = "https://www.alphavantage.co/query?function=DIGITAL_CURRENCY_WEEKLY&symbol=" + symbol + "&market=" + referentCurrency.Symbol + "&apikey=9P2LP0T1YR34LBSK";
                keyForTimeseries = "Time Series (Digital Currency Weekly)";
                break;

            case CurrencyIntervalType.DIGITAL_CURRENCY_MONTHLY:
                link             = "https://www.alphavantage.co/query?function=DIGITAL_CURRENCY_MONTHLY&symbol=" + symbol + "&market=" + referentCurrency.Symbol + "&apikey=9P2LP0T1YR34LBSK";
                keyForTimeseries = "Time Series (Digital Currency Monthly)";
                break;

            case CurrencyIntervalType.TIME_SERIES_INTRADAY:
                link             = "https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&symbol=" + symbol + "&interval=15min&outputsize=full&apikey=9P2LP0T1YR34LBSK";
                keyForTimeseries = "Time Series (15min)";
                break;

            case CurrencyIntervalType.TIME_SERIES_DAILY:
                link             = "https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=" + symbol + "&outputsize=full&apikey=9P2LP0T1YR34LBSK";
                keyForTimeseries = "Time Series (Daily)";
                break;

            case CurrencyIntervalType.TIME_SERIES_WEEKLY:
                link             = "https://www.alphavantage.co/query?function=TIME_SERIES_WEEKLY&symbol=" + symbol + "&apikey=9P2LP0T1YR34LBSK";
                keyForTimeseries = "Weekly Time Series";
                break;

            default:
                link             = "https://www.alphavantage.co/query?function=TIME_SERIES_MONTHLY&symbol=" + symbol + "&apikey=9P2LP0T1YR34LBSK";
                keyForTimeseries = "Monthly Time Series";
                break;
            }

            client.endPoint = link;

            string response = string.Empty;

            response = client.makeRequest();

            if (!response.Contains("Error") && !response.Contains("kindly contact support") && !string.IsNullOrEmpty(response))
            {
                var jObj = JsonConvert.DeserializeObject <dynamic>(response);
                ShowingCurrencyClass showingCurrency = new ShowingCurrencyClass();

                showingCurrency.Metadata = jObj["Meta Data"].ToObject <Dictionary <string, string> >();
                showingCurrency.Type     = interval;

                //u zavisnosti od intervala se prosledjuje kljuc za timeseries
                showingCurrency.Timeseries = jObj[keyForTimeseries].ToObject <Dictionary <string, Dictionary <string, double> > >();

                shownCurrenciesList.Add(showingCurrency);

                addNewTab(showingCurrency);
            }
            else
            {
                MessageBox.Show("unable to collect data");
            }
        }