I'm studying binance rl_trading, this main.py code is running well,
but didn't act buy and sell.
I can't find out what the problem is, please help me.
here is code
import tensorflow as tf
tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR)
from stable_baselines.common.policies import MlpPolicy
from stable_baselines.common.vec_env import DummyVecEnv
from stable_baselines import PPO2
from env import CryptoEnv
import pandas as pd
import os
# FutureWarning: elementwise comparison failed; returning scalar, but in the future will perform elementwise comparison
import warnings
import numpy as np
warnings.simplefilter(action='ignore', category=FutureWarning)
print('x' in np.arange(5)) #returns False, without Warning
############################################################################
df = pd.read_csv('data/BTCUSDT.csv', index_col=0)
env = DummyVecEnv([lambda: CryptoEnv(df)])
# Instanciate the agent
model = PPO2(MlpPolicy, env, gamma=1, learning_rate=0.01, verbose=0)
# Train the agent
total_timesteps = int(os.getenv('TOTAL_TIMESTEPS', 500000))
model.learn(total_timesteps)
# Render the graph of rewards
env.render(graph=True)
# Save the agent
# model.save('PPO2_CRYPTO')
# Trained agent performence
obs = env.reset()
env.render()
for i in range(100000):
action, _states = model.predict(obs)
obs, rewards, done, info = env.step(action)
env.render(print_step=True)
Here is RuntimeWarning. It may not effect running.
C:Usersshin3.condaenvspy37lib andom.py:357: RuntimeWarning: overflow encountered in long_scalars cum_weights = list(_itertools.accumulate(weights))
1 is date collecting code
2 is rl trading code