Example #1
0
            trials=trials,
            # 試行の過程を出力
            verbose=0)
    else:
        best = default_parameters

    params = default_parameters.copy()
    params.update(best)
    report = go(params)
    print(report)
    return (params, report)


if __name__ == '__main__':

    from utils import stop_watch

    ohlcv = pd.read_csv('csv/bitmex_2018_1m.csv',
                        index_col='timestamp',
                        parse_dates=True)
    buy_entry = ohlcv.close > ohlcv.close.shift(1)
    sell_entry = ohlcv.close < ohlcv.close.shift(1)
    buy_exit = sell_entry
    sell_exit = buy_entry
    Backtest = stop_watch(Backtest)

    Backtest(**locals())
    Backtest(**locals())
    Backtest(**locals())
    Backtest(**locals())
Example #2
0
if __name__ == '__main__':

    from utils import stop_watch

    # p0 = 8000 #初期値
    # vola = 15.0 #ボラティリティ(%)
    # dn = np.random.randint(2, size=1000)*2-1
    # scale = vola/100/np.sqrt(365*24*60)
    # gwalk = np.cumprod(np.exp(scale*dn))*p0
    # data = pd.Series(gwalk)

    ohlc = pd.read_csv('csv/bitmex_2018_1h.csv',
                       index_col='timestamp',
                       parse_dates=True)

    fastsma = stop_watch(fastsma)
    sma = stop_watch(sma)
    dsma = stop_watch(dsma)
    tsma = stop_watch(tsma)
    ema = stop_watch(ema)
    dema = stop_watch(dema)
    tema = stop_watch(tema)
    rma = stop_watch(rma)
    rsi = stop_watch(rsi)
    stoch = stop_watch(stoch)
    wvf = stop_watch(wvf)
    highest = stop_watch(highest)
    lowest = stop_watch(lowest)
    macd = stop_watch(macd)
    tr = stop_watch(tr)
    atr = stop_watch(atr)