コード例 #1
0
        static public void InsertTradeLog(Trade TradeObject)
        {
            try
            {
                AlsiDBDataContext dc = new AlsiDBDataContext();
                dc.Connection.ConnectionString = AlsiUtils.Data_Objects.GlobalObjects.CustomConnectionString;

                TradeLog l = new TradeLog
                {
                    Time      = TradeObject.TimeStamp,
                    BuySell   = TradeObject.BuyorSell.ToString(),
                    Reason    = TradeObject.Reason.ToString(),
                    Notes     = TradeObject.IndicatorNotes.ToString(),
                    Price     = (int)TradeObject.TradedPrice,
                    Volume    = TradeObject.TradeVolume,
                    ForeColor = TradeObject.ForeColor.ToKnownColor().ToString(),
                    BackColor = TradeObject.BackColor.ToKnownColor().ToString()
                };
                dc.TradeLogs.InsertOnSubmit(l);
                dc.SubmitChanges();
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Cannot write Log");
                Debug.WriteLine(ex.Message);
            }
        }
コード例 #2
0
        public static void ClearTradeLog()
        {
            var dc     = new AlsiDBDataContext();
            var delAll = dc.TradeLogs;

            dc.TradeLogs.DeleteAllOnSubmit(delAll);
            dc.SubmitChanges();
        }
コード例 #3
0
        static public void insertTicks(DateTime Stamp, int Price)
        {
            AlsiDBDataContext dc = new AlsiDBDataContext();
            int p = Price;

            RawTick c = new RawTick
            {
                Stamp = Stamp,
                Price = p
            };


            dc.RawTicks.InsertOnSubmit(c);
            dc.SubmitChanges();
        }
コード例 #4
0
        public static void UpdatetoMinuteImport()
        {
            AlsiDBDataContext dc = new AlsiDBDataContext();

            dc.Connection.ConnectionString = GlobalObjects.CustomConnectionString;
            dc.ClearImportTable();
            decimal progress    = 0;
            decimal totProgress = GlobalObjects.Points.Count;

            foreach (Price price in GlobalObjects.Points)
            {
                int open   = (int)price.Open;
                int high   = (int)price.High;
                int low    = (int)price.Low;
                int close  = (int)price.Close;
                int volume = (int)price.Volume;

                ImportMinute c = new ImportMinute
                {
                    Stamp      = price.TimeStamp,
                    O          = open,
                    H          = high,
                    L          = low,
                    C          = close,
                    V          = volume,
                    Instrument = price.InstrumentName
                };


                dc.ImportMinutes.InsertOnSubmit(c);
                dc.SubmitChanges();
                progress++;

                int p = Convert.ToInt16(100 * (progress / totProgress));
            }
            GlobalObjects.Points.Clear();
            dc.UpadteImport();
            dc.CleanUp();
        }