Added remaining trading system around portfolio in order to compare with OANDA.
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
from qsforex.event.event import SignalEvent
|
||||
|
||||
|
||||
class TestRandomStrategy(object):
|
||||
def __init__(self, instrument, events):
|
||||
self.instrument = instrument
|
||||
self.events = events
|
||||
self.ticks = 0
|
||||
|
||||
def calculate_signals(self, event):
|
||||
if event.type == 'TICK':
|
||||
self.ticks += 1
|
||||
if self.ticks == 2:
|
||||
signal = SignalEvent(self.instrument, "market", "buy")
|
||||
self.events.put(signal)
|
||||
if self.ticks == 10:
|
||||
signal = SignalEvent(self.instrument, "market", "sell")
|
||||
self.events.put(signal)
|
||||
Reference in New Issue
Block a user