Closed geeks121 closed 2 years ago
Please refer to https://github.com/beeb/pancaketrade#run-as-a-service where it's described how to provide the environment variable to the script
I could add parsing of a ".env" file in the future but for now .env file is not supported.
Please refer to https://github.com/beeb/pancaketrade#run-as-a-service where it's described how to provide the environment variable to the script
yes already do and it works with docker-compose.. but with poetry run trade .. it keep asking for the pk..
i think the best way is to safe the private key in .env or config.yml
btw where should i change the code for call parameter from config.yml?
thanks you
Running as a service is not the same as docker compose. You can run the "poetry run trade" command from a systemctl service which supports adding environment variables inside the service file, see the "pancaketrade.service" file.
Alternatively, you can also add your private key before the command in the shell if you don't mind that it gets recorded in the shell history:
$ WALLET_PK=MYPK poetry run trade
Running as a service is not the same as docker compose. You can run the "poetry run trade" command from a systemctl service which supports adding environment variables inside the service file, see the "pancaketrade.service" file.
Alternatively, you can also add your private key before the command in the shell if you don't mind that it gets recorded in the shell history:
$ WALLET_PK=MYPK poetry run trade
thank you for the info ,,, using $ WALLET_PK=MYPK poetry run trade ,, may be i can make simpe script to run this command ,, also for run as service i still no need the urgent to use it as service ...
Yes sure you can make a script for instance like:
#!/bin/sh
export WALLET_PK=MYPK
poetry run trade
and run it from the root folder of the project.
i think this script for alternative purpose ,, call this script run.py ,,
import subprocess
command = "WALLET_PK=MYPK poetry run trade"
ret = subprocess.run(command, capture_output=True, shell=True)
# before Python 3.7:
# ret = subprocess.run(command, stdout=subprocess.PIPE, shell=True)
print(ret.stdout.decode())
Added suggestion for .env file support at https://github.com/beeb/pancaketrade/issues/76
i think this script for alternative purpose ,, call this script run.py ,,
import subprocess command = "WALLET_PK=MYPK poetry run trade" ret = subprocess.run(command, capture_output=True, shell=True) # before Python 3.7: # ret = subprocess.run(command, stdout=subprocess.PIPE, shell=True) print(ret.stdout.decode())
I am not sure how this would interact with the poetry tool. You can try and if it works, good. If it doesn't work, create a shell script like I showed above.
working
support for .env
file has been added in 0.6.2
nice thank you
Every time i'm start this bot it always ask Private key.. and for me this annoying ,, i try to change the code but it failed ,,
i think the best way is to acess .env WALLET_PK as docker do ,,
as in readme.md i have try created .env file with WALLET_PK=MYPK
in root and user_data ,,, the prompt asked for pk is still exist,,,
is this should be tagged as bug?