Skip to main content

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

Metadata

Release files for pynisa 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pynisa 0.2.0
File Size Uploaded Provenance
pynisa-0.2.0.tar.gz 117.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pynisa 0.2.0
File Interpreter ABI Platform
pynisa-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 142.1 kB

Release files / pynisa-0.2.0.tar.gz

Download URL pynisa-0.2.0.tar.gz
Size 117.4 kB
Tags Source
SHA-256 checksum
How to use checksums
2be708e8029596795906743281b1fbe92067524a78fd1fd7256a16b086034461
BLAKE2b-256 checksum
How to use checksums
5286df2cc1fbdd71a304d33ae7c2f247b942d063f00aa2f1c45d6af7a44a58bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.0

Release files / pynisa-0.2.0-py3-none-any.whl

Download URL pynisa-0.2.0-py3-none-any.whl
Size 24.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
16a6a19de3d914a3cef6bc097dd9601a101ff40e43156b12a048fafa35336aeb
BLAKE2b-256 checksum
How to use checksums
db12fef2979f194bc92b9187429b444588937c2e2c156a0e288c60ae05816c61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.0

Security for pynisa 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page