Il s'agit d'un port PHP de l'extension Trader pour PHP, qui est un port du code TA-LIB C / Java.
Ce port est écrit en PHP et sans autre exigence.
L'objectif est que cette bibliothèque puisse être utilisée par ceux qui ne peuvent pas installer l'extension PHP Trader.
C'est la seule chose dont vous avez besoin! Comme indiqué, vous n'avez pas besoin d'installer de prolongations pour cette bibliothèque.
Cette bibliothèque est destinée à être installée avec Composer.
composer require lupecode/php-trader-native
Cette bibliothèque est destinée à remplacer l'extension Trader, il est livré avec un polyfill pour l'extension Trader.
Une autre option que ce package offre consiste à utiliser des fonctions qui ont un nom plus facile à comprendre.
Si vous ne voulez pas utiliser adosc car il n'est pas suffisamment descriptif, vous pouvez plutôt utiliser chaikinAccumulationDistributionOscillator comme ceci: TraderFriendly::chaikinAccumulationDistributionOscillator($high, $low, $close, $volume, $fastPeriod, $slowPeriod)
La version PECL du Ta-Lib, "Trader", n'a pas les valeurs par défaut correctes pour les fonctions. Un coup d'œil montre que de nombreuses fonctions utilisent la valeur minimale pour les paramètres facultatifs au lieu des valeurs par défaut utilisées dans la version C / Java de Ta-Lib. Certains des tests, comme testAdOscDefaultsDifferent Pass tant que la bibliothèque PECL Trader utilise des valeurs par défaut différentes de celles du code C / Java.
Pour le curieux, la source Ta-Lib pour ADOSC peut être vue ici avec des valeurs par défaut de 3 et 10, tandis que la source PECL Trader peut être vue ici avec des valeurs par défaut de 2 et 2.
Ce package utilise les paramètres par défaut C / Java et non les paramètres par défaut PECL.
Étant donné que cette bibliothèque est écrite en PHP pur, est plus lentement que l'extension PECL qui est écrite en C. mes repères donnent 5x à 30x plus lent selon la fonction.
Je salue toute aide avec les optimisations! Je n'ai pas travaillé pour optimiser cette bibliothèque; C'est une conversion simple de C à PHP.
Découvrez le référentiel, puis installez avec Composer.
git checkout [email protected]:LupeCode/phpTraderNative.git
cd phpTraderNative
composer install --dev
source - Le code source de la bibliothèque.tests - Les tests PHPUnit pour la bibliothèque.pecl - Le code source d'extension PECL Trader.talib - le code source Ta-Lib que l'extension PELL Trader utilise.Deux fichiers PHPUnit XML sont inclus, l'un pour les tests et l'autre pour la couverture. Cela est dû au fait que lorsque certains tests sont exécutés avec une couverture, PHP est suspendu et ne termine jamais.
Exécutez les tests en utilisant
php -dxdebug.coverage_enable=0 ./vendor/phpunit/phpunit/phpunit --configuration ./phpunit.xml ./tests
Exécutez la couverture en utilisant
php -dxdebug.coverage_enable=1 ./vendor/phpunit/phpunit/phpunit --configuration ./phpunit_coverage.xml ./tests
Vous trouverez ci-dessous les informations sur le droit d'auteur pour Ta-Lib trouvée dans le code source.
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.
Vous trouverez ci-dessous la licence pour mon portage du code à 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.