Skip to main content

A clean, beginner-friendly Python library for fetching JPX ETF portfolio composition (PCF) data.

Project description

pyjpx-etf

PyPI Python License Docs

A clean, beginner-friendly Python library for fetching JPX ETF portfolio composition (PCF) data and ranking ETFs by returns.

Installation

pip install pyjpx-etf

Quick Start

import pyjpx_etf as etf

e = etf.ETF("1306")
print(e.info.name)       # "TOPIX連動型上場投資信託"
print(e.nav)             # total fund NAV in yen
print(e.fee)             # trust fee (%) e.g. 0.06
print(e.holdings[:3])
# [Holding(code='7203', name='トヨタ自動車', ...),
#  Holding(code='8306', name='三菱UFJフィナンシャル・グループ', ...),
#  Holding(code='6758', name='ソニーグループ', ...)]

# Rank ETFs by returns
etf.ranking()              # top 10 by 1-month return
etf.ranking("1y", n=20)    # top 20 by 1-year return
etf.ranking("ytd", n=-5)   # worst 5 by ytd return

CLI

$ etf 1306

1306 — TOPIX連動型上場投資信託 (2026-02-27)
Nav: 5170億  信託報酬: 0.06%

 Code   Name                                Weight
─────  ──────────────────────────────────  ──────
 7203   トヨタ自動車                          3.7%
 8306   三菱UFJフィナンシャル・グループ    3.3%
 6501   日立製作所                            2.4%
 ...

ETF Ranking

Rank all TSE ETFs by period returns:

$ etf rank                # top 10 by 1-month return
$ etf rank 20 1y          # top 20 by 1-year return
$ etf rank -5 ytd --en    # worst 5 by ytd, English names

Available periods: 1m (default), 3m, 6m, 1y, 3y, 5y, 10y, ytd

Aliases

Use shorthand aliases instead of codes:

Alias Code ETF
etf topix 1306 TOPIX連動型上場投資信託
etf 225 1321 日経225連動型上場投資信託
etf core30 1311 TOPIX Core30連動型上場投資信託
etf div50 1489 日経平均高配当株50指数連動型ETF
etf div70 1577 野村日本株高配当70連動型ETF
etf pbr 2080 PBR1倍割れ解消推進ETF
etf sox 2243 Global X 半導体 ETF
etf jpsox1 200A 日経半導体株 ETF
etf jpsox2 2644 Global X 半導体関連-日本株式 ETF

Options

$ etf sox --en         # English names
$ etf topix -a         # all holdings (not just top 10)
$ etf 1306 -a --en     # combine options
$ etf --help           # show all commands
$ etf --version        # show version

Language Setting

Names default to Japanese. Switch to English via config or CLI flag:

import pyjpx_etf as etf

# English names
etf.config.lang = "en"
e = etf.ETF("1306")
print(e.info.name)  # "TOPIX ETF"

Configuration

import pyjpx_etf as etf

etf.config.timeout = 60
etf.config.request_delay = 0.5
etf.config.lang = "en"  # "ja" (default) or "en"

Documentation

Full documentation

Open In Colab

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyjpx_etf-0.3.3.tar.gz (122.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyjpx_etf-0.3.3-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

Details for the file pyjpx_etf-0.3.3.tar.gz.

File metadata

  • Download URL: pyjpx_etf-0.3.3.tar.gz
  • Upload date:
  • Size: 122.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for pyjpx_etf-0.3.3.tar.gz
Algorithm Hash digest
SHA256 1dc8cfd8e365d3cc5d5f1f2f4e0132f761245b48f2021eeefb5f2c972472f13d
MD5 0717ea19aa2fd1b4e28e3218e8ca2d5f
BLAKE2b-256 113d6e5542ee82ae783b7fd45cc50631e68855e46d4199b11d78ffb0f0e02247

See more details on using hashes here.

File details

Details for the file pyjpx_etf-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: pyjpx_etf-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 18.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for pyjpx_etf-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 396232e681c1cfc6ec50880d1ca6994d6c202052178c3467aa0ae6f24c8a2c07
MD5 d3d9bec49b98cf97a7d5493fa1f76d7b
BLAKE2b-256 9c03b9c91fcf30ea086ffd58e0b9a297227f8698989dbf7fe41eb88c828177e0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page