etf4u
etf4u copied to clipboard
Ability to remove display of weights from CSV output
This script is awesome—super helpful. I was wondering if it would be possible to add an additional optional argument to only display the ticker symbols (organized in order of weight) in CSV's.
Optional argument:
--tickers-only TICKERS_ONLY
Example:
python etf4u QQQ --tickers-only --out-file QQQ.csv
Example output in QQQ.csv:
MSFT,
AMZN,
TSLA,
GOOG,
GOOGL,
FB,
NVDA,
PYPL,
ADBE,
NFLX,
CMCSA,
CSCO,
INTC,
PEP
...
with QQQ.csv
a quick one line hack that does just that would be:
cat QQQ.csv | cut -d ',' -f1 > QQQ_tickers_only.csv
with
QQQ.csv
a quick one line hack that does just that would be:cat QQQ.csv | cut -d ',' -f1 > QQQ_tickers_only.csv
Solid suggestion, but I don't think it works—it ends up returning an empty CSV.