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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user