@@ -43,9 +43,9 @@ const Analytics = () => {
43
43
const fetchStock = async ( ) => {
44
44
const API_KEY = process . env . API_KEY_FOR_ST_DATA_AND_ST_TOCKEN
45
45
const Stock_Symbol = inputValue ;
46
- // const Stock_Symbol = "POLYPLEX.BSE "
46
+ // const Stock_Symbol = "APPH.DEX "
47
47
console . log ( Stock_Symbol ) ;
48
- const API_Call_Stock = `https://www.alphavantage.co/query?function=TIME_SERIES_DAILY_ADJUSTED &symbol=${ Stock_Symbol } &outputsize=full&apikey=${ API_KEY } ` ;
48
+ const API_Call_Stock = `https://www.alphavantage.co/query?function=TIME_SERIES_WEEKLY_ADJUSTED &symbol=${ Stock_Symbol } &outputsize=full&apikey=${ API_KEY } ` ;
49
49
try {
50
50
const res_stock = await fetch ( API_Call_Stock ) ;
51
51
const data_stock = await res_stock . json ( ) ;
@@ -56,17 +56,18 @@ const Analytics = () => {
56
56
const stockChartOpenValues = [ ] ;
57
57
const stockChartCloseValues = [ ] ;
58
58
59
- for ( let key in data_stock [ "Time Series (Daily)" ] ) {
60
- if ( key >= "2020-01-01" ) {
59
+ for ( let key in data_stock [ "Weekly Adjusted Time Series" ] ) {
60
+ if ( key >= "2019-01-01" ) {
61
+ // console.log("Valid date key:", key);
61
62
stockChartXValuesFunction . push ( key ) ;
62
63
stockChartYValuesFunction . push (
63
- data_stock [ "Time Series (Daily) " ] [ key ] [ "4. close" ]
64
+ data_stock [ "Weekly Adjusted Time Series" ] [ key ] [ "4. close" ]
64
65
) ;
65
66
stockChartOpenValues . push (
66
- data_stock [ "Time Series (Daily) " ] [ key ] [ "1. open" ]
67
+ data_stock [ "Weekly Adjusted Time Series" ] [ key ] [ "1. open" ]
67
68
) ;
68
69
stockChartCloseValues . push (
69
- data_stock [ "Time Series (Daily) " ] [ key ] [ "4. close" ]
70
+ data_stock [ "Weekly Adjusted Time Series" ] [ key ] [ "4. close" ]
70
71
) ;
71
72
}
72
73
}
@@ -95,7 +96,7 @@ const Analytics = () => {
95
96
if ( noHikeDay === false ) {
96
97
console . log ( "no data with given hike" ) ;
97
98
}
98
- // console.log(stockChartYValuesFunction);
99
+ console . log ( stockChartYValuesFunction ) ;
99
100
setStockChartXValues ( stockChartXValuesFunction ) ;
100
101
setStockChartYValues ( stockChartYValuesFunction ) ;
101
102
setStockChartColors ( stockChartColors ) ;
0 commit comments