use a different db handle for dry_run

This commit is contained in:
gcarq 2017-05-21 17:58:54 +02:00
parent 5402f8ba30
commit bc8f00009d
2 changed files with 8 additions and 3 deletions

View File

@ -24,7 +24,7 @@ from utils import get_conf
__author__ = "gcarq" __author__ = "gcarq"
__copyright__ = "gcarq 2017" __copyright__ = "gcarq 2017"
__license__ = "GPLv3" __license__ = "GPLv3"
__version__ = "0.6.1" __version__ = "0.7.0"
conf = get_conf() conf = get_conf()

View File

@ -6,11 +6,16 @@ from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.types import Enum from sqlalchemy.types import Enum
from exchange import Exchange from exchange import Exchange
from utils import get_conf
if get_conf().get('dry_run', False):
db_handle = 'sqlite:///tradesv2.dry_run.sqlite'
else:
db_handle = 'sqlite:///tradesv2.sqlite'
Base = declarative_base() engine = create_engine(db_handle, echo=False)
engine = create_engine('sqlite:///tradesv2.sqlite', echo=False)
Session = scoped_session(sessionmaker(bind=engine, autoflush=True, autocommit=True)) Session = scoped_session(sessionmaker(bind=engine, autoflush=True, autocommit=True))
Base = declarative_base()
class Trade(Base): class Trade(Base):