finkit
Open-source financial analysis library. Production-grade indicators, signals, risk metrics, screening, and cost analysis.
No VecTrade account required — this is a standalone library for the quant/fintech community.
Installation
pip install vectrade-finkit
Quick Start
import pandas as pd
import finkit
# ── Technical Indicators ──
df["sma_20"] = finkit.sma(df["close"], period=20)
df["ema_12"] = finkit.ema(df["close"], period=12)
df["rsi"] = finkit.rsi(df["close"], period=14)
macd_line, signal, histogram = finkit.macd(df["close"])
upper, middle, lower = finkit.bollinger_bands(df["close"])
df["atr"] = finkit.atr(df["high"], df["low"], df["close"], period=14)
df["vwap"] = finkit.vwap(df["high"], df["low"], df["close"], df["volume"])
df["obv"] = finkit.obv(df["close"], df["volume"])
# ── Signal Detection ──
df["buy_signal"] = finkit.crossover(df["sma_10"], df["sma_50"])
df["sell_signal"] = finkit.crossunder(df["sma_10"], df["sma_50"])
df["divergence"] = finkit.divergence(df["close"], df["rsi"])
# ── Signal Engine (composable rules) ──
engine = finkit.SignalEngine()
engine.add_rule("rsi_oversold", lambda df: df["rsi"] < 30, direction="long")
engine.add_rule("macd_cross", lambda df: finkit.crossover(df["macd"], df["signal"]), direction="long")
signals = engine.evaluate(df)
# ── Risk Metrics ──
sharpe = finkit.sharpe_ratio(returns, risk_free_rate=0.04)
sortino = finkit.sortino_ratio(returns)
mdd = finkit.max_drawdown(equity_curve)
value_at_risk = finkit.var(returns, confidence=0.95)
# ── Stock Screening ──
from finkit import Rule, screen
results = screen(universe_df, rules=[
Rule("pe_ratio", "<", 25),
Rule("market_cap", ">", 10_000_000_000),
Rule("rsi_14", "between", (30, 70)),
Rule("sector", "in", ["Technology", "Healthcare"]),
])
# ── Cost Analysis ──
cost = finkit.calculate_trade_cost(shares=100, price=150.0, commission_per_share=0.005)
drag = finkit.annual_cost_drag(trades_per_year=200, avg_trade_cost=cost.total, portfolio_value=100_000)
API Reference
finkit.indicators
| Function | Signature | Description |
|---|---|---|
sma |
(series, period=20) |
Simple Moving Average |
ema |
(series, period=20) |
Exponential Moving Average |
rsi |
(series, period=14) |
Relative Strength Index (0–100) |
macd |
(series, fast=12, slow=26, signal=9) |
MACD → (line, signal, histogram) |
bollinger_bands |
(series, period=20, std_dev=2.0) |
Bollinger → (upper, middle, lower) |
atr |
(high, low, close, period=14) |
Average True Range (volatility) |
vwap |
(high, low, close, volume) |
Volume Weighted Average Price |
obv |
(close, volume) |
On-Balance Volume |
finkit.signals
| Function | Signature | Description |
|---|---|---|
crossover |
(fast, slow) |
Bullish crossover detection (boolean Series) |
crossunder |
(fast, slow) |
Bearish crossunder detection (boolean Series) |
divergence |
(price, indicator, window=14) |
Bullish divergence detection |
SignalEngine |
class | Composable rule-based signal scoring engine |
finkit.risk
| Function | Signature | Description |
|---|---|---|
sharpe_ratio |
(returns, risk_free_rate=0.0, periods=252) |
Annualized Sharpe Ratio |
sortino_ratio |
(returns, risk_free_rate=0.0, periods=252) |
Sortino Ratio (downside only) |
max_drawdown |
(returns) |
Maximum peak-to-trough drawdown |
var |
(returns, confidence=0.95, method="historical") |
Value at Risk (historical or parametric) |
finkit.screen
| Function | Signature | Description |
|---|---|---|
Rule |
(field, operator, value) |
Screening rule definition |
screen |
(df, rules) |
Apply rules and return matching rows |
Supported operators: <, <=, >, >=, ==, !=, between, in, contains
finkit.costs
| Function | Signature | Description |
|---|---|---|
calculate_trade_cost |
(shares, price, *, commission_per_share, ...) |
Total trade cost breakdown |
annual_cost_drag |
(trades_per_year, avg_trade_cost, portfolio_value) |
Annualized cost as portfolio drag |
TradeCost |
dataclass | Structured cost result |
Design Principles
- Zero API dependency — works with any pandas DataFrame
- NumPy vectorized — fast computation on large datasets
- Minimal dependencies — only
numpyandpandas - Fully typed —
py.typedmarker, works with mypy/pyright - Well-tested — 99% branch coverage
Part of the VecTrade Ecosystem
| Package | Description |
|---|---|
vectrade |
Python SDK for VecTrade API |
@vectrade/sdk |
TypeScript/Node SDK |
vectrade-finkit |
Financial computation library (this package) |
@vectrade/ai-provider |
Vercel AI SDK provider |
Documentation
Full documentation is available at docs.vectrade.io/sdks/finkit.
Contributing
See CONTRIBUTING.md for development setup and guidelines.
License
Apache-2.0 — see LICENSE.
Metadata
Release files for vectrade-finkit 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| vectrade_finkit-0.1.0.tar.gz | 24.5 kB | With provenance | Details for vectrade_finkit-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| vectrade_finkit-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for vectrade_finkit-0.1.0-py3-none-any.whl |
Total release size: 37.1 kB
Release files / vectrade_finkit-0.1.0.tar.gz
| Download URL | vectrade_finkit-0.1.0.tar.gz |
|---|---|
| Size | 24.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
32c34bf45e24041dbe8e62b8c018487a23778d9e72d073fbcce24bbb9722239c
|
|
BLAKE2b-256 checksum How to use checksums |
31e71795888197d8a802b167c43759da256d091ec5b91e7da193b04217e24064
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 22, 2026.
Transparency logRelease files / vectrade_finkit-0.1.0-py3-none-any.whl
| Download URL | vectrade_finkit-0.1.0-py3-none-any.whl |
|---|---|
| Size | 12.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b230bd9f0273a0c5b2455e43dbd07ecd57ba50bdb24bf635561e0edd7da1a4bb
|
|
BLAKE2b-256 checksum How to use checksums |
77f84da815f26a7adc078d80dbbbfb93e88c9ec860776f7b9b6d43d8a0a802bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 22, 2026.
Transparency logSecurity for vectrade-finkit 0.1.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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for vectrade_finkit-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 22, 2026.
Transparency logA 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.