Skip to main content

A multi-factor quantitative trading framework for cryptocurrency markets.

Project description

Phandas

en zh-TW

English

A multi-factor quantitative trading framework for cryptocurrency markets.

Overview

Phandas is a quantitative analysis framework designed for systematic portfolio construction and risk management. It provides high-performance data structures and financial analysis tools for factor investing and statistical arbitrage strategies.

Key Features

  • Data management: Automated OHLCV data fetching with validation and quality checks
  • Factor operations: Extensive library of time-series and cross-sectional operators
  • Neutralization: Vector projection and regression-based factor neutralization
  • Backtesting: Dollar-neutral portfolio construction with dynamic rebalancing
  • Performance Analytics: Total Return, Annual Return, Sharpe Ratio, Max Drawdown, Turnover

Installation

pip install phandas

Quick Start

from phandas import *

# Fetch market data
panel = fetch_data(
    symbols=['BTC', 'ETH', 'SOL', 'DOGE', 'XRP', 'ADA'],
    timeframe='1d',
    start_date='2023-01-01'
)

# 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
neutralized_factor = vector_neut(rank(momentum_20), rank(-volume))

# Backtest strategy
result = backtest(
    price_factor=open, 
    strategy_factor=neutralized_factor,
    transaction_cost=(0.0003, 0.0003)
)

result.plot_equity()

Developed by Phantom Management.


繁體中文

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

概述

Phandas 是一個為系統化投資組合構建與風險管理而設計的量化分析框架。它為因子投資與統計套利策略提供高效能的資料結構與金融分析工具。

核心功能

  • 資料管理:自動化 OHLCV 資料獲取,包含驗證與品質檢查
  • 因子運算:豐富的時間序列與橫截面運算子庫
  • 中性化:基於向量投影與迴歸的因子中性化
  • 回測:美元中性投組構建、動態調倉
  • 績效分析:年化收益、夏普比率、最大回撤、換手率

安裝

pip install phandas

快速開始

from phandas import *

# 獲取市場資料
panel = fetch_data(
    symbols=['BTC', 'ETH', 'SOL', 'DOGE', 'XRP', 'ADA'],
    timeframe='1d',
    start_date='2023-01-01'
)

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

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

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

# 回測策略
result = backtest(
    price_factor=open, 
    strategy_factor=neutralized_factor,
    transaction_cost=(0.0003, 0.0003)
)

result.plot_equity()

由 Phantom Management 開發。

Community & Support | 社群與支持

License

This project is licensed under the MIT License - see LICENSE file for details.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

phandas-0.12.0.tar.gz (39.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

phandas-0.12.0-py3-none-any.whl (38.8 kB view details)

Uploaded Python 3

File details

Details for the file phandas-0.12.0.tar.gz.

File metadata

  • Download URL: phandas-0.12.0.tar.gz
  • Upload date:
  • Size: 39.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.7

File hashes

Hashes for phandas-0.12.0.tar.gz
Algorithm Hash digest
SHA256 c599445eda1ecc315fdc4a952d0af0af9ec5dae44401ac18be0bcbc01f43a80a
MD5 306b1a8dbab0a5fab422f354d2655db6
BLAKE2b-256 329308d0c4759382b564b960a9a2233a93a55e4d1773d5c25ec8ccc970609577

See more details on using hashes here.

File details

Details for the file phandas-0.12.0-py3-none-any.whl.

File metadata

  • Download URL: phandas-0.12.0-py3-none-any.whl
  • Upload date:
  • Size: 38.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.7

File hashes

Hashes for phandas-0.12.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0bb07133f64e8c40b11055e8435c7e079562560c8829f174f2c29511985248ab
MD5 cd29c5d8ee4460457b438c02a67993a5
BLAKE2b-256 938bb22d88e8792632b4004819e675b4d6e024d7f67851887853944e1f2ec61d

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