Example #1
0
        protected override void OnBarUpdate()
        {
            if (CurrentBar < Math.Max(SedAtr, SedStd))
            {
                Trending.Set(0);
                return;
            }

            myatr = ATR(Close, VisAtr)[0];
            atrs  = Lagsupressor ? myatr / ATR(Close, SedAtr)[0] + 0.5 * (Trending[1] - Trending[3]) : myatr / ATR(Close, SedAtr)[0];
            sd    = MyStdDev(Typical, VisStd, averageType) / MyStdDev(Typical, SedStd, averageType);
            k     = ThresholdLevel - sd;

            if (k > atrs)
            {
                BackColor = Color.MistyRose;
                DoNotTrade.Set(0);
            }

            Trending.Set(atrs);

            if (k >= 0)
            {
                Noise.Set(k);
            }
        }
Example #2
0
 public void Add(Trending value, NodeInstance nodeInstance)
 {
     using var context = new AutomaticaContext(_config);
     _logger.LogInformation($"Save trend for {nodeInstance.Name} ({nodeInstance.ObjId}) with value {value.Value}...");
     context.Add(value);
     context.SaveChanges();
 }
Example #3
0
        private void initObjectModels()
        {
            // initializing footer objects
            terms         = new Terms(browser);
            privacy       = new Privacy(browser);
            security      = new Security(browser);
            status        = new Status(browser);
            help          = new Help(browser);
            footerLogo    = new pageObjectModels.footer.Logo(browser);
            contactGitHub = new ContactGitHub(browser);
            api           = new API(browser);
            training      = new Training(browser);
            shop          = new Shop(browser);
            footerBlog    = new pageObjectModels.footer.Blog(browser);
            about         = new About(browser);

            // initializing explore objects
            integrations = new Integrations(browser);
            showcases    = new Showcases(browser);
            trending     = new Trending(browser);

            // initializing header objects
            headerLogo = new pageObjectModels.header.Logo(browser);
            personal   = new Personal(browser);
            openSource = new OpenSource(browser);
            business   = new Business(browser);
            explore    = new Explore(browser);
            pricing    = new Pricing(browser);
            headerBlog = new pageObjectModels.header.Blog(browser);
            support    = new Support(browser);
            searchBar  = new pageObjectModels.header.SearchBar(browser);
            signIn     = new SignIn(browser);
            signUp     = new SignUp(browser);

            // initializing main objects
            signUpUsername  = new SignUpUsername(browser);
            signUpEmail     = new SignUpEmail(browser);
            signUpPassword  = new SignUpPassword(browser);
            signUpSubmit    = new SignUpSubmit(browser);
            signUpForGitHub = new SignUpForGitHubButton(browser);

            // initializing pricing objects
            joinGitHubForFree    = new JoinGitHubForFree(browser);
            upgradeAccount       = new UpgradeAccount(browser);
            createOrganization   = new CreateOrganization(browser);
            startEnterpriseTrial = new StartEnterpriseTrial(browser);

            // initializing blog objects
            featured      = new Featured(browser);
            allPosts      = new AllPosts(browser);
            newFeatures   = new NewFeatures(browser);
            engineering   = new Engineering(browser);
            enterprise    = new Enterprise(browser);
            conferences   = new Conferences(browser);
            meetups       = new Meetups(browser);
            newHires      = new NewHires(browser);
            watercooler   = new Watercooler(browser);
            blogSearchBar = new pageObjectModels.blog.SearchBar(browser);
        }
        private void btnShowTrending_Click(object sender, RoutedEventArgs e)
        {
            //declare new trending window
            Trending tr = new Trending();

            //show trending window
            tr.ShowDialog();
        }
        private void btnQuit_Click(object sender, RoutedEventArgs e)
        {
            //create and show new trending window
            Trending tr = new Trending();

            tr.ShowDialog();
            //close window
            this.Close();
        }
