Add default rest config
This commit is contained in:
parent
fd5012c04e
commit
c272e1ccdf
@ -109,6 +109,11 @@
|
|||||||
"token": "your_telegram_token",
|
"token": "your_telegram_token",
|
||||||
"chat_id": "your_telegram_chat_id"
|
"chat_id": "your_telegram_chat_id"
|
||||||
},
|
},
|
||||||
|
"api_server": {
|
||||||
|
"enabled": false,
|
||||||
|
"listen_ip_address": "127.0.0.1",
|
||||||
|
"listen_port": 8080
|
||||||
|
},
|
||||||
"db_url": "sqlite:///tradesv3.sqlite",
|
"db_url": "sqlite:///tradesv3.sqlite",
|
||||||
"initial_state": "running",
|
"initial_state": "running",
|
||||||
"forcebuy_enable": false,
|
"forcebuy_enable": false,
|
||||||
|
@ -234,17 +234,19 @@ def load_config(configfile):
|
|||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
|
||||||
|
def print_commands():
|
||||||
|
# Print dynamic help for the different commands
|
||||||
|
client = FtRestClient(None)
|
||||||
|
print("Possible commands:")
|
||||||
|
for x, y in inspect.getmembers(client):
|
||||||
|
if not x.startswith('_'):
|
||||||
|
print(f"{x} {getattr(client, x).__doc__}")
|
||||||
|
|
||||||
|
|
||||||
def main(args):
|
def main(args):
|
||||||
|
|
||||||
if args.get("show"):
|
if args.get("help"):
|
||||||
# Print dynamic help for the different commands
|
print_commands()
|
||||||
client = FtRestClient(None)
|
|
||||||
print("Possible commands:")
|
|
||||||
for x, y in inspect.getmembers(client):
|
|
||||||
if not x.startswith('_'):
|
|
||||||
print(f"{x} {getattr(client, x).__doc__}")
|
|
||||||
|
|
||||||
return
|
|
||||||
|
|
||||||
config = load_config(args["config"])
|
config = load_config(args["config"])
|
||||||
url = config.get("api_server", {}).get("server_url", "127.0.0.1")
|
url = config.get("api_server", {}).get("server_url", "127.0.0.1")
|
||||||
@ -256,6 +258,7 @@ def main(args):
|
|||||||
command = args["command"]
|
command = args["command"]
|
||||||
if command not in m:
|
if command not in m:
|
||||||
logger.error(f"Command {command} not defined")
|
logger.error(f"Command {command} not defined")
|
||||||
|
print_commands()
|
||||||
return
|
return
|
||||||
|
|
||||||
print(getattr(client, command)(*args["command_arguments"]))
|
print(getattr(client, command)(*args["command_arguments"]))
|
||||||
|
Loading…
Reference in New Issue
Block a user