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

# US stock rankings from all brokerages
nisa us

# 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.1.0.tar.gz (117.1 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.1.0-py3-none-any.whl (23.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pynisa-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ec5be7b48c6c598e625b7343c880418e54e1849c406e9256276c2e29c474e358
MD5 42b14b595c06302846498a58b94bb901
BLAKE2b-256 092befbcad2017047737b727f941d0562c7a5262d76063647e19161251c19a2a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pynisa-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 23.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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fb46cb7d0aca87c8bd30cd9910fb8da807e8ad4db4e74efb8ad572a1ee6db4af
MD5 1194f588ca926719feeb689a5df2bdf1
BLAKE2b-256 9412918eb442586ab075991db368fb51a180333125ce352c5970b3d2f693fff4

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