btb.libtimer package

Submodules

btb.libtrading.timer module

synopis:

Convenience wrapper for timer functionality.

class btb.libtimer.timer.Timer(increment_minute=1)[source]

Bases: object

Provides a simple timer that will hit ever x modulo minutes.

Parameters:

increment_minute (int) – Number of minutes before timer hits.

get_timer_hit() bool[source]

Class getter for the timer_hit member.

Returns:

True if timer needs restarted, false otherwise.

Return type:

bool

restart_timer() bool[source]

Restarts the timer used in the timer function.

The indented use case is that once the timer has been reached this function can be called to reset it.

Returns:

True if timer successfully restarted, false otherwise.

Return type:

bool

timer() int[source]

Timer that returns a percentage in the form of a decimal to which a time increment (set in initializer) has been met.

E.g. if the time increment is set to 10 minutes and the time is currently 1:05 the timer will return 50. If the time was 1:07 the timer would return 70. If the time was 12:13 the timer would return 30.

Once the timer has reached 100% the value will be locked until reset with the restart_timer function.

Returns:

Percentage of elapsed time on the timer.

Return type:

int

Module contents