Skip to main content
Phandas

en   zh-TW

English

A multi-factor quantitative trading framework for cryptocurrency markets.

Overview

Phandas is a streamlined toolkit for alpha factor research and backtesting in cryptocurrency markets. Design factors with 60+ operators, test with dollar-neutral backtesting, and analyze with professional metrics.

Try it now

Web Demo - Experience Phandas directly in your browser. No installation required.

Key Features

  • Data Fetching: Multi-source OHLCV data (Binance, OKX)
  • Factor Engine: 60+ time-series and cross-sectional operators
  • Neutralization: Vector projection & regression-based orthogonalization
  • Backtesting: Dollar-neutral strategies with full/partial rebalancing
  • Performance Metrics: Sharpe, Sortino, Calmar, Max Drawdown, VaR, PSR
  • Factor Analysis: IC, IR, correlation, coverage, turnover
  • MCP Integration: AI agents (Claude) can directly access Phandas

Installation

pip install phandas

Quick Start

from phandas import *

# Fetch market data
panel = fetch_data(
    symbols=['ETH', 'SOL', 'ARB', 'OP', 'POL', 'SUI'],
    timeframe='1d',
    start_date='2023-01-01',
    sources=['binance'],
)

# Extract factors
close = panel['close']
volume = panel['volume']
open = panel['open']

# Construct momentum factor
momentum_20 = (close / close.ts_delay(20)) - 1

# Neutralize against volume
factor = vector_neut(rank(momentum_20), rank(-volume))

# Backtest strategy
result = backtest(
    entry_price_factor=open, 
    strategy_factor=factor,
    transaction_cost=(0.0003, 0.0003)
)

result.plot_equity()

AI Integration via MCP

Use Phandas with AI IDEs (Cursor, Claude Desktop) directly—no coding required.

Setup for Cursor (Recommended)

  1. pip install phandas
  2. Open Cursor → Settings → Tools & MCP → New MCP Server
  3. Paste the JSON config below, save and restart
{
  "mcpServers": {
    "phandas": {
      "command": "python",
      "args": ["-m", "phandas.mcp_server"]
    }
  }
}

Available Tools (4 Functions)

  • fetch_market_data: Get OHLCV data for symbols
  • list_operators: Browse all 50+ factor operators
  • read_source: View source code of any function
  • execute_factor_backtest: Backtest custom factor expressions

繁體中文

一個專為加密貨幣市場設計的多因子量化交易框架。

概述

Phandas 是一個精簡的加密貨幣因子研究與回測工具。提供 60+ 運算子設計因子、美元中性回測、專業績效指標分析。

立即體驗

網頁演示 - 直接在瀏覽器中體驗 Phandas,無需安裝。

核心功能

  • 資料獲取:多源 OHLCV 資料(Binance、OKX)
  • 因子引擎:60+ 時間序列與橫截面運算子
  • 因子中性化:向量投影與迴歸正交化
  • 回測引擎:美元中性策略、全/部分調倉
  • 績效指標:夏普比、Sortino、Calmar、最大回撤、VaR、PSR
  • 因子分析:IC、IR、相關性、覆蓋率、換手率
  • MCP 集成:AI 代理(Claude)可直接調用 Phandas

安裝

pip install phandas

快速開始

from phandas import *

# 獲取市場資料
panel = fetch_data(
    symbols=['ETH', 'SOL', 'ARB', 'OP', 'POL', 'SUI'],
    timeframe='1d',
    start_date='2023-01-01',
    sources=['binance'],
)

# 提取因子
close = panel['close']
volume = panel['volume']
open = panel['open']

# 構建動量因子
momentum_20 = (close / close.ts_delay(20)) - 1

# 對成交量進行中性化
factor = vector_neut(rank(momentum_20), rank(-volume))

# 回測策略
result = backtest(
    entry_price_factor=open, 
    strategy_factor=factor,
    transaction_cost=(0.0003, 0.0003)
)

result.plot_equity()

AI 集成(MCP 支援)

在 AI IDE(Cursor、Claude Desktop)中直接使用 Phandas—無需編碼。

Cursor 設定(推薦)

  1. pip install phandas
  2. 開啟 Cursor → Settings → Tools & MCP → New MCP Server
  3. 貼上下方 JSON 配置,儲存並重啟
{
  "mcpServers": {
    "phandas": {
      "command": "python",
      "args": ["-m", "phandas.mcp_server"]
    }
  }
}

可用工具(4 個函數)

  • fetch_market_data: 獲取代幣 OHLCV 資料
  • list_operators: 瀏覽 50+ 因子運算子
  • read_source: 查看任何函數的源代碼
  • execute_factor_backtest: 回測自訂因子表達式

Documentation | 文檔


Community & Support | 社群與支持

License

This project is licensed under the BSD 3-Clause License - see LICENSE file for details.

Metadata

Release files for phandas 0.18.1

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

Source distribution (sdist)

Source distribution for phandas 0.18.1
File Size Uploaded Provenance Actions
phandas-0.18.1.tar.gz 60.4 kB Without provenance Details for phandas-0.18.1.tar.gz

Built distribution (wheel)

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

Total release size: 123.5 kB

Release files / phandas-0.18.1.tar.gz

Download URL phandas-0.18.1.tar.gz
Size 60.4 kB
Tags Source
SHA-256 checksum
How to use checksums
1e7b2aedf3e887ac29305d50c03601a3e747c7b61abbdf3e9094b4298a9499be
BLAKE2b-256 checksum
How to use checksums
5bedfc43138020a3ca065f63b36f3abf2f64ae61326d8e151b1e7224fc904e96
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.7

Release files / phandas-0.18.1-py3-none-any.whl

Download URL phandas-0.18.1-py3-none-any.whl
Size 63.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3ec5a5ed64b2312121ac6649eafa5bd339fb19ff7fff2e593d97da41123485d4
BLAKE2b-256 checksum
How to use checksums
41302e9bcf9c966004d099efb136ba0bef326fe1488e6c46b3c2137a1cea07ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.7

Security for phandas 0.18.1

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