April 2019
Intermediate to advanced
426 pages
11h 13m
English
Finally, to start running our trading system, we need an entry point. Add the following run() class method to the MeanReversionTrader class:
def run(self):
self.get_positions()
self.broker.stream_prices(symbols=[self.symbol])
During the first run of our trading system, we read our current positions and use the information to initialize all position-related information. Then, we request our broker to start streaming prices for the given symbol and hold the connection until the program is terminated.
With an entry point defined, all we need to do is initialize our MeanReversionTrader class and call the run() command using the following codes:
trader = MeanReversionTrader( broker, symbol='EUR_USD', units=1 resample_interval='60s', ...
Read now
Unlock full access