Skip to main content

Fetch NISA account trading rankings from major Japanese securities brokerages

Project description

pynisa

PyPI version Python versions License: MIT Docs Open In Colab

Fetch NISA account trading rankings from major Japanese securities brokerages.

Note on ranking frequency: Rakuten rankings are updated monthly (around the 2nd of each month), while SBI rankings are updated weekly. This means SBI data changes every week, but Rakuten data only changes once a month. Historical queries reflect these different update cycles.

Installation

pip install pynisa

Quick Start

Python API

import pynisa

# Fetch top 10 NISA stock ranking from Rakuten
result = pynisa.ranking("rakuten")
result.data    # pandas DataFrame
result.period  # "2026年2月1日~2026年2月28日"

# US stocks from SBI
result = pynisa.ranking("sbi", "us_stock_buy", count=5)

# Historical ranking (requires database)
result = pynisa.ranking("sbi", date="2026-03-07")

# Force live fetch (skip database)
result = pynisa.ranking("rakuten", live=True)

# Rank history for a ticker
result = pynisa.history("rakuten", "7974")

# List available dates
pynisa.dates("sbi")  # ["2026-03-14", "2026-03-07", ...]

# Sync database manually
pynisa.sync(force=True)

CLI

# JP stock rankings from all brokerages (side by side)
nisa

楽天 (2026年2月1日~2026年2月28日)

rank change ticker name
1 7974 任天堂
2 9432 NTT
3 8306 三菱UFJ
4 7011 三菱重工業
5 5016 JX金属

SBI (2026/3/9 〜 2026/3/13)

rank change ticker name
1 8306 三菱UFJ
2 7267 本田技研工業
3 9984 ソフトバンク
4 5401 日本製鉄
5 7011 三菱重工業
# US stock rankings from all brokerages
nisa us

楽天 (2026年2月1日~2026年2月28日)

rank change ticker name
1 MSFT マイクロソフト
2 NVDA エヌビディア
3 SOFI ソーファイ
4 PLTR パランティア
5 MU マイクロン テクノロジー

SBI (2026/3/9 〜 2026/3/13)

rank change ticker name
1 NVDA エヌビディア
2 MSFT マイクロソフト
3 TSLA テスラ
4 PLTR パランティア
5 IONQ IonQ Inc
# Single brokerage
nisa rakuten
nisa us sbi -n 5

# Output as CSV or JSON
nisa rakuten -f csv
nisa us rakuten -f json

# Historical rankings
nisa rakuten --date 2026-02-28       # specific date
nisa rakuten --last 4                # last 4 weeks, latest first
nisa us --last 4                     # works with asset commands
nisa --last 4                        # all sources, last 4 weeks

# Force live fetch (skip database)
nisa rakuten --live

# Rank history for a ticker
nisa history rakuten 7974
nisa history sbi 8306 -c stock_buy

# Database management
nisa sync                            # download/update database
nisa sync --force                    # force re-download
nisa dates rakuten                   # list available dates
nisa dates sbi -c stock_buy

Supported Brokerages

Brokerage Asset Types Update Frequency
Rakuten Securities (楽天) JP/US/CN/ASEAN stocks, JP/Foreign ETFs Monthly (~2nd of month)
SBI Securities JP/US/CN stocks, US/CN ETFs, Funds Weekly

Database

pynisa maintains a SQLite database of historical rankings, automatically downloaded from GitHub Releases on first use. The database is updated by GitHub Actions:

  • Every Monday — captures SBI's weekly update
  • 3rd of each month — captures Rakuten's monthly update

The database is stored at ~/.cache/pynisa/nisa.db and auto-synced when stale (> 1 day).

License

MIT

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

pynisa-0.2.0.tar.gz (117.4 kB view details)

Uploaded Source

Built Distribution

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

pynisa-0.2.0-py3-none-any.whl (24.7 kB view details)

Uploaded Python 3

File details

Details for the file pynisa-0.2.0.tar.gz.

File metadata

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

File hashes

Hashes for pynisa-0.2.0.tar.gz
Algorithm Hash digest
SHA256 2be708e8029596795906743281b1fbe92067524a78fd1fd7256a16b086034461
MD5 2c5b9ab56897d1799e95e2269c8571f1
BLAKE2b-256 5286df2cc1fbdd71a304d33ae7c2f247b942d063f00aa2f1c45d6af7a44a58bb

See more details on using hashes here.

File details

Details for the file pynisa-0.2.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for pynisa-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 16a6a19de3d914a3cef6bc097dd9601a101ff40e43156b12a048fafa35336aeb
MD5 9bfeb8e30378a0168d36bfab80a4083f
BLAKE2b-256 db12fef2979f194bc92b9187429b444588937c2e2c156a0e288c60ae05816c61

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