timirey/trader-php
Composer 安装命令:
composer require timirey/trader-php
包简介
PHP wrapper for the trader extension, providing access to technical analysis indicators.
关键字:
README 文档
README
Trader PHP
Trader PHP is a PHP library that serves as a user-friendly wrapper for the Trader Extension. It provides developers with easy access to a wide range of technical analysis indicators and functions, enabling seamless integration of financial analytics into trading and finance applications.
With support for commonly used indicators like Moving Averages (SMA, EMA), Relative Strength Index (RSI), MACD, and more, this library simplifies the process of building financial tools, algorithmic trading systems, and real-time data analysis platforms.
Table of Contents
Features
- Easy-to-use wrapper around PHP’s Trader Extension.
- Support for over 30 technical analysis indicators such as SMA, EMA, RSI, MACD, and more.
- Real-time trading workflows with built-in error handling.
- Ideal for building financial applications, trading bots, and analytics tools.
Installation
You can easily install the library using Composer:
composer require timirey/trader-php
Make sure that the PHP Trader Extension is installed and enabled on your PHP setup.
Basic Usage
Once installed, you can quickly start using the indicators in your PHP application.
Example 1: Simple Moving Average (SMA)
use Trader\TraderService; require 'vendor/autoload.php'; // Initialize TraderService $trader = new TraderService(); // Sample close prices (could be from a stock price feed) $closePrices = [120.5, 121.0, 121.5, 122.0, 122.5]; // closing prices // Calculate the Simple Moving Average (SMA) with a period of 3 $sma = $trader->sma($closePrices, 3); // Display the result echo "Simple Moving Average (SMA): " . implode(", ", $sma);
Example 2: Relative Strength Index (RSI)
use Trader\TraderService; require 'vendor/autoload.php'; // Initialize TraderInterface $trader = new TraderService(); // Sample close prices $closePrices = [120.5, 121.0, 121.5, 122.0, 122.5]; // Calculate RSI with a period of 14 $rsi = $trader->rsi($closePrices, 14); // Display the result echo "Relative Strength Index (RSI): " . implode(", ", $rsi);
Available Indicators
The library provides access to a wide variety of technical analysis functions supported by the PHP Trader extension. Some of the most commonly used indicators include:
- SMA - Simple Moving Average
- EMA - Exponential Moving Average
- RSI - Relative Strength Index
- MACD - Moving Average Convergence Divergence
- ADX - Average Directional Index
- ATR - Average True Range
- Bollinger Bands
- CCI - Commodity Channel Index
- MFI - Money Flow Index
- OBV - On-Balance Volume
- Stochastic Oscillator
For a full list of available functions, refer to the official PHP Trader documentation.
Error Handling
To handle errors, you can catch BadFunctionCallException exceptions that occur when invalid data is passed to any indicator.
License
This library is licensed under the MIT License. See the LICENSE file for more information.
Reference
For more detailed documentation, please refer to official PHP Trader documentation.
timirey/trader-php 适用场景与选型建议
timirey/trader-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 195 次下载、GitHub Stars 达 7, 最近一次更新时间为 2024 年 11 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「trading」 「indicators」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 timirey/trader-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 timirey/trader-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 timirey/trader-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Secure Trading driver for the Omnipay PHP payment processing library
TwelveData API client library
Laravel cryptocurrency trading APIs.
This extension facilitates the computation of BIP! Scholar research-level impact indicators.
Alfabank REST API integration
Technical analysis indicators (TA-Lib) for PHP
统计信息
- 总下载量: 195
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 19
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-11-24