GithubHelp home page GithubHelp logo

deep_portfolio's Introduction

rl_portfolio

This Repository uses Reinforcement Learning and Supervised learning to Optimize portfolio allocation. The goal is to make profitable agent which can optimize portfolio between n stocks (or any assets) by taking there price series data and output holdings in each. Portfolio can be long-short.

#How it works: In the start, I will be using episode length of one day and price series data for last n days for each stock. Time stamp will be per minute for both input and output.Mostly stock will be from same sector to start with so algo can also find some covariance among them. Idea in the end is to trade different assets and make a balanced online optimized portfolio.

#More Detailed Explanation of Algorithm: a) Make LSTM network for each asset and predict next interval price. All these networks are trained individually and trained network parameter is stored. (Code inside supervised learning)

b) Use trained LSTM networks and with other layer combine the network and start training network using Reinforcement learning so second network predict allocation to each.

#Other thoughts on the project are: a) Most of the financial engineering is about predicting the next price interval of the underlying asset. If you see first part that's what algorithm do it takes a supervised learning (made using LSTM) to predict that. This part can be separately optimised and made better in future. The more better it become the more better the algo will able to make portfolio.
b) Second part making a portfolio using RL: This part takes input from first part and log returns of the price series to predict portfolio allocation. Idea here is that even knowing next price interval doesn't guarantee much, unless you can make a portfolio of different assets which can have less drawdown and consistent returns.

Here, Idea is to make automatic optimisation algorithm based on how we set rewards. For example:

  1. Make a portfolio where I only care about returns: Just set the reward based on returns, Network will output algorithm which only trying to optimise returns.

  2. Make a portfolio where drawdown should be less and medium returns, in this case rewards will be functions which will use drawdown also to give feedback to the network. The portfolio made will be focussing on drawdown also. The brief idea is to make algorithm which can be improved everyday and so much general purpose that it can do based on what we want.

#Finding which network can explore: a) Automatic finding of look_back period for momentum strategy.
b) Automatic finding of average period of mean reverting strategy.
c) Optimize portfolio to autocorrect above.

deep_portfolio's People

Contributors

deependersingla avatar nigelliyang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

deep_portfolio's Issues

update_target_network_params error

Hello,
I'm very interested in committing to the project and building on it with you. However, Iโ€™m still facing some troubles running it.

  • which pipeline(order of functions) should I use to get it running starting from the price files ?

also, i faced an error in ddpg_rl.py file at
self.update_target_network_params =
[self.target_network_params[i].assign(tf.multiply(self.network_params[i], self.tau) +
tf.multiply(self.target_network_params[i], 1. - self.tau))
for i in range(len(self.target_network_params))]

ValueError: Dimensions must be equal, but are 2 and 400 for 'add_16' (op: 'Add') with input shapes: [13,2], [13,400].

Thanks in advance

Plan to make it in java ?

Thank you for this work !
I'm searching to implement that since a long time using karpathy things, in an android app to improve portfolio managment.

issue for myself

i promised lots of currency data.
I should deliver.
This year!

Yeah!

(sorry!)

Data missing

hello, thanks for you code, but I just wonder that where is the data, which you mean "/data/oneminutedata"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.