geoffroy-pradier/php-trader
Composer 安装命令:
composer require geoffroy-pradier/php-trader
包简介
PHP implementation of technical indicators for trading. Alternative to the Trader extension.
README 文档
README
A pure PHP implementation of technical indicators for trading, including the Relative Strength Index (RSI) and Stochastic Oscillator. No native extensions (e.g., Trader PECL) are required, making it portable across PHP environments.
Installation
Install the package via Composer:
composer require geoffroy-pradier/php-trader
Requirements
- PHP >= 8.2
Usage
Relative Strength Index (RSI)
Calculate the RSI for a series of closing prices:
use GeoffroyPradier\Trader\Rsi; $prices = [100, 102, 101, 105, 103, 107, 110, 108, 112, 115, 113, 118, 120, 122, 119]; $rsi = Rsi::calculate($prices, 14); print_r($rsi); // Outputs array of RSI values
Stochastic Oscillator (%K and %D)
Calculate the %K and %D lines for high, low, and closing prices:
use GeoffroyPradier\Trader\Stochastic; $highs = [101, 103, 102, 106, 104, 108, 111, 109, 113, 116, 114, 119, 121, 123, 120, 126, 124]; $lows = [99, 101, 100, 104, 102, 106, 109, 107, 111, 114, 112, 117, 119, 121, 118, 124, 122]; $closes = [100, 102, 101, 105, 103, 107, 110, 108, 112, 115, 113, 118, 120, 122, 119, 125, 123]; $stoch = Stochastic::calculate($highs, $lows, $closes, 14, 3); print_r($stoch['k']); // %K values print_r($stoch['d']); // %D values
Testing
Run the PHPUnit tests to verify functionality:
composer test
Development
To contribute:
- Fork the repository on GitHub.
- Add your changes and include corresponding PHPUnit tests.
- Submit a pull request.
License
MIT
geoffroy-pradier/php-trader 适用场景与选型建议
geoffroy-pradier/php-trader 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 09 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 geoffroy-pradier/php-trader 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 geoffroy-pradier/php-trader 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 31
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-09-30