示例#1
0
        private static SimAccount doWinSim(int from, int to, int best_island_id, bool display_chart, double nn_threshold)
        {
            Console.WriteLine("Started Read Weight Win SIM");
            var ga     = new GA(0);
            var chromo = ga.readWeights(best_island_id, false);
            var sim    = new Sim();
            var ac     = new SimAccount();

            ac = sim.sim_win_ga_market(from, to, chromo, ac, nn_threshold);

            Console.WriteLine("pl=" + ac.performance_data.total_pl);
            Console.WriteLine("pl ratio=" + ac.performance_data.total_pl_ratio);
            Console.WriteLine("num trade=" + ac.performance_data.num_trade);
            Console.WriteLine("num market order=" + ac.performance_data.num_maker_order);
            Console.WriteLine("win rate=" + ac.performance_data.win_rate);
            Console.WriteLine("sharp_ratio=" + ac.performance_data.sharp_ratio);
            Console.WriteLine("num_buy=" + ac.performance_data.num_buy);
            Console.WriteLine("num_sell=" + ac.performance_data.num_sell);
            Console.WriteLine("buy_pl=" + ac.performance_data.buy_pl_list.Sum());
            Console.WriteLine("sell_pl=" + ac.performance_data.sell_pl_list.Sum());
            if (display_chart)
            {
                LineChart.DisplayLineChart(ac.total_pl_list, "from=" + from.ToString() + ", to=" + to.ToString() + ", pl=" + ac.performance_data.total_pl.ToString() + ", num_trade=" + ac.performance_data.num_trade.ToString());
            }
            return(ac);
        }
示例#2
0
        private static SimAccount doMultiSim(int from, int to, int max_amount, List <int> best_chrom_log_id, bool display_chart, List <double> nn_threshold)
        {
            Console.WriteLine("Started Multi SIM");
            var chromos = new Gene2[best_chrom_log_id.Count];
            var ga      = new GA(0);

            for (int i = 0; i < best_chrom_log_id.Count; i++)
            {
                chromos[i] = ga.readWeights(best_chrom_log_id[i], true);
            }
            var title = "Combined PL Ratio - " + from.ToString() + " - " + to.ToString() + ", dt:" + MarketData.Dt[from].ToString() + " - " + MarketData.Dt[to - 1];

            return(ga.sim_ga_multi_chromo(from, to, max_amount, chromos.ToList(), title, display_chart, nn_threshold));
        }
示例#3
0
        private static SimAccount doSim(int from, int to, int max_amount, int sim_type, int best_island_id, bool display_chart, double nn_threshold)
        {
            Console.WriteLine("Started Read Weight SIM");
            var ga     = new GA(0);
            var chromo = ga.readWeights(best_island_id, false);

            if (sim_type == 0)
            {
                return(ga.sim_ga_limit(from, to, max_amount, chromo, from.ToString() + " - " + to.ToString() + ", dt:" + MarketData.Dt[from].ToString() + " - " + MarketData.Dt[to - 1] + ", Best Island=" + best_island_id.ToString(), display_chart));
            }
            else
            {
                return(ga.sim_ga_market_limit(from, to, max_amount, chromo, from.ToString() + " - " + to.ToString() + ", dt:" + MarketData.Dt[from].ToString() + " - " + MarketData.Dt[to - 1] + ", Best Island=" + best_island_id.ToString(), display_chart, nn_threshold));
            }
        }