babao.inputs package

Submodules

babao.inputs.inputBase module

Base class for any input

class babao.inputs.inputBase.ABCInput[source]

Bases: abc.ABC

Base class for any input

Your subclass should at least implement: * fetch : self -> DataFrame * raw_columns : List[str]

And eventually: (if you want self.resample to works) * _resample : self -> DataFrame -> DataFrame * fillMissing : self -> DataFrame -> DataFrame * resampled_columns : List[str]

(cf. specific method doc-string in this class)

cache(fresh_data=None, since=None, till=None)[source]

Save some data to cache

If ´fresh_data´ is given, append it to cache, otherwise read in database from ´since´ to ´till´ and cache it

fetch()[source]

Return a time-serie DataFrame fetched from the internets

This data will be stored on database for later use (and eventual resampling). Data can be continuous. Index must be nanosecond timestamps.

fillMissing(resampled_data)[source]

Fill missing values (np.nan/np.inf) in ´resampled_data´

raw_columns

The columns names of your raw data (as fetched and stored in database)

read(since=None, till=None)[source]

Read data in database or cache from ´since´ to ´till´

refreshCache()[source]

Make sure the cache is up to date

resample(raw_data)[source]

Return the DataFrame ´raw_data´ as a continuous time-serie

This is a wrapper around _resample and fillMissing

resampled_columns

The columns names of your resampled data (from raw data)

updateCurrentRow(current_row=None, timestamp=None)[source]

Update the property self.current_row, useful for time travel

write(raw_data)[source]

Write the given raw_data to the database, and cache it if needed

babao.inputs.inputBase.resampleSerie(s)[source]

Call Serie.resample on s with preset parameters (the serie’s index must be datetime)

babao.inputs.inputManager module

Common interface to inputs to call methods on all of them at once

babao.inputs.inputManager.fetchInputs()[source]

Fetch all the INPUTS in a pool thread

The raw data resulting is then wrote to database.

babao.inputs.inputManager.readInputs(input_list: Optional[List[babao.inputs.inputBase.ABCInput]] = None, since=None)[source]

Read all INPUTS from ´since´ and resample them with matching time base

The return is one dataframe containing all concatened columns (so they will be renamed with the input name as prefix

babao.inputs.inputManager.refreshInputs(input_list: Optional[List[babao.inputs.inputBase.ABCInput]] = None)[source]

Make sure the cache is up to date on the given inputs (or all the INPUTS)

babao.inputs.inputManager.timeTravel(timestamp)[source]

Travel to the specified timestamp, for simulation purposes

babao.inputs.krakenInputBase module

This module define the base class and methods for kraken inputs

class babao.inputs.krakenInputBase.ABCKrakenInput[source]

Bases: babao.inputs.inputBase.ABCInput

Base class for any kraken input

fetch()[source]

Return a time-serie DataFrame fetched from the internets

This data will be stored on database for later use (and eventual resampling). Data can be continuous. Index must be nanosecond timestamps.

Module contents