clementperroud / rl-trading-agent Goto Github PK
View Code? Open in Web Editor NEWProfitable Reinforcement Learning Agent on Crypto Markets
Profitable Reinforcement Learning Agent on Crypto Markets
When running the notebook there are several errors, some of which seem like inconsistency between the Rainbow library version and this notebook. Some of the errors are easy to solve such as:
training_envs = gym.vector.SyncVectorEnv([lambda: make_env("/notebooks/data/processed/training/*.pkl") for _ in range(5)])
validation_envs = gym.vector.SyncVectorEnv([lambda: make_env("/notebooks/data/processed/validation/*.pkl") for _ in range(5)])
These lines does not work because the manage_data.ipynb
file doesn´t output to training
or validation
folder.
env.add_metric('Position Changes', lambda history : f"{ 100*np.sum(np.diff(history['position']) != 0)/len(history['position']):5.2f}%" )
env.add_metric('Max Drawdown', max_drawdown)
These lines throw the error: WARN: env.add_metric to get variables from other wrappers is deprecated and will be removed in v1.0, to get this variable you can do env.unwrapped.add_metric for environment variables or env.get_attr('add_metric') that will search the reminding wrappers.
Changing to:
env.unwrapped.add_metric('Position Changes', lambda history : f"{ 100*np.sum(np.diff(history['position']) != 0)/len(history['position']):5.2f}%" )
env.unwrapped.add_metric('Max Drawdown', max_drawdown)
Fixes it
'Rainbow' object has no attribute 'e_greedy_pick_actions_or_random'
I think this one is because the method was renamed to e_greedy_pick_actions
on this commit
This one I haven´t found how to fix it
could not broadcast input array from shape (15,7) into shape (15,6)
when the following line is ran:
agent.store_replays(obs, actions, rewards, next_obs, dones, truncateds)
P.D. Thanks for the amazing project!
def add_features(df):
df["feature_close"] = robust_scale(df["close"].pct_change())
df["feature_open"] = robust_scale(df["open"]/df["close"])
df["feature_high"] = robust_scale(df["high"]/df["close"])
df["feature_low"] = robust_scale(df["low"]/df["close"])
df["feature_volume"] = robust_scale(df["volume"] / df["volume"].rolling(7*24).max())
df.dropna(inplace= True) # Clean your data !
return df
I think robust_scale must use future info
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.