コード例 #1
0
def test_calc_SR4():
    """
    Check 'calc_SR' function for a particular problematic
    detection
    """
    tb = TradeBot(pair='AUD_USD',
                  timeframe='D',
                  start='2012-05-24 22:00:00',
                  end='2012-06-06 22:00:00',
                  settingf="../../data/settings.ini")

    harealst = tb.calc_SR(datetime.datetime(2012, 5, 24, 22, 0))

    assert len(harealst.halist) == 6
コード例 #2
0
def test_calc_SR5():
    """
    Check 'calc_SR' function for a USD_JPY problematic
    detection
    """
    tb = TradeBot(pair='GBP_JPY',
                  timeframe='D',
                  start='2018-12-20 22:00:00',
                  end='2019-01-17 22:00:00',
                  settingf="../../data/settings.ini")

    harealst = tb.calc_SR(datetime.datetime(2019, 1, 7, 22, 0))

    assert len(harealst.halist) == 6
コード例 #3
0
def test_calc_SR3():
    """
    Check 'calc_SR' function for a H4 TradeBot
    """
    tb = TradeBot(pair='EUR_GBP',
                  timeframe='H4',
                  start='2017-06-11 22:00:00',
                  end='2017-06-15 22:00:00',
                  settingf="../../data/settings.ini")

    harealst = tb.calc_SR(datetime.datetime(2017, 6, 13, 22, 0))

    # check the length of HAreaList.halist
    assert len(harealst.halist) == 4
コード例 #4
0
def test_calc_SR_H12hrs(pair, start, end, adatetime, halen, settings_obj,
                        clean_tmp):
    """
    Check 'calc_SR' function for a H12 timeframe
    """
    settings_obj.set('pivots', 'th_bounces', '0.02')
    settings_obj.set('trade_bot', 'th', '0.6')
    settings_obj.set('trade_bot', 'period_range', '3500')

    adatetimeObj = datetime.datetime.strptime(adatetime, "%Y-%m-%d %H:%M:%S")

    tb = TradeBot(pair=pair,
                  timeframe='H12',
                  start=start,
                  end=end,
                  settings=settings_obj)

    harealst = tb.calc_SR(adatetimeObj)

    assert len(harealst.halist) == halen