Skip to content

Commit

Permalink
Merge pull request #14 from paveldat/dev/pdat
Browse files Browse the repository at this point in the history
Create data and logs folder
  • Loading branch information
paveldat authored May 13, 2023
2 parents 4b96b63 + 6e8886a commit c285fad
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions dobby_trade_bot/backtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from datetime import datetime, timedelta
from traceback import format_exc
from typing import Dict
from pathlib import Path

from sqlitedict import SqliteDict

Expand All @@ -13,6 +14,8 @@
from .models import Coin, Pair
from .strategies import get_strategy


Path('data').mkdir(exist_ok=True, parents=True)
cache = SqliteDict("data/backtest_cache.db")


Expand Down
2 changes: 2 additions & 0 deletions dobby_trade_bot/logger.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging.handlers
from pathlib import Path

from .notifications import NotificationHandler

Expand All @@ -14,6 +15,7 @@ def __init__(self, logging_service="crypto_trading", enable_notifications=True):
self.Logger.propagate = False
formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
# default is "logs/crypto_trading.log"
Path('logs').mkdir(exist_ok=True, parents=True)
fh = logging.FileHandler(f"logs/{logging_service}.log")
fh.setLevel(logging.DEBUG)
fh.setFormatter(formatter)
Expand Down

0 comments on commit c285fad

Please sign in to comment.