()
| 19 | from ccxt.test.exchange.base import test_shared_methods # noqa E402 |
| 20 | |
| 21 | def test_round_timeframe(): |
| 22 | exchange = ccxt.Exchange({ |
| 23 | 'id': 'sampleexchange', |
| 24 | }) |
| 25 | test_date = exchange.parse8601('2019-08-12 13:22:08') |
| 26 | assert exchange.round_timeframe('5m', test_date, ROUND_DOWN) == exchange.parse8601('2019-08-12 13:20:00') |
| 27 | assert exchange.round_timeframe('10m', test_date, ROUND_DOWN) == exchange.parse8601('2019-08-12 13:20:00') |
| 28 | assert exchange.round_timeframe('30m', test_date, ROUND_DOWN) == exchange.parse8601('2019-08-12 13:00:00') |
| 29 | assert exchange.round_timeframe('1d', test_date, ROUND_DOWN) == exchange.parse8601('2019-08-12 00:00:00') |
| 30 | assert exchange.round_timeframe('5m', test_date, ROUND_UP) == exchange.parse8601('2019-08-12 13:25:00') |
| 31 | assert exchange.round_timeframe('10m', test_date, ROUND_UP) == exchange.parse8601('2019-08-12 13:30:00') |
| 32 | assert exchange.round_timeframe('30m', test_date, ROUND_UP) == exchange.parse8601('2019-08-12 13:30:00') |
| 33 | assert exchange.round_timeframe('1h', test_date, ROUND_UP) == exchange.parse8601('2019-08-12 14:00:00') |
| 34 | assert exchange.round_timeframe('1d', test_date, ROUND_UP) == exchange.parse8601('2019-08-13 00:00:00') |
| 35 | |
| 36 | |
| 37 | def test_parse_timeframe(): |
no test coverage detected
searching dependent graphs…