Observer converts NaN to 0.0 silently, so an unwarmed indicator reads as a real zero

Author: yehonatan-rabinovichCreated Sep 8, 2026Updated Sep 8, 2026

ObservationHistory.observe() runs every observation window through:

rows = np.nan_to_num(rows)

tensortrade/env/default/observers.py:145 @ d58afba23d and short windows are zero-padded a few lines above (:136-140).

Every NaN becomes a hard 0.0 before the agent sees it. An indicator that hasn't warmed up yet — a 200-period average on step 3 — is therefore presented to the agent as a genuine zero, indistinguishable from an indicator that really is zero, and the agent learns from it.

Whether that's acceptable is a modelling choice, but it happens silently.

Would a mask channel (or a NaN-preserving option) be in scope?

Happy to open a PR if so.

Source: tensortrade-org/tensortrade