public async Task <ActionResult> PostScreenRequest_ADX(string code, [FromBody] dynamic requestBody, string type = "day", int start = 0, int end = 0)
        {
            JsonElement rootElement = requestBody;

            string name = rootElement.GetProperty("name").GetString();

            this.screenBLL = ScreenFactory.GetScreenFunction(name, this.s3_bucket_name, this.local_temp_folder);

            Dictionary <string, object> options = new Dictionary <string, object>();

            JsonElement el;

            if (rootElement.TryGetProperty("OFFSET", out el))
            {
                options.Add("OFFSET", el.GetDouble());
            }

            if (rootElement.TryGetProperty("DIRECTION", out el))
            {
                options.Add("DIRECTION", el.GetString());
            }

            List <ScreenResultEntity> matchedResult = new List <ScreenResultEntity>();

            try
            {
                matchedResult = await this.screenBLL.DoScreen(code.ToUpper(), type, start, end, options);
            }
            catch (Exception ex)
            {
                Console.WriteLine($"error occurs {code} {type} {start} {end} \n {rootElement.GetRawText()} \n {ex.ToString()}");
            }

            return(Ok(matchedResult));
        }
예제 #2
0
        public async void TestGetEntryMatchTickersFromFactory_ADX()
        {
            var screenObj = ScreenFactory.GetScreenFunction("Screen_ADX", this.s3_bucket_name, this.tempTickerFolder);
            await screenObj.DoScreen("SUN");

            var result = screenObj.GetEntryMatchTickers(new Dictionary <string, object> {
                { "OFFSET", 5 },
                { "DIRECTION", "SELL" }
            });

            Console.WriteLine("result: " + ObjectHelper.ToJson(result));
        }
        public async void TestGetEntryMatchTickersFromFactory()
        {
            var screenObj = ScreenFactory.GetScreenFunction("Screen_MACD_William", this.s3_bucket_name, this.tempTickerFolder);
            await screenObj.DoScreen("SUN");

            var result = screenObj.GetEntryMatchTickers(new Dictionary <string, object> {
                { "WILLIAM_BUY_LEVEL", -80 },
                { "WILLIAM_SELL_LEVEL", -20 },
                { "DECLUSTER", 2 },
                { "DIRECTION", "SELL" }
            });

            Console.WriteLine("result: " + ObjectHelper.ToJson(result));
        }