Dies ist ein PHP-Port der Händlerverlängerung für PHP, bei dem es sich um einen Port des Ta-Lib C/Java-Code handelt.
Dieser Port ist in PHP und ohne andere Anforderungen geschrieben.
Das Ziel ist, dass diese Bibliothek von denjenigen verwendet werden kann, die die PHP Trader -Erweiterung nicht installieren können.
Das ist das einzige, was du brauchst! Wie bereits erwähnt, müssen Sie keine Erweiterungen für diese Bibliothek installieren.
Diese Bibliothek soll mit Komponisten installiert werden.
composer require lupecode/php-trader-native
Diese Bibliothek soll ein Drop-In-Ersatz für die Händlerverlängerung sein. Sie wird mit einer Polyfill für die Händlerverlängerung geliefert.
Eine weitere Option, die dieses Paket bietet, besteht darin, Funktionen zu verwenden, die den Namen leichter verstehen.
Wenn Sie adosc nicht verwenden möchten, weil es nicht beschreibend genug ist, können Sie stattdessen chaikinAccumulationDistributionOscillator wie folgt verwenden: TraderFriendly::chaikinAccumulationDistributionOscillator($high, $low, $close, $volume, $fastPeriod, $slowPeriod)
Die PECL-Version des Ta-Lib "Trader" hat nicht die korrekten Standardwerte für die Funktionen. Ein kurzer Blick zeigt, dass viele der Funktionen den Mindestwert für die optionalen Parameter anstelle der in der C/Java-Version von Ta-Lib verwendeten Standardeinstellungen verwenden. Einige der Tests wie testAdOscDefaultsDifferent bestehen so lange, wie die Pecl Trader -Bibliothek unterschiedliche Standardeinstellungen verwendet als die im C/Java -Code.
Für das Neugierige ist die Ta-Lib-Quelle für ADOSC hier mit Standardeinstellungen von 3 und 10 zu sehen, während die Pecl-Händlerquelle hier mit Standardeinstellungen von 2 und 2 zu sehen ist.
Dieses Paket verwendet die C/Java -Standardeinstellungen und nicht die PECL -Standardeinstellungen.
Angesichts der Tatsache, dass diese Bibliothek in reinem PHP geschrieben ist, läuft langsamer als die PECL -Erweiterung, die in C geschrieben ist. Meine Benchmarks geben je nach Funktion 5x bis 30x langsamer.
Ich begrüße jede Hilfe bei Optimierungen! Ich habe nicht daran gearbeitet, diese Bibliothek zu optimieren. Es ist eine einfache Konvertierung von C zu PHP.
Checkout des Repositorys und dann mit dem Komponisten installieren.
git checkout [email protected]:LupeCode/phpTraderNative.git
cd phpTraderNative
composer install --dev
source - Der Quellcode für die Bibliothek.tests - Die Phpunit -Tests für die Bibliothek.pecl - Der Quellcode von Pecl Trader -Erweiterungsquellen.talib - Der Ta -Lib -Quellcode, den die PECL -Händler -Erweiterung verwendet.Es sind zwei Phpunit -XML -Dateien enthalten, eine zum Testen und die andere zur Berichterstattung. Dies liegt an der Tatsache, dass PHP -Abhänge und nie fertig sind, wenn einige Tests mit Abdeckung durchgeführt werden.
Führen Sie die Tests mit
php -dxdebug.coverage_enable=0 ./vendor/phpunit/phpunit/phpunit --configuration ./phpunit.xml ./tests
Führen Sie die Abdeckung mit
php -dxdebug.coverage_enable=1 ./vendor/phpunit/phpunit/phpunit --configuration ./phpunit_coverage.xml ./tests
Nachfolgend finden Sie die Copyright-Informationen für Ta-Lib im Quellcode.
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.
Unten finden Sie die Lizenz für meine Portierung des Codes an 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.