Example #6
0
 public bool ToCsv(Trending trending)
 {
     try
     {
         string csv = $"{trending.Hashtags},{trending.NofHashtags.ToString()}";
         csv = csv + Environment.NewLine;
         File.AppendAllText(_csvFilePath, csv.ToString());
         return(true);
     }
     catch (Exception ex)
     {
         ErrorCode = ex.ToString();
         return(false);
     }
 }
        internal void SaveValue(NodeInstance instance, double value, string source)
        {
            var trending = new Trending
            {
                This2NodeInstance = instance.ObjId,
                Value             = value,
                Timestamp         = DateTime.UtcNow,
                Source            = source
            };

            trending.Source = source;
            try
            {
                Save(trending, instance);
            }
            catch (Exception e)
            {
                SystemLogger.Instance.LogError(e, "Error save trending value...");
            }
        }
        internal override void Save(Trending trend, NodeInstance nodeInstance)
        {
            var fileName = Path.Combine(ServerInfo.GetTrendingDirectory(), nodeInstance.ObjId + ".csv");

            lock (_lock)
            {
                var isNewFile = !File.Exists(fileName);

                using var file =
                          File.Open(fileName, FileMode.Append);
                using var streamWriter = new StreamWriter(file);

                if (isNewFile)
                {
                    streamWriter.WriteLine("Id,Name,Timestamp,Value,Source");
                }

                streamWriter.WriteLine($"{nodeInstance.ObjId},{nodeInstance.Name},{trend.TimestampIso},{trend.Value},{trend.Source}");
            }
        }
        //Processes Tweets
        private void ProcessTweet()
        {
            //Processes textspeak abbreviations and saves to ProcessedMessages.json
            Database.Textspeak_Abbreviations_Database.LoadTextspeakAbbreviations load = new Database.Textspeak_Abbreviations_Database.LoadTextspeakAbbreviations();

            var MessageHeaderText = MessageHeaderTextBox.ToString();
            var MessageBodyText   = MessageBodyTextBox.ToString();

            string[] splitMessageBodyText = MessageBodyTextBox.ToString().Split(' ');

            MessageBodyText = GetAbbreviations(MessageBodyText);

            MessagesProcessor msgProcessor = new MessagesProcessor()
            {
                msgType = MessageHeaderText,
                msgBody = MessageBodyText
            };

            File.AppendAllText("C:/VS Database/ProcessedMessages.json", JsonConvert.SerializeObject(msgProcessor));
            MessageBox.Show("Message Processed Successfully:" + Environment.NewLine + "Message Type - " + MessageHeaderText + Environment.NewLine + "Message Body - " + MessageBodyText);

            //Processes Mentions and saves to Mentions.csv
            Database.Mentions_Database.LoadMentionsFromFile load2 = new Database.Mentions_Database.LoadMentionsFromFile();
            Database.Mentions_Database.SaveMentionsToFile   save2 = new Database.Mentions_Database.SaveMentionsToFile();

            if (!load2.FromCSV())
            {
                MentionsList = new ObservableCollection <Mentions>();
            }
            else
            {
                MentionsList = new ObservableCollection <Mentions>(load2.MentionsList);

                var NofMentions = 0;
                for (int i = 2; i < splitMessageBodyText.Length; i++)
                {
                    var @char = splitMessageBodyText[i];
                    if (@char[0] == '@')
                    {
                        foreach (var Mentions in MentionsList)
                        {
                            if (Mentions.Users == splitMessageBodyText[i])
                            {
                                NofMentions = Mentions.NofUsers + 1;
                            }
                            else
                            {
                                NofMentions = 1;
                            }
                        }

                        Mentions mentions = new Mentions()
                        {
                            Users    = splitMessageBodyText[i],
                            NofUsers = NofMentions
                        };

                        if (!save2.ToCsv(mentions))
                        {
                            MessageBox.Show("Error while saving to mentions\n" + save2.ErrorCode);
                        }
                        else
                        {
                            save2 = null;
                        }
                    }
                }
            }

            //Processes Trending hashtags and adds it to Trending.csv
            Database.Trending_Database.LoadTrendingFromFile load3 = new Database.Trending_Database.LoadTrendingFromFile();
            Database.Trending_Database.SaveTrendingToFile   save3 = new Database.Trending_Database.SaveTrendingToFile();

            if (!load3.FromCSV())
            {
                TrendingList = new ObservableCollection <Trending>();
            }
            else
            {
                TrendingList = new ObservableCollection <Trending>(load3.TrendingList);

                var NofTrending = 0;
                for (int i = 2; i < splitMessageBodyText.Length; i++)
                {
                    var @char = splitMessageBodyText[i];
                    if (@char[0] == '#')
                    {
                        foreach (var Trending in TrendingList)
                        {
                            if (Trending.Hashtags == splitMessageBodyText[i])
                            {
                                NofTrending = Trending.NofHashtags + 1;
                            }
                            else
                            {
                                NofTrending = 1;
                            }
                        }

                        Trending trending = new Trending()
                        {
                            Hashtags    = splitMessageBodyText[i],
                            NofHashtags = NofTrending
                        };

                        if (!save3.ToCsv(trending))
                        {
                            MessageBox.Show("Error while saving to Trending\n" + save3.ErrorCode);
                        }
                        else
                        {
                            save2 = null;
                        }
                    }
                }
            }
        }
