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=['BNB', 'ETH', 'SOL', 'MATIC', 'ARB', 'OP'],
    timeframe='1d',
    start_date='2023-01-01'
)

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

# Construct momentum factor
momentum_14 = (close / close.ts_delay(14)) - 1
momentum_21 = (close / close.ts_delay(21)) - 1
momentum_30 = (close / close.ts_delay(30)) - 1
factor = momentum_14 + momentum_21 + momentum_30

# Neutralize against volume
neutralized_factor = vector_neut(factor, -volume)

# Backtest strategy
result = backtest(
    price_factor=open_price, 
    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=['BNB', 'ETH', 'SOL', 'MATIC', 'ARB', 'OP'],
    timeframe='1d',
    start_date='2023-01-01'
)

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

# 構建動量因子
momentum_14 = (close / close.ts_delay(14)) - 1
momentum_21 = (close / close.ts_delay(21)) - 1
momentum_30 = (close / close.ts_delay(30)) - 1
factor = momentum_14 + momentum_21 + momentum_30

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

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

result.plot_equity()

由 Phantom Management 開發。

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.11.0.tar.gz (37.4 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.11.0-py3-none-any.whl (37.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for phandas-0.11.0.tar.gz
Algorithm Hash digest
SHA256 6034288c68cb6c0e3bfcc10aa9e65f4e7231fcae546048b298c6e8aeb1212dc0
MD5 031cb78393bb1f35e0539d748941277e
BLAKE2b-256 54ef8858b91c6af8ce9680c904ba50f5cd53dc4138a6684dd86d26029f42dd09

See more details on using hashes here.

File details

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

File metadata

  • Download URL: phandas-0.11.0-py3-none-any.whl
  • Upload date:
  • Size: 37.4 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.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2ba16959e63145a7c619dfff3482810e3b7e145c6061b4b61a8e45d6152c18ba
MD5 3ef9b9241c744fd274e71885fe3efbed
BLAKE2b-256 bfd111fce7188ec7a69e9514ebc893122229845fec8caffed076d4f3289ebc6a

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