Modified the Position handling to use long/short instead of buy/sell for side/position_type. Also modified the unit tests for both Portfolio and Position to reflect these changes. Added a basic historical backtesting capability via backtest.py and using CSV tick data for currency pairs.

This commit is contained in:
Michael Halls-Moore
2015-04-17 12:34:31 +01:00
parent d9a7444fc2
commit e74777802b
12 changed files with 519 additions and 192 deletions
+2 -2
View File
@@ -10,7 +10,7 @@ class TestStrategy(object):
def calculate_signals(self, event):
if event.type == 'TICK':
if self.ticks % 200 == 0:
if self.ticks % 5 == 0:
if self.invested == False:
signal = SignalEvent(self.instrument, "market", "buy")
self.events.put(signal)
@@ -19,4 +19,4 @@ class TestStrategy(object):
signal = SignalEvent(self.instrument, "market", "sell")
self.events.put(signal)
self.invested = False
self.ticks += 1
self.ticks += 1