etf4u icon indicating copy to clipboard operation
etf4u copied to clipboard

Ability to remove display of weights from CSV output

Open dannykeane opened this issue 3 years ago • 2 comments

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
...

dannykeane avatar Oct 03 '21 05:10 dannykeane

with QQQ.csv a quick one line hack that does just that would be:

cat QQQ.csv | cut -d ',' -f1 > QQQ_tickers_only.csv

ohjho avatar Oct 05 '21 04:10 ohjho

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.

dannykeane avatar Oct 10 '21 21:10 dannykeane