Coder Social home page Coder Social logo

pat42w / ef_portfolio_optimization Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 31.26 MB

This project aims to test Portfolio Optimization methods on stock data in python.

License: MIT License

Jupyter Notebook 99.98% Python 0.02%
efficient-frontier python sharpe-ratio stock-portfolio time-series

ef_portfolio_optimization's People

Stargazers

 avatar  avatar

Watchers

 avatar

ef_portfolio_optimization's Issues

Negative Adj Close price from YFinance

Negative prices in the price data this shouldn't be possible, seeing this as an issue in yfinance repo.

perhaps a drop of any columns with negatives would be an interim fix.
I will investigate further.
Until this is solved our modeling is pointless.

Another example is ITRN

import yfinance as yf
yf.download(['MSFT','ITRN'],'2006-1-1')['Adj Close']

image

Originally posted by @pat42w in ranaroussi/yfinance#138 (comment)

List of indexes tickers lists to Add

List of indexes tickers lists to Add

Check what indexs are available through yfinance

All must be formatted as TSVs & have two columns Symbol containing the share/stock's ticker & Description containing its name
-London Stock Exchange
-Irish
-European
-Japanese
-Canadian

Create testing notebook

Testing notebook that will take a pipeline or function, index & date range and test how the optimal portfolio performs vs actual

Infinities arising in the max , mean and actual stats

database=df_Nasdaq startdate=pd.to_datetime("2015-08-01") enddate=pd.to_datetime("2016-12-01") dmf.portfolio_generate_test(database,startdate,enddate,p_max=250, min_returns=0.01, s_asset=0, asset_len=50, silent=False, obj_method="SHARPE")

Results in inf

Risk free rate should be 0

When generating portfolios since we have no financing costs we should have a risk free rate of 0 applied. As we have no financing cost

Main branch protected

Getting this when pushing to main branch

PS C:\Users\eogha\EF_Portfolio_Optimization> git push
Enter passphrase for key '/c/Users/eogha/.ssh/id_ed25519': 
Enumerating objects: 12, done.
Counting objects: 100% (10/10), done.
Delta compression using up to 8 threads
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 7.33 MiB | 84.00 KiB/s, done.
Total 6 (delta 4), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (4/4), completed with 2 local objects.
remote: error: GH006: Protected branch update failed for refs/heads/main.
remote: error: At least 2 approving reviews are required by reviewers with write access.
To github.com:pat42w/EF_Portfolio_Optimization.git
 ! [remote rejected] main -> main (protected branch hook declined)
error: failed to push some refs to 'github.com:pat42w/EF_Portfolio_Optimization.git'

I think I have unsufficient perms @pat42w

Portfolio & stock analysis

Now that we have the data currency & forex as we want it, we should start to think about how to use it.
there are lots of approaches to take, we have the Effiencient frontier, we can look at time series forecasting of stocks, or groupings by type etc.

have a think about how should we go about these analysis

Check for extra prerequisites

Testing in relatively fresh environment on my Windows PC to check for additional required packages to add to requirements.txt

Logic to remove delisted Tickers from an index list

NYSE has redundant tickers example BSN.U: No data found, symbol may be delisted these should be removed from the TSV file.

This culd be done manually but would be good to have logic as we add more indexes

Currency data fetching issue

When run dmf.gen_curr_csv(start_date) in 1_Database_maintainance.ipynb i get the following error:

ConnectionError: None: Max retries exceeded with url: /api/2007-01-01?base=USD&symbols=EUR&rtype=fpy (Caused by None)

Error checking on Indexs

Introduce list of available index's which is checked when entering index name in any of the database function

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.