mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
Merge pull request #1830 from hroff-1902/python-version
check python version
This commit is contained in:
commit
6451feee0e
|
@ -3,8 +3,14 @@
|
||||||
Main Freqtrade bot script.
|
Main Freqtrade bot script.
|
||||||
Read the documentation to know what cli arguments you need.
|
Read the documentation to know what cli arguments you need.
|
||||||
"""
|
"""
|
||||||
import logging
|
|
||||||
import sys
|
import sys
|
||||||
|
# check min. python version
|
||||||
|
if sys.version_info < (3, 6):
|
||||||
|
sys.exit("Freqtrade requires Python version >= 3.6")
|
||||||
|
|
||||||
|
# flake8: noqa E402
|
||||||
|
import logging
|
||||||
from argparse import Namespace
|
from argparse import Namespace
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
|
@ -22,6 +28,10 @@ def main(sysargv: List[str]) -> None:
|
||||||
This function will initiate the bot and start the trading loop.
|
This function will initiate the bot and start the trading loop.
|
||||||
:return: None
|
:return: None
|
||||||
"""
|
"""
|
||||||
|
try:
|
||||||
|
worker = None
|
||||||
|
return_code = 1
|
||||||
|
|
||||||
arguments = Arguments(
|
arguments = Arguments(
|
||||||
sysargv,
|
sysargv,
|
||||||
'Free, open source crypto trading bot'
|
'Free, open source crypto trading bot'
|
||||||
|
@ -32,11 +42,9 @@ def main(sysargv: List[str]) -> None:
|
||||||
# Means if Backtesting or Hyperopt have been called we exit the bot
|
# Means if Backtesting or Hyperopt have been called we exit the bot
|
||||||
if hasattr(args, 'func'):
|
if hasattr(args, 'func'):
|
||||||
args.func(args)
|
args.func(args)
|
||||||
return
|
# TODO: fetch return_code as returned by the command function here
|
||||||
|
return_code = 0
|
||||||
worker = None
|
else:
|
||||||
return_code = 1
|
|
||||||
try:
|
|
||||||
# Load and run worker
|
# Load and run worker
|
||||||
worker = Worker(args)
|
worker = Worker(args)
|
||||||
worker.run()
|
worker.run()
|
||||||
|
|
|
@ -20,6 +20,8 @@ def test_parse_args_backtesting(mocker) -> None:
|
||||||
further argument parsing is done in test_arguments.py
|
further argument parsing is done in test_arguments.py
|
||||||
"""
|
"""
|
||||||
backtesting_mock = mocker.patch('freqtrade.optimize.start_backtesting', MagicMock())
|
backtesting_mock = mocker.patch('freqtrade.optimize.start_backtesting', MagicMock())
|
||||||
|
# it's sys.exit(0) at the end of backtesting
|
||||||
|
with pytest.raises(SystemExit):
|
||||||
main(['backtesting'])
|
main(['backtesting'])
|
||||||
assert backtesting_mock.call_count == 1
|
assert backtesting_mock.call_count == 1
|
||||||
call_args = backtesting_mock.call_args[0][0]
|
call_args = backtesting_mock.call_args[0][0]
|
||||||
|
@ -33,6 +35,8 @@ def test_parse_args_backtesting(mocker) -> None:
|
||||||
|
|
||||||
def test_main_start_hyperopt(mocker) -> None:
|
def test_main_start_hyperopt(mocker) -> None:
|
||||||
hyperopt_mock = mocker.patch('freqtrade.optimize.start_hyperopt', MagicMock())
|
hyperopt_mock = mocker.patch('freqtrade.optimize.start_hyperopt', MagicMock())
|
||||||
|
# it's sys.exit(0) at the end of hyperopt
|
||||||
|
with pytest.raises(SystemExit):
|
||||||
main(['hyperopt'])
|
main(['hyperopt'])
|
||||||
assert hyperopt_mock.call_count == 1
|
assert hyperopt_mock.call_count == 1
|
||||||
call_args = hyperopt_mock.call_args[0][0]
|
call_args = hyperopt_mock.call_args[0][0]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user