April 2019
Intermediate to advanced
426 pages
11h 13m
English
The resample interval and the number of periods in our calculation are two important parameters that are required by our trading system. First, create a class named MeanReversionTrader, which we can instantiate and run as our trading system:
import timeimport datetime as dtimport pandas as pdclass MeanReversionTrader(object): def __init__( self, broker, symbol=None, units=1, resample_interval='60s', mean_periods=5 ): """ A trading platform that trades on one side based on a mean-reverting algorithm. :param broker: Broker object :param symbol: A str object recognized by the broker for trading :param units: Number of units to trade :param resample_interval: Frequency for resampling price time series ...