コード例 #1
0
    internal static Tuple<string, string> GetTickerAndFieldFromConfig(SeriesConfig line_)
    {
      var keys = line_.Parameters.Split('*').Select(x => x.Split(':')).ToDictionary(x => x[0], x => x[1]);

      var ticker = keys[Param_Ticker];
      var field = keys[Param_Field];

      return Tuple.Create(ticker, field);
    }
 public SeriesConfigProcessForm(SeriesConfig config)
 {
     InitializeComponent();
     this.config      = config;
     currentStimul    = 0;
     this.WindowState = FormWindowState.Maximized;
     timer.Interval   = (int)config.MinInt;
     timer.Enabled    = true;
     timer.Start();
 }
コード例 #3
0
        private void grdConfigs_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex < 0 || e.RowIndex < 0)
            {
                return;
            }
            DataGridViewCell c = grdConfigs[e.ColumnIndex, e.RowIndex];

            if (c is DataGridViewButtonCell)
            {
                if (e.ColumnIndex == EDIT_STIMULUS_SET)
                {
                    Int64 id = (Int64)grdConfigs["id", e.RowIndex].Value;
                    EditStimulusSetForm essf = new EditStimulusSetForm(id);
                    essf.Show();
                }
                else if (e.ColumnIndex == EDIT_STIMULUS_ORDER)
                {
                    string str                 = (string)grdConfigs["stimulusOrder", e.RowIndex].Value;
                    long   interval            = (long)grdConfigs["maxInt", e.RowIndex].Value;
                    string order               = (string)grdConfigs["orderType", e.RowIndex].Value;
                    Order  orderType           = order.Trim().Equals("FIXED") ? Order.Fixed : Order.Probability;
                    EditStimulusOrderForm esof = new EditStimulusOrderForm(str, interval, orderType);
                    if (esof.ShowDialog() == DialogResult.OK)
                    {
                        grdConfigs["stimulusOrder", e.RowIndex].Value = esof.Result;
                    }
                }
                else if (e.ColumnIndex == TEST_SERIES)
                {
                    Int64                   id     = (Int64)grdConfigs["id", e.RowIndex].Value;
                    SeriesConfig            config = SqlUtils.SelectSeriesConfig(id, Settings.Default.DBConnectionString);
                    SeriesConfigProcessForm scpf   = new SeriesConfigProcessForm(config);
                    scpf.Show();
                }
                else if (e.ColumnIndex == EDIT_TEXT_BEFORE)
                {
                    string       text = (string)grdConfigs["textBefore", e.RowIndex].Value;
                    EditTextForm etf  = new EditTextForm(text);
                    if (etf.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        grdConfigs["textBefore", e.RowIndex].Value = etf.EditText;
                    }
                }
                else if (e.ColumnIndex == EDIT_TEXT_AFTER)
                {
                    string       text = (string)grdConfigs["textAfter", e.RowIndex].Value;
                    EditTextForm etf  = new EditTextForm(text);
                    if (etf.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        grdConfigs["textAfter", e.RowIndex].Value = etf.EditText;
                    }
                }
            }
        }
コード例 #4
0
ファイル: SeriesList.cs プロジェクト: heimanhon/researchwork
    public async Task<ITimeSeries> Retrieve(SeriesConfig cl_, ICarbonClient cc_, bool forceRefresh_ = false)
    {
      ITimeSeries ret = null;

      foreach (var source in m_sublists)
      {
        ret = await source.Retrieve(cl_, cc_, forceRefresh_);
        if (ret != null) break;
      }

      return ret;
    }
コード例 #5
0
    private static UltraTreeNode findOrCreateNode(UltraTreeNode parent_, string text_, SeriesConfig config=null)
    {
      UltraTreeNode ret = parent_.Nodes.Cast<UltraTreeNode>().FirstOrDefault(node => node.Text.Equals(text_));

      if (ret == null)
      {

        ret = config != null ? (UltraTreeNode)new TreeNode_Leaf(text_, config) : new TreeNode_Folder(text_);
        parent_.Nodes.Add(ret);
      }

      return ret;
    }
コード例 #6
0
    public async Task<DatedDataCollectionGen<double>> Extract(SeriesConfig line_, ICarbonClient cc_, bool forceRefresh_ = false)
    {
      var keys = line_.Parameters.Split('*').Select(x => x.Split(':')).ToDictionary(x => x[0], x => x[1]);

      string frameMoniker = keys[CommonConstants._frameField];

      var frame = await DataFrameCache.Get<DateTime>(frameMoniker, cc_, forceRefresh_);

      if (frame == null) return null;

      var con = frame.ToConstructGenGen<DateTime, double>();

      return con == null ? null : con.SumRows().ToCumulative();
    }
