Skip to content

Config file bot.config could be standardized #5

Description

@c0indev3l

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-token

So currently bot.config looks like

SLIPPAGE = 0.0008
FEES = 0.0002
CACHED_KLINES_PATH = cached_klines
INITIAL_BALANCE = 1000

and load_config implementation is

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions