From ea8b8eec1ca178ca151796f19aaef7c48bae7624 Mon Sep 17 00:00:00 2001 From: Matthias Date: Fri, 26 Apr 2019 10:06:46 +0200 Subject: [PATCH] Add edge handler --- freqtrade/rpc/api_server.py | 12 +++++++++++- scripts/rest_client.py | 21 ++++++++++++++------- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/freqtrade/rpc/api_server.py b/freqtrade/rpc/api_server.py index f63c68bf1..bde28be73 100644 --- a/freqtrade/rpc/api_server.py +++ b/freqtrade/rpc/api_server.py @@ -112,6 +112,7 @@ class ApiServer(RPC): app.add_url_rule('/balance', 'balance', view_func=self._balance, methods=['GET']) app.add_url_rule('/count', 'count', view_func=self._count, methods=['GET']) app.add_url_rule('/daily', 'daily', view_func=self._daily, methods=['GET']) + app.add_url_rule('/edge', 'edge', view_func=self._edge, methods=['GET']) app.add_url_rule('/profit', 'profit', view_func=self._profit, methods=['GET']) app.add_url_rule('/performance', 'performance', view_func=self._performance, methods=['GET']) @@ -126,7 +127,6 @@ class ApiServer(RPC): # TODO: Implement the following # forcebuy # forcesell - # edge # help (?) def run(self): @@ -250,6 +250,16 @@ class ApiServer(RPC): return self.rest_dump(stats) + @safe_rpc + def _edge(self): + """ + Returns information related to Edge. + :return: edge stats + """ + stats = self._rpc_edge() + + return self.rest_dump(stats) + @safe_rpc def _profit(self): """ diff --git a/scripts/rest_client.py b/scripts/rest_client.py index 7dbed9bc5..efca8adfa 100755 --- a/scripts/rest_client.py +++ b/scripts/rest_client.py @@ -85,6 +85,13 @@ class FtRestClient(): """ return self._get("daily", params={"timescale": days} if days else None) + def edge(self): + """ + Returns information about edge + :returns: json object + """ + return self._get("edge") + def profit(self): """ Returns the profit summary @@ -106,6 +113,13 @@ class FtRestClient(): """ return self._get("status") + def version(self): + """ + Returns the version of the bot + :returns: json object containing the version + """ + return self._get("version") + def whitelist(self): """ Show the current whitelist @@ -124,13 +138,6 @@ class FtRestClient(): else: return self._post("blacklist", data={"blacklist": args}) - def version(self): - """ - Returns the version of the bot - :returns: json object containing the version - """ - return self._get("version") - def add_arguments(): parser = argparse.ArgumentParser()