Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alter trading.py logging to use source relative path #39

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion trading/trading.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
from decimal import Decimal, getcontext
import logging
import logging.config
from inspect import getsourcefile
from os.path import abspath, dirname, join, normpath
try:
import Queue as queue
except ImportError:
Expand Down Expand Up @@ -46,7 +48,10 @@ def trade(events, strategy, portfolio, execution, heartbeat):

if __name__ == "__main__":
# Set up logging
logging.config.fileConfig('../logging.conf')
# Logging config is in ../logging.conf relative to this source file
this_src_path = dirname(abspath(getsourcefile(lambda:0)))
log_conf_file = join('..', 'logging.conf')
logging.config.fileConfig(normpath(join(this_src_path, log_conf_file)))
logger = logging.getLogger('qsforex.trading.trading')

# Set the number of decimal places to 2
Expand Down