ClementPerroud / Gym-Trading-Env

A simple, easy, customizable Gymnasium environment for trading.
https://gym-trading-env.readthedocs.io/
MIT License
270 stars 56 forks source link

The renderer is not working in my system #11

Open RitwikGhoshLives opened 10 months ago

RitwikGhoshLives commented 10 months ago

First of all thank you for this amazing environment. I am using Anaconda and Spyder. I am facing the following problem.

Screenshot 2023-09-05 210020

Next I tried Screenshot 2023-09-05 214850

It works to run the code with no error. But in the browser I find no graph

Screenshot 2023-09-05 213514

ClementPerroud commented 10 months ago

I suggest you to downgrade your gymnasium version to the one I used when I created the env

RitwikGhoshLives commented 10 months ago

I have done it. I have downgraded the gymnasium version to 0.28.1. The user warning error is not coming any more. how ever the web page is still showing blank. Following error I am getting in spyder Screenshot 2023-09-07 190558

sebnapi commented 10 months ago

I have done it. I have downgraded the gymnasium version to 0.28.1. The user warning error is not coming any more. how ever the web page is still showing blank. Following error I am getting in spyder Screenshot 2023-09-07 190558

Your dataframe index obviously isn't a Timestamp index.

RitwikGhoshLives commented 10 months ago

No my data frame index is in timestamps cause I am getting the result like market return portfolio return. Only the renderer is not working. 265762786-77c38aff-cab9-4a75-8d1b-fb2fbd87a038

sebnapi commented 10 months ago

No my data frame index is in timestamps cause I am getting the result like market return portfolio return. Only the renderer is not working. 265762786-77c38aff-cab9-4a75-8d1b-fb2fbd87a038

I tried the renderer yesterday and it works! You have to debug it by yourself, what @ClementPerroud is calling there is this function: https://pandas.pydata.org/docs/reference/api/pandas.Timestamp.strftime.html#pandas.Timestamp.strftime So if your dataframe has a timestamp index it would be definitely available.

sebnapi commented 9 months ago

@RitwikGhoshLives I ran into the same issue, I think it depends what kind of Index pandas creates. I replaced the line with:

df['date_str'] = [d.strftime("%Y-%m-%d %H:%M") for d in df.index]

This way it works always.