public void TestCalculateRealData() { TickerBLL tbll = new TickerBLL(_unit); List <Ticker> tList = tbll.GetTickerListByShareDB(1585, 0, 21100000); var input = new SMAIn(); input.Data = new SMAItem[tList.Count]; var i = 0; foreach (var t in tList) { input.Data[i] = new SMAItem(); input.Data[i].TradingDate = t.TradingDate; input.Data[i].iClose = t.Close; i++; } var setting = new SMASetting(); setting.Period = 50; setting.Offset = 0; Result res = new SMA().Calculate(input, setting); }
public void TestCalculateRealData() { TickerBLL tbll = new TickerBLL(_unit); List <Ticker> tList = tbll.GetTickerListByShareDB(1585, null, 21100000); double[] inputData = new double[tList.Count]; double[] h = new double[tList.Count]; double[] lo = new double[tList.Count]; double?[] k = new double?[tList.Count]; var i = 0; foreach (var t in tList) { inputData[i] = t.Close; h[i] = t.High; lo[i] = t.Low; i++; } WilliamR.Calculate(inputData, h, lo, 14, k); }
public void TestCalculate() { TickerBLL tbll = new TickerBLL(_unit); List <Ticker> tList = tbll.GetTickerListByShareDB(1585, 20160401, 21100000); double[] o = new double[tList.Count]; double[] h = new double[tList.Count]; double[] l = new double[tList.Count]; double[] c = new double[tList.Count]; double?[] oo = new double?[tList.Count]; double?[] oh = new double?[tList.Count]; double?[] ol = new double?[tList.Count]; double?[] oc = new double?[tList.Count]; var i = 0; foreach (var t in tList) { o[i] = t.Open; h[i] = t.High; l[i] = t.Low; c[i] = t.Close; i++; } Result res = HeikinAshi.Calculate(o, c, h, l, oo, oc, oh, ol); }
public IHttpActionResult Get(int id, int start = 0, int end = 0, string indicator = "") { int MINI_TICKER = 30; TickerViewModel tickerVM = new TickerViewModel(); List <Ticker> tickerList = null; IndicatorBLL iBLL = new IndicatorBLL(_unit); try { if (end == 0) { end = DateHelper.DateToInt(DateTime.Now); } tickerList = new TickerBLL(_unit).GetTickerListByShareDB(id, start, end); // Load indicators tickerVM.TickerList = tickerList; if (!string.IsNullOrEmpty(indicator) && tickerList.Count >= MINI_TICKER) { tickerVM.Indicators = iBLL.GetIndicators(tickerList, indicator); } } catch (Exception ex) { LogHelper.Error(_log, ex.ToString()); return(InternalServerError(ex)); } return(Ok(tickerVM)); }
public IHttpActionResult GetLatestByZone(int shareId, int?zoneId) { Ticker t = null; try { if (!zoneId.HasValue) { t = new TickerBLL(_unit).GetLastTicker(shareId, null); } else { var z = new ZoneBLL(_unit).GetByID(zoneId.Value); t = new TickerBLL(_unit).GetLastTicker(shareId, z.TradingDate); } } catch (Exception ex) { LogHelper.Error(_log, ex.ToString()); return(InternalServerError(ex)); } return(Ok(t)); }
public async void TestHeikinAshi() { TickerBLL bll = new TickerBLL(this.s3_bucket_name, this.tempTickerFolder); List <TickerEntity> tList = await bll.GetDailyTickerEntityList("ORG", 20191001, 20191101); double[] o = new double[tList.Count]; double[] h = new double[tList.Count]; double[] l = new double[tList.Count]; double[] c = new double[tList.Count]; double?[] oo = new double?[tList.Count]; double?[] oh = new double?[tList.Count]; double?[] ol = new double?[tList.Count]; double?[] oc = new double?[tList.Count]; var i = 0; foreach (var t in tList) { o[i] = t.O; h[i] = t.H; l[i] = t.L; c[i] = t.C; i++; } Result res = HeikinAshi.Calculate(o, c, h, l, oo, oc, oh, ol); Console.WriteLine(ObjectHelper.ToJson(oo)); }
public async void TestMACD() { TickerBLL bll = new TickerBLL(this.s3_bucket_name, this.tempTickerFolder); List <TickerEntity> tList = await bll.GetDailyTickerEntityList("ORG", 20181001, 20191101); double[] inputData = new double[tList.Count]; var i = 0; foreach (var t in tList) { inputData[i] = t.C; i++; } double?[] m = new double?[tList.Count]; double?[] s = new double?[tList.Count]; double?[] h = new double?[tList.Count]; Result res = MACD.Calculate(inputData, 26, 12, 9, m, s, h); var tArray = tList.ToArray(); for (int j = 0; j < tList.Count; j++) { Console.WriteLine($"{tArray[j].T} {tArray[j].P} O: {tArray[j].O} H: {tArray[j].H} L: {tArray[j].L} C: {tArray[j].C} M: {m[j]} S: {s[j]} H: {h[j]} "); } }
public void TestCalculateRealData() { TickerBLL tbll = new TickerBLL(_unit); List <Ticker> tList = tbll.GetTickerListByShareDB(1585, null, 21100000); double[] close = new double[tList.Count]; double[] h = new double[tList.Count]; double[] lo = new double[tList.Count]; double?[] adx = new double?[tList.Count]; double?[] diPlus = new double?[tList.Count]; double?[] diMinus = new double?[tList.Count]; var i = 0; foreach (var t in tList) { close[i] = t.Close; h[i] = t.High; lo[i] = t.Low; i++; } ADX.Calculate(h, lo, close, diPlus, diMinus, adx); }
public void Test_GetDailyShareTickerFromYahoo() { TickerBLL tbll = new TickerBLL(_unit); var result = tbll.GetDailyShareTickerFromYahoo("org.ax", DateTime.Now.AddDays(-20), DateTime.Now); var resultString = XMLHelper.SerializeObject <List <Ticker> >(result); }
public void Test_GetTickerListByShareDB() { TickerBLL tBll = new TickerBLL(_unit); var tickerList = tBll.GetTickerListByShareDB(1585, 20100101, 20160320); tickerList = tBll.GetTickerListByShareDB(1585, 20100101, null); }
public IHttpActionResult GetLatestDate(int shareID) { TickerBLL tbll = new TickerBLL(_unit); var latestDate = tbll.GetLatestTradingDateByShareZone(shareID, null); return(Ok(latestDate)); }
public void TestLoadAsxRawFromAzure() { TickerBLL tBll = new TickerBLL(_unit, null); int tradingDate = DateHelper.DateToInt(DateTime.Now); tBll.UpdateDailyShareTickerBatchToday(tradingDate.ToString()); }
protected void WallPost(string post) { UserBO objUser = new UserBO(); objUser = UserBLL.getUserByUserId(Userid); WallBO objWall = new WallBO(); objWall.PostedByUserId = Userid; objWall.WallOwnerUserId = Userid; objWall.FirstName = objUser.FirstName; objWall.LastName = objUser.LastName; objWall.Post = post; objWall.AddedDate = DateTime.Now; objWall.Type = Global.PROFILE_CHANGE; string wid = WallBLL.insertWall(objWall); ////////////////////////////////////TICKER CODE ////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// List <UserFriendsBO> listtag = FriendsBLL.getAllFriendsListName(Session["UserId"].ToString(), Global.CONFIRMED); //get the education,hometown and employer of people in list foreach (UserFriendsBO Useritem in listtag) { TickerBO objTicker = new TickerBO(); objTicker.PostedByUserId = objWall.PostedByUserId; objTicker.TickerOwnerUserId = Useritem.FriendUserId; objTicker.FirstName = objWall.FirstName; objTicker.LastName = objWall.LastName; objTicker.Post = objWall.Post; objTicker.Title = objWall.Post; objTicker.AddedDate = DateTime.UtcNow; objTicker.Type = objWall.Type; objTicker.EmbedPost = objWall.EmbedPost; objTicker.WallId = wid; TickerBLL.insertTicker(objTicker); } TickerBO objTickerUserTag = new TickerBO(); objTickerUserTag.PostedByUserId = Session["UserId"].ToString(); objTickerUserTag.TickerOwnerUserId = Session["UserId"].ToString(); objTickerUserTag.FirstName = objUser.FirstName; objTickerUserTag.LastName = objUser.LastName; objTickerUserTag.Post = objWall.Post; objTickerUserTag.Title = objWall.Post; objTickerUserTag.AddedDate = DateTime.UtcNow; objTickerUserTag.Type = objWall.Type; objTickerUserTag.EmbedPost = objWall.EmbedPost; objTickerUserTag.WallId = wid; TickerBLL.insertTicker(objTickerUserTag); //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// }
public void Test_GetIndicators() { IndicatorBLL iBLL = new IndicatorBLL(_unit); TickerBLL tBll = new TickerBLL(_unit); var tickerList = tBll.GetTickerListByShareDB(1585, 20100101, 20160520); iBLL.GetIndicators(tickerList, "sma,10|ema,20"); }
public async void TestGetDailyTickerEntityList() { string tempTickerFolder = "/tmp/screen3_temp_files/localticker/"; TickerBLL bll = new TickerBLL(this.s3_bucket_name, tempTickerFolder); await bll.GetDailyTickerEntityList("ANZ"); await bll.GetDailyTickerEntityList("SUN"); }
public void Test_UpdateDailyShareTicker_FromAsxEod_DB() { TickerBLL tBll = new TickerBLL(_unit); ShareBLL sBll = new ShareBLL(_unit); Share s = sBll.GetShareBySymbol("ORG.AX"); tBll.UpdateDailyShareTicker(s); }
protected void lbtnDelete_Click(object sender, EventArgs e) { GridViewRow row = ((GridViewRow)((LinkButton)sender).NamingContainer); HiddenField hfId = (HiddenField)row.FindControl("HiddenFieldWallId"); WallBLL.deleteWall(hfId.Value); HiddenField hfTId = (HiddenField)row.FindControl("HiddenFieldId"); TickerBLL.deleteTicker(hfTId.Value); }
public void Test_SearchShareDayTicker() { var tickerLast = new TickerBLL(_unit).GetLastTicker(1585, null); IndicatorBLL iBLL = new IndicatorBLL(_unit); if (tickerLast != null) { iBLL.SearchShareDayTicker(tickerLast.TradingDate, tickerLast.TradingDate); } }
public async void TestGetTickerFromEmail() { string tempTickerFolder = "/tmp/screen3_temp_files/localticker/"; TickerBLL bll = new TickerBLL(this.s3_bucket_name, tempTickerFolder); string emailAccount = Environment.GetEnvironmentVariable("SCREEN3_TICKER_EMAIL_ACCOUNT"); string emailPwd = Environment.GetEnvironmentVariable("SCREEN3_TICKER_EMAIL_PWD"); string bucketName = Environment.GetEnvironmentVariable("SCREEN3_S3_BUCKET"); await bll.GetTickerFromEmail(emailAccount, emailPwd, bucketName); }
public void Test_GetLastTicker() { TickerBLL tBll = new TickerBLL(_unit); ShareBLL sBLL = new ShareBLL(_unit); Share s = sBLL.GetShareBySymbol("ORG.AX"); var ticker = tBll.GetLastTicker(s.Id, null); s = sBLL.GetShareBySymbol("1PG.AX"); ticker = tBll.GetLastTicker(s.Id, null); }
public void TestSaveTickers() { TickerBLL bll = new TickerBLL(this.s3_bucket_name, this.tempTickerFolder); List <TickerEntity> tickerList = new List <TickerEntity>(); tickerList.Add(new TickerEntity { T = "CLL", P = 20081201, O = (float)66.01, H = (float)77.01, L = (float)999.0, C = (float)12.1, V = 123124 }); tickerList.Add(new TickerEntity { T = "CLL", P = 20071201, O = (float)111111.01, H = (float)11111.01, L = (float)111.0, C = (float)111.1, V = 123124 }); tickerList.Add(new TickerEntity { T = "CLL", P = 20091212, O = (float)33.01, H = (float)199.01, L = (float)13.0, C = (float)13.1, V = 2346 }); tickerList.Add(new TickerEntity { T = "CLL", P = 20081202, O = (float)33.01, H = (float)99.01, L = (float)13.0, C = (float)13.1, V = 2346 }); bll.SaveTickersToS3("CLL", tickerList, true).Wait(); }
public void Test_GetTickerListByShareDB_Full_AllShares() { ShareBLL sBll = new ShareBLL(_unit); TickerBLL tBll = new TickerBLL(_unit); var shareList = sBll.GetList().ToList(); foreach (var s in shareList) { var tickerList = tBll.GetTickerListByShareDB(s.Id, null, null); Debug.WriteLine("share {0} {1}", s.Id, tickerList.Count); } }
public void LoadTickers_Should_Return_False() { var mock = new Mock <TickerLoader>() { CallBase = true }; mock.Setup(loader => loader.UploadAsxEodRaw()).Returns(false); TickerBLL bll = new TickerBLL(null, "testConnectionString"); var result = bll.LoadTickers(mock.Object); Assert.IsFalse(result); }
public IHttpActionResult GetLatest(int shareId) { Ticker t = null; try { t = new TickerBLL(_unit).GetLastTicker(shareId, null); } catch (Exception ex) { LogHelper.Error(_log, ex.ToString()); return(InternalServerError(ex)); } return(Ok(t)); }
public IHttpActionResult GetVerificationList(int shareId, int tradingDate, int count) { List <Ticker> t = null; try { t = new TickerBLL(_unit).GetTickerListByDate(shareId, tradingDate, count); } catch (Exception ex) { LogHelper.Error(_log, ex.ToString()); return(InternalServerError(ex)); } return(Ok(t)); }
public IHttpActionResult GetTickerByDate(int shareId, int tradingDate) { Ticker t = null; try { t = new TickerBLL(_unit).GetTickerByDate(shareId, tradingDate); } catch (Exception ex) { LogHelper.Error(_log, ex.ToString()); return(InternalServerError(ex)); } return(Ok(t)); }
public static void post(PostProperties post) { UserBO objUser = UserBLL.getUserByUserId(SessionClass.getUserId()); WallBO objWall = new WallBO(); objWall.WallOwnerUserId = post.WallOwnerUserId; objWall.PostedByUserId = post.PostedByUserId; objWall.FirstName = objUser.FirstName; objWall.LastName = objUser.LastName; objWall.Post = post.PostText; objWall.EmbedPost = post.EmbedPost; objWall.AddedDate = DateTime.Now; objWall.Type = post.PostType; string wid = WallBLL.insertWall(objWall); List <UserFriendsBO> listtag = FriendsBLL.getAllFriendsListName(SessionClass.getUserId(), Global.CONFIRMED); //get the education,hometown and employer of people in list foreach (UserFriendsBO Useritem in listtag) { TickerBO objTicker = new TickerBO(); objTicker.PostedByUserId = objWall.PostedByUserId; objTicker.TickerOwnerUserId = Useritem.FriendUserId; objTicker.FirstName = objWall.FirstName; objTicker.LastName = objWall.LastName; objTicker.Post = objWall.Post; objTicker.Title = Global.SHARE_A_POST; objTicker.AddedDate = DateTime.UtcNow; objTicker.Type = objWall.Type; objTicker.EmbedPost = objWall.EmbedPost; objTicker.WallId = wid; TickerBLL.insertTicker(objTicker); } TickerBO objTickerUserTag = new TickerBO(); objTickerUserTag.PostedByUserId = SessionClass.getUserId(); objTickerUserTag.TickerOwnerUserId = SessionClass.getUserId(); objTickerUserTag.FirstName = objUser.FirstName; objTickerUserTag.LastName = objUser.LastName; objTickerUserTag.Post = objWall.Post; objTickerUserTag.Title = Global.SHARE_A_POST; objTickerUserTag.AddedDate = DateTime.UtcNow; objTickerUserTag.Type = objWall.Type; objTickerUserTag.EmbedPost = objWall.EmbedPost; objTickerUserTag.WallId = wid; TickerBLL.insertTicker(objTickerUserTag); }
public void TestCalculateRealData() { TickerBLL tbll = new TickerBLL(_unit); List <Ticker> tList = tbll.GetTickerListByShareDB(1585, null, 21100000); double[] inputData = new double[tList.Count]; double?[] outData = new double?[tList.Count]; var i = 0; foreach (var t in tList) { inputData[i] = t.Close; i++; } Result res = RSI.Calculate(inputData, 14, outData); }
public async Task ProcessSourceFile(S3Object fileInfo) { LambdaLogger.Log($"About to download file, {fileInfo.Key}\n"); String resultFileName = await this.DownloadFileAsync(fileInfo.BucketName, fileInfo.Key, this.Temp_Folder + "originSourceFiles/"); string dailyTargetFolder = this.Temp_Folder + $"originExtractedFiles/{fileInfo.Key}/"; LambdaLogger.Log($"Download file, {fileInfo.Key}, about to extract to {dailyTargetFolder}.\n"); List <String> dailyFileList = this.ExtractIntoDayData(resultFileName, dailyTargetFolder); LambdaLogger.Log($"Extracted files done. items {dailyFileList.Count} \n"); foreach (string path in dailyFileList) { this.AddDailyFileIntoStockDict(path); } TickerBLL bll = new TickerBLL(this.S3_Bucket_Name, this.Temp_Folder); // save tickers into S3 foreach (KeyValuePair <string, List <TickerEntity> > tickerGroup in this.stockDict) { await bll.SaveTickersToS3(tickerGroup.Key, tickerGroup.Value, true); LambdaLogger.Log($"Save to S3 for {tickerGroup.Key} with items {tickerGroup.Value.Count} \n"); } // move file to archive S3Service service = new S3Service(); string archiveKey = fileInfo.Key.Replace("source", "archive"); await service.CopyObject(this.S3_Bucket_Name, fileInfo.Key, this.S3_Bucket_Name, archiveKey); await service.DeleteObject(this.S3_Bucket_Name, fileInfo.Key); // about to clean things File.Delete(resultFileName); FileHelper.ClearDirectory(this.Temp_Folder + $"originExtractedFiles/", true); this.stockDict = new Dictionary <string, List <TickerEntity> >(); LambdaLogger.Log("Temp folder cleared"); }
////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////// protected void lbtnFeedDetail_Click(object sender, EventArgs e) { GridViewRow row = ((GridViewRow)((LinkButton)sender).NamingContainer); PopupControlExtender pce = row.FindControl("PopupControlExtenderTicker") as PopupControlExtender; ImageButton imbtnPhoto = (ImageButton)row.FindControl("imbtnPhoto"); ImageButton imbtnVideo = (ImageButton)row.FindControl("imbtnVideo"); HiddenField hfId = (HiddenField)row.FindControl("HiddenFieldId"); HiddenField hfWallId = (HiddenField)row.FindControl("HiddenFieldWallId"); TickerBO objClass = new TickerBO(); objClass = TickerBLL.getTickerByTickerId(hfId.Value); string sValue = hfWallId.Value; GridView gridviewComments = (GridView)row.FindControl("GridViewComments"); //LinkButton btn = (LinkButton)gvr.FindControl("LinkButton2"); WallBO objWall = new WallBO(); objWall = WallBLL.getWallByWallId(sValue); if (objWall.Type == Global.PHOTO || objWall.Type == Global.TAG_PHOTO) { imbtnPhoto.ImageUrl = "../../Resources/ThumbnailPhotos/" + objClass.EmbedPost + ".jpg"; imbtnPhoto.Visible = true; } if (objWall.Type == Global.VIDEO || objWall.Type == Global.TAG_VIDEO || objWall.Type == Global.POST_VIDEOLINK || objWall.Type == Global.TAG_VIDEOLINK) { imbtnVideo.Visible = true; } YouLikes(row); CountShare(row); gridviewComments.DataSource = CommentsDAL.getCommentsTop(Global.WALL, sValue, 2); gridviewComments.DataBind(); Comment_YouLikes(row); pce.DataBind(); }