-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Hello,
maybe bot.config could be standardized as a TOML or INI file or YML file.
So editor such as VSCode can automatically render it correctly.
Here is an example of toml file (see https://toml.io/ )
# TOML-based config
[influx2]
url = "http://localhost:8086"
org = "my-org"
token = "my-token"Here is an example of ini
; ini-based config
[influx2]
url = http://localhost:8086
org = my-org
token = my-tokenSo currently bot.config looks like
SLIPPAGE = 0.0008
FEES = 0.0002
CACHED_KLINES_PATH = cached_klines
INITIAL_BALANCE = 1000
and load_config implementation is
backtester/cryptrality/__config__.py
Lines 4 to 16 in f0c1fe7
| def load_config(config_file): | |
| res = {} | |
| if os.path.isfile(config_file): | |
| with open(config_file, "rt") as config_data: | |
| for line in config_data: | |
| if line.startswith("#"): | |
| continue | |
| try: | |
| key, val = line.split("=") | |
| res[key.strip()] = val.strip() | |
| except ValueError: | |
| pass | |
| return res |
so comments start with #
so it's a mix of both ;-)
I would name bot_config.toml and use sections
# Bot configuration
[backtest]
slippage = 0.0008
fees = 0.0002
cached_klines_path = "cached_klines"
initial_balance = 1000
[livetrade]
[livetrade.binance]
api_key = "your_long_api_key_here"
api_secret = "your_other_long_api_key_here"Metadata
Metadata
Assignees
Labels
No labels