From 743f316b3a79d6708ecfbd9a273224cca64bac05 Mon Sep 17 00:00:00 2001 From: moshferatu Date: Sat, 19 Oct 2024 07:13:12 -0700 Subject: [PATCH] Initial commit of OHLC wrapper --- ohlc/ohlc.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 ohlc/ohlc.py diff --git a/ohlc/ohlc.py b/ohlc/ohlc.py new file mode 100644 index 0000000..2246c32 --- /dev/null +++ b/ohlc/ohlc.py @@ -0,0 +1,9 @@ +from datetime import datetime + +from iqfeed import get_daily_data, get_historical_data, minutes as to_minutes + +def ohlc(symbol: str, minutes: int = None, start_date: datetime = None, end_date: datetime = None): + if minutes is None: + return get_daily_data(symbol, start_date, end_date or datetime.today()) + else: + return get_historical_data(symbol, interval = to_minutes(minutes), start_date = start_date, end_date = end_date or datetime.today()) \ No newline at end of file