MCPcopy Create free account
hub / github.com/ccxt/ccxt / test_round_timeframe

Function test_round_timeframe

python/ccxt/test/base/test_timeframes.py:21–34  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

19from ccxt.test.exchange.base import test_shared_methods # noqa E402
20
21def 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
37def test_parse_timeframe():

Callers 1

test_timeframesFunction · 0.85

Calls 3

parse8601Method · 0.95
round_timeframeMethod · 0.95
ExchangeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…