stockdaq.acquisiter.acquisiter.Acquisiter¶
-
class
stockdaq.acquisiter.acquisiter.Acquisiter(stocklist, api_config_path, apikey_dict, api_list=['Alpha Vantage'], frequency='intraday', root_dir='./', file_structure=['symbol', 'frequency', 'data'], rolling=False, api_call_interval=12, database_update_interval=86400)¶ Bases:
objectData Acquisiter
- Parameters
stocklist (list of str) – List of symbols of stocks of interest.
apikey_dict (dict) – A dictionary of API keys in {“api”:”key”} pairs.
api_list (list of str, optional) – List of APIs, in preferred order. Options are [“Alpha Vantage”,]
root_dir (str, optional) – The root directory of the database.
frequency (str, optional) – “intraday”, “daily”, “weekly”, “monthly” Options are [“intraday”].
file_structure (list of str, optional) – How to set up parent/child folders. Defaults to [“symbol”, “frequency”, “data”].
-
stocklist¶ List of symbols of stocks of interest.
- Type
list of str
-
apikey_dict¶ A dictionary of API keys in {“api”:”key”} pairs.
- Type
dict
-
api_list¶ List of APIs, in preferred order. Options are [“Alpha Vantage”,]
- Type
list of str, optional
-
root_dir¶ The root directory of the database.
- Type
str, optional
-
frequency¶ “intraday”, “daily”, “weekly”, “monthly” Options are [“intraday”].
- Type
str, optional
-
file_structure¶ How to set up parent/child folders. Defaults to [“symbol”, “frequency”, “data”].
- Type
list of str, optional
-
__init__(stocklist, api_config_path, apikey_dict, api_list=['Alpha Vantage'], frequency='intraday', root_dir='./', file_structure=['symbol', 'frequency', 'data'], rolling=False, api_call_interval=12, database_update_interval=86400)¶ Constructor
- Parameters
stocklist (list of str) – List of symbols of stocks of interest.
api_config_path (str) – Path to the API configuration file.
apikey_dict (dict) – A dictionary of API keys in {“api”:”key”} pairs.
api_list (list of str, optional) – List of APIs, in preferred order. Options are [“Alpha Vantage”,]
root_dir (str, optional) – The root directory of the database.
frequency (str, optional) – “intraday”, “daily”, “weekly”, “monthly” Options are [“intraday”].
file_structure (list of str, optional) – How to set up parent/child folders. Defaults to [“symbol”, “frequency”, “data”].
rolling (boolean, optional) – Rolling update. Rate limited by API requestion limitations set in the API configuration file. Defaults to be False.
api_call_interval (int, optional) – Minimal delay (seconds) between API calls. Use your API’s limitation to derive this value. Defaults to 12.
database_update_interval (int, optional) – Interval (seconds) between each database update. Defaults to 86400 (1 day).
Methods
__init__(stocklist, api_config_path, apikey_dict)Constructor
get_prefix(symbol)Get path prefix for a specific data.
update_database([download_kwargs, export_kwargs])Get stock data from API and update datebase.
-
get_prefix(symbol)¶ Get path prefix for a specific data.
- Parameters
symbol (str) – The stock symbol.
- Returns
prefix – The prefix of the file path.
- Return type
str
-
update_database(download_kwargs={}, export_kwargs={})¶ Get stock data from API and update datebase.
- Parameters
downloader_kwargs (dict) – Keyword arguments passed to stockdaq.data.downloader.YourDownloader.download() method.
export_kwargs (dict) – Keyword arguments passed to stockdaq.data.downloader.Downloader.export() method.