Move edge bot_loop_start to edge_cli

(otherwise it's called twice when running trade mode with edge on).
This commit is contained in:
Matthias 2022-04-30 08:55:07 +02:00
parent 8756e7d9a1
commit 09b74cebce
3 changed files with 4 additions and 5 deletions

View File

@ -24,11 +24,11 @@ Currently available callbacks:
## Bot start ## Bot start
A simple callback which is called once when the bot starts. A simple callback which is called once when the strategy is loaded.
This can be used to perform actions that must only be performed once and runs after dataprovider and wallet are set This can be used to perform actions that must only be performed once and runs after dataprovider and wallet are set
``` python ``` python
import asyncio import requests
class AwesomeStrategy(IStrategy): class AwesomeStrategy(IStrategy):
@ -42,7 +42,7 @@ class AwesomeStrategy(IStrategy):
if self.config['runmode'].value in ('live', 'dry_run'): if self.config['runmode'].value in ('live', 'dry_run'):
# Assign this to the class by using self.* # Assign this to the class by using self.*
# can then be used by populate_* methods # can then be used by populate_* methods
self.remote_data = requests.get('https://some_remote_source.example.com') self.cust_remote_data = requests.get('https://some_remote_source.example.com')
``` ```
## Bot loop start ## Bot loop start

View File

@ -91,8 +91,6 @@ class Edge:
except IndexError: except IndexError:
self.fee = None self.fee = None
strategy.bot_start()
def calculate(self, pairs: List[str]) -> bool: def calculate(self, pairs: List[str]) -> bool:
if self.fee is None and pairs: if self.fee is None and pairs:
self.fee = self.exchange.get_fee(pairs[0]) self.fee = self.exchange.get_fee(pairs[0])

View File

@ -44,6 +44,7 @@ class EdgeCli:
self.edge._timerange = TimeRange.parse_timerange(None if self.config.get( self.edge._timerange = TimeRange.parse_timerange(None if self.config.get(
'timerange') is None else str(self.config.get('timerange'))) 'timerange') is None else str(self.config.get('timerange')))
self.strategy.bot_start()
def start(self) -> None: def start(self) -> None:
result = self.edge.calculate(self.config['exchange']['pair_whitelist']) result = self.edge.calculate(self.config['exchange']['pair_whitelist'])