-
Notifications
You must be signed in to change notification settings - Fork 0
/
StockAPIFactory.py
36 lines (29 loc) · 1.34 KB
/
StockAPIFactory.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
"""
Builds the appropriate StockAPICallers based on input from the Controller.
@author: sgb
"""
from AlphaVantage.AlphaVantage import AlphaVantage
from Briefing.Briefing import Briefing
from GuruFocus.GuruFocus import GuruFocus
from Intrinio.Intrinio import Intrinio
from Zacks.Zacks import Zacks
class StockAPIFactory:
def getAPI(self, apiArgs, dataRequest):
if apiArgs.__contains__('gurufocus'):
return GuruFocus(credentials = apiArgs.get('gurufocus'),
dataRequest = dataRequest)
elif apiArgs.__contains__('intrinio'):
return Intrinio(credentials = apiArgs.get('intrinio'),
dataRequest = dataRequest)
elif apiArgs.__contains__('alphavantage'):
return AlphaVantage(credentials = apiArgs.get('alphavantage'),
dataRequest = dataRequest)
elif apiArgs.__contains__('zacks'):
return Zacks(dataRequest = dataRequest)
elif apiArgs.__contains__('briefing'):
return Briefing(credentials = apiArgs.get('briefing'),
dataRequest = dataRequest)
else:
raise Exception('Currently only ' +
'Intrinio, AlphaVantage, GuruFocus, and Zacks ' +
'APIs are supported.')