investfly.utils.CommonUtils
Data-conversion helpers for implementing custom indicators.
Convert market bars to a pandas data frame indexed by timestamp.
def
extractCloseSeries( bars: List[investfly.models.marketdata.Bar]) -> Tuple[List[datetime.datetime], List[float]]:
Return parallel timestamp and close-price lists from market bars.
def
extractOHLCSeries( bars: List[investfly.models.marketdata.Bar]) -> Tuple[List[datetime.datetime], List[float], List[float], List[float], List[float]]:
Return parallel timestamp, open, high, low, and close lists from bars.
def
pandasSeriesToList( series: pandas.core.series.Series) -> List[investfly.models.common.DatedValue]:
Convert a timestamp-indexed pandas series to non-NaN dated values.
def
createListOfDatedValue( dates: List[datetime.datetime], values: numpy.ndarray[typing.Any, numpy.dtype[numpy.float64]]):
Pair timestamps with non-NaN values from a NumPy array.
def
floatListToDatedValueList(dates: List[datetime.datetime], values: List[float | int]):
Pair parallel timestamp and numeric lists as dated values.
def
toHeikinAshi( bars: List[investfly.models.marketdata.Bar]) -> List[investfly.models.marketdata.Bar]:
Transform standard OHLC bars into Heikin-Ashi bars.