babao.utils package¶
Submodules¶
babao.utils.date module¶
Some utils functions for date handling and time traveling
-
class
babao.utils.date.
TimeTraveler
[source]¶ Bases:
object
Class handling time travel tricks
-
getTime
(force=False)[source]¶ Return the current time in nanoseconds
Used for time traveling purpose, so this might be a date in the past matching the current simulation state, unless ´force´ is set to True.
-
-
babao.utils.date.
secToNano
(sec)[source]¶ Convert seconds to nanoseconds Just trying to avoid float rounding…
-
babao.utils.date.
toDatetime
(df)[source]¶ Convert the index of the given dataframe to datetime
Also works directly on a dataframe index.
babao.utils.enum module¶
Enums describing positions and assets.
-
class
babao.utils.enum.
ActionEnum
[source]¶ Bases:
enum.Enum
Enum describing a transaction action
-
BUY
= 1¶
-
DEPOSIT
= 2¶
-
FEE
= -3¶
-
HODL
= 0¶
-
SELL
= -1¶
-
WITHDRAW
= -2¶
-
-
class
babao.utils.enum.
CryptoEnum
[source]¶ Bases:
enum.Enum
Enum describing a crypto asset
-
BCH
= -1¶
-
DASH
= -2¶
-
EOS
= -3¶
-
ETC
= -5¶
-
ETH
= -6¶
-
GNO
= -4¶
-
LTC
= -7¶
-
REP
= -8¶
-
XBT
= -9¶
-
XLM
= -10¶
-
XMR
= -11¶
-
XRP
= -12¶
-
ZEC
= -13¶
-
-
class
babao.utils.enum.
QuoteEnum
[source]¶ Bases:
enum.Enum
Enum describing a quote asset
-
CAD
= 1¶
-
EUR
= 2¶
-
GBP
= 3¶
-
JPY
= 4¶
-
USD
= 5¶
-
-
class
babao.utils.enum.
TradeEnum
[source]¶ Bases:
enum.Enum
Enum describing a transaction on a given asset
-
BUY_BCH
= 1¶
-
BUY_DASH
= 2¶
-
BUY_EOS
= 3¶
-
BUY_ETC
= 5¶
-
BUY_ETH
= 6¶
-
BUY_GNO
= 4¶
-
BUY_LTC
= 7¶
-
BUY_REP
= 8¶
-
BUY_XBT
= 9¶
-
BUY_XLM
= 10¶
-
BUY_XMR
= 11¶
-
BUY_XRP
= 12¶
-
BUY_ZEC
= 13¶
-
HODL
= 0¶
-
SELL_BCH
= -1¶
-
SELL_DASH
= -2¶
-
SELL_EOS
= -3¶
-
SELL_ETC
= -5¶
-
SELL_ETH
= -6¶
-
SELL_GNO
= -4¶
-
SELL_LTC
= -7¶
-
SELL_REP
= -8¶
-
SELL_XBT
= -9¶
-
SELL_XLM
= -10¶
-
SELL_XMR
= -11¶
-
SELL_XRP
= -12¶
-
SELL_ZEC
= -13¶
-
babao.utils.file module¶
Some utils functions for hdf handling
-
babao.utils.file.
delete
(frame)[source]¶ Remove the given ´frame´ entry (key) from the hdf database
Thread Safe!
-
babao.utils.file.
getLastRows
(frame, nrows)[source]¶ Return ´nrows´ rows from a ´frame´ (key) in the hdf database as a DataFrame
-
babao.utils.file.
maintenance
()[source]¶ Maintenance routine on the hdf database
Create table index for each table, and make sure everything is sorted.
-
babao.utils.file.
read
(frame, where=None)[source]¶ Read a ´frame´ (key) from the hdf database
´where´ can be use to specify search criteria. Thread Safe!
babao.utils.indicators module¶
Various indicators which can be added to any serie
//www.quantinsti.com/blog/build-technical-indicators-in-python
-
babao.utils.indicators.
get
(df, columns)[source]¶ Add indicators specified by columns to the given df
Expected ´columns´ format: [“sma_vwap_42”, “ewma_volume_12”]
-
babao.utils.indicators.
macd
(serie, fast_delay, slow_delay, signal_delay, full=False)[source]¶ Moving Average Convergence/Divergence Oscillator
babao.utils.lock module¶
Some utils functions for lock file handling
babao.utils.log module¶
Some utils functions for logging
babao.utils.scale module¶
Scaler
babao.utils.signal module¶
Signal handling