コード例 #7
0
        public static void SaveSeria(ETS_Data.Series series, FileStream stream)
        {
            using (StreamWriter sr = new StreamWriter(stream))
            {
                //Name
                sr.WriteLine("Seria name;" + series.Name + ";");
                //Config
                SeriesConfig config = series.Config;
                sr.WriteLine("Config;");
                sr.WriteLine("Name;" + config.Name + ";");
                sr.WriteLine("Max interval;" + config.MaxInt + ";");
                sr.WriteLine("Min interval;" + config.MinInt + ";");
                sr.WriteLine("Order type;" + config.StringOrderType + ";");
                sr.WriteLine("Text before;" + config.TextBefore + ";");
                sr.WriteLine("Text after;" + config.TextAfter + ";");
                //Stimuluses
                sr.WriteLine("Stimuluses set;");
                sr.WriteLine("Name;Filename;Type;");
                foreach (Stimulus s in series.Config.StimulusSet)
                {
                    SerializeStimulus(s, sr);
                }
                //Templates
                for (int i = 0; i < series.Templates.Count; i++)
                {
                    Template t = (Template)series.Templates[i];
                    sr.WriteLine("Template;" + t.Name + ";");
                    ArrayList coords = (ArrayList)series.TemplateCoords[i];
                    sr.Write("Time;");
                    for (int j = 0; j < coords.Count; j++)
                    {
                        SeriesRecord r = (SeriesRecord)coords[j];
                        if (r != null)
                        {
                            sr.Write(Util.MsToStandardTimeRepresentation((int)r.Time) + ";");
                        }
                    }
                    sr.WriteLine();
                    sr.Write("X;");
                    for (int j = 0; j < coords.Count; j++)
                    {
                        SeriesRecord r = (SeriesRecord)coords[j];
                        if (r != null)
                        {
                            sr.Write(r.X + ";");
                        }
                    }
                    sr.WriteLine();
                    sr.Write("Y;");
                    for (int j = 0; j < coords.Count; j++)
                    {
                        SeriesRecord r = (SeriesRecord)coords[j];
                        if (r != null)
                        {
                            sr.Write(r.Y + ";");
                        }
                    }
                    sr.WriteLine();
                }
                if (series.TemplateCoords.Count > 0)
                {
                    ArrayList coords = (ArrayList)series.TemplateCoords[0];
                    if (coords.Count > 0)
                    {
                        sr.Write("Stimuluses;");

                        for (int j = 0; j < coords.Count; j++)
                        {
                            SeriesRecord r    = (SeriesRecord)coords[j];
                            int          time = (int)r.Time;
                            Stimulus     s    = series.GetStimulusForTime(time);
                            if (s == null)
                            {
                                sr.Write(";");
                            }
                            else
                            {
                                sr.Write(s.Name + ";");
                            }
                        }
                    }
                }
            }
            try
            {
                stream.Close();
            }
            catch (Exception e)
            {
            }
        }
コード例 #8
0
 public async Task<DatedDataCollectionGen<double>> Extract(SeriesConfig line_, Symmetry.Carbon.Client.ICarbonClient cc_, bool forceRefresh_ = false)
 {
   var tickerAndField = GetTickerAndFieldFromConfig(line_);
   return BbgTalk.HistoryRequester.GetHistory(new DateTime(2000, 1, 1), tickerAndField.Item1, tickerAndField.Item2,
     BbgTalk.RefreshOption.RefreshIfOlderThanToday);
 }
コード例 #9
0
 public TimeSeriesFromConfig(SeriesConfig conf_, DatedDataCollectionGen<double> series_)
 {
   Series = series_;
   Config = conf_;
 }
コード例 #10
0
ファイル: TRProvider.cs プロジェクト: heimanhon/researchwork
 public async Task<DatedDataCollectionGen<double>> Get(SeriesConfig line_, ICarbonClient cc_, bool forceRefresh_=false)
 {
   return await SeriesExtractor.Extract(line_, cc_, forceRefresh_);
 }
コード例 #11
0
 public TreeNode_Leaf(string text_, SeriesConfig config_)
 {
   Text = text_;
   Config = config_;
   LeftImages.Add(_leftImage);
 }