Пример #1
0
        public string curveFilePath(Siv siv, string marketName)
        {
            var d = new QDirectory(join(@"\", list(stoDir(), stoId(), "CurvesBin", siv.sviName("_") + "_" + marketName)));

            d.createIfMissing();
            return(d.file("run_" + runNumber() + ".bin").path());
        }
Пример #2
0
        public string metricsFilePath(Siv siv, string marketName)
        {
            var d = new QDirectory(join(@"\", list(stoDir(), stoId(), "Metrics")));

            d.createIfMissing();
            return(d.file(siv.sviName("_") + "_" + marketName + ".csv").path());
        }
Пример #3
0
        public static void Main(string[] args)
        {
            var arguments = Arguments.arguments(args, jStrings("group", "start", "end", "dir", "asOf", "metricSource", "overwrite"));
            var groupName = arguments.@string("group");
            var start     = date(arguments.get("start", jDate("1990/01/01")));
            var end       = date(arguments.get("end", Dates.midnight()));

            if (arguments.containsKey("asOf"))
            {
                freezeNow(date(arguments.date("asOf")));
            }
            var metricSource = arguments.containsKey("metricSource") ? new DataSource(arguments.@string("metricSource")) : null;
            var dir          = new QDirectory(arguments.get("dir"));

            dir.createIfMissing();
            var group     = Groups.GROUPS.forName(groupName);
            var overwrite = arguments.get("overwrite", false);

            Bomb.unless(overwrite || isEmpty(dir.files()),
                        () => dir.path() + " contains existing files and overwrite is false!");
            writeGroupXml(dir, group, start, end);
            var liveMarkets     = list <MsivPv>(Groups.GROUPS.liveMarkets(groupName));
            var marketsBySystem = new Dictionary <LiveSystem, List <JMarket> >();

            each(liveMarkets, liveMarket => marketsBySystem[liveMarket.liveSystem()] = new List <JMarket>());
            each(liveMarkets, liveMarket => marketsBySystem[liveMarket.liveSystem()].Add(new JMarket(liveMarket.market())));
            each(marketsBySystem, (system, markets) => generateCurves(system, markets, dir, start, end, metricSource));
            Environment.Exit(0);
        }
Пример #4
0
        public static int Main(string[] args)
        {
            Log.doNotDebugSqlForever();
            var arguments      = Arguments.arguments(args, jStrings("dir", "lastDate", "generateCurves", "overwrite"));
            var end            = date(arguments.get("lastDate"));
            var portfolioDir   = new QDirectory(arguments.get("dir", PRODUCTION));
            var generateCurves = arguments.get("generateCurves", true);

            portfolioDir.createIfMissing();
            var newDirectory = dateDirectory(portfolioDir, end);

            if (generateCurves)
            {
                var overwrite = arguments.get("overwrite", false);
                Portfolio.Main(new[] {
                    "-group", "AllSystemsQ",
                    "-end", ymdHuman(end),
                    "-asOf", ymdHuman(end),
                    "-dir", newDirectory,
                    "-metricSource", "internal",
                    "-overwrite", "" + overwrite
                });
            }
            var prior = date(Dates.businessDaysAgo(1, jDate(end), "nyb"));
            var bytes = new ByteArrayOutputStream();

            Log.setBothStreams(new PrintStream(bytes));
            var rc = PortfolioTieOut.runReport(new[] {
                "-old", dateDirectory(portfolioDir, prior),
                "-new", newDirectory,
                "-ignoreLast", "true",
                "-summary", "true"
            });

            if (rc != 0)
            {
                Email.problem("daily portfolio yesterday != today", bytes.ToString()).sendTo("team");
            }
            return(rc);
        }
Пример #5
0
        public void setLogFile(QDirectory dir)
        {
            dir.createIfMissing();
            switch (runMode())
            {
            case RunMode.LIVE:
                LogC.setOut("System", dir.file("Q_" + liveSystem().name() + ".log").path(), true);
                break;

            case RunMode.RIGHTEDGE:
                LogC.setOut("System", dir.file("Q.log").path(), true);
                break;

            case RunMode.STO:
                LogC.setOut("System", dir.file("Q_" + siv().name() + ".log").path(), true);
                break;

            default:
                Bomb.toss("unhandled run mode setting log file!");
                break;
            }
        }
Пример #6
0
 public void createDirectories()
 {
     tempDir.createIfMissing();
     LogC.makeOldDir(metricsDir.path());
 }
Пример #7
0
 public void writeCurveFiles(LiveSystem liveSystem, QDirectory directory)
 {
     directory.createIfMissing();
     eachKey(collectors, collectible => collectors[collectible].writeCurveFile(collectible, liveSystem, directory));
 }