File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ class AVTimeSeriesReader(AlphaVantage):
39
39
"TIME_SERIES_MONTHLY" : "Monthly Time Series" ,
40
40
"TIME_SERIES_MONTHLY_ADJUSTED" : "Monthly Adjusted Time Series" ,
41
41
"TIME_SERIES_INTRADAY" : "Time Series (1min)" ,
42
+ "FX_DAILY" : "Time Series FX (Daily)" ,
42
43
}
43
44
44
45
def __init__ (
@@ -77,6 +78,10 @@ def function(self):
77
78
def intraday (self ):
78
79
return True if self .function == "TIME_SERIES_INTRADAY" else False
79
80
81
+ @property
82
+ def forex (self ):
83
+ return True if self .function == "FX_DAILY" else False
84
+
80
85
@property
81
86
def output_size (self ):
82
87
""" Used to limit the size of the Alpha Vantage query when
@@ -92,13 +97,17 @@ def data_key(self):
92
97
@property
93
98
def params (self ):
94
99
p = {
95
- "symbol" : self .symbols ,
96
100
"function" : self .function ,
97
101
"apikey" : self .api_key ,
98
102
"outputsize" : self .output_size ,
99
103
}
100
104
if self .intraday :
101
105
p .update ({"interval" : "1min" })
106
+ if self .forex :
107
+ p .update ({"from_symbol" : self .symbols .split ("/" )[0 ]})
108
+ p .update ({"to_symbol" : self .symbols .split ("/" )[1 ]})
109
+ else :
110
+ p .update ({"symbol" : self .symbols })
102
111
return p
103
112
104
113
def _read_lines (self , out ):
Original file line number Diff line number Diff line change @@ -361,6 +361,7 @@ def DataReader(
361
361
"yahoo-actions" ,
362
362
"yahoo-dividends" ,
363
363
"av-forex" ,
364
+ "av-forex-daily" ,
364
365
"av-daily" ,
365
366
"av-daily-adjusted" ,
366
367
"av-weekly" ,
@@ -567,6 +568,18 @@ def DataReader(
567
568
api_key = api_key ,
568
569
).read ()
569
570
571
+ elif data_source == "av-forex-daily" :
572
+ return AVTimeSeriesReader (
573
+ symbols = name ,
574
+ function = "FX_DAILY" ,
575
+ start = start ,
576
+ end = end ,
577
+ retry_count = retry_count ,
578
+ pause = pause ,
579
+ session = session ,
580
+ api_key = api_key ,
581
+ ).read ()
582
+
570
583
elif data_source == "av-daily" :
571
584
return AVTimeSeriesReader (
572
585
symbols = name ,
You can’t perform that action at this time.
0 commit comments