Skip to content
This repository has been archived by the owner on Sep 14, 2022. It is now read-only.

Commit

Permalink
Arguments for dev environment (#38)
Browse files Browse the repository at this point in the history
* Uses argparse to determine which task to run in dev mode

* Documents Dev mode
  • Loading branch information
Jamie Wade authored Aug 29, 2021
1 parent 5134395 commit 33ea8f3
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
14 changes: 12 additions & 2 deletions PieBot.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from functions import *
import argparse
import gc
import schedule
import signal
Expand Down Expand Up @@ -177,5 +178,14 @@ def rebalance(pairs):
time.sleep(1)

else:
buy(pairs=pair_list)
# rebalance(pairs=pair_list)
parser = argparse.ArgumentParser()
parser.add_argument("task")
args = parser.parse_args()
if (args.task == "buy") or (args.task == "Buy"):
buy(pairs=pair_list)

elif (args.task == "rebalance") or (args.task == "Rebalance"):
rebalance(pairs=pair_list)

else:
print(colored("Please specify which task you want to run", "red"))
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ PieBot is a DCA (Dollar Cost Averaging) cryptocurrency trading bot, built with P
- [buy_order_value](#buy_order_value)
- [usdt_reserve](#usdt_reserve)
- [Operation](#operation)
- [Running PieBot](#running-piebot)
- [Dev Mode](#dev-mode)
- [Updating](#updating)
- [Disclaimer](#disclaimer)
- [Donate](#donate)
Expand Down Expand Up @@ -196,6 +198,19 @@ Once it is running, you can view the logs for that PM2 process like so:
pm2 logs PieBot
```

#### Dev mode

By setting `environment = "dev"` in your `_config.py` file, you can run PieBot without placing any real world trades. This is a good way of running the bot for the first time to ensure everything is working, without the risk of placing real trades for real money.

As PieBot is split into two distinct tasks; [Buy](#buy) and [Rebalance](#rebalance), you will need to specify which task you want to run by using one of these commands:

```
python3 PieBot.py Buy
python3 PieBot.py Rebalance
```

When in dev mode, PieBot uses exactly the same logic as if you were running the bot in the real world. The bot attempts to connect to your account through your API key, it will collect your coin balances and work everything out it needs to. You will even see exactly the same console output. The only difference being that orders aren't actually placed.

### Updating

PieBot updates are pushed directly to this Git repository, so a simple `git pull` on the `main` branch is normally all that is required to run the latest version of the bot. Luckily there is a little script file you can run that handles it for you.
Expand Down

0 comments on commit 33ea8f3

Please sign in to comment.