示例#1
0
        private void HoleDaten(string strFile, string strSort, string strWomit)
        {
            CollWertpapiere cwp = Wertpapiere_ReadXml(strFile, out DateTime dt);

            foreach (Wertpapier wp in cwp)
            {
                if (wp.IsSumme)
                {
                    continue;
                }
                Wertpapierklasse typeid = (Wertpapierklasse)wp.Type;
                if (typeid < Wertpapierklasse.MinWertpap || typeid > Wertpapierklasse.MaxWertpap)
                {
                    continue;
                }
                if (wp.ISIN.ToString().Length != 12)
                {
                    continue;
                }
                _synchrovs.Add(new SynchroV {
                    WPVAnzahl           = wp.Anzahl,
                    WPVName             = wp.Name,
                    WPVKursZeit         = wp.KursZeit,
                    WPVAktWert          = wp.AktWert,
                    WPVISIN             = wp.ISIN,
                    WPVURL              = wp.URL,
                    WPVKurs             = (float)wp.AktKurs,
                    WPVProzentAenderung = wp.Heute,
                    WPVType             = (Wertpapierklasse)wp.Type,
                    WPVSharpe           = wp.Sharpe,
                    WPVBemerkung        = strWomit + " " + strFile + " " + dt,
                    WPVSort             = wp.ISIN + " " + strSort,
                    WPVRowColor         = "0",
                    WPVAnzeigen         = NurPreisDifferenzen ^ true,
                    WPVForegroundColor  = Brushes.AliceBlue
                });
            }
        }
示例#2
0
        public CollWertpapiere Wertpapiere_ReadXml(string strPortFol, out DateTime dt)
        {
            string        s                = Convert.ToString(DateTime.Now).Trim();
            string        filename         = GlobalRef.g_Ein.myDepotPfad + @"\KursDaten";
            DirectoryInfo ParentDirectory2 = new DirectoryInfo(filename);

            dt = DateTime.Now.AddDays(1);
            while (!File.Exists(filename))
            {
                dt       = dt.AddDays(-1);
                s        = Convert.ToString(dt).Trim();
                filename = GlobalRef.g_Ein.myDepotPfad + @"\KursDaten\" + strPortFol
                           + s.Substring(6, 4) + s.Substring(3, 2) + s.Substring(0, 2) + ".xml";
                // In ...PortFol_JJJJMMTT.xml stehen Daten mit Subsembly geholt.
            }
            //Console.WriteLine("---- Wertpapiere_ReadXml " + filename);
            CollWertpapiere cwp = null;

            using (StreamReader _reader = new StreamReader(filename)) {
                cwp = (CollWertpapiere)ser.Deserialize(_reader);
            }
            return(cwp);
        }