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=['ETH', 'SOL', 'ARB', 'OP', 'POL', 'SUI'],
    timeframe='1d',
    start_date='2023-01-01',
    sources=['binance', 'benchmark', 'calendar'],
)

# 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=['ETH', 'SOL', 'ARB', 'OP', 'POL', 'SUI'],
    timeframe='1d',
    start_date='2023-01-01',
    sources=['binance', 'benchmark', 'calendar'],
)

# 提取因子
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 BSD 3-Clause 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.13.0.tar.gz (41.3 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.13.0-py3-none-any.whl (41.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for phandas-0.13.0.tar.gz
Algorithm Hash digest
SHA256 b34a7d82db828463a7033c6f49c775561788a0f0afbb696159b274d0c074d42f
MD5 fbe170987b70c5311ed3e95e81d0944f
BLAKE2b-256 bf55cbf4b78c4af8fd0afc728c2a2e2831455f87f4e2ce1ed29dca104d09a826

See more details on using hashes here.

File details

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

File metadata

  • Download URL: phandas-0.13.0-py3-none-any.whl
  • Upload date:
  • Size: 41.2 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.13.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3e9b567abc73816dba0de562e39a51c3d8e37265d5d8b7130e9facda73566214
MD5 c2083cf7de0d8d49c7ec353bd554a616
BLAKE2b-256 2f41b1272aed4efff64b185966917f748baa7a95c527a784ee38d0cbe3e3dbbe

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