tensortrade-org / tensortrade

An open source reinforcement learning framework for training, evaluating, and deploying robust trading agents.
https://discord.gg/ZZ7BGWh
Apache License 2.0
4.54k stars 1.03k forks source link

Stream sensor at times returns None raising a Type Error. #314

Open paramrajpura opened 3 years ago

paramrajpura commented 3 years ago

System information

Describe the current behavior Running the test_exchange_with_wallets_feed function from test_observers.py as attached in screenshot, the sensor of the stream returns None at times so when I want to use lag/diff function on stream it returns Type error as i cant use operator "-" on None type and float Please help me understand if i am doing anything wrong?

Describe the expected behavior Would ideally want the output of the sensor to be same as the stream's current value. However, it is random as i am unable to replicate this all the times.

Code to reproduce the issue
I have reused the test_exchange_with_wallets_feed() from test_observers.py with a modification as attached in the following screenshot.

Other info / logs
image

paramrajpura commented 3 years ago

The issue is with the following line in toposort function in base.py. source = set([s for s, t in edges])

The set function doesn't maintain the sequence which leads to sensor stream getting processed first in .forward() and finding None as main stream doesn't have any data.