PHP交易者本地人
这是PHP的交易者扩展名的PHP端口,该端口是TA-LIB C/JAVA代码的端口。
该端口以PHP编写,没有任何其他要求。
要求
- PHP> = 8.2.0
那是您唯一需要的东西!如前所述,您无需为此库安装任何扩展名。
安装
该库旨在与作曲家一起安装。
composer require lupecode/php-trader-native
用法
置换式替换
该图书馆旨在用于交易者扩展程序的替换,并带有交易者扩展名的多填充。
友好的替代者
该软件包提供的另一个选项是使用更容易理解名称的功能。
如果您不想使用adosc TraderFriendly::chaikinAccumulationDistributionOscillator($high, $low, $close, $volume, $fastPeriod, $slowPeriod)因为它的描述chaikinAccumulationDistributionOscillator不够
关于默认值的注意
TA-LIB的PECL版本“ Trader”没有适用于功能的正确默认值。快速查看显示,许多函数都使用可选参数的最小值,而不是ta-lib的C/Java版本中使用的默认值。只要PECL Trader库使用与C/Java代码中的测试不同的默认值,例如testAdOscDefaultsDifferent通过。
对于好奇的是,在这里可以看到ADOSC的TA-LIB源,默认值为3和10,而PECL Trader源可以在此处看到2和2的默认值。
该软件包使用C/Java默认值,而不是PECL默认值。
速度
鉴于此库是用纯PHP编写的,因此运行量的运行速度比C延长的PECL扩展名慢。根据功能,我的基准测试得出5倍至30倍。
我欢迎任何优化帮助!我没有努力优化此库;这是从C到PHP的简单转换。
贡献/发展
要求
- PHP> = 8.0.0
- ext_trader> = 0.4.1这里
设置
检查存储库,然后与作曲家安装。
phpTraderNative.git
cd phpTraderNative
composer install –dev\”>
git checkout git@github.com:LupeCode/ phpTraderNative .git
cd phpTraderNative
composer install --dev
目录结构
source– 库的源代码。-
tests– 库的Phpunit测试。 -
peclPECL交易者扩展源代码。 -
talib– PECL交易者扩展使用的TA -LIB源代码。
测试
包括两个phpunit XML文件,一个用于测试,另一个用于覆盖。这是由于以下事实:当某些测试覆盖范围时,PHP悬挂并且永远不会完成。
使用测试
php -dxdebug.coverage_enable=0 ./vendor/phpunit/phpunit/phpunit --configuration ./phpunit.xml ./tests
使用覆盖范围
php -dxdebug.coverage_enable=1 ./vendor/phpunit/phpunit/phpunit --configuration ./phpunit_coverage.xml ./tests
执照
以下是源代码中发现的TA-LIB的版权信息。
TA-LIB Copyright (c) 1999-2007, Mario Fortier
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither name of author nor the names of its contributors may be used
to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
\'\'AS IS\'\' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
以下是我对PHP的代码移植的许可证。
MIT License
Copyright (C) Lupe Code, LLC.; Joshua Lopez
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the \"Software\"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
