MontrealTradingGroup / freqtrade

Simple High Frequency Trading Bot for crypto currencies
GNU General Public License v3.0
70 stars 61 forks source link

use freqtrade as systemd service on vps #9

Open hanswayne23 opened 4 years ago

hanswayne23 commented 4 years ago

Step 1: Have you search for this issue before posting it?

yes.

Step 2: Describe your environment

Step 3: Describe the problem:

i bought your new course and i followed all instruction to setup systemd and i got this problem. i tried to run this command /home/hstest/freqtrade/.env/bin/freqtrade trade -c /home/hstest/freqtrade/config.json --strategy SampleStrategy --userdir /home/hstest/freqtrade/ on /freqtrade/freqtrade command line but the error i can see all the time is failed to load Sample Strategy.

Kindly need help on this one.

Steps to reproduce:

Go to ~/freqtrade/freqtrade, and edit the file called main.py using nano:

nano main.py

!/root/freqtrade/.env/bin/python3

""" Main Freqtrade bot script. Read the documentation to know what cli arguments you need. """

from freqtrade.exceptions import FreqtradeException, OperationalException 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 typing import Any, List

from freqtrade.commands import Arguments

logger = logging.getLogger('freqtrade')

def main(sysargv: List[str] = None) -> None: """ This function will initiate the bot and start the trading loop. :return: None """

...

Add the freqtrade systemd service using:

sudo systemctl edit --force --full freqtrade.service

Paste the following:

[Unit] Description=Freqtrade Service Wants=network.target After=network.target

[Service] ExecStartPre=/bin/sleep 10 ExecStart=/root/freqtrade/freqtrade/main.py trade -c /root/freqtrade/config.json --strategy DefaultStrategy --userdir /root/freqtrade/ Restart=always

[Install] WantedBy=multi-user.target

Observed Results:

Relevant code exceptions or logs:

  // paste your log here
ilyasst commented 4 years ago

Hi,

It seems like the path you put at the top of your freqtrade file(#!/root/freqtrade/.env/bin/python3) is not the same as the one you used to start your freqtrade (/home/hstest/freqtrade/.env/bin/freqtrade). Please double check that you are using the right path. You can check the current path to a folder using the pwd command,

Cheers, On Mar 24 2020, at 9:37 pm, hanswayne23 notifications@github.com wrote:

Step 1: Have you search for this issue before posting it? yes.

Step 2: Describe your environment Python Version: _____ 3.7.5

CCXT version: _____ (pip freeze | grep ccxt)

Branch: Develop

Last Commit ID: _____ f320c0a410e5832d4a3fc35647aa6fea6a958b

Step 3: Describe the problem: i bought your new course and i followed all instruction to setup systemd and i got this problem. i tried to run this command /home/hstest/freqtrade/.env/bin/freqtrade trade -c /home/hstest/freqtrade/config.json --strategy SampleStrategy --userdir /home/hstest/freqtrade/ on /freqtrade/freqtrade command line but the error i can see all the time is failed to load Sample Strategy.

Kindly need help on this one. Steps to reproduce: Go to ~/freqtrade/freqtrade, and edit the file called main.py using nano:

nano main.py

!/root/freqtrade/.env/bin/python3

""" Main Freqtrade bot script. Read the documentation to know what cli arguments you need. """

from freqtrade.exceptions import FreqtradeException, OperationalException 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 typing import Any, List

from freqtrade.commands import Arguments logger = logging.getLogger('freqtrade') def main(sysargv: List[str] = None) -> None: """ This function will initiate the bot and start the trading loop. :return: None """

... Add the freqtrade systemd service using: sudo systemctl edit --force --full freqtrade.service Paste the following: [Unit] Description=Freqtrade Service Wants=network.target After=network.target

[Service] ExecStartPre=/bin/sleep 10 ExecStart=/root/freqtrade/freqtrade/main.py trade -c /root/freqtrade/config.json --strategy DefaultStrategy --userdir /root/freqtrade/ Restart=always

[Install] WantedBy=multi-user.target

Observed Results: What happened?

What did you expect to happen?

Relevant code exceptions or logs: // paste your log here — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub (https://github.com/MontrealTradingGroup/freqtrade/issues/9), or unsubscribe (https://github.com/notifications/unsubscribe-auth/AADMMM5LPGT6A23DLGNAAC3RJFN5ZANCNFSM4LTDQHXA).

hanswayne23 commented 4 years ago

Thanks for your reply. i will reinstall everything to install from scratch. i will let you know once my installation of freqtrade and setup of systemd is successful or not. i will do it one by one based on your video tutorial

hanswayne23 commented 4 years ago

i destroy current vps and installed a new one. i followed all the steps on the tutorial to install freqtrade step by step and after the installation i just execute the command freqtrade then there is the problem with the strategy already. it says Error - Impossible to load strategy 'SampleStrategy'. SampleStrategy because that's the one i saw in the templates folder. it is also the same at 'SimpleStrategy'. SimpleStrategy because i saw your guidelines in the tutorial Session 23-0 : Minor change to the freqtrade code.

What i have to do next? i followed your step by step instruction on the video and once i installed freqtrade there is no error. but when it comes to the basic command line to execute freqtrade there's an error already in the strategy? it is also the same problem with basic execution for systemd

Kindly need help on this one.

Thanks.

hanswayne23 commented 4 years ago

By the way hope you and mohsen is doing well in this crazy time. Take Care!!! :)

i like your courses just really having problem to execute the strategy.