def test_run2(): """ Test tradebot on a really easy to identify long trade on a tight time interval """ 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") tl = tb.run() assert len(tl.tlist) == 1
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
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
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
def test_run4(clean_tmp): """ Test tradebot on a possible trade that falls on a Saturday and will not be taken """ tb = TradeBot(pair='AUD_JPY', timeframe='D', start='2008-12-30 22:00:00', end='2009-01-06 22:00:00', settingf="../../data/settings.ini") tl = tb.run() assert tl is None
def test_run3(): """ Test tradebot on a really easy to identify short trade on a tight time interval using USD_JPY """ tb = TradeBot(pair='USD_JPY', timeframe='D', start='2018-09-24 22:00:00', end='2018-10-09 22:00:00', settingf="../../data/settings.ini") tl = tb.run() assert len(tl.tlist) == 1
def test_run1(settings_obj): """ Test tradebot on a really easy to identify short trade on a tight time interval """ settings_obj.set('trade_bot', 'period_range', '1500') tb = TradeBot(pair='AUD_USD', timeframe='D', start='2018-01-22 22:00:00', end='2018-02-06 22:00:00', settings=settings_obj) tl = tb.run() assert len(tl.tlist) == 2
def tb_object(): '''Returns TradeBot object''' tb = TradeBot(pair='EUR_GBP', timeframe='D', start='2019-08-12 22:00:00', end='2019-08-19 22:00:00', settingf="../../data/settings.ini") return tb
def test_run_H4(pair, start, end, len_tl, settings_obj, clean_tmp): """ Test tradebot using an H4 timeframe """ settings_obj.set('pivots', 'th_bounces', '0.01') settings_obj.set('trade_bot', 'th', '0.2') settings_obj.set('trade_bot', 'period_range', '6000') tb = TradeBot(pair=pair, timeframe='H4', start=start, end=end, settings=settings_obj) tl = tb.run() assert len(tl.tlist) == len_tl
def test_run_D_wserialized(clean_tmp): """ Run the trade_bot with serialized data """ tb = TradeBot( pair='AUD_CAD', timeframe='D', start='2014-01-01 22:00:00', end='2014-08-20 22:00:00', ser_data_f= "/Users/ernesto/SCRATCH/FOREX/05_07_2020/DAILY/AUD_CAD.DTF.2004_2020.ser.data", settingf="../../data/settings.ini") tl = tb.run(pickled_file="../../data/test.pickled") assert len(tl.tlist) == 4
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
def tb_object(): tb = TradeBot(pair='EUR_GBP', timeframe='D', start='2020-06-29 22:00:00', end='2020-07-01 22:00:00') return tb