Skip to main content

kabu-json-lib

システムトレーディングに必要な計算や便利なPythonライブラリをまとめたパッケージです。

バージョン

  • 最新バージョン: 0.1.12
  • リリース日: 2024-03-22

機能一覧

  • bp関数: 損益計算に必要な値を計算します。
  • fetch_now関数: 現在の日本時間をdatetimeオブジェクトで返します。
  • order_to_one_line関数: 注文情報を1行の文字列にフォーマットします(valueはprice×quantityで自動計算されます)。
  • setup_logger関数: アプリケーション全体で使用する共通のロギング設定を提供します。
  • fetch_tradable_codes関数: 取引可能な証券コードのリストを取得します。
  • fetch_symbol_name関数: 銘柄コードから銘柄名を取得します。

インストール方法

pip install kabu-json-lib

使い方

from kabu_json_lib import bp, fetch_now, order_to_one_line, setup_logger, fetch_tradable_codes, fetch_symbol_name

# 取引可能な証券コードの取得
tradable_codes = fetch_tradable_codes()
print(tradable_codes)  # ['1234', '5678', '9012', ...]

# 銘柄名の取得
symbol_name = fetch_symbol_name("1305")
print(symbol_name)  # "住友不動産"

# ロギングの設定
logger = setup_logger('my_app')
logger.info('アプリケーション開始')
logger.warning('警告メッセージ')
logger.error('エラーメッセージ')

print(bp(0.05))  # 500
print(bp(None))  # None

now = fetch_now()
print(now)  # 2023-10-01 12:34:56+09:00

# 注文情報のフォーマット例
order = {
    "long_or_short": "LONG",
    "entry_or_exit": "ENTRY",
    "symbol": "AAPL",
    "price": 150.0,
    "quantity": 100,
    "value": 15000,
    "order_type": "MARKET",
    "datetime_obj": now
}
print(order_to_one_line(order))  # [LONG -ENTRY ] AAPL @ 150.0 *   100 (¥    15000) [MARKET] 2024-03-21 12:34:56

ロギング機能の詳細

  • 環境変数LOG_LEVELでログレベルを設定可能(デフォルト: INFO)
  • INFOレベル以下のメッセージは標準出力へ
  • WARNINGレベル以上のメッセージは標準エラー出力へ
  • 日本語対応のフォーマット
  • 重複設定の防止機能

リポジトリ

Metadata

Release files for kabu-json-lib 0.1.12

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

Source distribution (sdist)

Source distribution for kabu-json-lib 0.1.12
File Size Uploaded Provenance
kabu_json_lib-0.1.12.tar.gz 6.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for kabu-json-lib 0.1.12
File Interpreter ABI Platform
kabu_json_lib-0.1.12-py3-none-any.whl Python 3 none any Details

Total release size: 13.3 kB

Release files / kabu_json_lib-0.1.12.tar.gz

Download URL kabu_json_lib-0.1.12.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
8b7cd9a7f9557063c4ff4d604586f2880cfcd05844adc1ef8b47d306be5b4dd4
BLAKE2b-256 checksum
How to use checksums
9a3cc5cd4b368dbb1b103598bfb4cdfceea658d8923bfc7d9461444f7496f60b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.2

Release files / kabu_json_lib-0.1.12-py3-none-any.whl

Download URL kabu_json_lib-0.1.12-py3-none-any.whl
Size 6.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
83bb96dd04768a8b73c376029baf211e529483954ea53e1c102dfa9f0de59bc5
BLAKE2b-256 checksum
How to use checksums
c17c53850fe195390b23ac2b1d88542ae01f04ae94d2238cb8a774ac20b5ef2f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.2

Security for kabu-json-lib 0.1.12

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.

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