Esempio n. 1
0
        private static void GetAllegroItems(int fromId, int toId)
        {
            var hasInd      = ActiveList.Where(x => x.itemTitle.Contains("(") && x.itemTitle.Contains(")"));
            var dontHaveInd = ActiveList.Where(x => !x.itemTitle.Contains("(") && !x.itemTitle.Contains(")")).ToList();
            var indexes     = hasInd
                              .SelectMany(x =>
            {
                var ind       = x.itemTitle.LastIndexOf("(", StringComparison.InvariantCulture);
                var coinIndex = x.itemTitle.Substring(ind).Replace(")", "").Replace("(", "");
                int result;
                if (!int.TryParse(coinIndex, out result))
                {
                    return(new[] { new { Index = -1, ItemID = x.itemId, Index2 = coinIndex, x } });
                }
                return(new[] { new { Index = result, ItemID = x.itemId, Index2 = coinIndex, x } });
            }

                                          ).OrderBy(x => x.Index).ToList();

            var def = (List <FieldsValue>)LoadFromBinaryFile <List <FieldsValue> >(
                new DirectoryInfo(@"SaveTemplates").FullName + @"\default_fields.dat");

            for (int i = 0; i < dontHaveInd.Count(); i++)
            {
                var list = dontHaveInd[i];

                var firstEdit = _apiContext.doChangeItemFields(_login, list.itemId,
                                                               def.ToArray()
                                                               , new int[] { 43, 143, 243 }, 0, null, null, null, null);
            }
        }
Esempio n. 2
0
        public static int GetItemCountById(int index)
        {
            var count = ActiveList.Count(x => x.itemTitle.Contains("*(" + index + ")"));

            if (count > 1)
            {
                var it = ActiveList.Where(x => x.itemTitle.Contains("*(" + index + ")"));
            }
            return(count);
        }
Esempio n. 3
0
        public static void CheckDublicates()
        {
            var hasInd      = ActiveList.Where(x => x.itemTitle.Contains("(") && x.itemTitle.Contains(")"));
            var dontHaveInd = ActiveList
                              .Where(x => !x.itemTitle.Contains("(") && !x.itemTitle.Contains(")")) /*.Select(x => x.itemTitle)*/;
            var indexes = hasInd
                          //    .Where(x=>
                          //{
                          //    var ind = x.itemTitle.LastIndexOf("(", StringComparison.InvariantCulture);
                          //    var coinIndex = x.itemTitle.Substring(ind).Replace(")", "").Replace("(", "");
                          //    int result;
                          //    return int.TryParse(coinIndex, out result);
                          //})
                          .SelectMany(x =>
            {
                var ind       = x.itemTitle.LastIndexOf("(", StringComparison.InvariantCulture);
                var coinIndex = x.itemTitle.Substring(ind).Replace(")", "").Replace("(", "");
                int result;
                if (!int.TryParse(coinIndex, out result))
                {
                    return(new[] { new { Index = -1, ItemID = x.itemId, Index2 = coinIndex, x } });
                }
                return(new[] { new { Index = result, ItemID = x.itemId, Index2 = coinIndex, x } });
            }

                                      ).OrderBy(x => x.Index);
            var indexesList = indexes.ToList();

            for (int i = 0; i < indexesList.Count(); i++)
            {
                var ind      = indexesList[i].Index;
                var indasasd = indexesList[i];

                if (!_indexesChecked.Contains(ind) && !ind.Equals(-1) && ind <= 3548)
                {
                }
            }

            var duplicates = indexes
                             .GroupBy(i => i.Index)
                             .Where(g => g.Count() > 1);



            foreach (var sellItemStruct in ActiveList)
            {
                if (sellItemStruct.itemBiddersCounter > 0)
                {
                }
            }
            //.Select(g => g.Key);
        }
        public async void CompareNewBar(IAgg bar, string symbol)
        {
            var id        = StockList.Where(e => e.Symbol == symbol).Select(e => e.Id).FirstOrDefault();
            var itemFlags = ActiveList.Where(e => e.SymbolId == id).ToList();

            foreach (var item in itemFlags)
            {
                if (item.IsActive == "Y")
                {
                    if (item.ExpirationDate >= DateTime.Now)
                    {
                        if (item.ComparisonType == "GreaterThan")
                        {
                            if (item.AlertPrice >= bar.Close)
                            {
                                var xx = item.BuySellFlag;

                                var emailList = await GetUserEmails();

                                EmailEngine.SendTradeAlert(emailList);
                                //send alert,
                                //remove active flag in table,
                                ActiveList.Remove(item);
                            }
                        }
                        else if (item.ComparisonType == "LessThan")
                        {
                            if (item.AlertPrice <= bar.Close)
                            {
                                ActiveList.Remove(item);
                            }
                        }
                    }
                    else
                    {
                        //send tracker expired email,
                        //update active flag
                        ActiveList.Remove(item);
                    }
                }
                else
                {
                    ActiveList.Remove(item);
                }
            }
        }