quantlab.utils.watermark.read_watermark#

quantlab.utils.watermark.read_watermark(path)[source]#

Return the day the dated watermark in path reaches, or None without a file.

Parameters:
pathstr or Path

The watermark file.

Returns:
date or None

None when the file is absent.

Raises:
ValueError

If the file is not valid JSON.

KeyError

If it has no through.

Examples

>>> import tempfile
>>> from pathlib import Path
>>> read_watermark(Path(tempfile.mkdtemp()) / WATERMARK_FILE) is None
True