TensorFlow 2 Reinforcement Learning Cookbook by Praveen Palanisamy

TensorFlow 2 Reinforcement Learning Cookbook by Praveen Palanisamy

Author:Praveen Palanisamy
Language: eng
Format: epub, mobi
Publisher: Packt Publishing Pvt Ltd
Published: 2021-01-15T00:00:00+00:00


Now, it's time for you to get one of the agents you built as part of the previous chapter to train and test this real data-backed stock market trading environment. For now, let's test the environment with a simple, random agent:if __name__ == "__main__":

env = StockTradingVisualContinuousEnv()

obs = env.reset()

for _ in range(600):

action = env.action_space.sample()

next_obs, reward, done, _ = env.step(action)

env.render()

How it works…

To simulate a stock market, a real stock market data stream must be used. An offline file-based stream is utilized as an alternative to a web-based API, which would require internet connectivity and potentially a user account to fetch market data. The file stream contains the market data in a standard format: Date, Open, High, Low, Close, Adj-Close, and Volume.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.