示例#1
0
        public void RemoveSymbol(String symbol)
        {
            var I = (CQGInstrument)_symbolsTable[symbol].Instrument;

            _cel.RemoveInstrument(I);
            DatabaseManager.RunSQLLive("DROP TABLE IF EXISTS " + _symbolsTable[symbol].TableName, "flush", "");
            _tickTable.Remove(symbol);
            _symbolsTable.Remove(symbol);
            _symbolsInProgress.Remove(symbol);
        }
示例#2
0
        public static void StopCollectingSymbol(int itemIndex, string symbol)
        {
            if (_symbolsInProgress.Exists(oo => oo.Name == symbol))
            {
                var item = _symbolsInProgress.Find(oo => oo.Name == symbol);

                if (item.AllowedCollecting)
                {
                    item.AllowedCollecting = false;
                    if (item.CqgInstrument != null)
                    {
                        Cel.RemoveInstrument(item.CqgInstrument);
                    }
                    item.Description = "Stoped";
                    OnSymbolStoped(symbol, true);
                }
                else
                {
                    if (itemIndex != -1)
                    {
                        _symbolsInProgress.RemoveAt(itemIndex);
                    }
                }



                RefreshSubscribedSymbolOnUi();
            }
        }
示例#3
0
        static void _cel_InstrumentSubscribed(string symbol, CQGInstrument cqgInstrument)
        {
            //Check expired date
            DateTime d = cqgInstrument.ExpirationDate;

            Console.WriteLine("Symbol: '" + symbol + "' will be expired:" + d.ToShortDateString());

            if ((d - DateTime.Now).TotalHours < (Settings.Default.DaysToExpiration * 24))
            {
                if (!Settings.Default.EmailedSymbols.Contains(symbol))
                {
                    OnSendReport("Symbol: '" + symbol + "' will expired soon", "Hello. \n The symbol: '" + symbol + "' will be expired on less then " + Settings.Default.DaysToExpiration + " days. \nExpiration date: " + d.ToShortDateString() + "\n\nGood luck");
                    Settings.Default.EmailedSymbols += symbol;
                }
            }
            //Month
            MonthCharYearModel variable = new MonthCharYearModel();

            variable.MonthChar = "def";
            variable.Year      = "def";
            foreach (var monthCharYearModel in monthCharYearlList)
            {
                if (monthCharYearModel.Symbol == symbol)
                {
                    return;
                }
            }
            CQGInstrumentProperties props = cqgInstrument.Properties;
            var properties = props[eInstrumentProperty.ipMonthChar];

            if (props != null && Cel.IsValid(properties.Value))
            {
                variable.MonthChar = properties.Value.ToString();
            }
            properties = props[eInstrumentProperty.ipYear];
            if (props != null && Cel.IsValid(properties.Value))
            {
                variable.Year = properties.Value.ToString();
            }
            variable.Symbol = symbol;
            monthCharYearlList.Add(variable);
            Cel.RemoveInstrument(cqgInstrument);
        }
示例#4
0
        static void CQG_var_InstrumentChanged(CQGInstrument cqgInstrument, CQGQuotes cqgQuotes,
                                              CQGInstrumentProperties cqgInstrumentProperties)
        {
            double qtIndicativeOpen = -1;
            double qtSettlement     = -1;
            double qtMarker         = -1;
            double qtTodayMarker    = -1;
            //var dailyValueModel=new DailyValueModel();
            // var prop=cqgInstrument.Properties[ep]
            var quote = cqgInstrument.Quotes[eQuoteType.qtIndicativeOpen];

            if (quote != null && quote.IsValid)
            {
                qtIndicativeOpen = quote.Price;
            }
            quote = cqgInstrument.Quotes[eQuoteType.qtSettlement];
            if (quote != null && quote.IsValid)
            {
                qtSettlement = quote.Price;
            }
            quote = cqgInstrument.Quotes[eQuoteType.qtMarker];
            if (quote != null && quote.IsValid)
            {
                qtMarker = quote.Price;
            }
            quote = cqgInstrument.Quotes[eQuoteType.qtTodayMarker];
            if (quote != null && quote.IsValid)
            {
                qtTodayMarker = quote.Price;
            }


            ClientDatabaseManager.AddDailyValue(qtIndicativeOpen, qtMarker, qtSettlement, qtTodayMarker, cqgInstrument.FullName, DateTime.Today, cqgInstrument.ExpirationDate);
            _cqgVar.RemoveInstrument(cqgInstrument);
            SubscribedSymbol.Remove(cqgInstrument.FullName);


            //To DB
        }