Added Python 2.7.x and 3.4.x compatibility to the code. Disabled HTTPS security warning in urllib3 package of 'requests' package.

This commit is contained in:
Michael Halls-Moore
2015-05-11 17:30:28 +01:00
parent 8e74edb4f7
commit a03bc7a1fb
9 changed files with 67 additions and 39 deletions
+8 -5
View File
@@ -1,8 +1,11 @@
import copy
import Queue
from decimal import Decimal, getcontext
try:
import Queue as queue
except ImportError:
import queue
import threading
import time
from decimal import Decimal, getcontext
from qsforex.execution.execution import OANDAExecutionHandler
from qsforex.portfolio.portfolio import Portfolio
@@ -22,7 +25,7 @@ def trade(events, strategy, portfolio, execution, heartbeat):
while True:
try:
event = events.get(False)
except Queue.Empty:
except queue.Empty:
pass
else:
if event is not None:
@@ -40,7 +43,7 @@ if __name__ == "__main__":
getcontext().prec = 2
heartbeat = 0.0 # Half a second between polling
events = Queue.Queue()
events = queue.Queue()
equity = settings.EQUITY
# Trade "Cable"
@@ -81,4 +84,4 @@ if __name__ == "__main__":
# Start both threads
trade_thread.start()
price_thread.start()
price_thread.start()