Example #10
0
 internal override void Save(Trending trend, NodeInstance nodeInstance)
 {
     Logger.LogInformation($"CloudLogger save is not implemented...");
 }
 internal override void Save(Trending trend, NodeInstance nodeInstance)
 {
     _databaseTrendingValueStore.Add(trend, nodeInstance);
 }
Example #12
0
        // Written, 02.12.2019

        static async Task Main(string[] args)
        {
            // Written, 02.12.2019

            Console.WriteLine("The Library v1.1 Trending Test\nEnter either, 'all', 'movie', 'tv' or 'person' to get trending items");
            string mediaTypeInput         = Console.ReadLine();
            bool   vaildTrendingMediaType = true;
            TrendingAllowedMediaTypesEnum trendMediaType = TrendingAllowedMediaTypesEnum.all;

            switch (mediaTypeInput)
            {
            case "all":
                trendMediaType = TrendingAllowedMediaTypesEnum.all;
                break;

            case "movie":
                trendMediaType = TrendingAllowedMediaTypesEnum.movie;
                break;

            case "tv":
                trendMediaType = TrendingAllowedMediaTypesEnum.tv;
                break;

            case "person":
                trendMediaType = TrendingAllowedMediaTypesEnum.person;
                break;

            default:
                vaildTrendingMediaType = false;
                break;
            }
            if (vaildTrendingMediaType)
            {
                Console.WriteLine("Enter either, 'day' or 'week' to get daily or weekly trending items.");
                string timeWindowInput      = Console.ReadLine();
                bool   vaildTimeWindowInput = true;
                TrendingTimeWindowEnum trendingTimeWindow = TrendingTimeWindowEnum.day;

                switch (timeWindowInput)
                {
                case "day":
                    trendingTimeWindow = TrendingTimeWindowEnum.day;
                    break;

                case "week":
                    trendingTimeWindow = TrendingTimeWindowEnum.week;
                    break;

                default:
                    vaildTimeWindowInput = false;
                    break;
                }
                if (vaildTimeWindowInput)
                {
                    Trending trending = await Trending.retrieveTrendingAsync(trendMediaType, trendingTimeWindow);

                    for (int i = 0; i < trending.trendingResults.GetLength(0); i++)
                    {
                        IdResultObject idResult = trending.trendingResults[i];

                        Console.Write("{0}.) [{1}]", i + 1, idResult.GetType().Name);

                        if (idResult is MediaSearchResult)
                        {
                            MediaSearchResult media = idResult as MediaSearchResult;
                            Console.Write(" | {0} ({1})", media.name, media.release_date);
                        }
                        else
                        {
                            if (idResult is PeopleSearchResult)
                            {
                                PersonResult person = await PersonResult.retrieveDetailsAsync(idResult.id);

                                Console.Write(" | {0} ({1})", person.name, person.birthday);
                            }
                        }
                        Console.WriteLine();
                    }
                }
                else
                {
                    Console.WriteLine("Error: Invaild time window input, '{0}'. Expecting either: 'day' or 'week'.", timeWindowInput);
                }
            }
            else
            {
                Console.WriteLine("Error: Invaild trend media type, '{0}'. Expecting one of: 'all', 'movie', 'tv' or 'person'.", mediaTypeInput);
            }
            Console.WriteLine("\n\nPress R to restart or press any key to exit");
            if (Console.ReadKey().Key == ConsoleKey.R)
            {
                Console.Clear();
                await Main(null);
            }
        }
 internal abstract void Save(Trending trend, NodeInstance nodeInstance);
 internal override void Save(Trending trend, NodeInstance nodeInstance)
 {
     LastTrending = trend;
 }