示例#1
0
        public static bool IsValidMetastockFolder(string path)
        {
            var meta = new MetaLib();

            return(!String.IsNullOrEmpty(path) && Directory.Exists(path) &&
                   meta.IsMetaStockDirectory(path));
        }
示例#2
0
        public static bool UpdateSymbol(string metastockFolder, string symbol, List <PriceRecord> priceRecords)
        {
            if (priceRecords == null)
            {
                return(false);
            }

            try
            {
                var meta = new MetaLib();
                meta.OpenDirectory(metastockFolder, FileAccess.ReadWrite);
                var found = meta.OpenSecuritySymbol(symbol);
                if (!found)
                {
                    return(false);
                }
                meta.SeekForLastRecord();

                foreach (var priceRecord in priceRecords)
                {
                    meta.AppendPriceRecord(priceRecord);
                }

                meta.CloseDirectory();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
示例#3
0
        public static CSPkg CreateDefaultCSPKG(uint msgID)
        {
            CSPkg pkg = CSPkg.New();

            pkg.stPkgHead.dwMsgID  = msgID;
            pkg.stPkgHead.iVersion = MetaLib.getVersion();
            pkg.stPkgData.construct((long)msgID);
            return(pkg);
        }
示例#4
0
        public static string GetLastDateStatus(string metastockFolder, string symbol)
        {
            var meta = new MetaLib();

            meta.OpenDirectory(metastockFolder, FileAccess.ReadWrite);
            var found = meta.OpenSecuritySymbol(symbol);

            if (!found)
            {
                return("Symbol not found");
            }
            meta.SeekForLastRecord();
            var date = meta.ReadPriceRecord().Date.Date.ToShortDateString();

            meta.CloseDirectory();
            return(date);
        }