{"id":46361,"library":"shioaji","title":"Shioaji","description":"Shioaji is a cross-language, cross-platform universal trading API providing native Python bindings, HTTP API with SSE streaming, standalone CLI, and a visual dashboard. Current version 1.5.2, with regular updates focused on fixing bugs and adding broker support. Requires Python >=3.7.","status":"active","version":"1.5.2","language":"python","source_language":"en","source_url":"https://github.com/Sinotrade/Shioaji","tags":["trading","finance","api","cli","dashboard"],"install":[{"cmd":"pip install shioaji","lang":"bash","label":"Standard install from PyPI"}],"dependencies":[],"imports":[{"note":"Shioaji is a module, not a class; the main entry point is via sj.login()","wrong":"from shioaji import Shioaji","symbol":"Shioaji","correct":"import shioaji as sj"},{"note":"Contracts enum is in the constant module, not directly in contracts","wrong":"import shioaji.contracts","symbol":"Contracts","correct":"from shioaji.constant import Contracts"}],"quickstart":{"code":"import shioaji as sj\napi = sj.Shioaji(simulation=True)  # simulation mode for paper trading\naccounts = api.login(\n    api_key=os.environ.get('SHIOAJI_API_KEY', ''),\n    secret_key=os.environ.get('SHIOAJI_SECRET_KEY', '')\n)\nprint(accounts)","lang":"python","description":"Initialize Shioaji in simulation mode and log in using environment variables for credentials."},"warnings":[{"fix":"Use api = sj.Shioaji(simulation=True) when testing or using paper trading.","message":"Shioaji has both simulation and real trading modes. Setting simulation=False or omitting simulation=True will connect to production servers, which may cause unintended real trades. Always explicitly set simulation=True for testing.","severity":"gotcha","affected_versions":"all"},{"fix":"Update code to handle Accounts object: accounts = api.login(...); account = accounts[0]  # or iterate","message":"In v1.4.0, the login method changed its return type. Previously it returned a tuple, now it returns an Accounts object. Code expecting a tuple will break.","severity":"breaking","affected_versions":">=1.4.0"},{"fix":"Use simulation=True instead of simulate=True.","message":"The Shioaji constructor parameter 'simulate' was deprecated in 1.3.0 and removed in 1.4.0. Use 'simulation' instead.","severity":"deprecated","affected_versions":">=1.4.0"}],"env_vars":null,"search_vec":"'1.5.2':31 '3.7':45 'ad':40 'api':13,19,48 'bind':17 'broker':41 'bug':38 'cli':24,49 'cross':6,9 'cross-languag':5 'cross-platform':8 'current':29 'dashboard':28,50 'financ':47 'fix':37 'focus':35 'http':18 'languag':7 'nativ':15 'platform':10 'provid':14 'python':16,44 'regular':33 'requir':43 'shioaji':1,2 'sse':21 'standalon':23 'stream':22 'support':42 'trade':12,46 'univers':11 'updat':34 'version':30 'visual':27","created_at":"2026-06-07T12:59:33.003376+00:00","updated_at":"2026-06-07T12:59:33.003376+00:00","problems":[{"fix":"Run: pip install shioaji --upgrade","cause":"The package is not installed or the Python environment is incorrect.","error":"ModuleNotFoundError: No module named 'shioaji'"},{"fix":"Use: import shioaji as sj; api = sj.Shioaji()","cause":"Incorrect import: trying to access Shioaji as a class directly from the module, but it's a class nested inside the package.","error":"AttributeError: module 'shioaji' has no attribute 'Shioaji'"},{"fix":"Ensure you set environment variables SHIOAJI_API_KEY and SHIOAJI_SECRET_KEY correctly. Check for typos or expired keys.","cause":"Missing or invalid API credentials.","error":"shioaji.exception.LoginFailedException: Login failed. Check your API Key and Secret Key."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["finance"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-29","last_verified":"2026-06-29","next_check":"2026-07-29","install_tag":null}}