public bool downloadIntraday(string folderPath, string scriptName, bool bIsTestOn, bool bSaveData) { string interval = ddlIntraday_Interval.SelectedValue; string outputsize = ddlIntraday_outputsize.SelectedValue; if (StockApi.getIntraday(folderPath, scriptName, time_interval: interval, outputsize: outputsize, bIsTestModeOn: bIsTestOn, bSaveData: bSaveData, apiKey: Session["ApiKey"].ToString()) == null) { Response.Write("<script language=javascript>alert('Intraday data not available for selected script.')</script>"); return(false); } return(true); }
public void ShowGraph(string scriptName) { string folderPath = Server.MapPath("~/scriptdata/"); bool bIsTestOn = true; DataTable scriptData = null; DataTable tempData = null; string expression = ""; string outputSize = ""; string interval = ""; string fromDate = "", toDate = ""; DataRow[] filteredRows = null; if (ViewState["FetchedData"] == null) { if (Session["IsTestOn"] != null) { bIsTestOn = System.Convert.ToBoolean(Session["IsTestOn"]); } if (Session["TestDataFolder"] != null) { folderPath = Session["TestDataFolder"].ToString(); } if ((Request.QueryString["size"] != null) && (Request.QueryString["interval"] != null)) { outputSize = Request.QueryString["size"].ToString(); interval = Request.QueryString["interval"]; scriptData = StockApi.getIntraday(folderPath, scriptName, time_interval: interval, outputsize: outputSize, bIsTestModeOn: bIsTestOn, bSaveData: false); } ViewState["FetchedData"] = scriptData; } else { if (ViewState["FromDate"] != null) { fromDate = ViewState["FromDate"].ToString(); } if (ViewState["ToDate"] != null) { toDate = ViewState["ToDate"].ToString(); } if ((fromDate.Length > 0) && (toDate.Length > 0)) { tempData = (DataTable)ViewState["FetchedData"]; expression = "Date >= '" + fromDate + "' and Date <= '" + toDate + "'"; filteredRows = tempData.Select(expression); if ((filteredRows != null) && (filteredRows.Length > 0)) { scriptData = filteredRows.CopyToDataTable(); } } else { scriptData = (DataTable)ViewState["FetchedData"]; } } if (scriptData != null) { chartintraGraph.DataSource = scriptData; chartintraGraph.DataBind(); chartintraGraph.ChartAreas[0].AxisX.LabelStyle.Format = "g"; if (checkBoxOpen.Checked) { showOpenLine(scriptData); } if (checkBoxHigh.Checked) { showHighLine(scriptData); } if (checkBoxLow.Checked) { showLowLine(scriptData); } if (checkBoxClose.Checked) { showCloseLine(scriptData); } if (checkBoxCandle.Checked) { showCandleStickGraph(scriptData); } if (checkBoxVolume.Checked) { showVolumeGraph(scriptData); } if (checkBoxGrid.Checked) { GridViewDaily.Visible = true; GridViewDaily.DataSource = scriptData; GridViewDaily.DataBind(); } } }
public void ShowGraph(string scriptName) { string folderPath = Server.MapPath("~/scriptdata/"); bool bIsTestOn = true; DataTable intraData = null; DataTable vwapData = null; DataTable tempData = null; string expression = ""; string outputSize = ""; string interval_intra = ""; string interval_vwap = ""; string fromDate = "", toDate = ""; DataRow[] filteredRows = null; if ((ViewState["FetchedDataIntra"] == null) || (ViewState["FetchedDataVWAP"] == null)) { if (Session["IsTestOn"] != null) { bIsTestOn = System.Convert.ToBoolean(Session["IsTestOn"]); } if (Session["TestDataFolder"] != null) { folderPath = Session["TestDataFolder"].ToString(); } if ((Request.QueryString["size"] != null) && (Request.QueryString["interval_intra"] != null)) { outputSize = Request.QueryString["size"].ToString(); interval_intra = Request.QueryString["interval_intra"]; intraData = StockApi.getIntraday(folderPath, scriptName, time_interval: interval_intra, outputsize: outputSize, bIsTestModeOn: bIsTestOn, bSaveData: false); ViewState["FetchedDataIntra"] = intraData; } else { ViewState["FetchedDataIntra"] = null; intraData = null; } if (Request.QueryString["interval_vwap"] != null) { interval_vwap = Request.QueryString["interval_vwap"]; vwapData = StockApi.getVWAP(folderPath, scriptName, day_interval: interval_vwap, bIsTestModeOn: bIsTestOn, bSaveData: false); ViewState["FetchedDataVWAP"] = vwapData; } else { ViewState["FetchedDataVWAP"] = null; vwapData = null; } } else { if (ViewState["FromDate"] != null) { fromDate = ViewState["FromDate"].ToString(); } if (ViewState["ToDate"] != null) { toDate = ViewState["ToDate"].ToString(); } if ((fromDate.Length > 0) && (toDate.Length > 0)) { tempData = (DataTable)ViewState["FetchedDataIntra"]; expression = "Date >= '" + fromDate + "' and Date <= '" + toDate + "'"; filteredRows = tempData.Select(expression); if ((filteredRows != null) && (filteredRows.Length > 0)) { intraData = filteredRows.CopyToDataTable(); } tempData.Clear(); tempData = null; tempData = (DataTable)ViewState["FetchedDataVWAP"]; expression = "Date >= '" + fromDate + "' and Date <= '" + toDate + "'"; filteredRows = tempData.Select(expression); if ((filteredRows != null) && (filteredRows.Length > 0)) { vwapData = filteredRows.CopyToDataTable(); } } else { intraData = (DataTable)ViewState["FetchedDataIntra"]; vwapData = (DataTable)ViewState["FetchedDataVWAP"]; } } if ((intraData != null) && (vwapData != null)) { showCandleStickGraph(intraData); showVWAP(vwapData); } }