All Projects β†’ leoncvlt β†’ etf4u

leoncvlt / etf4u

Licence: other
πŸ“Š Python tool to scrape real-time information about ETFs from the web and mixing them together by proportionally distributing their assets allocation

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to etf4u

value-investing-studies
Data Analysis Studies on Value Investing
Stars: ✭ 66 (+127.59%)
Mutual labels:  investing, stock-market
nordnet
Uonfficial wrapper for financial data api from the Scandinavian broker Nordnet
Stars: ✭ 13 (-55.17%)
Mutual labels:  stock-market, etfs
linkedin-scraper
Tool to scrape linkedin
Stars: ✭ 74 (+155.17%)
Mutual labels:  scraping
NBA-Fantasy-Optimizer
NBA Daily Fantasy Lineup Optimizer for FanDuel Using Python
Stars: ✭ 21 (-27.59%)
Mutual labels:  scraping
cira
Cira algorithmic trading made easy. A Façade library for simpler interaction with alpaca-trade-API from Alpaca Markets.
Stars: ✭ 21 (-27.59%)
Mutual labels:  stock-market
Goirate
Pillaging the seven seas for torrents, pieces of eight and other bounty.
Stars: ✭ 20 (-31.03%)
Mutual labels:  scraping
stock-price-prediction
A practice project for machine learning and stop price prediction
Stars: ✭ 19 (-34.48%)
Mutual labels:  stock-market
hmm market behavior
Unsupervised Learning to Market Behavior Forecasting Example
Stars: ✭ 36 (+24.14%)
Mutual labels:  stock-market
support resistance
Small package that helps to find support and resistance levels and plot them on chart
Stars: ✭ 263 (+806.9%)
Mutual labels:  stock-market
rebalance-app
πŸ’Έ Optimal lazy portfolio rebalancing calculator (in Rust)
Stars: ✭ 37 (+27.59%)
Mutual labels:  investing
market-monitor
Interactive app to monitor market using Python
Stars: ✭ 20 (-31.03%)
Mutual labels:  stock-market
BigBoard
An Elegant Financial Markets Library Written in Swift
Stars: ✭ 66 (+127.59%)
Mutual labels:  stock-market
info-bot
πŸ€– A Versatile Telegram Bot
Stars: ✭ 37 (+27.59%)
Mutual labels:  scraping
double-agent
A test suite of common scraper detection techniques. See how detectable your scraper stack is.
Stars: ✭ 123 (+324.14%)
Mutual labels:  scraping
TradeByte
πŸ’Έ TradeByte - Stocks Trading Simulation WebApp
Stars: ✭ 30 (+3.45%)
Mutual labels:  stock-market
turtle
Instagram Photo Downloader
Stars: ✭ 15 (-48.28%)
Mutual labels:  scraping
chopper
Chopper is a tool to extract elements from HTML by preserving ancestors and CSS rules
Stars: ✭ 22 (-24.14%)
Mutual labels:  scraping
crawler-chrome-extensions
ηˆ¬θ™«ε·₯η¨‹εΈˆεΈΈη”¨ηš„ Chrome 插仢 | Chrome extensions used by crawler developer
Stars: ✭ 53 (+82.76%)
Mutual labels:  scraping
gochanges
**[ARCHIVED]** website changes tracker πŸ”
Stars: ✭ 12 (-58.62%)
Mutual labels:  scraping
SierraChartZorroPlugin
A Zorro broker API plugin for Sierra Chart, written in Win32 C++.
Stars: ✭ 22 (-24.14%)
Mutual labels:  etfs

etf4u

A python tool which scrapes real-time information about ETF holdings from the web, and can blend multiple ETF together by proportionally distributing their assets allocation, optionally clamping the maximum amount of assets for the blended fund.

Installation & Requirements

Make sure you're in your virtual environment of choice, then run

  • poetry install --no-dev if you have Poetry installed
  • pip install -r requirements.txt otherwise

Usage

etf4u [-h] [--clamp CLAMP] [--minimum MINIMUM] [--exclude EXCLUDE [EXCLUDE ...]] [--include INCLUDE [INCLUDE ...]] [--out-file OUT_FILE] [--no-cache] [-v] funds [funds ...]

positional arguments:
  funds                 A list of ETF symbols (or a single one) to scrape

optional arguments:
  -h, --help            show this help message and exit
  --clamp CLAMP         Clamp the number of maximum assets to this value, redistributing weights
  --minimum MINIMUM     Remove all assets with allocation smaller than this number after redistribution
  --exclude EXCLUDE [EXCLUDE ...]
                        A list of tickers to exclude from the scraped portfolio. Pass the tickers directly to the argument (e.g. --exclude AAA BBB CCC) Or pass the path to a text file containing the tickers
  --include INCLUDE [INCLUDE ...]
                        Only include assets whose ticker appear in this list. Pass the tickers directly to the argument (e.g. --include AAA BBB CCC) Or pass the path to a text file containing the tickers
  --out-file OUT_FILE   Exports the holdings list to this comma-separated (.csv) file
  --no-cache            Don't use cache files to load or store data
  -v, --verbose         Increase output log verbosity

Explanation

The tool exports the list of assets as a simple { [asset_symbol] : [weight] } dictionary format. Use the --out-file option to export this to a .csv.

When going through the provided ETF symbols, the script checks if there's a bespoke adapter defined to fetch information for that specific fund (some ETFs provides the full list of holdings on their website) - if not found, it uses a generic adapter that scrapes https://etfdb.com/ - the public version of the website only publishes the top 15 holdings for a fund but the script mixes and matches several requests with different sorting criterias to try and get the largest amount of data possible.

All data is cached on a daily basis, meaning that using the same fund in multiple commands will only scrape the real-time information once a day and then re-use the data from disk afterwards. Use the --no-cache flag to always query real-time data.

You can also use the tool to scrape a single ETF by passing only one symbole to the --funds parameter and not supplying the --clamp option.

Creating an adapter

Simply create a new .py file in the adapters folder, implementing the following:

  • A FUNDS variable in the module's scope containing a list of ETF symbols that should be processed with this adapter
  • a fetch() method which takes a fund parameter being the ETF symbol, and returns a dictionary of assets and their weights in the { [asset_symbol] : [weight] } format

No need to add anything else, the script automatically checks all modules in the adapters folder when processing funds. For a practical examples, check the existing adapters.

Example usage

python etf4u ARKK ARKW ARKQ ARKF ARKG --clamp 50 --out-file blend_ark.csv Adds together all holdings the 5 ARK’s Active ETFs, keeps only the top 50 holdings on the list, rebalances all weights proportionally and exports the assets list to the blend_ark.csv file

Support Buy me a coffee

If this tool has proven useful to you, consider buying me a coffee to support development of this and many other projects.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].