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

Uploaded Python 3

File details

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

File metadata

  • Download URL: phandas-0.11.1.tar.gz
  • Upload date:
  • Size: 38.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.11.1.tar.gz
Algorithm Hash digest
SHA256 049da5a0d88b04f80b2d90c1707bc4e5de8cfe6785d592d1d24704c3f6a7da4b
MD5 a9ca82271dad95ea33bb1afb81d54463
BLAKE2b-256 dc138cb1cd4c43be42596d645015bacb56949751b9fc5d5d816d6ac3e7d5b943

See more details on using hashes here.

File details

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

File metadata

  • Download URL: phandas-0.11.1-py3-none-any.whl
  • Upload date:
  • Size: 37.9 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d1964219e15730d8fdca07e47c3442aedbd13c9fbf69b1c94d0b08332cf84928
MD5 f37c20da56692aeb0e890357dcd72c65
BLAKE2b-256 4ad74c65f6d45aa6f749688b2cc17847750f22690253c4465e71c213e03a999e

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