public void DoExperiment()
 {
     string [,] event_table = ToolsIOCSV.ReadCSVFile(@"D:\GoogleDrive\TestData\Trading\events.csv", Delimiter.SemiColon);
     //Load events
     //ToolsTradingCalendarEvent.GetTradingCalendarEvents(new string[] { "EUR", "USD" }, start_date, end_date);
     //Load candles
     ToolsPrice.GetPriceCandles("EUR_USD", TimeScale.Minute1, start_date, end_date, 0.07);
     //
 }
        public void DoExperiment()
        {
            List <PriceCandle> all_data = ToolsPrice.GetPriceCandles();

            // new DateTime(2016, 9, 3)
            PlotLine2D line_plot_2d = new PlotLine2D();


            for (int month_index = 1; month_index < 9; month_index++)
            {
                DateTimeUTC nfp_date = null;// ToolsTradingCalendarEvent.GetNFPDatetime(2016, month_index);

                DateTimeUTC   nfp_date_begin = nfp_date.AddMinutes(-100);
                DateTimeUTC   nfp_date_end   = nfp_date.AddMinutes(100);
                List <double> nfp_time       = new List <double>();
                List <double> nfp_bid        = new List <double>();

                double candle_time = 0;
                double subtract    = 0;
                foreach (PriceCandle candle in all_data)
                {
                    if ((nfp_date_begin <= candle.OpenTime) && (candle.OpenTime < nfp_date_end))
                    {
                        if (candle_time == 0)
                        {
                            subtract = candle.OpenBid;
                        }
                        nfp_time.Add(candle_time);
                        nfp_time.Add(candle_time);
                        nfp_time.Add(candle_time);
                        nfp_time.Add(candle_time);
                        nfp_bid.Add(candle.OpenBid);
                        nfp_bid.Add(candle.LowBid);
                        nfp_bid.Add(candle.HighBid);
                        nfp_bid.Add(candle.CloseBid);
                        candle_time++;
                    }
                }
                line_plot_2d.AddSeries(nfp_time, nfp_bid, Color.Black);
            }
            ToolsPlotting.WriteToFile(ToolsTradingDataSet.GetPath() + "nfp.png", line_plot_2d, 800, 800);
        }
Exemple #3
0
        public void DoExperiment()
        {
            IReadOnlyList <PriceCandle> candles = ToolsPrice.GetPriceCandles(ToolsPrice.DefaultSymbolUSDEUR, TimeScale.Second1);
            DictionaryCount <int>       dic     = new DictionaryCount <int>();

            foreach (PriceCandle candle in candles)
            {
                dic.Increment((int)Math.Round((candle.OpenAsk - candle.OpenBid) / TradingConstants.POINT));
            }
            List <int> keys = new List <int>(dic.Keys);

            keys.Sort();

            string[,] spread_table = new string[keys.Count, 2];
            for (int i = 0; i < keys.Count; i++)
            {
                Console.WriteLine(keys[i] + " " + dic[keys[i]]);
                spread_table[i, 0] = keys[i].ToString(CultureInfo.InvariantCulture);
                spread_table[i, 1] = dic[keys[i]].ToString(CultureInfo.InvariantCulture);
            }
            ToolsIOCSV.WriteCSVFile(@"D:\GoogleDrive\TestData\Trading\Spreads.csv", spread_table);
        }
 public void TestGetPriceCandles()
 {
     ToolsPrice.GetPriceCandles(ToolsPrice.DefaultSymbolGBPUSD, TimeScale.Second1);
 }