diff --git a/.deepsource.toml b/.deepsource.toml new file mode 100644 index 0000000..8f389ad --- /dev/null +++ b/.deepsource.toml @@ -0,0 +1,7 @@ +version = 1 + +test_patterns = ["Tests/*Test.php"] + +[[analyzers]] +name = "php" +enabled = true \ No newline at end of file diff --git a/.gitignore b/.gitignore index 4fbbbfe..ac168b2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ .* !/.gitignore -vendor/ +!/.gitlab-ci.yml +/vendor/ +/logs/ +/metrics/ +*.bat diff --git a/LICENSE b/LICENSE index 9cecc1d..3f9cd1f 100644 --- a/LICENSE +++ b/LICENSE @@ -1,674 +1,188 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - {one line to give the program's name and a brief idea of what it does.} - Copyright (C) {year} {name of author} - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - {project} Copyright (C) {year} {fullname} - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. +GNU GENERAL PUBLIC LICENSE +Version 3, 29 June 2007 + +Copyright (C) 2007 Free Software Foundation, Inc. + +Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. +Preamble + +The GNU General Public License is a free, copyleft license for software and other kinds of works. + +The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. + +When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. + +To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. + +For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. + +Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. + +For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. + +Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. + +Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. + +The precise terms and conditions for copying, distribution and modification follow. +TERMS AND CONDITIONS +0. Definitions. + +“This License” refers to version 3 of the GNU General Public License. + +“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. + +“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations. + +To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work. + +A “covered work” means either the unmodified Program or a work based on the Program. + +To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. + +To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. + +An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. +1. Source Code. + +The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work. + +A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. + +The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. + +The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. + +The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. + +The Corresponding Source for a work in source code form is that same work. +2. Basic Permissions. + +All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. + +You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. +3. Protecting Users' Legal Rights From Anti-Circumvention Law. + +No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. + +When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. +4. Conveying Verbatim Copies. + +You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. + +You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. +5. Conveying Modified Source Versions. + +You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified it, and giving a relevant date. + b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”. + c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. + d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. + +A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. +6. Conveying Non-Source Forms. + +You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: + + a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. + b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. + c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. + d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. + e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. + +A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. + +“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. + +If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). + +The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. + +Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. +7. Additional Terms. + +“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. + +Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or + b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or + c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or + d) Limiting the use for publicity purposes of names of licensors or authors of the material; or + e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or + f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. + +All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. + +If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. +8. Termination. + +You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). + +However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. + +Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. + +Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. +9. Acceptance Not Required for Having Copies. + +You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. +10. Automatic Licensing of Downstream Recipients. + +Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. + +An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. + +You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. +11. Patents. + +A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”. + +A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. + +In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. + +If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. + +If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. + +A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. +12. No Surrender of Others' Freedom. + +If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. +13. Use with the GNU Affero General Public License. + +Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. +14. Revised Versions of this License. + +The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. + +If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. + +Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. +15. Disclaimer of Warranty. + +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. +16. Limitation of Liability. + +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +17. Interpretation of Sections 15 and 16. + +If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. + +END OF TERMS AND CONDITIONS diff --git a/README.md b/README.md new file mode 100644 index 0000000..1c85827 --- /dev/null +++ b/README.md @@ -0,0 +1,57 @@ +# PHP Trader Interface + +This is an interface to the PHP Trader Extension. +The PHP Trader Extension is available from . +The extension and the source for it can be downloaded there. + +### Requires the PHP Trader Extension to be installed. + +This project is just an interface to that extension, and does not work without it. + +If you cannot install the PECL extension, try the [PHP Trader Native](https://github.com/LupeCode/phpTraderNative) project instead. + +### Requires PHP 7.0.0 or newer + +Variable types are set on all function parameters. + +### Requires PECL Trader 0.4.1 or newer. + +If you are using version 0.4.0, see the branch `trader-0.4.0` for that. + +## Purpose + +This package is meant to help when using the Trader PECL package. +This is helpful if you do not have the code stub for the Trader Extension. +Loading this interface will provide your IDE with the function information and auto completing. + +## How to use + +Lets assume that you want to generate a correlation indicator. +Instead of using +`trader_correl($Open, $Close, 30)` +You can now use the exact named +`\LupeCode\phpTraderInterface\Trader::correl($Open, $Close, 30)` +or the friendly named +`\LupeCode\phpTraderInterface\Trader::pearsonCorrelationCoefficient($Open, $Close, 30)` + +## Metrics & Coverage +### PHP Metrics Report +To see the current report of metrics by PHP Metrics, visit [Metrics](https://projects.lupecode.com/phpTraderInterface/metrics/) +### PHP Unit Coverage +To see the current report of coverage by PHP Unit, visit [Coverage](https://projects.lupecode.com/phpTraderInterface/logs/report/) +### PHP Unit Test Results + * PHP 7.0 NTS [[XML]](https://projects.lupecode.com/phpTraderInterface/logs/logfile-7.0NTS.xml) [[TXT]](https://projects.lupecode.com/phpTraderInterface/logs/testdox-7.0NTS.txt) [[HTML]](https://projects.lupecode.com/phpTraderInterface/logs/testdox-7.0NTS.html) + * PHP 7.0 TS [[XML]](https://projects.lupecode.com/phpTraderInterface/logs/logfile-7.0TS.xml) [[TXT]](https://projects.lupecode.com/phpTraderInterface/logs/testdox-7.0TS.txt) [[HTML]](https://projects.lupecode.com/phpTraderInterface/logs/testdox-7.0TS.html) + * PHP 7.1 NTS [[XML]](https://projects.lupecode.com/phpTraderInterface/logs/logfile-7.1NTS.xml) [[TXT]](https://projects.lupecode.com/phpTraderInterface/logs/testdox-7.1NTS.txt) [[HTML]](https://projects.lupecode.com/phpTraderInterface/logs/testdox-7.1NTS.html) + * PHP 7.1 TS [[XML]](https://projects.lupecode.com/phpTraderInterface/logs/logfile-7.1TS.xml) [[TXT]](https://projects.lupecode.com/phpTraderInterface/logs/testdox-7.1TS.txt) [[HTML]](https://projects.lupecode.com/phpTraderInterface/logs/testdox-7.1TS.html) + * PHP 7.2 NTS [[XML]](https://projects.lupecode.com/phpTraderInterface/logs/logfile-7.2NTS.xml) [[TXT]](https://projects.lupecode.com/phpTraderInterface/logs/testdox-7.2NTS.txt) [[HTML]](https://projects.lupecode.com/phpTraderInterface/logs/testdox-7.2TS.html) + * PHP 7.2 TS [[XML]](https://projects.lupecode.com/phpTraderInterface/logs/logfile-7.2TS.xml) [[TXT]](https://projects.lupecode.com/phpTraderInterface/logs/testdox-7.2TS.txt) [[HTML]](https://projects.lupecode.com/phpTraderInterface/logs/testdox-7.2TS.html) + +## License +Copyright (C) Lupe Code, LLC.; Joshua Lopez + +This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program. If not, see . diff --git a/Tests/TraderTest.php b/Tests/TraderTest.php index 3863814..406200c 100644 --- a/Tests/TraderTest.php +++ b/Tests/TraderTest.php @@ -1,66 +1,2055 @@ assertEquals(TRADER_MA_TYPE_SMA, \LupeCode\phpTraderInterface\Trader::TRADER_MA_TYPE_SMA); - $this->assertEquals(TRADER_MA_TYPE_EMA, \LupeCode\phpTraderInterface\Trader::TRADER_MA_TYPE_EMA); - $this->assertEquals(TRADER_MA_TYPE_WMA, \LupeCode\phpTraderInterface\Trader::TRADER_MA_TYPE_WMA); - $this->assertEquals(TRADER_MA_TYPE_DEMA, \LupeCode\phpTraderInterface\Trader::TRADER_MA_TYPE_DEMA); - $this->assertEquals(TRADER_MA_TYPE_TEMA, \LupeCode\phpTraderInterface\Trader::TRADER_MA_TYPE_TEMA); - $this->assertEquals(TRADER_MA_TYPE_TRIMA, \LupeCode\phpTraderInterface\Trader::TRADER_MA_TYPE_TRIMA); - $this->assertEquals(TRADER_MA_TYPE_KAMA, \LupeCode\phpTraderInterface\Trader::TRADER_MA_TYPE_KAMA); - $this->assertEquals(TRADER_MA_TYPE_MAMA, \LupeCode\phpTraderInterface\Trader::TRADER_MA_TYPE_MAMA); - $this->assertEquals(TRADER_MA_TYPE_T3, \LupeCode\phpTraderInterface\Trader::TRADER_MA_TYPE_T3); - $this->assertEquals(TRADER_REAL_MIN, \LupeCode\phpTraderInterface\Trader::TRADER_REAL_MIN); - $this->assertEquals(TRADER_REAL_MAX, \LupeCode\phpTraderInterface\Trader::TRADER_REAL_MAX); - $this->assertEquals(TRADER_FUNC_UNST_ADX, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_ADX); - $this->assertEquals(TRADER_FUNC_UNST_ADXR, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_ADXR); - $this->assertEquals(TRADER_FUNC_UNST_ATR, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_ATR); - $this->assertEquals(TRADER_FUNC_UNST_CMO, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_CMO); - $this->assertEquals(TRADER_FUNC_UNST_DX, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_DX); - $this->assertEquals(TRADER_FUNC_UNST_EMA, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_EMA); - $this->assertEquals(TRADER_FUNC_UNST_HT_DCPERIOD, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_HT_DCPERIOD); - $this->assertEquals(TRADER_FUNC_UNST_HT_DCPHASE, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_HT_DCPHASE); - $this->assertEquals(TRADER_FUNC_UNST_HT_PHASOR, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_HT_PHASOR); - $this->assertEquals(TRADER_FUNC_UNST_HT_TRENDLINE, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_HT_TRENDLINE); - $this->assertEquals(TRADER_FUNC_UNST_HT_TRENDMODE, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_HT_TRENDMODE); - $this->assertEquals(TRADER_FUNC_UNST_KAMA, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_KAMA); - $this->assertEquals(TRADER_FUNC_UNST_MAMA, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_MAMA); - $this->assertEquals(TRADER_FUNC_UNST_MFI, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_MFI); - $this->assertEquals(TRADER_FUNC_UNST_MINUS_DI, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_MINUS_DI); - $this->assertEquals(TRADER_FUNC_UNST_MINUS_DM, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_MINUS_DM); - $this->assertEquals(TRADER_FUNC_UNST_NATR, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_NATR); - $this->assertEquals(TRADER_FUNC_UNST_PLUS_DI, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_PLUS_DI); - $this->assertEquals(TRADER_FUNC_UNST_PLUS_DM, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_PLUS_DM); - $this->assertEquals(TRADER_FUNC_UNST_RSI, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_RSI); - $this->assertEquals(TRADER_FUNC_UNST_STOCHRSI, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_STOCHRSI); - $this->assertEquals(TRADER_FUNC_UNST_T3, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_T3); - $this->assertEquals(TRADER_FUNC_UNST_ALL, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_ALL); - $this->assertEquals(TRADER_FUNC_UNST_NONE, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_NONE); - $this->assertEquals(TRADER_COMPATIBILITY_DEFAULT, \LupeCode\phpTraderInterface\Trader::TRADER_COMPATIBILITY_DEFAULT); - $this->assertEquals(TRADER_COMPATIBILITY_METASTOCK, \LupeCode\phpTraderInterface\Trader::TRADER_COMPATIBILITY_METASTOCK); - $this->assertEquals(TRADER_ERR_SUCCESS, \LupeCode\phpTraderInterface\Trader::TRADER_ERR_SUCCESS); - $this->assertEquals(TRADER_ERR_LIB_NOT_INITIALIZE, \LupeCode\phpTraderInterface\Trader::TRADER_ERR_LIB_NOT_INITIALIZE); - $this->assertEquals(TRADER_ERR_BAD_PARAM, \LupeCode\phpTraderInterface\Trader::TRADER_ERR_BAD_PARAM); - $this->assertEquals(TRADER_ERR_ALLOC_ERR, \LupeCode\phpTraderInterface\Trader::TRADER_ERR_ALLOC_ERR); - $this->assertEquals(TRADER_ERR_GROUP_NOT_FOUND, \LupeCode\phpTraderInterface\Trader::TRADER_ERR_GROUP_NOT_FOUND); - $this->assertEquals(TRADER_ERR_FUNC_NOT_FOUND, \LupeCode\phpTraderInterface\Trader::TRADER_ERR_FUNC_NOT_FOUND); - $this->assertEquals(TRADER_ERR_INVALID_HANDLE, \LupeCode\phpTraderInterface\Trader::TRADER_ERR_INVALID_HANDLE); - $this->assertEquals(TRADER_ERR_INVALID_PARAM_HOLDER, \LupeCode\phpTraderInterface\Trader::TRADER_ERR_INVALID_PARAM_HOLDER); - $this->assertEquals(TRADER_ERR_INVALID_PARAM_HOLDER_TYPE, \LupeCode\phpTraderInterface\Trader::TRADER_ERR_INVALID_PARAM_HOLDER_TYPE); - $this->assertEquals(TRADER_ERR_INVALID_PARAM_FUNCTION, \LupeCode\phpTraderInterface\Trader::TRADER_ERR_INVALID_PARAM_FUNCTION); - $this->assertEquals(TRADER_ERR_INPUT_NOT_ALL_INITIALIZE, \LupeCode\phpTraderInterface\Trader::TRADER_ERR_INPUT_NOT_ALL_INITIALIZE); - $this->assertEquals(TRADER_ERR_OUTPUT_NOT_ALL_INITIALIZE, \LupeCode\phpTraderInterface\Trader::TRADER_ERR_OUTPUT_NOT_ALL_INITIALIZE); - $this->assertEquals(TRADER_ERR_OUT_OF_RANGE_START_INDEX, \LupeCode\phpTraderInterface\Trader::TRADER_ERR_OUT_OF_RANGE_START_INDEX); - $this->assertEquals(TRADER_ERR_OUT_OF_RANGE_END_INDEX, \LupeCode\phpTraderInterface\Trader::TRADER_ERR_OUT_OF_RANGE_END_INDEX); - $this->assertEquals(TRADER_ERR_INVALID_LIST_TYPE, \LupeCode\phpTraderInterface\Trader::TRADER_ERR_INVALID_LIST_TYPE); - $this->assertEquals(TRADER_ERR_BAD_OBJECT, \LupeCode\phpTraderInterface\Trader::TRADER_ERR_BAD_OBJECT); - $this->assertEquals(TRADER_ERR_NOT_SUPPORTED, \LupeCode\phpTraderInterface\Trader::TRADER_ERR_NOT_SUPPORTED); - $this->assertEquals(TRADER_ERR_INTERNAL_ERROR, \LupeCode\phpTraderInterface\Trader::TRADER_ERR_INTERNAL_ERROR); - $this->assertEquals(TRADER_ERR_UNKNOWN_ERROR, \LupeCode\phpTraderInterface\Trader::TRADER_ERR_UNKNOWN_ERROR); + + // + protected $Open = + [ + '37.560001', '36.889999', '36.25', '35.580002', '35.869999', '36.400002', '37.639999', '37.369999', + '37.369999', '37.27', '37.43', '37.389999', '37.43', '36.630001', '36.700001', '36.970001', '36.82', + '36.84', '36.900002', '36.669998', '37.110001', '36.66', '37.25', '37.73', '36.880001', '36.130001', + '36.630001', '36.849998', '36.459999', '36.049999', '36.939999', '37.09', '37.439999', '37.029999', + '36.91', '37.389999', '37.279999', '37.169998', '36.970001', '36.549999', '37.060001', '35.810001', + '36.25', '36.650002', '36.509998', '36.84', '37.52', '37.32', '37.470001', '37.50', '37.919998', + '37.099998', '36.459999', '36.240002', '37.130001', '37.470001', '36.939999', '36.650002', + '36.380001', '36.849998', '35.860001', '36.400002', '36.700001', '36.549999', '36.540001', + '36.509998', '36.610001', '35.049999', '35.389999', '34.450001', '35.43', '34.68', '35.00', + '34.540001', '33.880001', '33.029999', '33.32', '33.75', '33.290001', '33.59', '33.09', '33.66', + '33.68', '32.91', '32.709999', '32.810001', '32.040001', '31.309999', '31.68', '30.74', '30.41', + '31.200001', '30.65', '30.190001', '29.559999', '29.469999', '27.98', '27.120001', '26.459999', + '27.110001', '26.639999', '27.610001', '29.059999', '27.91', '28.450001', '29.32', '29.27', '29.10', + '30.59', '29.90', '29.76', '29.959999', '29.969999', '28.75', '28.98', '29.84', '29.280001', + '29.690001', '30.889999', '30.58', '30.65', '30.51', '30.969999', '31.67', '31.549999', '32.119999', + '33.220001', '33.849998', '33.630001', '33.900002', '34.189999', '34.240002', '32.990002', + '33.119999', '33.099998', '33.810001', '33.150002', '32.529999', '32.939999', '34.009998', + '34.490002', '35.799999', '34.240002', '34.759998', '34.34', '35.59', '35.00', '33.869999', + '33.029999', '32.790001', '32.77', '33.09', '33.00', '32.860001', '33.209999', '32.889999', + '33.009998', '32.23', '32.779999', '33.200001', '34.209999', '33.450001', '34.07', '34.939999', + '35.02', '34.889999', '35.150002', '35.459999', '35.139999', '34.869999', '34.299999', '34.970001', + '33.130001', '32.650002', '31.26', '32.060001', '33.490002', '33.259998', '33.639999', '32.419998', + '32.279999', '32.560001', '32.709999', '32.349998', '31.790001', '31.309999', '30.790001', + '30.799999', '28.620001', '28.950001', '28.65', '28.58', '29.030001', '29.66', '29.469999', + '30.559999', '30.780001', '31.200001', '30.51', '31.309999', '31.139999', '29.719999', '30.68', + '31.09', '31.35', '30.40', '32.200001', '32.00', '31.860001', '32.009998', '31.49', '32.91', + '33.32', '33.360001', '32.459999', '32.98', '29.02', '33.580002', '34.77', '35.669998', '35.779999', + '36.240002', '35.82', '35.080002', '34.290001', '36.740002', '36.869999', '36.52', '37.34', '37.32', + '36.610001', '36.669998', '37.560001', '37.50', '37.919998', '37.639999', '38.310001', '39.580002', + '39.299999', '38.57', '39.610001', '39.98', '39.189999', '38.700001', '38.509998', '38.650002', + '38.25', '38.349998', '38.23', '37.200001', '38.240002', '38.759998', '39.259998', '39.459999', + ]; + protected $High = + [ + '38.080002', '37.580002', '37.080002', '36.139999', '36.009998', '36.950001', '37.779999', '37.52', + '37.549999', '37.68', '37.439999', '37.450001', '37.599998', '37.439999', '36.91', '37.139999', + '37.73', '37.299999', '36.990002', '37.200001', '37.110001', '37.220001', '37.740002', '38.080002', + '37.880001', '36.849998', '36.959999', '37.630001', '36.950001', '36.720001', '37.23', '37.50', + '37.700001', '37.790001', '37.07', '37.509998', '37.630001', '37.580002', '37.349998', '37.310001', + '37.450001', '36.09', '36.41', '36.740002', '36.98', '37.439999', '37.59', '37.540001', '37.540001', + '38.09', '38.119999', '38.189999', '36.73', '37.00', '37.150002', '37.50', '37.349998', '36.830002', + '36.849998', '36.919998', '37.25', '37.00', '36.919998', '37.50', '36.880001', '37.02', '37.279999', + '36.43', '35.450001', '34.869999', '35.700001', '35.610001', '36.099998', '35.209999', '34.549999', + '34.080002', '33.459999', '34.09', '33.860001', '33.599998', '33.52', '33.82', '34.380001', '33.93', + '33.209999', '33.240002', '32.849998', '32.459999', '31.90', '31.360001', '31.120001', '31.379999', + '31.209999', '30.23', '30.139999', '29.66', '29.440001', '27.32', '26.969999', '27.809999', + '27.690001', '27.969999', '29.139999', '29.23', '28.610001', '30.23', '29.790001', '29.51', + '30.629999', '30.530001', '30.190001', '30.389999', '30.52', '29.799999', '29.110001', '30.00', + '29.77', '30.57', '31.17', '30.969999', '30.75', '31.540001', '31.190001', '32.459999', '32.330002', + '32.349998', '33.689999', '34.040001', '34.169998', '33.91', '34.740002', '34.580002', '34.209999', + '33.299999', '33.630001', '34.080002', '33.880001', '33.389999', '33.27', '34.150002', '34.73', + '35.84', '34.98', '34.919998', '35.200001', '35.720001', '36.389999', '33.889999', '33.830002', + '33.09', '33.52', '33.189999', '33.869999', '33.299999', '33.50', '33.02', '33.119999', '32.990002', + '33.040001', '33.849998', '34.23', '34.130001', '34.080002', '35.200001', '35.299999', '35.240002', + '35.34', '35.48', '35.700001', '35.150002', '35.27', '35.470001', '33.490002', '33.360001', '31.90', + '32.43', '33.59', '33.630001', '33.860001', '33.490002', '32.490002', '32.830002', '33.02', '32.689999', + '32.50', '31.99', '31.190001', '31.200001', '30.709999', '29.00', '29.110001', '29.23', '29.219999', + '29.709999', '29.57', '30.57', '30.92', '31.74', '30.799999', '31.33', '31.77', '31.23', '30.92', + '31.43', '31.59', '31.799999', '32.830002', '32.290001', '32.740002', '32.029999', '32.099998', + '32.990002', '33.57', '33.77', '32.619999', '33.029999', '32.279999', '34.02', '34.950001', + '35.669998', '36.189999', '36.240002', '36.349998', '36.610001', '34.77', '36.77', '37.689999', + '36.759998', '37.52', '37.709999', '37.209999', '36.98', '37.57', '37.689999', '37.919998', + '37.919998', '38.310001', '39.580002', '39.779999', '39.630001', '39.849998', '39.98', '39.790001', + '38.959999', '38.799999', '39.029999', '38.799999', '38.419998', '38.68', '37.490002', '38.380001', + '39.119999', '39.639999', '39.779999', + ]; + protected $Low = + [ + '37.43', '36.889999', '36.25', '35.50', '35.049999', '36.09', '37.41', '37.169998', '37.200001', + '37.240002', '36.810001', '36.540001', '37.099998', '36.630001', '36.419998', '36.59', '36.709999', + '36.84', '36.630001', '36.52', '36.50', '36.580002', '36.560001', '37.50', '36.84', '36.07', + '35.470001', '36.77', '36.43', '35.880001', '36.669998', '36.889999', '37.25', '36.880001', + '36.380001', '36.790001', '37.200001', '37.139999', '36.919998', '36.490002', '36.860001', + '35.740002', '35.91', '36.32', '36.150002', '36.509998', '36.630001', '36.91', '37.18', '37.16', + '37.349998', '37.00', '36.110001', '35.880001', '36.419998', '36.849998', '36.900002', '36.279999', + '36.32', '35.619999', '35.720001', '36.310001', '36.220001', '36.540001', '36.310001', '36.50', + '36.439999', '35.009998', '34.619999', '33.93', '34.709999', '34.68', '35.00', '34.380001', + '33.869999', '33.00', '33.110001', '33.509998', '32.84', '32.09', '32.779999', '32.84', '33.59', + '32.759998', '32.419998', '32.77', '32.040001', '31.309999', '31.219999', '30.24', '29.799999', + '30.51', '30.389999', '29.700001', '29.389999', '29.059999', '27.940001', '26.719999', '26.15', + '26.84', '26.51', '26.48', '27.73', '27.709999', '26.57', '28.129999', '28.790001', '28.51', + '28.60', '29.450001', '29.620001', '29.66', '29.309999', '28.190001', '27.440001', '29.309999', + '28.59', '28.709999', '29.33', '30.209999', '29.74', '30.00', '30.02', '31.60', '31.530001', + '31.139999', '33.18', '33.349998', '33.599998', '33.349998', '34.099998', '33.990002', '32.970001', + '32.689999', '32.869999', '33.110001', '32.91', '32.50', '32.209999', '32.82', '33.91', '33.150002', + '34.029999', '34.470001', '34.18', '34.099998', '34.77', '33.470001', '32.849998', '32.439999', + '32.75', '32.610001', '32.869999', '32.689999', '32.580002', '32.32', '32.619999', '32.119999', + '32.169998', '33.130001', '33.029999', '33.259998', '33.080002', '33.459999', '34.16', '34.75', + '34.650002', '35.07', '35.049999', '34.700001', '34.299999', '33.880001', '33.00', '32.240002', + '31.209999', '31.01', '32.77', '33.18', '33.16', '32.400002', '31.77', '32.32', '32.549999', + '31.99', '31.73', '31.209999', '30.66', '30.35', '28.43', '28.440001', '28.49', '27.85', + '27.200001', '28.91', '28.85', '29.629999', '30.17', '30.879999', '30.41', '30.809999', '30.99', + '29.41', '30.00', '30.629999', '31.030001', '30.35', '30.860001', '31.440001', '31.799999', + '31.379999', '31.23', '32.23', '32.93', '32.950001', '31.110001', '31.540001', '29.00', '32.91', + '33.869999', '35.029999', '35.599998', '35.77', '35.720001', '34.82', '33.849998', '35.73', + '36.869999', '36.150002', '36.299999', '37.23', '36.599998', '36.369999', '36.619999', '37.299999', + '37.380001', '37.27', '37.650002', '38.669998', '39.060001', '38.259998', '39.349998', '39.259998', + '38.93', '38.599998', '38.150002', '38.439999', '38.099998', '37.779999', '37.52', '36.939999', + '36.580002', '38.459999', '39.189999', '39.150002', + ]; + protected $Close = + [ + '37.990002', '37.560001', '36.860001', '36.040001', '35.220001', '36.240002', '37.779999', + '37.360001', '37.400002', '37.290001', '36.939999', '37.389999', '37.32', '37.400002', '36.470001', + '36.830002', '37.349998', '36.970001', '36.73', '37.07', '36.599998', '37.150002', '36.650002', + '37.939999', '37.82', '36.759998', '35.59', '37.529999', '36.66', '36.50', '37.02', '37.240002', + '37.27', '37.48', '36.48', '37.029999', '37.369999', '37.439999', '37.18', '37.23', '36.939999', + '36.00', '36.009998', '36.529999', '36.599998', '36.59', '36.950001', '37.110001', '37.23', '37.48', + '37.669998', '37.84', '36.330002', '36.52', '36.509998', '37.169998', '37.310001', '36.66', '36.48', + '36.07', '36.169998', '36.66', '36.41', '37.02', '36.48', '36.810001', '36.560001', '36.32', + '35.23', '34.860001', '34.799999', '35.41', '35.470001', '35.169998', '34.279999', '34.009998', + '33.259998', '33.580002', '33.810001', '32.82', '33.509998', '32.93', '33.959999', '33.860001', + '32.880001', '32.91', '32.799999', '31.790001', '31.370001', '31.360001', '30.950001', '30.67', + '31.17', '30.040001', '29.42', '29.370001', '29.280001', '27.040001', '26.76', '27.10', '26.82', + '27.049999', '27.969999', '29.15', '27.68', '29.059999', '29.57', '29.51', '28.75', '29.690001', + '29.98', '29.780001', '29.75', '29.309999', '28.780001', '29.74', '29.139999', '30.32', '29.440001', + '30.690001', '30.17', '30.629999', '30.16', '32.16', '32.200001', '31.40', '33.259998', '33.369999', + '34.040001', '33.599998', '34.110001', '34.450001', '34.189999', '32.970001', '32.950001', '33.23', + '33.779999', '33.029999', '32.59', '32.91', '34.630001', '34.400002', '34.849998', '34.68', '34.91', + '34.34', '35.650002', '33.709999', '33.810001', '32.939999', '33.16', '32.959999', '33.360001', + '33.110001', '32.630001', '32.98', '32.860001', '32.950001', '32.189999', '33.23', '33.380001', + '33.990002', '33.68', '34.200001', '35.119999', '35.07', '34.720001', '35.27', '35.619999', + '35.049999', '35.189999', '34.299999', '33.400002', '33.169998', '31.67', '31.120001', '32.830002', + '33.50', '33.369999', '33.48', '32.09', '32.34', '32.860001', '32.52', '32.369999', '31.870001', + '30.959999', '30.85', '30.709999', '28.91', '28.91', '28.26', '27.60', '29.129999', '29.34', + '29.74', '30.40', '31.17', '30.74', '30.93', '31.40', '31.040001', '30.32', '31.43', '31.15', + '31.52', '30.90', '31.58', '32.540001', '31.77', '31.60', '32.240002', '33.139999', '33.689999', + '32.52', '31.74', '31.309999', '32.93', '34.099998', '35.189999', '35.689999', '36.099998', + '36.240002', '35.93', '34.490002', '36.029999', '37.150002', '36.669998', '36.459999', '37.25', + '37.119999', '36.689999', '36.669998', '37.419998', '37.669998', '37.720001', '37.84', '38.849998', + '39.209999', '39.240002', '39.73', '39.540001', '39.68', '38.91', '38.380001', '38.630001', + '38.759998', '37.919998', '37.610001', '37.23', '38.23', '38.610001', '39.380001', '39.330002', + ]; + protected $Volume = + [ + '10602800', '15209900', '10808200', '10990700', '14108600', '19657800', '7710900', '6279200', + '5574600', '8957300', '12593900', '10634000', '10213200', '13023100', '6519800', '11216500', + '14759100', '9181900', '14757100', '8426100', '12059100', '12179300', '22177600', '12873600', + '14645900', '16285700', '33984900', '10623800', '7785800', '34330700', '7127500', '8497900', + '11340300', '16995100', '11073200', '11170900', '10010800', '7178500', '6157400', '9218200', + '13718900', '9668700', '9088800', '6585500', '12006800', '13175900', '16401800', '10083100', + '9832100', '9106700', '11658700', '30761900', '20460600', '17738300', '19046900', '16620000', + '17166400', '10447800', '13750800', '20273400', '38789100', '19445000', '12443000', '20227300', + '13656200', '18679000', '19849800', '23603400', '12981000', '14118600', '12217700', '11613900', + '13551300', '20552600', '9335700', '11002500', '10672300', '8252700', '12380800', '19452000', + '12653200', '21043800', '22924000', '22946600', '11361400', '10462200', '14850900', '21168500', + '16683500', '19907400', '12613500', '17072300', '21465100', '20735000', '15319400', '12949700', + '20187900', '13011900', '11188200', '9098800', '14324800', '24498200', '16379600', '28548200', + '55707000', '36544700', '12905700', '18979500', '15589300', '13534600', '11426200', '23176900', + '16298100', '16282500', '20458900', '20053000', '17572600', '15031400', '16692400', '13198500', + '17140100', '26322800', '21209100', '16047800', '14301100', '25194400', '7423300', '5933500', + '12621900', '11020800', '3470700', '13469200', '15531300', '9106700', '16921800', '13243500', + '12689400', '16140900', '15949600', '14936200', '16174200', '45101900', '19852600', '12047900', + '16109600', '17080500', '56708100', '11020400', '17534700', '5316100', '13257200', '13364700', + '11899700', '12498500', '14222100', '11105600', '10270400', '11087800', '11063300', '14273100', + '11804100', '11511000', '13645500', '16608600', '15679100', '17501800', '12394300', '15206700', + '17418900', '10796200', '15174300', '26380900', '15810300', '24308600', '18501200', '30390400', + '19349200', '10856500', '12209300', '19403800', '11282800', '15873800', '12580300', '11830400', + '14245400', '12224800', '10963900', '12883300', '29250500', '14467600', '18317900', '41895400', + '49541300', '12817500', '19109900', '12755400', '15614900', '18745000', '20538300', '17094200', + '22179700', '25661600', '22186900', '14365400', '14330900', '47058500', '26873900', '13854100', + '13748900', '15688100', '19903500', '13609000', '9366100', '19105100', '25414500', '15752300', + '23163400', '18373600', '15604400', '8976700', '11445300', '7933600', '12241100', '28987700', + '31405700', '13833200', '11351400', '11845500', '12299700', '6844000', '9051900', '9887300', + '15446100', '9542700', '10290600', '10333100', '12942700', '8590700', '9267400', '17714800', + '14861600', '14752100', '14864300', '8462400', '9147300', '9506500', '8713200', '10057600', + '16909400', '20529200', '19432500', '11803400', '7713000', '6398400', + ]; + // + + // + public function testConstants_TRADER_MA_TYPE_SMA() + { + self::assertEquals(TRADER_MA_TYPE_SMA, Trader::$TRADER_MA_TYPE_SMA); + } + + public function testConstants_TRADER_MA_TYPE_EMA() + { + self::assertEquals(TRADER_MA_TYPE_EMA, Trader::$TRADER_MA_TYPE_EMA); + } + + public function testConstants_TRADER_MA_TYPE_WMA() + { + self::assertEquals(TRADER_MA_TYPE_WMA, Trader::$TRADER_MA_TYPE_WMA); + } + + public function testConstants_TRADER_MA_TYPE_DEMA() + { + self::assertEquals(TRADER_MA_TYPE_DEMA, Trader::$TRADER_MA_TYPE_DEMA); + } + + public function testConstants_TRADER_MA_TYPE_TEMA() + { + self::assertEquals(TRADER_MA_TYPE_TEMA, Trader::$TRADER_MA_TYPE_TEMA); + } + + public function testConstants_TRADER_MA_TYPE_TRIMA() + { + self::assertEquals(TRADER_MA_TYPE_TRIMA, Trader::$TRADER_MA_TYPE_TRIMA); + } + + public function testConstants_TRADER_MA_TYPE_KAMA() + { + self::assertEquals(TRADER_MA_TYPE_KAMA, Trader::$TRADER_MA_TYPE_KAMA); + } + + public function testConstants_TRADER_MA_TYPE_MAMA() + { + self::assertEquals(TRADER_MA_TYPE_MAMA, Trader::$TRADER_MA_TYPE_MAMA); + } + + public function testConstants_TRADER_MA_TYPE_T3() + { + self::assertEquals(TRADER_MA_TYPE_T3, Trader::$TRADER_MA_TYPE_T3); + } + + public function testConstants_TRADER_REAL_MIN() + { + self::assertEquals(TRADER_REAL_MIN, Trader::$TRADER_REAL_MIN); + } + + public function testConstants_TRADER_REAL_MAX() + { + self::assertEquals(TRADER_REAL_MAX, Trader::$TRADER_REAL_MAX); + } + + public function testConstants_TRADER_FUNC_UNST_ADX() + { + self::assertEquals(TRADER_FUNC_UNST_ADX, Trader::$TRADER_FUNC_UNST_ADX); + } + + public function testConstants_TRADER_FUNC_UNST_ADXR() + { + self::assertEquals(TRADER_FUNC_UNST_ADXR, Trader::$TRADER_FUNC_UNST_ADXR); + } + + public function testConstants_TRADER_FUNC_UNST_ATR() + { + self::assertEquals(TRADER_FUNC_UNST_ATR, Trader::$TRADER_FUNC_UNST_ATR); + } + + public function testConstants_TRADER_FUNC_UNST_CMO() + { + self::assertEquals(TRADER_FUNC_UNST_CMO, Trader::$TRADER_FUNC_UNST_CMO); + } + + public function testConstants_TRADER_FUNC_UNST_DX() + { + self::assertEquals(TRADER_FUNC_UNST_DX, Trader::$TRADER_FUNC_UNST_DX); + } + + public function testConstants_TRADER_FUNC_UNST_EMA() + { + self::assertEquals(TRADER_FUNC_UNST_EMA, Trader::$TRADER_FUNC_UNST_EMA); + } + + public function testConstants_TRADER_FUNC_UNST_HT_DCPERIOD() + { + self::assertEquals(TRADER_FUNC_UNST_HT_DCPERIOD, Trader::$TRADER_FUNC_UNST_HT_DCPERIOD); + } + + public function testConstants_TRADER_FUNC_UNST_HT_DCPHASE() + { + self::assertEquals(TRADER_FUNC_UNST_HT_DCPHASE, Trader::$TRADER_FUNC_UNST_HT_DCPHASE); + } + + public function testConstants_TRADER_FUNC_UNST_HT_PHASOR() + { + self::assertEquals(TRADER_FUNC_UNST_HT_PHASOR, Trader::$TRADER_FUNC_UNST_HT_PHASOR); + } + + public function testConstants_TRADER_FUNC_UNST_HT_TRENDLINE() + { + self::assertEquals(TRADER_FUNC_UNST_HT_TRENDLINE, Trader::$TRADER_FUNC_UNST_HT_TRENDLINE); + } + + public function testConstants_TRADER_FUNC_UNST_HT_TRENDMODE() + { + self::assertEquals(TRADER_FUNC_UNST_HT_TRENDMODE, Trader::$TRADER_FUNC_UNST_HT_TRENDMODE); + } + + public function testConstants_TRADER_FUNC_UNST_KAMA() + { + self::assertEquals(TRADER_FUNC_UNST_KAMA, Trader::$TRADER_FUNC_UNST_KAMA); + } + + public function testConstants_TRADER_FUNC_UNST_MAMA() + { + self::assertEquals(TRADER_FUNC_UNST_MAMA, Trader::$TRADER_FUNC_UNST_MAMA); + } + + public function testConstants_TRADER_FUNC_UNST_MFI() + { + self::assertEquals(TRADER_FUNC_UNST_MFI, Trader::$TRADER_FUNC_UNST_MFI); + } + + public function testConstants_TRADER_FUNC_UNST_MINUS_DI() + { + self::assertEquals(TRADER_FUNC_UNST_MINUS_DI, Trader::$TRADER_FUNC_UNST_MINUS_DI); + } + + public function testConstants_TRADER_FUNC_UNST_MINUS_DM() + { + self::assertEquals(TRADER_FUNC_UNST_MINUS_DM, Trader::$TRADER_FUNC_UNST_MINUS_DM); + } + + public function testConstants_TRADER_FUNC_UNST_NATR() + { + self::assertEquals(TRADER_FUNC_UNST_NATR, Trader::$TRADER_FUNC_UNST_NATR); + } + + public function testConstants_TRADER_FUNC_UNST_PLUS_DI() + { + self::assertEquals(TRADER_FUNC_UNST_PLUS_DI, Trader::$TRADER_FUNC_UNST_PLUS_DI); + } + + public function testConstants_TRADER_FUNC_UNST_PLUS_DM() + { + self::assertEquals(TRADER_FUNC_UNST_PLUS_DM, Trader::$TRADER_FUNC_UNST_PLUS_DM); + } + + public function testConstants_TRADER_FUNC_UNST_RSI() + { + self::assertEquals(TRADER_FUNC_UNST_RSI, Trader::$TRADER_FUNC_UNST_RSI); + } + + public function testConstants_TRADER_FUNC_UNST_STOCHRSI() + { + self::assertEquals(TRADER_FUNC_UNST_STOCHRSI, Trader::$TRADER_FUNC_UNST_STOCHRSI); + } + + public function testConstants_TRADER_FUNC_UNST_T3() + { + self::assertEquals(TRADER_FUNC_UNST_T3, Trader::$TRADER_FUNC_UNST_T3); + } + + public function testConstants_TRADER_FUNC_UNST_ALL() + { + self::assertEquals(TRADER_FUNC_UNST_ALL, Trader::$TRADER_FUNC_UNST_ALL); + } + + public function testConstants_TRADER_FUNC_UNST_NONE() + { + self::assertEquals(TRADER_FUNC_UNST_NONE, Trader::$TRADER_FUNC_UNST_NONE); + } + + public function testConstants_TRADER_COMPATIBILITY_DEFAULT() + { + self::assertEquals(TRADER_COMPATIBILITY_DEFAULT, Trader::$TRADER_COMPATIBILITY_DEFAULT); + } + + public function testConstants_TRADER_COMPATIBILITY_METASTOCK() + { + self::assertEquals(TRADER_COMPATIBILITY_METASTOCK, Trader::$TRADER_COMPATIBILITY_METASTOCK); + } + + public function testConstants_TRADER_ERR_SUCCESS() + { + self::assertEquals(TRADER_ERR_SUCCESS, Trader::$TRADER_ERR_SUCCESS); + } + + public function testConstants_TRADER_ERR_LIB_NOT_INITIALIZE() + { + self::assertEquals(TRADER_ERR_LIB_NOT_INITIALIZE, Trader::$TRADER_ERR_LIB_NOT_INITIALIZE); + } + + public function testConstants_TRADER_ERR_BAD_PARAM() + { + self::assertEquals(TRADER_ERR_BAD_PARAM, Trader::$TRADER_ERR_BAD_PARAM); + } + + public function testConstants_TRADER_ERR_ALLOC_ERR() + { + self::assertEquals(TRADER_ERR_ALLOC_ERR, Trader::$TRADER_ERR_ALLOC_ERR); + } + + public function testConstants_TRADER_ERR_GROUP_NOT_FOUND() + { + self::assertEquals(TRADER_ERR_GROUP_NOT_FOUND, Trader::$TRADER_ERR_GROUP_NOT_FOUND); + } + + public function testConstants_TRADER_ERR_FUNC_NOT_FOUND() + { + self::assertEquals(TRADER_ERR_FUNC_NOT_FOUND, Trader::$TRADER_ERR_FUNC_NOT_FOUND); + } + + public function testConstants_TRADER_ERR_INVALID_HANDLE() + { + self::assertEquals(TRADER_ERR_INVALID_HANDLE, Trader::$TRADER_ERR_INVALID_HANDLE); + } + + public function testConstants_TRADER_ERR_INVALID_PARAM_HOLDER() + { + self::assertEquals(TRADER_ERR_INVALID_PARAM_HOLDER, Trader::$TRADER_ERR_INVALID_PARAM_HOLDER); + } + + public function testConstants_TRADER_ERR_INVALID_PARAM_HOLDER_TYPE() + { + self::assertEquals(TRADER_ERR_INVALID_PARAM_HOLDER_TYPE, Trader::$TRADER_ERR_INVALID_PARAM_HOLDER_TYPE); + } + + public function testConstants_TRADER_ERR_INVALID_PARAM_FUNCTION() + { + self::assertEquals(TRADER_ERR_INVALID_PARAM_FUNCTION, Trader::$TRADER_ERR_INVALID_PARAM_FUNCTION); + } + + public function testConstants_TRADER_ERR_INPUT_NOT_ALL_INITIALIZE() + { + self::assertEquals(TRADER_ERR_INPUT_NOT_ALL_INITIALIZE, Trader::$TRADER_ERR_INPUT_NOT_ALL_INITIALIZE); + } + + public function testConstants_TRADER_ERR_OUTPUT_NOT_ALL_INITIALIZE() + { + self::assertEquals(TRADER_ERR_OUTPUT_NOT_ALL_INITIALIZE, Trader::$TRADER_ERR_OUTPUT_NOT_ALL_INITIALIZE); + } + + public function testConstants_TRADER_ERR_OUT_OF_RANGE_START_INDEX() + { + self::assertEquals(TRADER_ERR_OUT_OF_RANGE_START_INDEX, Trader::$TRADER_ERR_OUT_OF_RANGE_START_INDEX); + } + + public function testConstants_TRADER_ERR_OUT_OF_RANGE_END_INDEX() + { + self::assertEquals(TRADER_ERR_OUT_OF_RANGE_END_INDEX, Trader::$TRADER_ERR_OUT_OF_RANGE_END_INDEX); + } + + public function testConstants_TRADER_ERR_INVALID_LIST_TYPE() + { + self::assertEquals(TRADER_ERR_INVALID_LIST_TYPE, Trader::$TRADER_ERR_INVALID_LIST_TYPE); + } + + public function testConstants_TRADER_ERR_BAD_OBJECT() + { + self::assertEquals(TRADER_ERR_BAD_OBJECT, Trader::$TRADER_ERR_BAD_OBJECT); + } + + public function testConstants_TRADER_ERR_NOT_SUPPORTED() + { + self::assertEquals(TRADER_ERR_NOT_SUPPORTED, Trader::$TRADER_ERR_NOT_SUPPORTED); + } + + public function testConstants_TRADER_ERR_INTERNAL_ERROR() + { + self::assertEquals(TRADER_ERR_INTERNAL_ERROR, Trader::$TRADER_ERR_INTERNAL_ERROR); + } + + public function testConstants_TRADER_ERR_UNKNOWN_ERROR() + { + self::assertEquals(TRADER_ERR_UNKNOWN_ERROR, Trader::$TRADER_ERR_UNKNOWN_ERROR); + } + // + + // + + public function testInterfaceFunctions_acos() + { + self::assertEquals(trader_acos(array_map('cos', $this->Close)), Trader::acos(array_map('cos', $this->Close))); + } + + public function testInterfaceFunctions_ad() + { + self::assertEquals(trader_ad($this->High, $this->Low, $this->Close, $this->Volume), Trader::ad($this->High, $this->Low, $this->Close, $this->Volume)); + } + + public function testInterfaceFunctions_add() + { + self::assertEquals(trader_add($this->High, $this->Low), Trader::add($this->High, $this->Low)); + } + + public function testInterfaceFunctions_adosc() + { + self::assertEquals(trader_adosc($this->High, $this->Low, $this->Close, $this->Volume, 3, 10), Trader::adosc($this->High, $this->Low, $this->Close, $this->Volume, 3, 10)); + } + + public function testInterfaceFunctions_adx() + { + self::assertEquals(trader_adx($this->High, $this->Low, $this->Close, 14), Trader::adx($this->High, $this->Low, $this->Close, 14)); + } + + public function testInterfaceFunctions_adxr() + { + self::assertEquals(trader_adxr($this->High, $this->Low, $this->Close, 14), Trader::adxr($this->High, $this->Low, $this->Close, 14)); + } + + public function testInterfaceFunctions_apo() + { + self::assertEquals(trader_apo($this->Close, 12, 26, TRADER_MA_TYPE_SMA), Trader::apo($this->Close, 12, 26, TRADER_MA_TYPE_SMA)); + } + + public function testInterfaceFunctions_aroon() + { + self::assertEquals(trader_aroon($this->High, $this->Low, 14), Trader::aroon($this->High, $this->Low, 14)); + } + + public function testInterfaceFunctions_arronosc() + { + self::assertEquals(trader_aroonosc($this->High, $this->Low, 14), Trader::aroonosc($this->High, $this->Low, 14)); + } + + public function testInterfaceFunctions_asin() + { + self::assertEquals(trader_asin(array_map('sin', $this->Close)), Trader::asin(array_map('sin', $this->Close))); + } + + public function testInterfaceFunctions_atan() + { + self::assertEquals(trader_atan(array_map('tan', $this->Close)), Trader::atan(array_map('tan', $this->Close))); + } + + public function testInterfaceFunctions_atr() + { + self::assertEquals(trader_atr($this->High, $this->Low, $this->Close, 14), Trader::atr($this->High, $this->Low, $this->Close, 14)); + } + + public function testInterfaceFunctions_avgprice() + { + self::assertEquals(trader_avgprice($this->Open, $this->High, $this->Low, $this->Close), Trader::avgprice($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_bbands() + { + self::assertEquals(trader_bbands($this->Close, 5, 2.0, 2.0, TRADER_MA_TYPE_SMA), Trader::bbands($this->Close, 5, 2.0, 2.0, TRADER_MA_TYPE_SMA)); + } + + public function testInterfaceFunctions_beta() + { + self::assertEquals(trader_beta($this->Open, $this->Close, 5), Trader::beta($this->Open, $this->Close, 5)); + } + + public function testInterfaceFunctions_bop() + { + self::assertEquals(trader_bop($this->Open, $this->High, $this->Low, $this->Close), Trader::bop($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cci() + { + self::assertEquals(trader_cci($this->High, $this->Low, $this->Close, 14), Trader::cci($this->High, $this->Low, $this->Close, 14)); + } + + public function testInterfaceFunctions_cdl2crows() + { + self::assertEquals(trader_cdl2crows($this->Open, $this->High, $this->Low, $this->Close), Trader::cdl2crows($this->Open, $this->High, $this->Low, $this->Close)); } + + public function testInterfaceFunctions_cdl3blackcrows() + { + self::assertEquals(trader_cdl3blackcrows($this->Open, $this->High, $this->Low, $this->Close), Trader::cdl3blackcrows($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdl3inside() + { + self::assertEquals(trader_cdl3inside($this->Open, $this->High, $this->Low, $this->Close), Trader::cdl3inside($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdl3linestrike() + { + self::assertEquals(trader_cdl3linestrike($this->Open, $this->High, $this->Low, $this->Close), Trader::cdl3linestrike($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdl3outside() + { + self::assertEquals(trader_cdl3outside($this->Open, $this->High, $this->Low, $this->Close), Trader::cdl3outside($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdl3starsinsouth() + { + self::assertEquals(trader_cdl3starsinsouth($this->Open, $this->High, $this->Low, $this->Close), Trader::cdl3starsinsouth($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdl3whitesoldiers() + { + self::assertEquals(trader_cdl3whitesoldiers($this->Open, $this->High, $this->Low, $this->Close), Trader::cdl3whitesoldiers($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdlabandonedbaby() + { + self::assertEquals(trader_cdlabandonedbaby($this->Open, $this->High, $this->Low, $this->Close), Trader::cdlabandonedbaby($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdladvanceblock() + { + self::assertEquals(trader_cdladvanceblock($this->Open, $this->High, $this->Low, $this->Close), Trader::cdladvanceblock($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdlbelthold() + { + self::assertEquals(trader_cdlbelthold($this->Open, $this->High, $this->Low, $this->Close), Trader::cdlbelthold($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdlbreakaway() + { + self::assertEquals(trader_cdlbreakaway($this->Open, $this->High, $this->Low, $this->Close), Trader::cdlbreakaway($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdlclosingmarubozu() + { + self::assertEquals(trader_cdlclosingmarubozu($this->Open, $this->High, $this->Low, $this->Close), Trader::cdlclosingmarubozu($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdlconcealbabyswall() + { + self::assertEquals(trader_cdlconcealbabyswall($this->Open, $this->High, $this->Low, $this->Close), Trader::cdlconcealbabyswall($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdlcounterattack() + { + self::assertEquals(trader_cdlcounterattack($this->Open, $this->High, $this->Low, $this->Close), Trader::cdlcounterattack($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdldarkcloudcover() + { + self::assertEquals(trader_cdldarkcloudcover($this->Open, $this->High, $this->Low, $this->Close, 0.5), Trader::cdldarkcloudcover($this->Open, $this->High, $this->Low, $this->Close, 0.5)); + } + + public function testInterfaceFunctions_cdldoji() + { + self::assertEquals(trader_cdldoji($this->Open, $this->High, $this->Low, $this->Close), Trader::cdldoji($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdldojistar() + { + self::assertEquals(trader_cdldojistar($this->Open, $this->High, $this->Low, $this->Close), Trader::cdldojistar($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdldragonflydoji() + { + self::assertEquals(trader_cdldragonflydoji($this->Open, $this->High, $this->Low, $this->Close), Trader::cdldragonflydoji($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdlengulfing() + { + self::assertEquals(trader_cdlengulfing($this->Open, $this->High, $this->Low, $this->Close), Trader::cdlengulfing($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdleveningdojistar() + { + self::assertEquals(trader_cdleveningdojistar($this->Open, $this->High, $this->Low, $this->Close, 0.3), Trader::cdleveningdojistar($this->Open, $this->High, $this->Low, $this->Close, 0.3)); + } + + public function testInterfaceFunctions_cdleveningstar() + { + self::assertEquals(trader_cdleveningstar($this->Open, $this->High, $this->Low, $this->Close, 0.3), Trader::cdleveningstar($this->Open, $this->High, $this->Low, $this->Close, 0.3)); + } + + public function testInterfaceFunctions_cdlgapsidesidewhite() + { + self::assertEquals(trader_cdlgapsidesidewhite($this->Open, $this->High, $this->Low, $this->Close), Trader::cdlgapsidesidewhite($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdlgravestonedoji() + { + self::assertEquals(trader_cdlgravestonedoji($this->Open, $this->High, $this->Low, $this->Close), Trader::cdlgravestonedoji($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdlhammer() + { + self::assertEquals(trader_cdlhammer($this->Open, $this->High, $this->Low, $this->Close), Trader::cdlhammer($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdlhangingman() + { + self::assertEquals(trader_cdlhangingman($this->Open, $this->High, $this->Low, $this->Close), Trader::cdlhangingman($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdlharami() + { + self::assertEquals(trader_cdlharami($this->Open, $this->High, $this->Low, $this->Close), Trader::cdlharami($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdlharamicross() + { + self::assertEquals(trader_cdlharamicross($this->Open, $this->High, $this->Low, $this->Close), Trader::cdlharamicross($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdlhighwave() + { + self::assertEquals(trader_cdlhighwave($this->Open, $this->High, $this->Low, $this->Close), Trader::cdlhighwave($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdlhikkake() + { + self::assertEquals(trader_cdlhikkake($this->Open, $this->High, $this->Low, $this->Close), Trader::cdlhikkake($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdlhikkakemod() + { + self::assertEquals(trader_cdlhikkakemod($this->Open, $this->High, $this->Low, $this->Close), Trader::cdlhikkakemod($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdlhomingpigeon() + { + self::assertEquals(trader_cdlhomingpigeon($this->Open, $this->High, $this->Low, $this->Close), Trader::cdlhomingpigeon($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdlidentical3crows() + { + self::assertEquals(trader_cdlidentical3crows($this->Open, $this->High, $this->Low, $this->Close), Trader::cdlidentical3crows($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdlinneck() + { + self::assertEquals(trader_cdlinneck($this->Open, $this->High, $this->Low, $this->Close), Trader::cdlinneck($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdlinvertedhammer() + { + self::assertEquals(trader_cdlinvertedhammer($this->Open, $this->High, $this->Low, $this->Close), Trader::cdlinvertedhammer($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdlkicking() + { + self::assertEquals(trader_cdlkicking($this->Open, $this->High, $this->Low, $this->Close), Trader::cdlkicking($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdlkickingbylength() + { + self::assertEquals(trader_cdlkickingbylength($this->Open, $this->High, $this->Low, $this->Close), Trader::cdlkickingbylength($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdlladderbottom() + { + self::assertEquals(trader_cdlladderbottom($this->Open, $this->High, $this->Low, $this->Close), Trader::cdlladderbottom($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdllongleggeddoji() + { + self::assertEquals(trader_cdllongleggeddoji($this->Open, $this->High, $this->Low, $this->Close), Trader::cdllongleggeddoji($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdllongline() + { + self::assertEquals(trader_cdllongline($this->Open, $this->High, $this->Low, $this->Close), Trader::cdllongline($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdlmarubozu() + { + self::assertEquals(trader_cdlmarubozu($this->Open, $this->High, $this->Low, $this->Close), Trader::cdlmarubozu($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdlmatchinglow() + { + self::assertEquals(trader_cdlmatchinglow($this->Open, $this->High, $this->Low, $this->Close), Trader::cdlmatchinglow($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdlmathold() + { + self::assertEquals(trader_cdlmathold($this->Open, $this->High, $this->Low, $this->Close, 0.5), Trader::cdlmathold($this->Open, $this->High, $this->Low, $this->Close, 0.5)); + } + + public function testInterfaceFunctions_cdlmorningdojistar() + { + self::assertEquals(trader_cdlmorningdojistar($this->Open, $this->High, $this->Low, $this->Close, 0.3), Trader::cdlmorningdojistar($this->Open, $this->High, $this->Low, $this->Close, 0.3)); + } + + public function testInterfaceFunctions_cdlmorningstar() + { + self::assertEquals(trader_cdlmorningstar($this->Open, $this->High, $this->Low, $this->Close, 0.3), Trader::cdlmorningstar($this->Open, $this->High, $this->Low, $this->Close, 0.3)); + } + + public function testInterfaceFunctions_cdlonneck() + { + self::assertEquals(trader_cdlonneck($this->Open, $this->High, $this->Low, $this->Close), Trader::cdlonneck($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdlpiercing() + { + self::assertEquals(trader_cdlpiercing($this->Open, $this->High, $this->Low, $this->Close), Trader::cdlpiercing($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdlrickshawman() + { + self::assertEquals(trader_cdlrickshawman($this->Open, $this->High, $this->Low, $this->Close), Trader::cdlrickshawman($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdlrisefall3methods() + { + self::assertEquals(trader_cdlrisefall3methods($this->Open, $this->High, $this->Low, $this->Close), Trader::cdlrisefall3methods($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdlseparatinglines() + { + self::assertEquals(trader_cdlseparatinglines($this->Open, $this->High, $this->Low, $this->Close), Trader::cdlseparatinglines($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdlshootingstar() + { + self::assertEquals(trader_cdlshootingstar($this->Open, $this->High, $this->Low, $this->Close), Trader::cdlshootingstar($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdlshortline() + { + self::assertEquals(trader_cdlshortline($this->Open, $this->High, $this->Low, $this->Close), Trader::cdlshortline($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdlspinningtop() + { + self::assertEquals(trader_cdlspinningtop($this->Open, $this->High, $this->Low, $this->Close), Trader::cdlspinningtop($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdlstalledpattern() + { + self::assertEquals(trader_cdlstalledpattern($this->Open, $this->High, $this->Low, $this->Close), Trader::cdlstalledpattern($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdlsticksandwich() + { + self::assertEquals(trader_cdlsticksandwich($this->Open, $this->High, $this->Low, $this->Close), Trader::cdlsticksandwich($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdltakuri() + { + self::assertEquals(trader_cdltakuri($this->Open, $this->High, $this->Low, $this->Close), Trader::cdltakuri($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdltasukigap() + { + self::assertEquals(trader_cdltasukigap($this->Open, $this->High, $this->Low, $this->Close), Trader::cdltasukigap($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdlthrusting() + { + self::assertEquals(trader_cdlthrusting($this->Open, $this->High, $this->Low, $this->Close), Trader::cdlthrusting($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdltristar() + { + self::assertEquals(trader_cdltristar($this->Open, $this->High, $this->Low, $this->Close), Trader::cdltristar($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdlunique3river() + { + self::assertEquals(trader_cdlunique3river($this->Open, $this->High, $this->Low, $this->Close), Trader::cdlunique3river($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdlupsidegap2crows() + { + self::assertEquals(trader_cdlupsidegap2crows($this->Open, $this->High, $this->Low, $this->Close), Trader::cdlupsidegap2crows($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_cdlxsidegap3methods() + { + self::assertEquals(trader_cdlxsidegap3methods($this->Open, $this->High, $this->Low, $this->Close), Trader::cdlxsidegap3methods($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_ceil() + { + self::assertEquals(trader_ceil($this->Close), Trader::ceil($this->Close)); + } + + public function testInterfaceFunctions_cmo() + { + self::assertEquals(trader_cmo($this->Close, 14), Trader::cmo($this->Close, 14)); + } + + public function testInterfaceFunctions_correl() + { + self::assertEquals(trader_correl($this->Open, $this->Close, 30), Trader::correl($this->Open, $this->Close, 30)); + } + + public function testInterfaceFunctions_cos() + { + self::assertEquals(trader_cos($this->Close), Trader::cos($this->Close)); + } + + public function testInterfaceFunctions_cosh() + { + self::assertEquals(trader_cosh($this->Close), Trader::cosh($this->Close)); + } + + public function testInterfaceFunctions_dema() + { + self::assertEquals(trader_dema($this->Close, 30), Trader::dema($this->Close, 30)); + } + + public function testInterfaceFunctions_div() + { + self::assertEquals(trader_div($this->Open, $this->Close), Trader::div($this->Open, $this->Close)); + } + + public function testInterfaceFunctions_dx() + { + self::assertEquals(trader_dx($this->High, $this->Low, $this->Close, 14), Trader::dx($this->High, $this->Low, $this->Close, 14)); + } + + public function testInterfaceFunctions_ema() + { + self::assertEquals(trader_ema($this->Close, 30), Trader::ema($this->Close, 30)); + } + + public function testInterfaceFunctions_exp() + { + self::assertEquals(trader_exp($this->Close), Trader::exp($this->Close)); + } + + public function testInterfaceFunctions_floor() + { + self::assertEquals(trader_floor($this->Close), Trader::floor($this->Close)); + } + + public function testInterfaceFunctions_ht_dcperiod() + { + self::assertEquals(trader_ht_dcperiod($this->Close), Trader::ht_dcperiod($this->Close)); + } + + public function testInterfaceFunctions_ht_dcphase() + { + self::assertEquals(trader_ht_dcphase($this->Close), Trader::ht_dcphase($this->Close)); + } + + public function testInterfaceFunctions_ht_phasor() + { + self::assertEquals(trader_ht_phasor($this->Close), Trader::ht_phasor($this->Close)); + } + + public function testInterfaceFunctions_ht_sine() + { + self::assertEquals(trader_ht_sine($this->Close), Trader::ht_sine($this->Close)); + } + + public function testInterfaceFunctions_ht_trendline() + { + self::assertEquals(trader_ht_trendline($this->Close), Trader::ht_trendline($this->Close)); + } + + public function testInterfaceFunctions_ht_trendmode() + { + self::assertEquals(trader_ht_trendmode($this->Close), Trader::ht_trendmode($this->Close)); + } + + public function testInterfaceFunctions_kama() + { + self::assertEquals(trader_kama($this->Close, 30), Trader::kama($this->Close, 30)); + } + + public function testInterfaceFunctions_linearreg_angle() + { + self::assertEquals(trader_linearreg_angle($this->Close, 14), Trader::linearreg_angle($this->Close, 14)); + } + + public function testInterfaceFunctions_linearreg_intercept() + { + self::assertEquals(trader_linearreg_intercept($this->Close, 14), Trader::linearreg_intercept($this->Close, 14)); + } + + public function testInterfaceFunctions_linearreg_slope() + { + self::assertEquals(trader_linearreg_slope($this->Close, 14), Trader::linearreg_slope($this->Close, 14)); + } + + public function testInterfaceFunctions_linearreg() + { + self::assertEquals(trader_linearreg($this->Close, 14), Trader::linearreg($this->Close, 14)); + } + + public function testInterfaceFunctions_ln() + { + self::assertEquals(trader_ln($this->Close), Trader::ln($this->Close)); + } + + public function testInterfaceFunctions_log10() + { + self::assertEquals(trader_log10($this->Close), Trader::log10($this->Close)); + } + + public function testInterfaceFunctions_ma() + { + self::assertEquals(trader_ma($this->Close, 30, TRADER_MA_TYPE_SMA), Trader::ma($this->Close, 30, TRADER_MA_TYPE_SMA)); + } + + public function testInterfaceFunctions_macd() + { + self::assertEquals(trader_macd($this->Close, 12, 26, 9), Trader::macd($this->Close, 12, 26, 9)); + } + + public function testInterfaceFunctions_macdext() + { + self::assertEquals(trader_macdext($this->Close, 12, TRADER_MA_TYPE_SMA, 26, TRADER_MA_TYPE_SMA, 9), Trader::macdext($this->Close, 12, TRADER_MA_TYPE_SMA, 26, TRADER_MA_TYPE_SMA, 9)); + } + + public function testInterfaceFunctions_macdfix() + { + self::assertEquals(trader_macdfix($this->Close, 9), Trader::macdfix($this->Close, 9)); + } + + public function testInterfaceFunctions_mama() + { + self::assertEquals(trader_mama($this->Close, 0.5, 0.05), Trader::mama($this->Close, 0.5, 0.05)); + } + + public function testInterfaceFunctions_mavp() + { + self::assertEquals(trader_mavp($this->Close, $this->Open, 2, 30, TRADER_MA_TYPE_SMA), Trader::mavp($this->Close, $this->Open, 2, 30, TRADER_MA_TYPE_SMA)); + } + + public function testInterfaceFunctions_max() + { + self::assertEquals(trader_max($this->Close, 30), Trader::max($this->Close, 30)); + } + + public function testInterfaceFunctions_maxindex() + { + self::assertEquals(trader_maxindex($this->Close, 30), Trader::maxindex($this->Close, 30)); + } + + public function testInterfaceFunctions_medprice() + { + self::assertEquals(trader_medprice($this->High, $this->Low), Trader::medprice($this->High, $this->Low)); + } + + public function testInterfaceFunctions_mfi() + { + self::assertEquals(trader_mfi($this->High, $this->Low, $this->Close, $this->Volume, 14), Trader::mfi($this->High, $this->Low, $this->Close, $this->Volume, 14)); + } + + public function testInterfaceFunctions_midpoint() + { + self::assertEquals(trader_midpoint($this->Close, 14), Trader::midpoint($this->Close, 14)); + } + + public function testInterfaceFunctions_midprice() + { + self::assertEquals(trader_midprice($this->High, $this->Low, 14), Trader::midprice($this->High, $this->Low, 14)); + } + + public function testInterfaceFunctions_min() + { + self::assertEquals(trader_min($this->High, 30), Trader::min($this->High, 30)); + } + + public function testInterfaceFunctions_minindex() + { + self::assertEquals(trader_minindex($this->High, 30), Trader::minindex($this->High, 30)); + } + + public function testInterfaceFunctions_minmax() + { + self::assertEquals(trader_minmax($this->High, 30), Trader::minmax($this->High, 30)); + } + + public function testInterfaceFunctions_minmaxindex() + { + self::assertEquals(trader_minmaxindex($this->High, 30), Trader::minmaxindex($this->High, 30)); + } + + public function testInterfaceFunctions_minus_di() + { + self::assertEquals(trader_minus_di($this->High, $this->Low, $this->Close, 14), Trader::minus_di($this->High, $this->Low, $this->Close, 14)); + } + + public function testInterfaceFunctions_minus_dmi() + { + self::assertEquals(trader_minus_dm($this->High, $this->Low, 14), Trader::minus_dm($this->High, $this->Low, 14)); + } + + public function testInterfaceFunctions_mom() + { + self::assertEquals(trader_mom($this->High, 10), Trader::mom($this->High, 10)); + } + + public function testInterfaceFunctions_mult() + { + self::assertEquals(trader_mult($this->Open, $this->Close), Trader::mult($this->Open, $this->Close)); + } + + public function testInterfaceFunctions_natr() + { + self::assertEquals(trader_natr($this->High, $this->Low, $this->Close, 14), Trader::natr($this->High, $this->Low, $this->Close, 14)); + } + + public function testInterfaceFunctions_obv() + { + self::assertEquals(trader_obv($this->Close, $this->Volume), Trader::obv($this->Close, $this->Volume)); + } + + public function testInterfaceFunctions_plus_di() + { + self::assertEquals(trader_plus_di($this->High, $this->Low, $this->Close, 14), Trader::plus_di($this->High, $this->Low, $this->Close, 14)); + } + + public function testInterfaceFunctions_plus_dm() + { + self::assertEquals(trader_plus_dm($this->High, $this->Low, 14), Trader::plus_dm($this->High, $this->Low, 14)); + } + + public function testInterfaceFunctions_ppo() + { + self::assertEquals(trader_ppo($this->Close, 12, 26, TRADER_MA_TYPE_SMA), Trader::ppo($this->Close, 12, 26, TRADER_MA_TYPE_SMA)); + } + + public function testInterfaceFunctions_roc() + { + self::assertEquals(trader_roc($this->Close, 10), Trader::roc($this->Close, 10)); + } + + public function testInterfaceFunctions_rocp() + { + self::assertEquals(trader_rocp($this->Close, 10), Trader::rocp($this->Close, 10)); + } + + public function testInterfaceFunctions_rocr100() + { + self::assertEquals(trader_rocr100($this->Close, 10), Trader::rocr100($this->Close, 10)); + } + + public function testInterfaceFunctions_rocr() + { + self::assertEquals(trader_rocr($this->Close, 10), Trader::rocr($this->Close, 10)); + } + + public function testInterfaceFunctions_rsi() + { + self::assertEquals(trader_rsi($this->Close, 14), Trader::rsi($this->Close, 14)); + } + + public function testInterfaceFunctions_sar() + { + self::assertEquals(trader_sar($this->Close, $this->Low, 0.02, 0.2), Trader::sar($this->Close, $this->Low, 0.02, 0.2)); + } + + public function testInterfaceFunctions_sarext() + { + self::assertEquals(trader_sarext($this->Close, $this->Low, 0.0, 0.0, 0.02, 0.02, 0.2, 0.02, 0.02, 0.2), Trader::sarext($this->Close, $this->Low, 0.0, 0.0, 0.02, 0.02, 0.2, 0.02, 0.02, 0.2)); + } + + public function testInterfaceFunctions_sin() + { + self::assertEquals(trader_sin($this->Close), Trader::sin($this->Close)); + } + + public function testInterfaceFunctions_sinh() + { + self::assertEquals(trader_sinh($this->Close), Trader::sinh($this->Close)); + } + + public function testInterfaceFunctions_sma() + { + self::assertEquals(trader_sma($this->Close, 30), Trader::sma($this->Close, 30)); + } + + public function testInterfaceFunctions_sqrt() + { + self::assertEquals(trader_sqrt($this->Close), Trader::sqrt($this->Close)); + } + + public function testInterfaceFunctions_stddev() + { + self::assertEquals(trader_stddev($this->Close, 5, 1.0), Trader::stddev($this->Close, 5, 1.0)); + } + + public function testInterfaceFunctions_stoch() + { + self::assertEquals(trader_stoch($this->High, $this->Low, $this->Close, 5, 3, TRADER_MA_TYPE_SMA, 3, TRADER_MA_TYPE_SMA), Trader::stoch($this->High, $this->Low, $this->Close, 5, 3, TRADER_MA_TYPE_SMA, 3, TRADER_MA_TYPE_SMA)); + } + + public function testInterfaceFunctions_stochf() + { + self::assertEquals(trader_stochf($this->High, $this->Low, $this->Close, 5, 3, TRADER_MA_TYPE_SMA), Trader::stochf($this->High, $this->Low, $this->Close, 5, 3, TRADER_MA_TYPE_SMA)); + } + + public function testInterfaceFunctions_stochrsi() + { + self::assertEquals(trader_stochrsi($this->Close, 14, 5, 3, TRADER_MA_TYPE_SMA), Trader::stochrsi($this->Close, 14, 5, 3, TRADER_MA_TYPE_SMA)); + } + + public function testInterfaceFunctions_sub() + { + self::assertEquals(trader_sub($this->High, $this->Low), Trader::sub($this->High, $this->Low)); + } + + public function testInterfaceFunctions_sum() + { + self::assertEquals(trader_sum($this->High, 30), Trader::sum($this->High, 30)); + } + + public function testInterfaceFunctions_t3() + { + self::assertEquals(trader_t3($this->High, 5, 0.7), Trader::t3($this->High, 5, 0.7)); + } + + public function testInterfaceFunctions_tan() + { + self::assertEquals(trader_tan($this->Close), Trader::tan($this->Close)); + } + + public function testInterfaceFunctions_tanh() + { + self::assertEquals(trader_tanh($this->Close), Trader::tanh($this->Close)); + } + + public function testInterfaceFunctions_tema() + { + self::assertEquals(trader_tema($this->Close, 30), Trader::tema($this->Close, 30)); + } + + public function testInterfaceFunctions_trange() + { + self::assertEquals(trader_trange($this->High, $this->Low, $this->Close), Trader::trange($this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_trima() + { + self::assertEquals(trader_trima($this->Close, 30), Trader::trima($this->Close, 30)); + } + + public function testInterfaceFunctions_trix() + { + self::assertEquals(trader_trix($this->Close, 30), Trader::trix($this->Close, 30)); + } + + public function testInterfaceFunctions_tsf() + { + self::assertEquals(trader_tsf($this->Close, 14), Trader::tsf($this->Close, 14)); + } + + public function testInterfaceFunctions_typprice() + { + self::assertEquals(trader_typprice($this->High, $this->Low, $this->Close), Trader::typprice($this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_ultosc() + { + self::assertEquals(trader_ultosc($this->High, $this->Low, $this->Close, 7, 14, 28), Trader::ultosc($this->High, $this->Low, $this->Close, 7, 14, 28)); + } + + public function testInterfaceFunctions_var() + { + self::assertEquals(trader_var($this->Close, 5, 1.0), Trader::var($this->Close, 5, 1.0)); + } + + public function testInterfaceFunctions_wclprice() + { + self::assertEquals(trader_wclprice($this->High, $this->Low, $this->Close), Trader::wclprice($this->High, $this->Low, $this->Close)); + } + + public function testInterfaceFunctions_willr() + { + self::assertEquals(trader_willr($this->High, $this->Low, $this->Close, 14), Trader::willr($this->High, $this->Low, $this->Close, 14)); + } + + public function testInterfaceFunctions_wma() + { + self::assertEquals(trader_wma($this->Close, 30), Trader::wma($this->Close, 30)); + } + + // + + // + + public function testFriendlyFunctions_acos() + { + self::assertEquals(trader_acos(array_map('cos', $this->Close)), Trader::mathArcCosine(array_map('cos', $this->Close))); + } + + public function testFriendlyFunctions_ad() + { + self::assertEquals(trader_ad($this->High, $this->Low, $this->Close, $this->Volume), Trader::chaikinAccumulationDistributionLine($this->High, $this->Low, $this->Close, $this->Volume)); + } + + public function testFriendlyFunctions_add() + { + self::assertEquals(trader_add($this->High, $this->Low), Trader::mathAddition($this->High, $this->Low)); + } + + public function testFriendlyFunctions_adosc() + { + self::assertEquals(trader_adosc($this->High, $this->Low, $this->Close, $this->Volume, 3, 10), Trader::chaikinAccumulationDistributionOscillator($this->High, $this->Low, $this->Close, $this->Volume, 3, 10)); + } + + public function testFriendlyFunctions_adx() + { + self::assertEquals(trader_adx($this->High, $this->Low, $this->Close, 14), Trader::averageDirectionalMovementIndex($this->High, $this->Low, $this->Close, 14)); + } + + public function testFriendlyFunctions_adxr() + { + self::assertEquals(trader_adxr($this->High, $this->Low, $this->Close, 14), Trader::averageDirectionalMovementIndexRating($this->High, $this->Low, $this->Close, 14)); + } + + public function testFriendlyFunctions_apo() + { + self::assertEquals(trader_apo($this->Close, 12, 26, TRADER_MA_TYPE_SMA), Trader::absolutePriceOscillator($this->Close, 12, 26, TRADER_MA_TYPE_SMA)); + } + + public function testFriendlyFunctions_aroon() + { + self::assertEquals(trader_aroon($this->High, $this->Low, 14), Trader::aroonIndicator($this->High, $this->Low, 14)); + } + + public function testFriendlyFunctions_arronosc() + { + self::assertEquals(trader_aroonosc($this->High, $this->Low, 14), Trader::arronOscillator($this->High, $this->Low, 14)); + } + + public function testFriendlyFunctions_asin() + { + self::assertEquals(trader_asin(array_map('sin', $this->Close)), Trader::mathArcSine(array_map('sin', $this->Close))); + } + + public function testFriendlyFunctions_atan() + { + self::assertEquals(trader_atan(array_map('tan', $this->Close)), Trader::mathArcTangent(array_map('tan', $this->Close))); + } + + public function testFriendlyFunctions_atr() + { + self::assertEquals(trader_atr($this->High, $this->Low, $this->Close, 14), Trader::averageTrueRange($this->High, $this->Low, $this->Close, 14)); + } + + public function testFriendlyFunctions_avgprice() + { + self::assertEquals(trader_avgprice($this->Open, $this->High, $this->Low, $this->Close), Trader::averagePrice($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_bbands() + { + self::assertEquals(trader_bbands($this->Close, 5, 2.0, 2.0, TRADER_MA_TYPE_SMA), Trader::bollingerBands($this->Close, 5, 2.0, 2.0, TRADER_MA_TYPE_SMA)); + } + + public function testFriendlyFunctions_beta() + { + self::assertEquals(trader_beta($this->Open, $this->Close, 5), Trader::betaVolatility($this->Open, $this->Close, 5)); + } + + public function testFriendlyFunctions_bop() + { + self::assertEquals(trader_bop($this->Open, $this->High, $this->Low, $this->Close), Trader::balanceOfPower($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cci() + { + self::assertEquals(trader_cci($this->High, $this->Low, $this->Close, 14), Trader::commodityChannelIndex($this->High, $this->Low, $this->Close, 14)); + } + + public function testFriendlyFunctions_cdl2crows() + { + self::assertEquals(trader_cdl2crows($this->Open, $this->High, $this->Low, $this->Close), Trader::candleTwoCrows($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdl3blackcrows() + { + self::assertEquals(trader_cdl3blackcrows($this->Open, $this->High, $this->Low, $this->Close), Trader::candleThreeBlackCrows($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdl3inside() + { + self::assertEquals(trader_cdl3inside($this->Open, $this->High, $this->Low, $this->Close), Trader::candleThreeInsideUpDown($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdl3linestrike() + { + self::assertEquals(trader_cdl3linestrike($this->Open, $this->High, $this->Low, $this->Close), Trader::candleThreeLineStrike($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdl3outside() + { + self::assertEquals(trader_cdl3outside($this->Open, $this->High, $this->Low, $this->Close), Trader::candleThreeOutsideUpDown($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdl3starsinsouth() + { + self::assertEquals(trader_cdl3starsinsouth($this->Open, $this->High, $this->Low, $this->Close), Trader::candleThreeStarsInTheSouth($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdl3whitesoldiers() + { + self::assertEquals(trader_cdl3whitesoldiers($this->Open, $this->High, $this->Low, $this->Close), Trader::candleThreeWhiteSoldiers($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdlabandonedbaby() + { + self::assertEquals(trader_cdlabandonedbaby($this->Open, $this->High, $this->Low, $this->Close), Trader::candleAbandonedBaby($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdladvanceblock() + { + self::assertEquals(trader_cdladvanceblock($this->Open, $this->High, $this->Low, $this->Close), Trader::candleAdvanceBlock($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdlbelthold() + { + self::assertEquals(trader_cdlbelthold($this->Open, $this->High, $this->Low, $this->Close), Trader::candleBeltHold($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdlbreakaway() + { + self::assertEquals(trader_cdlbreakaway($this->Open, $this->High, $this->Low, $this->Close), Trader::candleBreakaway($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdlclosingmarubozu() + { + self::assertEquals(trader_cdlclosingmarubozu($this->Open, $this->High, $this->Low, $this->Close), Trader::candleClosingMarubozu($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdlconcealbabyswall() + { + self::assertEquals(trader_cdlconcealbabyswall($this->Open, $this->High, $this->Low, $this->Close), Trader::candleConcealingBabySwallow($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdlcounterattack() + { + self::assertEquals(trader_cdlcounterattack($this->Open, $this->High, $this->Low, $this->Close), Trader::candleCounterattack($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdldarkcloudcover() + { + self::assertEquals(trader_cdldarkcloudcover($this->Open, $this->High, $this->Low, $this->Close, 0.5), Trader::candleDarkCloudCover($this->Open, $this->High, $this->Low, $this->Close, 0.5)); + } + + public function testFriendlyFunctions_cdldoji() + { + self::assertEquals(trader_cdldoji($this->Open, $this->High, $this->Low, $this->Close), Trader::candleDoji($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdldojistar() + { + self::assertEquals(trader_cdldojistar($this->Open, $this->High, $this->Low, $this->Close), Trader::candleDojiStar($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdldragonflydoji() + { + self::assertEquals(trader_cdldragonflydoji($this->Open, $this->High, $this->Low, $this->Close), Trader::candleDragonflyDoji($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdlengulfing() + { + self::assertEquals(trader_cdlengulfing($this->Open, $this->High, $this->Low, $this->Close), Trader::candleEngulfingPattern($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdleveningdojistar() + { + self::assertEquals(trader_cdleveningdojistar($this->Open, $this->High, $this->Low, $this->Close, 0.3), Trader::candleEveningDojiStar($this->Open, $this->High, $this->Low, $this->Close, 0.3)); + } + + public function testFriendlyFunctions_cdleveningstar() + { + self::assertEquals(trader_cdleveningstar($this->Open, $this->High, $this->Low, $this->Close, 0.3), Trader::candleEveningStar($this->Open, $this->High, $this->Low, $this->Close, 0.3)); + } + + public function testFriendlyFunctions_cdlgapsidesidewhite() + { + self::assertEquals(trader_cdlgapsidesidewhite($this->Open, $this->High, $this->Low, $this->Close), Trader::candleUpDownGapsSideBySideWhiteLines($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdlgravestonedoji() + { + self::assertEquals(trader_cdlgravestonedoji($this->Open, $this->High, $this->Low, $this->Close), Trader::candleGravestoneDoji($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdlhammer() + { + self::assertEquals(trader_cdlhammer($this->Open, $this->High, $this->Low, $this->Close), Trader::candleHammer($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdlhangingman() + { + self::assertEquals(trader_cdlhangingman($this->Open, $this->High, $this->Low, $this->Close), Trader::candleHangingMan($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdlharami() + { + self::assertEquals(trader_cdlharami($this->Open, $this->High, $this->Low, $this->Close), Trader::candleHarami($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdlharamicross() + { + self::assertEquals(trader_cdlharamicross($this->Open, $this->High, $this->Low, $this->Close), Trader::candleHaramiCross($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdlhighwave() + { + self::assertEquals(trader_cdlhighwave($this->Open, $this->High, $this->Low, $this->Close), Trader::candleHighWave($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdlhikkake() + { + self::assertEquals(trader_cdlhikkake($this->Open, $this->High, $this->Low, $this->Close), Trader::candleHikkake($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdlhikkakemod() + { + self::assertEquals(trader_cdlhikkakemod($this->Open, $this->High, $this->Low, $this->Close), Trader::candleModifiedHikkake($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdlhomingpigeon() + { + self::assertEquals(trader_cdlhomingpigeon($this->Open, $this->High, $this->Low, $this->Close), Trader::candleHomingPigeon($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdlidentical3crows() + { + self::assertEquals(trader_cdlidentical3crows($this->Open, $this->High, $this->Low, $this->Close), Trader::candleIdenticalThreeCrows($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdlinneck() + { + self::assertEquals(trader_cdlinneck($this->Open, $this->High, $this->Low, $this->Close), Trader::candleInNeck($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdlinvertedhammer() + { + self::assertEquals(trader_cdlinvertedhammer($this->Open, $this->High, $this->Low, $this->Close), Trader::candleInvertedHammer($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdlkicking() + { + self::assertEquals(trader_cdlkicking($this->Open, $this->High, $this->Low, $this->Close), Trader::candleKicking($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdlkickingbylength() + { + self::assertEquals(trader_cdlkickingbylength($this->Open, $this->High, $this->Low, $this->Close), Trader::candleKickingByLength($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdlladderbottom() + { + self::assertEquals(trader_cdlladderbottom($this->Open, $this->High, $this->Low, $this->Close), Trader::candleLadderBottom($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdllongleggeddoji() + { + self::assertEquals(trader_cdllongleggeddoji($this->Open, $this->High, $this->Low, $this->Close), Trader::candleLongLeggedDoji($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdllongline() + { + self::assertEquals(trader_cdllongline($this->Open, $this->High, $this->Low, $this->Close), Trader::candleLongLine($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdlmarubozu() + { + self::assertEquals(trader_cdlmarubozu($this->Open, $this->High, $this->Low, $this->Close), Trader::candleMarubozu($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdlmatchinglow() + { + self::assertEquals(trader_cdlmatchinglow($this->Open, $this->High, $this->Low, $this->Close), Trader::candleMatchingLow($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdlmathold() + { + self::assertEquals(trader_cdlmathold($this->Open, $this->High, $this->Low, $this->Close, 0.5), Trader::candleMatHold($this->Open, $this->High, $this->Low, $this->Close, 0.5)); + } + + public function testFriendlyFunctions_cdlmorningdojistar() + { + self::assertEquals(trader_cdlmorningdojistar($this->Open, $this->High, $this->Low, $this->Close, 0.3), Trader::candleMorningDojiStar($this->Open, $this->High, $this->Low, $this->Close, 0.3)); + } + + public function testFriendlyFunctions_cdlmorningstar() + { + self::assertEquals(trader_cdlmorningstar($this->Open, $this->High, $this->Low, $this->Close, 0.3), Trader::candleMorningStar($this->Open, $this->High, $this->Low, $this->Close, 0.3)); + } + + public function testFriendlyFunctions_cdlonneck() + { + self::assertEquals(trader_cdlonneck($this->Open, $this->High, $this->Low, $this->Close), Trader::candleOnNeck($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdlpiercing() + { + self::assertEquals(trader_cdlpiercing($this->Open, $this->High, $this->Low, $this->Close), Trader::candlePiercing($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdlrickshawman() + { + self::assertEquals(trader_cdlrickshawman($this->Open, $this->High, $this->Low, $this->Close), Trader::candleRickshawMan($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdlrisefall3methods() + { + self::assertEquals(trader_cdlrisefall3methods($this->Open, $this->High, $this->Low, $this->Close), Trader::candleRisingFallingThreeMethods($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdlseparatinglines() + { + self::assertEquals(trader_cdlseparatinglines($this->Open, $this->High, $this->Low, $this->Close), Trader::candleSeparatingLines($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdlshootingstar() + { + self::assertEquals(trader_cdlshootingstar($this->Open, $this->High, $this->Low, $this->Close), Trader::candleShootingStar($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdlshortline() + { + self::assertEquals(trader_cdlshortline($this->Open, $this->High, $this->Low, $this->Close), Trader::candleShortLine($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdlspinningtop() + { + self::assertEquals(trader_cdlspinningtop($this->Open, $this->High, $this->Low, $this->Close), Trader::candleSpinningTop($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdlstalledpattern() + { + self::assertEquals(trader_cdlstalledpattern($this->Open, $this->High, $this->Low, $this->Close), Trader::candleStalled($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdlsticksandwich() + { + self::assertEquals(trader_cdlsticksandwich($this->Open, $this->High, $this->Low, $this->Close), Trader::candleStickSandwich($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdltakuri() + { + self::assertEquals(trader_cdltakuri($this->Open, $this->High, $this->Low, $this->Close), Trader::candleTakuri($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdltasukigap() + { + self::assertEquals(trader_cdltasukigap($this->Open, $this->High, $this->Low, $this->Close), Trader::candleTasukiGap($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdlthrusting() + { + self::assertEquals(trader_cdlthrusting($this->Open, $this->High, $this->Low, $this->Close), Trader::candleThrusting($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdltristar() + { + self::assertEquals(trader_cdltristar($this->Open, $this->High, $this->Low, $this->Close), Trader::candleTristar($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdlunique3river() + { + self::assertEquals(trader_cdlunique3river($this->Open, $this->High, $this->Low, $this->Close), Trader::candleUniqueThreeRiver($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdlupsidegap2crows() + { + self::assertEquals(trader_cdlupsidegap2crows($this->Open, $this->High, $this->Low, $this->Close), Trader::candleUpsideGapTwoCrows($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_cdlxsidegap3methods() + { + self::assertEquals(trader_cdlxsidegap3methods($this->Open, $this->High, $this->Low, $this->Close), Trader::candleUpsideDownsideGapThreeMethods($this->Open, $this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_ceil() + { + self::assertEquals(trader_ceil($this->Close), Trader::mathCeiling($this->Close)); + } + + public function testFriendlyFunctions_cmo() + { + self::assertEquals(trader_cmo($this->Close, 14), Trader::chandeMomentumOscillator($this->Close, 14)); + } + + public function testFriendlyFunctions_correl() + { + self::assertEquals(trader_correl($this->Open, $this->Close, 30), Trader::pearsonCorrelationCoefficient($this->Open, $this->Close, 30)); + } + + public function testFriendlyFunctions_cos() + { + self::assertEquals(trader_cos($this->Close), Trader::mathCosine($this->Close)); + } + + public function testFriendlyFunctions_cosh() + { + self::assertEquals(trader_cosh($this->Close), Trader::mathHyperbolicCosine($this->Close)); + } + + public function testFriendlyFunctions_dema() + { + self::assertEquals(trader_dema($this->Close, 30), Trader::doubleExponentialMovingAverage($this->Close, 30)); + } + + public function testFriendlyFunctions_div() + { + self::assertEquals(trader_div($this->Open, $this->Close), Trader::mathDivision($this->Open, $this->Close)); + } + + public function testFriendlyFunctions_dx() + { + self::assertEquals(trader_dx($this->High, $this->Low, $this->Close, 14), Trader::directionalMovementIndex($this->High, $this->Low, $this->Close, 14)); + } + + public function testFriendlyFunctions_ema() + { + self::assertEquals(trader_ema($this->Close, 30), Trader::exponentialMovingAverage($this->Close, 30)); + } + + public function testFriendlyFunctions_exp() + { + self::assertEquals(trader_exp($this->Close), Trader::mathExponent($this->Close)); + } + + public function testFriendlyFunctions_floor() + { + self::assertEquals(trader_floor($this->Close), Trader::mathFloor($this->Close)); + } + + public function testFriendlyFunctions_ht_dcperiod() + { + self::assertEquals(trader_ht_dcperiod($this->Close), Trader::hilbertTransformDominantCyclePeriod($this->Close)); + } + + public function testFriendlyFunctions_ht_dcphase() + { + self::assertEquals(trader_ht_dcphase($this->Close), Trader::hilbertTransformDominantCyclePhase($this->Close)); + } + + public function testFriendlyFunctions_ht_phasor() + { + self::assertEquals(trader_ht_phasor($this->Close), Trader::hilbertTransformPhasorComponents($this->Close)); + } + + public function testFriendlyFunctions_ht_sine() + { + self::assertEquals(trader_ht_sine($this->Close), Trader::hilbertTransformSineWave($this->Close)); + } + + public function testFriendlyFunctions_ht_trendline() + { + self::assertEquals(trader_ht_trendline($this->Close), Trader::hilbertTransformInstantaneousTrendLine($this->Close)); + } + + public function testFriendlyFunctions_ht_trendmode() + { + self::assertEquals(trader_ht_trendmode($this->Close), Trader::hilbertTransformTrendVsCycleMode($this->Close)); + } + + public function testFriendlyFunctions_kama() + { + self::assertEquals(trader_kama($this->Close, 30), Trader::kaufmanAdaptiveMovingAverage($this->Close, 30)); + } + + public function testFriendlyFunctions_linearreg_angle() + { + self::assertEquals(trader_linearreg_angle($this->Close, 14), Trader::linearRegressionAngle($this->Close, 14)); + } + + public function testFriendlyFunctions_linearreg_intercept() + { + self::assertEquals(trader_linearreg_intercept($this->Close, 14), Trader::linearRegressionIntercept($this->Close, 14)); + } + + public function testFriendlyFunctions_linearreg_slope() + { + self::assertEquals(trader_linearreg_slope($this->Close, 14), Trader::linearRegressionSlope($this->Close, 14)); + } + + public function testFriendlyFunctions_linearreg() + { + self::assertEquals(trader_linearreg($this->Close, 14), Trader::linearRegression($this->Close, 14)); + } + + public function testFriendlyFunctions_ln() + { + self::assertEquals(trader_ln($this->Close), Trader::mathLogarithmNatural($this->Close)); + } + + public function testFriendlyFunctions_log10() + { + self::assertEquals(trader_log10($this->Close), Trader::mathLogarithmBase10($this->Close)); + } + + public function testFriendlyFunctions_ma() + { + self::assertEquals(trader_ma($this->Close, 30, TRADER_MA_TYPE_SMA), Trader::movingAverage($this->Close, 30, TRADER_MA_TYPE_SMA)); + } + + public function testFriendlyFunctions_macd() + { + self::assertEquals(trader_macd($this->Close, 12, 26, 9), Trader::movingAverageConvergenceDivergence($this->Close, 12, 26, 9)); + } + + public function testFriendlyFunctions_macdext() + { + self::assertEquals(trader_macdext($this->Close, 12, TRADER_MA_TYPE_SMA, 26, TRADER_MA_TYPE_SMA, 9), Trader::movingAverageConvergenceDivergenceExtended($this->Close, 12, TRADER_MA_TYPE_SMA, 26, TRADER_MA_TYPE_SMA, 9)); + } + + public function testFriendlyFunctions_macdfix() + { + self::assertEquals(trader_macdfix($this->Close, 9), Trader::movingAverageConvergenceDivergenceFixed($this->Close, 9)); + } + + public function testFriendlyFunctions_mama() + { + self::assertEquals(trader_mama($this->Close, 0.5, 0.05), Trader::mesaAdaptiveMovingAverage($this->Close, 0.5, 0.05)); + } + + public function testFriendlyFunctions_mavp() + { + self::assertEquals(trader_mavp($this->Close, $this->Open, 2, 30, TRADER_MA_TYPE_SMA), Trader::movingAverageVariablePeriod($this->Close, $this->Open, 2, 30, TRADER_MA_TYPE_SMA)); + } + + public function testFriendlyFunctions_max() + { + self::assertEquals(trader_max($this->Close, 30), Trader::mathMax($this->Close, 30)); + } + + public function testFriendlyFunctions_maxindex() + { + self::assertEquals(trader_maxindex($this->Close, 30), Trader::mathMaxIndex($this->Close, 30)); + } + + public function testFriendlyFunctions_medprice() + { + self::assertEquals(trader_medprice($this->High, $this->Low), Trader::mathMedianPrice($this->High, $this->Low)); + } + + public function testFriendlyFunctions_mfi() + { + self::assertEquals(trader_mfi($this->High, $this->Low, $this->Close, $this->Volume, 14), Trader::moneyFlowIndex($this->High, $this->Low, $this->Close, $this->Volume, 14)); + } + + public function testFriendlyFunctions_midpoint() + { + self::assertEquals(trader_midpoint($this->Close, 14), Trader::middlePoint($this->Close, 14)); + } + + public function testFriendlyFunctions_midprice() + { + self::assertEquals(trader_midprice($this->High, $this->Low, 14), Trader::middlePointPrice($this->High, $this->Low, 14)); + } + + public function testFriendlyFunctions_min() + { + self::assertEquals(trader_min($this->High, 30), Trader::mathMin($this->High, 30)); + } + + public function testFriendlyFunctions_minindex() + { + self::assertEquals(trader_minindex($this->High, 30), Trader::mathMinIndex($this->High, 30)); + } + + public function testFriendlyFunctions_minmax() + { + self::assertEquals(trader_minmax($this->High, 30), Trader::mathMinMax($this->High, 30)); + } + + public function testFriendlyFunctions_minmaxindex() + { + self::assertEquals(trader_minmaxindex($this->High, 30), Trader::mathMinMaxIndex($this->High, 30)); + } + + public function testFriendlyFunctions_minus_di() + { + self::assertEquals(trader_minus_di($this->High, $this->Low, $this->Close, 14), Trader::minusDirectionalIndicator($this->High, $this->Low, $this->Close, 14)); + } + + public function testFriendlyFunctions_minus_dmi() + { + self::assertEquals(trader_minus_dm($this->High, $this->Low, 14), Trader::minusDirectionalMovement($this->High, $this->Low, 14)); + } + + public function testFriendlyFunctions_mom() + { + self::assertEquals(trader_mom($this->High, 10), Trader::momentum($this->High, 10)); + } + + public function testFriendlyFunctions_mult() + { + self::assertEquals(trader_mult($this->Open, $this->Close), Trader::mathMultiply($this->Open, $this->Close)); + } + + public function testFriendlyFunctions_natr() + { + self::assertEquals(trader_natr($this->High, $this->Low, $this->Close, 14), Trader::normalizedAverageTrueRange($this->High, $this->Low, $this->Close, 14)); + } + + public function testFriendlyFunctions_obv() + { + self::assertEquals(trader_obv($this->Close, $this->Volume), Trader::onBalanceVolume($this->Close, $this->Volume)); + } + + public function testFriendlyFunctions_plus_di() + { + self::assertEquals(trader_plus_di($this->High, $this->Low, $this->Close, 14), Trader::plusDirectionalIndicator($this->High, $this->Low, $this->Close, 14)); + } + + public function testFriendlyFunctions_plus_dm() + { + self::assertEquals(trader_plus_dm($this->High, $this->Low, 14), Trader::plusDirectionalMovement($this->High, $this->Low, 14)); + } + + public function testFriendlyFunctions_ppo() + { + self::assertEquals(trader_ppo($this->Close, 12, 26, TRADER_MA_TYPE_SMA), Trader::percentagePriceOscillator($this->Close, 12, 26, TRADER_MA_TYPE_SMA)); + } + + public function testFriendlyFunctions_roc() + { + self::assertEquals(trader_roc($this->Close, 10), Trader::rateOfChange($this->Close, 10)); + } + + public function testFriendlyFunctions_rocp() + { + self::assertEquals(trader_rocp($this->Close, 10), Trader::rateOfChangePercentage($this->Close, 10)); + } + + public function testFriendlyFunctions_rocr100() + { + self::assertEquals(trader_rocr100($this->Close, 10), Trader::rateOfChangeRatio100($this->Close, 10)); + } + + public function testFriendlyFunctions_rocr() + { + self::assertEquals(trader_rocr($this->Close, 10), Trader::rateOfChangeRatio($this->Close, 10)); + } + + public function testFriendlyFunctions_rsi() + { + self::assertEquals(trader_rsi($this->Close, 14), Trader::relativeStrengthIndex($this->Close, 14)); + } + + public function testFriendlyFunctions_sar() + { + self::assertEquals(trader_sar($this->Close, $this->Low, 0.02, 0.2), Trader::parabolicSAR($this->Close, $this->Low, 0.02, 0.2)); + } + + public function testFriendlyFunctions_sarext() + { + self::assertEquals(trader_sarext($this->Close, $this->Low, 0.0, 0.0, 0.02, 0.02, 0.2, 0.02, 0.02, 0.2), Trader::parabolicSARExtended($this->Close, $this->Low, 0.0, 0.0, 0.02, 0.02, 0.2, 0.02, 0.02, 0.2)); + } + + public function testFriendlyFunctions_sin() + { + self::assertEquals(trader_sin($this->Close), Trader::mathSine($this->Close)); + } + + public function testFriendlyFunctions_sinh() + { + self::assertEquals(trader_sinh($this->Close), Trader::mathHyperbolicSine($this->Close)); + } + + public function testFriendlyFunctions_sma() + { + self::assertEquals(trader_sma($this->Close, 30), Trader::simpleMovingAverage($this->Close, 30)); + } + + public function testFriendlyFunctions_sqrt() + { + self::assertEquals(trader_sqrt($this->Close), Trader::mathSquareRoot($this->Close)); + } + + public function testFriendlyFunctions_stddev() + { + self::assertEquals(trader_stddev($this->Close, 5, 1.0), Trader::standardDeviation($this->Close, 5, 1.0)); + } + + public function testFriendlyFunctions_stoch() + { + self::assertEquals(trader_stoch($this->High, $this->Low, $this->Close, 5, 3, TRADER_MA_TYPE_SMA, 3, TRADER_MA_TYPE_SMA), Trader::stochastic($this->High, $this->Low, $this->Close, 5, 3, TRADER_MA_TYPE_SMA, 3, TRADER_MA_TYPE_SMA)); + } + + public function testFriendlyFunctions_stochf() + { + self::assertEquals(trader_stochf($this->High, $this->Low, $this->Close, 5, 3, TRADER_MA_TYPE_SMA), Trader::stochasticFast($this->High, $this->Low, $this->Close, 5, 3, TRADER_MA_TYPE_SMA)); + } + + public function testFriendlyFunctions_stochrsi() + { + self::assertEquals(trader_stochrsi($this->Close, 14, 5, 3, TRADER_MA_TYPE_SMA), Trader::stochasticRelativeStrengthIndex($this->Close, 14, 5, 3, TRADER_MA_TYPE_SMA)); + } + + public function testFriendlyFunctions_sub() + { + self::assertEquals(trader_sub($this->High, $this->Low), Trader::mathSubtraction($this->High, $this->Low)); + } + + public function testFriendlyFunctions_sum() + { + self::assertEquals(trader_sum($this->High, 30), Trader::mathSummation($this->High, 30)); + } + + public function testFriendlyFunctions_t3() + { + self::assertEquals(trader_t3($this->High, 5, 0.7), Trader::tripleExponentialMovingAverageT3($this->High, 5, 0.7)); + } + + public function testFriendlyFunctions_tan() + { + self::assertEquals(trader_tan($this->Close), Trader::mathTangent($this->Close)); + } + + public function testFriendlyFunctions_tanh() + { + self::assertEquals(trader_tanh($this->Close), Trader::mathHyperbolicTangent($this->Close)); + } + + public function testFriendlyFunctions_tema() + { + self::assertEquals(trader_tema($this->Close, 30), Trader::tripleExponentialMovingAverage($this->Close, 30)); + } + + public function testFriendlyFunctions_trange() + { + self::assertEquals(trader_trange($this->High, $this->Low, $this->Close), Trader::trueRange($this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_trima() + { + self::assertEquals(trader_trima($this->Close, 30), Trader::triangularMovingAverage($this->Close, 30)); + } + + public function testFriendlyFunctions_trix() + { + self::assertEquals(trader_trix($this->Close, 30), Trader::tripleExponentialAverage($this->Close, 30)); + } + + public function testFriendlyFunctions_tsf() + { + self::assertEquals(trader_tsf($this->Close, 14), Trader::timeSeriesForecast($this->Close, 14)); + } + + public function testFriendlyFunctions_typprice() + { + self::assertEquals(trader_typprice($this->High, $this->Low, $this->Close), Trader::typicalPrice($this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_ultosc() + { + self::assertEquals(trader_ultosc($this->High, $this->Low, $this->Close, 7, 14, 28), Trader::ultimateOscillator($this->High, $this->Low, $this->Close, 7, 14, 28)); + } + + public function testFriendlyFunctions_var() + { + self::assertEquals(trader_var($this->Close, 5, 1.0), Trader::variance($this->Close, 5, 1.0)); + } + + public function testFriendlyFunctions_wclprice() + { + self::assertEquals(trader_wclprice($this->High, $this->Low, $this->Close), Trader::weightedClosePrice($this->High, $this->Low, $this->Close)); + } + + public function testFriendlyFunctions_willr() + { + self::assertEquals(trader_willr($this->High, $this->Low, $this->Close, 14), Trader::williamsR($this->High, $this->Low, $this->Close, 14)); + } + + public function testFriendlyFunctions_wma() + { + self::assertEquals(trader_wma($this->Close, 30), Trader::weightedMovingAverage($this->Close, 30)); + } + + // + } diff --git a/composer.json b/composer.json index d567533..ad95cb9 100644 --- a/composer.json +++ b/composer.json @@ -1,25 +1,27 @@ { "name": "lupecode/php-trader-interface", "description": "An interface to the PHP Trader extension.", - "version": "0.2.0", + "version": "1.0.5", "type": "library", - "license": "GNU GPLv3", - "authors":[ + "license": "GPL-3.0-or-later", + "authors": [ { - "name": "Joshua Saige", - "email": "joshuasaige@lupecode.com", - "homepage": "http://github.com/jbsaige", + "name": "Joshua Lopez", + "email": "joshua@lupecode.com", + "homepage": "http://github.com/LupeCode", "role": "Developer" } ], "require": { "php": ">=7.0.0", - "ext-trader": "*" + "ext-trader": ">=0.4.1" }, "require-dev": { - "phpunit/phpunit": "~5.4" + "phpunit/phpunit": "~6.3.0", + "codacy/coverage": "~1.4.0", + "phpmetrics/phpmetrics": "~2.3.2" }, "autoload": { "psr-4": {"LupeCode\\phpTraderInterface\\": "source/"} } -} \ No newline at end of file +} diff --git a/composer.lock b/composer.lock index 98d296f..82fe9f9 100644 --- a/composer.lock +++ b/composer.lock @@ -4,38 +4,82 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "633890059dff9b60f61c9e9accfe0ce3", - "content-hash": "a31b8d538a81d00704f9879d8a24e686", + "content-hash": "f7641e61f8461268a7d266bc0e55f69e", "packages": [], "packages-dev": [ + { + "name": "codacy/coverage", + "version": "1.4.1", + "source": { + "type": "git", + "url": "https://github.com/codacy/php-codacy-coverage.git", + "reference": "546ac2e000a004571c1000ecff4d68a98706db3a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/codacy/php-codacy-coverage/zipball/546ac2e000a004571c1000ecff4d68a98706db3a", + "reference": "546ac2e000a004571c1000ecff4d68a98706db3a", + "shasum": "" + }, + "require": { + "gitonomy/gitlib": ">=1.0", + "php": ">=5.3.3", + "symfony/console": "~2.5|~3.0|~4.0" + }, + "require-dev": { + "phpunit/phpunit": "~6.5" + }, + "bin": [ + "bin/codacycoverage" + ], + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jakob Pupke", + "email": "jakob.pupke@gmail.com" + } + ], + "description": "Sends PHP test coverage information to Codacy.", + "homepage": "https://github.com/codacy/php-codacy-coverage", + "time": "2017-12-20T14:31:46+00:00" + }, { "name": "doctrine/instantiator", - "version": "1.0.5", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" + "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", + "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", "shasum": "" }, "require": { - "php": ">=5.3,<8.0-DEV" + "php": "^7.1" }, "require-dev": { "athletic/athletic": "~0.1.8", "ext-pdo": "*", "ext-phar": "*", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "~2.0" + "phpunit/phpunit": "^6.2.3", + "squizlabs/php_codesniffer": "^3.0.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.2.x-dev" } }, "autoload": { @@ -60,41 +104,100 @@ "constructor", "instantiate" ], - "time": "2015-06-14 21:17:01" + "time": "2017-07-22T11:58:36+00:00" + }, + { + "name": "gitonomy/gitlib", + "version": "v1.0.3", + "source": { + "type": "git", + "url": "https://github.com/gitonomy/gitlib.git", + "reference": "1c2b0605115786613cb517798046c8ab57c17097" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/gitonomy/gitlib/zipball/1c2b0605115786613cb517798046c8ab57c17097", + "reference": "1c2b0605115786613cb517798046c8ab57c17097", + "shasum": "" + }, + "require": { + "php": "^5.3 || ^7.0", + "symfony/process": "^2.3|^3.0|^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35|^5.7", + "psr/log": "^1.0" + }, + "suggest": { + "psr/log": "Add some log" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "Gitonomy\\Git\\": "src/Gitonomy/Git/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Alexandre Salomé", + "email": "alexandre.salome@gmail.com", + "homepage": "http://alexandre-salome.fr" + }, + { + "name": "Julien DIDIER", + "email": "genzo.wm@gmail.com", + "homepage": "http://www.jdidier.net" + } + ], + "description": "Library for accessing git", + "homepage": "http://gitonomy.com", + "time": "2018-01-10T11:34:47+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.5.1", + "version": "1.7.0", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "a8773992b362b58498eed24bf85005f363c34771" + "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/a8773992b362b58498eed24bf85005f363c34771", - "reference": "a8773992b362b58498eed24bf85005f363c34771", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", + "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", "shasum": "" }, "require": { - "php": ">=5.4.0" + "php": "^5.6 || ^7.0" }, "require-dev": { - "doctrine/collections": "1.*", - "phpunit/phpunit": "~4.1" + "doctrine/collections": "^1.0", + "doctrine/common": "^2.6", + "phpunit/phpunit": "^4.1" }, "type": "library", "autoload": { "psr-4": { "DeepCopy\\": "src/DeepCopy/" - } + }, + "files": [ + "src/DeepCopy/deep_copy.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "description": "Create deep copies (clones) of your objects", - "homepage": "https://github.com/myclabs/DeepCopy", "keywords": [ "clone", "copy", @@ -102,20 +205,173 @@ "object", "object graph" ], - "time": "2015-11-20 12:04:31" + "time": "2017-10-19T19:58:43+00:00" + }, + { + "name": "nikic/php-parser", + "version": "v3.1.3", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "579f4ce846734a1cf55d6a531d00ca07a43e3cda" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/579f4ce846734a1cf55d6a531d00ca07a43e3cda", + "reference": "579f4ce846734a1cf55d6a531d00ca07a43e3cda", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "~4.0|~5.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "time": "2017-12-26T14:43:21+00:00" + }, + { + "name": "phar-io/manifest", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/2df402786ab5368a0169091f61a7c1e0eb6852d0", + "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "phar-io/version": "^1.0.1", + "php": "^5.6 || ^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "time": "2017-03-05T18:14:27+00:00" + }, + { + "name": "phar-io/version", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/a70c0ced4be299a63d32fa96d9281d03e94041df", + "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "time": "2017-03-05T17:38:23+00:00" }, { "name": "phpdocumentor/reflection-common", - "version": "1.0", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c" + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c", - "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", "shasum": "" }, "require": { @@ -156,33 +412,39 @@ "reflection", "static analysis" ], - "time": "2015-12-27 11:43:31" + "time": "2017-09-11T18:02:19+00:00" }, { "name": "phpdocumentor/reflection-docblock", - "version": "3.1.0", + "version": "4.2.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "9270140b940ff02e58ec577c237274e92cd40cdd" + "reference": "66465776cfc249844bde6d117abff1d22e06c2da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/9270140b940ff02e58ec577c237274e92cd40cdd", - "reference": "9270140b940ff02e58ec577c237274e92cd40cdd", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/66465776cfc249844bde6d117abff1d22e06c2da", + "reference": "66465776cfc249844bde6d117abff1d22e06c2da", "shasum": "" }, "require": { - "php": ">=5.5", - "phpdocumentor/reflection-common": "^1.0@dev", - "phpdocumentor/type-resolver": "^0.2.0", + "php": "^7.0", + "phpdocumentor/reflection-common": "^1.0.0", + "phpdocumentor/type-resolver": "^0.4.0", "webmozart/assert": "^1.0" }, "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^4.4" + "doctrine/instantiator": "~1.0.5", + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^6.4" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.x-dev" + } + }, "autoload": { "psr-4": { "phpDocumentor\\Reflection\\": [ @@ -201,24 +463,24 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2016-06-10 09:48:41" + "time": "2017-11-27T17:38:31+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "0.2", + "version": "0.4.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "b39c7a5b194f9ed7bd0dd345c751007a41862443" + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/b39c7a5b194f9ed7bd0dd345c751007a41862443", - "reference": "b39c7a5b194f9ed7bd0dd345c751007a41862443", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", "shasum": "" }, "require": { - "php": ">=5.5", + "php": "^5.5 || ^7.0", "phpdocumentor/reflection-common": "^1.0" }, "require-dev": { @@ -248,36 +510,98 @@ "email": "me@mikevanriel.com" } ], - "time": "2016-06-10 07:14:17" + "time": "2017-07-14T14:27:02+00:00" + }, + { + "name": "phpmetrics/phpmetrics", + "version": "v2.3.2", + "source": { + "type": "git", + "url": "https://github.com/phpmetrics/PhpMetrics.git", + "reference": "e44f5224d08571ee6ba85c50379560b9ec217b91" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpmetrics/PhpMetrics/zipball/e44f5224d08571ee6ba85c50379560b9ec217b91", + "reference": "e44f5224d08571ee6ba85c50379560b9ec217b91", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "nikic/php-parser": "v3.*", + "php": ">=5.5" + }, + "replace": { + "halleck45/php-metrics": "*", + "halleck45/phpmetrics": "*" + }, + "require-dev": { + "phpunit/phpunit": ">=4.8.27,<=5.7.13" + }, + "bin": [ + "bin/phpmetrics" + ], + "type": "library", + "autoload": { + "psr-0": { + "Hal\\": "./src/" + }, + "files": [ + "./src/functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jean-François Lépine", + "email": "lepinejeanfrancois@yahoo.fr", + "homepage": "http://www.lepine.pro", + "role": "Copyright Holder" + } + ], + "description": "Static analyzer tool for PHP : Coupling, Cyclomatic complexity, Maintainability Index, Halstead's metrics... and more !", + "homepage": "http://www.phpmetrics.org", + "keywords": [ + "analysis", + "qa", + "quality", + "testing" + ], + "time": "2017-10-13T16:11:30+00:00" }, { "name": "phpspec/prophecy", - "version": "v1.6.1", + "version": "1.7.3", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "58a8137754bc24b25740d4281399a4a3596058e0" + "reference": "e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/58a8137754bc24b25740d4281399a4a3596058e0", - "reference": "58a8137754bc24b25740d4281399a4a3596058e0", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf", + "reference": "e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", - "sebastian/comparator": "^1.1", - "sebastian/recursion-context": "^1.0" + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", + "sebastian/comparator": "^1.1|^2.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0" }, "require-dev": { - "phpspec/phpspec": "^2.0" + "phpspec/phpspec": "^2.5|^3.2", + "phpunit/phpunit": "^4.8.35 || ^5.7" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.6.x-dev" + "dev-master": "1.7.x-dev" } }, "autoload": { @@ -310,44 +634,44 @@ "spy", "stub" ], - "time": "2016-06-07 08:13:47" + "time": "2017-11-24T13:59:53+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "4.0.0", + "version": "5.3.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "900370c81280cc0d942ffbc5912d80464eaee7e9" + "reference": "661f34d0bd3f1a7225ef491a70a020ad23a057a1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/900370c81280cc0d942ffbc5912d80464eaee7e9", - "reference": "900370c81280cc0d942ffbc5912d80464eaee7e9", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/661f34d0bd3f1a7225ef491a70a020ad23a057a1", + "reference": "661f34d0bd3f1a7225ef491a70a020ad23a057a1", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0", - "phpunit/php-file-iterator": "~1.3", - "phpunit/php-text-template": "~1.2", - "phpunit/php-token-stream": "^1.4.2", - "sebastian/code-unit-reverse-lookup": "~1.0", - "sebastian/environment": "^1.3.2", - "sebastian/version": "~1.0|~2.0" + "ext-dom": "*", + "ext-xmlwriter": "*", + "php": "^7.0", + "phpunit/php-file-iterator": "^1.4.2", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-token-stream": "^2.0.1", + "sebastian/code-unit-reverse-lookup": "^1.0.1", + "sebastian/environment": "^3.0", + "sebastian/version": "^2.0.1", + "theseer/tokenizer": "^1.1" }, "require-dev": { - "ext-xdebug": ">=2.1.4", - "phpunit/phpunit": "^5.4" + "phpunit/phpunit": "^6.0" }, "suggest": { - "ext-dom": "*", - "ext-xdebug": ">=2.4.0", - "ext-xmlwriter": "*" + "ext-xdebug": "^2.5.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0.x-dev" + "dev-master": "5.3.x-dev" } }, "autoload": { @@ -362,7 +686,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -373,20 +697,20 @@ "testing", "xunit" ], - "time": "2016-06-03 05:03:56" + "time": "2017-12-06T09:29:45+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "1.4.1", + "version": "1.4.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0" + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6150bf2c35d3fc379e50c7602b75caceaa39dbf0", - "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", "shasum": "" }, "require": { @@ -420,7 +744,7 @@ "filesystem", "iterator" ], - "time": "2015-06-21 13:08:43" + "time": "2017-11-27T13:52:08+00:00" }, { "name": "phpunit/php-text-template", @@ -461,29 +785,34 @@ "keywords": [ "template" ], - "time": "2015-06-21 13:50:34" + "time": "2015-06-21T13:50:34+00:00" }, { "name": "phpunit/php-timer", - "version": "1.0.8", + "version": "1.0.9", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260" + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/38e9124049cf1a164f1e4537caf19c99bf1eb260", - "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.3.3 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~4|~5" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, "autoload": { "classmap": [ "src/" @@ -505,33 +834,33 @@ "keywords": [ "timer" ], - "time": "2016-05-12 18:03:57" + "time": "2017-02-26T11:10:40+00:00" }, { "name": "phpunit/php-token-stream", - "version": "1.4.8", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da" + "reference": "791198a2c6254db10131eecfe8c06670700904db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", - "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/791198a2c6254db10131eecfe8c06670700904db", + "reference": "791198a2c6254db10131eecfe8c06670700904db", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": ">=5.3.3" + "php": "^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.2" + "phpunit/phpunit": "^6.2.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -554,51 +883,57 @@ "keywords": [ "tokenizer" ], - "time": "2015-09-15 10:49:45" + "time": "2017-11-27T05:48:46+00:00" }, { "name": "phpunit/phpunit", - "version": "5.4.7", + "version": "6.3.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "6c8a756c17a1a92a066c99860eb57922e8b723da" + "reference": "c0ff817b36a827e64bf5f57bc72278150cf30a77" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/6c8a756c17a1a92a066c99860eb57922e8b723da", - "reference": "6c8a756c17a1a92a066c99860eb57922e8b723da", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c0ff817b36a827e64bf5f57bc72278150cf30a77", + "reference": "c0ff817b36a827e64bf5f57bc72278150cf30a77", "shasum": "" }, "require": { "ext-dom": "*", "ext-json": "*", - "ext-pcre": "*", - "ext-reflection": "*", - "ext-spl": "*", - "myclabs/deep-copy": "~1.3", - "php": "^5.6 || ^7.0", - "phpspec/prophecy": "^1.3.1", - "phpunit/php-code-coverage": "^4.0", - "phpunit/php-file-iterator": "~1.4", - "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": "^1.0.6", - "phpunit/phpunit-mock-objects": "^3.2", - "sebastian/comparator": "~1.1", - "sebastian/diff": "~1.2", - "sebastian/environment": "^1.3 || ^2.0", - "sebastian/exporter": "~1.2", - "sebastian/global-state": "~1.0", - "sebastian/object-enumerator": "~1.0", - "sebastian/resource-operations": "~1.0", - "sebastian/version": "~1.0|~2.0", - "symfony/yaml": "~2.1|~3.0" + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "myclabs/deep-copy": "^1.6.1", + "phar-io/manifest": "^1.0.1", + "phar-io/version": "^1.0", + "php": "^7.0", + "phpspec/prophecy": "^1.7", + "phpunit/php-code-coverage": "^5.2.2", + "phpunit/php-file-iterator": "^1.4.2", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-timer": "^1.0.9", + "phpunit/phpunit-mock-objects": "^4.0.3", + "sebastian/comparator": "^2.0.2", + "sebastian/diff": "^2.0", + "sebastian/environment": "^3.1", + "sebastian/exporter": "^3.1", + "sebastian/global-state": "^2.0", + "sebastian/object-enumerator": "^3.0.3", + "sebastian/resource-operations": "^1.0", + "sebastian/version": "^2.0.1" }, "conflict": { - "phpdocumentor/reflection-docblock": "3.0.2" + "phpdocumentor/reflection-docblock": "3.0.2", + "phpunit/dbunit": "<3.0" + }, + "require-dev": { + "ext-pdo": "*" }, "suggest": { - "phpunit/php-invoker": "~1.1" + "ext-xdebug": "*", + "phpunit/php-invoker": "^1.1" }, "bin": [ "phpunit" @@ -606,7 +941,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.4.x-dev" + "dev-master": "6.3.x-dev" } }, "autoload": { @@ -632,33 +967,33 @@ "testing", "xunit" ], - "time": "2016-07-21 06:55:27" + "time": "2017-09-24T07:25:54+00:00" }, { "name": "phpunit/phpunit-mock-objects", - "version": "3.2.3", + "version": "4.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "b13d0d9426ced06958bd32104653526a6c998a52" + "reference": "2f789b59ab89669015ad984afa350c4ec577ade0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/b13d0d9426ced06958bd32104653526a6c998a52", - "reference": "b13d0d9426ced06958bd32104653526a6c998a52", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/2f789b59ab89669015ad984afa350c4ec577ade0", + "reference": "2f789b59ab89669015ad984afa350c4ec577ade0", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.6 || ^7.0", - "phpunit/php-text-template": "^1.2", - "sebastian/exporter": "^1.2" + "doctrine/instantiator": "^1.0.5", + "php": "^7.0", + "phpunit/php-text-template": "^1.2.1", + "sebastian/exporter": "^3.0" }, "conflict": { - "phpunit/phpunit": "<5.4.0" + "phpunit/phpunit": "<6.0" }, "require-dev": { - "phpunit/phpunit": "^5.4" + "phpunit/phpunit": "^6.0" }, "suggest": { "ext-soap": "*" @@ -666,7 +1001,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2.x-dev" + "dev-master": "4.0.x-dev" } }, "autoload": { @@ -691,27 +1026,27 @@ "mock", "xunit" ], - "time": "2016-06-12 07:37:26" + "time": "2017-08-03T14:08:16+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.0", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "c36f5e7cfce482fde5bf8d10d41a53591e0198fe" + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/c36f5e7cfce482fde5bf8d10d41a53591e0198fe", - "reference": "c36f5e7cfce482fde5bf8d10d41a53591e0198fe", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", "shasum": "" }, "require": { - "php": ">=5.6" + "php": "^5.6 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~5" + "phpunit/phpunit": "^5.7 || ^6.0" }, "type": "library", "extra": { @@ -736,34 +1071,34 @@ ], "description": "Looks up which function or method a line of code belongs to", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2016-02-13 06:45:14" + "time": "2017-03-04T06:30:41+00:00" }, { "name": "sebastian/comparator", - "version": "1.2.0", + "version": "2.1.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "937efb279bd37a375bcadf584dec0726f84dbf22" + "reference": "11c07feade1d65453e06df3b3b90171d6d982087" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22", - "reference": "937efb279bd37a375bcadf584dec0726f84dbf22", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/11c07feade1d65453e06df3b3b90171d6d982087", + "reference": "11c07feade1d65453e06df3b3b90171d6d982087", "shasum": "" }, "require": { - "php": ">=5.3.3", - "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2" + "php": "^7.0", + "sebastian/diff": "^2.0", + "sebastian/exporter": "^3.1" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^6.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "2.1.x-dev" } }, "autoload": { @@ -794,38 +1129,38 @@ } ], "description": "Provides the functionality to compare PHP values for equality", - "homepage": "http://www.github.com/sebastianbergmann/comparator", + "homepage": "https://github.com/sebastianbergmann/comparator", "keywords": [ "comparator", "compare", "equality" ], - "time": "2015-07-26 15:48:44" + "time": "2018-01-12T06:34:42+00:00" }, { "name": "sebastian/diff", - "version": "1.4.1", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e" + "reference": "347c1d8b49c5c3ee30c7040ea6fc446790e6bddd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/347c1d8b49c5c3ee30c7040ea6fc446790e6bddd", + "reference": "347c1d8b49c5c3ee30c7040ea6fc446790e6bddd", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.8" + "phpunit/phpunit": "^6.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -852,32 +1187,32 @@ "keywords": [ "diff" ], - "time": "2015-12-08 07:14:41" + "time": "2017-08-03T08:09:46+00:00" }, { "name": "sebastian/environment", - "version": "1.3.7", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716" + "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/4e8f0da10ac5802913afc151413bc8c53b6c2716", - "reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/cd0871b3975fb7fc44d11314fd1ee20925fce4f5", + "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^6.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3.x-dev" + "dev-master": "3.1.x-dev" } }, "autoload": { @@ -902,34 +1237,34 @@ "environment", "hhvm" ], - "time": "2016-05-17 03:18:57" + "time": "2017-07-01T08:51:00+00:00" }, { "name": "sebastian/exporter", - "version": "1.2.2", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4" + "reference": "234199f4528de6d12aaa58b612e98f7d36adb937" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4", - "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/234199f4528de6d12aaa58b612e98f7d36adb937", + "reference": "234199f4528de6d12aaa58b612e98f7d36adb937", "shasum": "" }, "require": { - "php": ">=5.3.3", - "sebastian/recursion-context": "~1.0" + "php": "^7.0", + "sebastian/recursion-context": "^3.0" }, "require-dev": { "ext-mbstring": "*", - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3.x-dev" + "dev-master": "3.1.x-dev" } }, "autoload": { @@ -969,27 +1304,27 @@ "export", "exporter" ], - "time": "2016-06-17 09:04:28" + "time": "2017-04-03T13:19:02+00:00" }, { "name": "sebastian/global-state", - "version": "1.1.1", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.2" + "phpunit/phpunit": "^6.0" }, "suggest": { "ext-uopz": "*" @@ -997,7 +1332,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -1020,33 +1355,34 @@ "keywords": [ "global state" ], - "time": "2015-10-12 03:26:01" + "time": "2017-04-27T15:39:26+00:00" }, { "name": "sebastian/object-enumerator", - "version": "1.0.0", + "version": "3.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "d4ca2fb70344987502567bc50081c03e6192fb26" + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/d4ca2fb70344987502567bc50081c03e6192fb26", - "reference": "d4ca2fb70344987502567bc50081c03e6192fb26", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", "shasum": "" }, "require": { - "php": ">=5.6", - "sebastian/recursion-context": "~1.0" + "php": "^7.0", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" }, "require-dev": { - "phpunit/phpunit": "~5" + "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "3.0.x-dev" } }, "autoload": { @@ -1066,32 +1402,77 @@ ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2016-01-28 13:25:10" + "time": "2017-08-03T12:35:26+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "773f97c67f28de00d397be301821b06708fca0be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", + "reference": "773f97c67f28de00d397be301821b06708fca0be", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "time": "2017-03-29T09:07:27+00:00" }, { "name": "sebastian/recursion-context", - "version": "1.0.2", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "913401df809e99e4f47b27cdd781f4a258d58791" + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/913401df809e99e4f47b27cdd781f4a258d58791", - "reference": "913401df809e99e4f47b27cdd781f4a258d58791", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "3.0.x-dev" } }, "autoload": { @@ -1119,7 +1500,7 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2015-11-11 19:50:13" + "time": "2017-03-03T06:23:57+00:00" }, { "name": "sebastian/resource-operations", @@ -1161,20 +1542,20 @@ ], "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2015-07-28 20:34:47" + "time": "2015-07-28T20:34:47+00:00" }, { "name": "sebastian/version", - "version": "2.0.0", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "c829badbd8fdf16a0bad8aa7fa7971c029f1b9c5" + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c829badbd8fdf16a0bad8aa7fa7971c029f1b9c5", - "reference": "c829badbd8fdf16a0bad8aa7fa7971c029f1b9c5", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", "shasum": "" }, "require": { @@ -1204,34 +1585,53 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2016-02-04 12:56:52" + "time": "2016-10-03T07:35:21+00:00" }, { - "name": "symfony/yaml", - "version": "v3.1.2", + "name": "symfony/console", + "version": "v4.0.3", "source": { "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "2884c26ce4c1d61aebf423a8b912950fe7c764de" + "url": "https://github.com/symfony/console.git", + "reference": "fe0e69d7162cba0885791cf7eea5f0d7bc0f897e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/2884c26ce4c1d61aebf423a8b912950fe7c764de", - "reference": "2884c26ce4c1d61aebf423a8b912950fe7c764de", + "url": "https://api.github.com/repos/symfony/console/zipball/fe0e69d7162cba0885791cf7eea5f0d7bc0f897e", + "reference": "fe0e69d7162cba0885791cf7eea5f0d7bc0f897e", "shasum": "" }, "require": { - "php": ">=5.5.9" + "php": "^7.1.3", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/dependency-injection": "<3.4", + "symfony/process": "<3.3" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~3.4|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/event-dispatcher": "~3.4|~4.0", + "symfony/lock": "~3.4|~4.0", + "symfony/process": "~3.4|~4.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/lock": "", + "symfony/process": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "4.0-dev" } }, "autoload": { "psr-4": { - "Symfony\\Component\\Yaml\\": "" + "Symfony\\Component\\Console\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -1251,34 +1651,183 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Yaml Component", + "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2016-06-29 05:41:56" + "time": "2018-01-03T07:38:00+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.6.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", + "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2017-10-11T12:05:26+00:00" + }, + { + "name": "symfony/process", + "version": "v4.0.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "2145b3e8137e463b1051b79440a59b38220944f0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/2145b3e8137e463b1051b79440a59b38220944f0", + "reference": "2145b3e8137e463b1051b79440a59b38220944f0", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Process Component", + "homepage": "https://symfony.com", + "time": "2018-01-03T07:38:00+00:00" + }, + { + "name": "theseer/tokenizer", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/cb2f008f3f05af2893a87208fe6a6c4985483f8b", + "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "time": "2017-04-07T12:08:54+00:00" }, { "name": "webmozart/assert", - "version": "1.0.2", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/webmozart/assert.git", - "reference": "30eed06dd6bc88410a4ff7f77b6d22f3ce13dbde" + "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/30eed06dd6bc88410a4ff7f77b6d22f3ce13dbde", - "reference": "30eed06dd6bc88410a4ff7f77b6d22f3ce13dbde", + "url": "https://api.github.com/repos/webmozart/assert/zipball/2db61e59ff05fe5126d152bd0655c9ea113e550f", + "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.3.3 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "^4.6" + "phpunit/phpunit": "^4.6", + "sebastian/version": "^1.0.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "1.3-dev" } }, "autoload": { @@ -1302,7 +1851,7 @@ "check", "validate" ], - "time": "2015-08-24 13:29:44" + "time": "2016-11-23T20:04:58+00:00" } ], "aliases": [], diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..32c9919 --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,35 @@ + + + + + + + tests + + + + + + source + + + + + + + + + diff --git a/source/Trader.php b/source/Trader.php index 5688578..6704327 100644 --- a/source/Trader.php +++ b/source/Trader.php @@ -2,6 +2,8 @@ namespace LupeCode\phpTraderInterface; +require_once __DIR__ . '/TraderTrait.php'; + /** * Class Trader * @@ -16,15 +18,17 @@ class Trader /** * Vector arc cosine + * * Calculates the arc cosine for each value in real and returns the resulting array. * * @param array $real Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function mathArcCosine(array $real): array { - return trader_acos($real); + return static::acos($real); } /** @@ -45,10 +49,11 @@ public static function mathArcCosine(array $real): array * @param array $volume Volume traded, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function chaikinAccumulationDistributionLine(array $high, array $low, array $close, array $volume): array { - return trader_ad($high, $low, $close, $volume); + return static::ad($high, $low, $close, $volume); } /** @@ -58,10 +63,11 @@ public static function chaikinAccumulationDistributionLine(array $high, array $l * @param array $real1 Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function mathAddition(array $real0, array $real1): array { - return trader_add($real0, $real1); + return static::add($real0, $real1); } /** @@ -84,10 +90,11 @@ public static function mathAddition(array $real0, array $real1): array * @param int|null $slowPeriod Number of period for the slow MA. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function chaikinAccumulationDistributionOscillator(array $high, array $low, array $close, array $volume, integer $fastPeriod = null, integer $slowPeriod = null): array + public static function chaikinAccumulationDistributionOscillator(array $high, array $low, array $close, array $volume, int $fastPeriod = null, int $slowPeriod = null): array { - return trader_adosc($high, $low, $close, $volume, $fastPeriod, $slowPeriod); + return static::adosc($high, $low, $close, $volume, $fastPeriod, $slowPeriod); } /** @@ -110,129 +117,180 @@ public static function chaikinAccumulationDistributionOscillator(array $high, ar * @param int|null $timePeriod Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function averageDirectionalMovementIndex(array $high, array $low, array $close, integer $timePeriod = null): array + public static function averageDirectionalMovementIndex(array $high, array $low, array $close, int $timePeriod = null): array { - return trader_adx($high, $low, $close, $timePeriod); + return static::adx($high, $low, $close, $timePeriod); } /** * Average Directional Movement Index Rating * + * The Average Directional Movement Index Rating (ADXR) measures the strength of the Average Directional Movement Index (ADX). + * It's calculated by taking the average of the current ADX and the ADX from one time period before (time periods can vary, but the most typical period used is 14 days). + * + * Like the ADX, the ADXR ranges from values of 0 to 100 and reflects strengthening and weakening trends. + * However, because it represents an average of ADX, values don't fluctuate as dramatically and some analysts believe the indicator helps better display trends in volatile markets. + * * @param array $high High price, array of real values. * @param array $low Low price, array of real values. * @param array $close Closing price, array of real values. * @param int|null $timePeriod Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function averageDirectionalMovementIndexRating(array $high, array $low, array $close, integer $timePeriod = null): array + public static function averageDirectionalMovementIndexRating(array $high, array $low, array $close, int $timePeriod = null): array { - return trader_adxr($high, $low, $close, $timePeriod); + return static::adxr($high, $low, $close, $timePeriod); } /** * Absolute Price Oscillator * + * The Absolute Price Oscillator (APO) is based on the absolute differences between two moving averages of different lengths, a ‘Fast’ and a ‘Slow’ moving average. + * A positive indicator value indicates an upward movement, while negative readings signal a downward trend. + * + * Divergences form when a new high or low in price is not confirmed by the Absolute Price Oscillator (APO). + * A bullish divergence forms when price make a lower low, but the APO forms a higher low. + * This indicates less downward momentum that could foreshadow a bullish reversal. + * A bearish divergence forms when price makes a higher high, but the APO forms a lower high. + * This shows less upward momentum that could foreshadow a bearish reversal. + * * @param array $real Array of real values. * @param int|null $fastPeriod Number of period for the fast MA. Valid range from 2 to 100000. * @param int|null $slowPeriod Number of period for the slow MA. Valid range from 2 to 100000. * @param int|null $mAType Type of Moving Average. TRADER_MA_TYPE_* series of constants should be used. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function absolutePriceOscillator(array $real, integer $fastPeriod = null, integer $slowPeriod = null, integer $mAType = null): array + public static function absolutePriceOscillator(array $real, int $fastPeriod = null, int $slowPeriod = null, int $mAType = null): array { - return trader_apo($real, $fastPeriod, $slowPeriod, $mAType); + return static::apo($real, $fastPeriod, $slowPeriod, $mAType); } /** * Aroon * + * The Aroon indicator was developed by Tushar Chande in 1995. + * + * Both the Aroon up and the Aroon down fluctuate between zero and 100, with values close to 100 indicating a strong trend, and zero indicating a weak trend. + * The lower the Aroon up, the weaker the uptrend and the stronger the downtrend, and vice versa. + * The main assumption underlying this indicator is that a stock's price will close at record highs in an uptrend, and record lows in a downtrend. + * * @param array $high High price, array of real values. * @param array $low Low price, array of real values. * @param int|null $timePeriod Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function aroon(array $high, array $low, integer $timePeriod = null): array + public static function aroonIndicator(array $high, array $low, int $timePeriod = null): array { - return trader_aroon($high, $low, $timePeriod); + return static::aroon($high, $low, $timePeriod); } /** * Aroon Oscillator * + * The Aroon oscillator is calculated by subtracting Aroon down from Aroon up. + * Readings above zero indicate that an uptrend is present, while readings below zero indicate that a downtrend is present. + * * @param array $high High price, array of real values. * @param array $low Low price, array of real values. * @param int|null $timePeriod Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function arronOscillator(array $high, array $low, integer $timePeriod = null): array + public static function arronOscillator(array $high, array $low, int $timePeriod = null): array { - return trader_aroonosc($high, $low, $timePeriod); + return static::aroonosc($high, $low, $timePeriod); } /** * Vector Trigonometric ASin + * * Calculates the arc sine for each value in real and returns the resulting array. * * @param array $real Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function mathArcSine(array $real): array { - return trader_asin($real); + return static::asin($real); } /** * Vector Trigonometric ATan + * * Calculates the arc tangent for each value in real and returns the resulting array. * * @param array $real Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function mathArcTangent(array $real): array { - return trader_atan($real); + return static::atan($real); } /** * Average True Range * + * The average true range (ATR) is a measure of volatility introduced by Welles Wilder in his book, "New Concepts in Technical Trading Systems." + * The true range indicator is the greatest of the following: + * current high less the current low, + * the absolute value of the current high less the previous close, + * and the absolute value of the current low less the previous close. + * The average true range is a moving average, generally 14 days, of the true ranges. + * * @param array $high High price, array of real values. * @param array $low Low price, array of real values. * @param array $close Closing price, array of real values. * @param int|null $timePeriod Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function averageTrueRange(array $high, array $low, array $close, integer $timePeriod = null): array + public static function averageTrueRange(array $high, array $low, array $close, int $timePeriod = null): array { - return trader_atr($high, $low, $close, $timePeriod); + return static::atr($high, $low, $close, $timePeriod); } /** * Average Price * + * An average price is a representative measure of a range of prices that is calculated by taking the sum of the values and dividing it by the number of prices being examined. + * The average price reduces the range into a single value, which can then be compared to any point to determine if the value is higher or lower than what would be expected. + * * @param array $open Opening price, array of real values. * @param array $high High price, array of real values. * @param array $low Low price, array of real values. * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function averagePrice(array $open, array $high, array $low, array $close): array { - return trader_avgprice($open, $high, $low, $close); + return static::avgprice($open, $high, $low, $close); } /** * Bollinger Bands * + * A Bollinger Band® is a band plotted two standard deviations away from a simple moving average, developed by famous technical trader John Bollinger. + * + * Because standard deviation is a measure of volatility, Bollinger Bands® adjust themselves to the market conditions. + * When the markets become more volatile, the bands widen (move further away from the average), and during less volatile periods, the bands contract (move closer to the average). + * The tightening of the bands is often used by technical traders as an early indication that the volatility is about to increase sharply. + * * @param array $real Array of real values. * @param int|null $timePeriod Number of period. Valid range from 2 to 100000. * @param float|null $nbDevUp Deviation multiplier for upper band. Valid range from TRADER_REAL_MIN to TRADER_REAL_MAX. @@ -240,24 +298,34 @@ public static function averagePrice(array $open, array $high, array $low, array * @param int|null $mAType Type of Moving Average. TRADER_MA_TYPE_* series of constants should be used. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function bollingerBands(array $real, integer $timePeriod = null, float $nbDevUp = null, float $nbDevDn = null, integer $mAType = null): array + public static function bollingerBands(array $real, int $timePeriod = null, float $nbDevUp = null, float $nbDevDn = null, int $mAType = null): array { - return trader_bbands($real, $timePeriod, $nbDevUp, $nbDevDn, $mAType); + return static::bbands($real, $timePeriod, $nbDevUp, $nbDevDn, $mAType); } /** * Beta * + * Beta is a measure of the volatility, or systematic risk, of a security or a portfolio in comparison to the market as a whole. + * Beta is used in the capital asset pricing model (CAPM), which calculates the expected return of an asset based on its beta and expected market returns. + * Beta is also known as the beta coefficient. + * + * A beta of 1 indicates that the security's price moves with the market. + * A beta of less than 1 means that the security is theoretically less volatile than the market. + * A beta of greater than 1 indicates that the security's price is theoretically more volatile than the market. + * * @param array $real0 Array of real values. * @param array $real1 Array of real values. * @param int|null $timePeriod Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function beta(array $real0, array $real1, integer $timePeriod = null): array + public static function betaVolatility(array $real0, array $real1, int $timePeriod = null): array { - return trader_beta($real0, $real1, $timePeriod); + return static::beta($real0, $real1, $timePeriod); } /** @@ -269,25 +337,30 @@ public static function beta(array $real0, array $real1, integer $timePeriod = nu * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function balanceOfPower(array $open, array $high, array $low, array $close): array { - return trader_bop($open, $high, $low, $close); + return static::bop($open, $high, $low, $close); } /** * Commodity Channel Index * + * An oscillator used in technical analysis to help determine when an investment vehicle has been overbought and oversold. + * The Commodity Channel Index, first developed by Donald Lambert, quantifies the relationship between the asset's price, a moving average (MA) of the asset's price, and normal deviations (D) from that average. + * * @param array $high High price, array of real values. * @param array $low Low price, array of real values. * @param array $close Closing price, array of real values. * @param int|null $timePeriod Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function commodityChannelIndex(array $high, array $low, array $close, integer $timePeriod = null): array + public static function commodityChannelIndex(array $high, array $low, array $close, int $timePeriod = null): array { - return trader_cci($high, $low, $close, $timePeriod); + return static::cci($high, $low, $close, $timePeriod); } /** @@ -299,10 +372,11 @@ public static function commodityChannelIndex(array $high, array $low, array $clo * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleTwoCrows(array $open, array $high, array $low, array $close): array { - return trader_cdl2crows($open, $high, $low, $close); + return static::cdl2crows($open, $high, $low, $close); } /** @@ -314,10 +388,11 @@ public static function candleTwoCrows(array $open, array $high, array $low, arra * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleThreeBlackCrows(array $open, array $high, array $low, array $close): array { - return trader_cdl3blackcrows($open, $high, $low, $close); + return static::cdl3blackcrows($open, $high, $low, $close); } /** @@ -329,10 +404,11 @@ public static function candleThreeBlackCrows(array $open, array $high, array $lo * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleThreeInsideUpDown(array $open, array $high, array $low, array $close): array { - return trader_cdl3inside($open, $high, $low, $close); + return static::cdl3inside($open, $high, $low, $close); } /** @@ -344,10 +420,11 @@ public static function candleThreeInsideUpDown(array $open, array $high, array $ * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleThreeLineStrike(array $open, array $high, array $low, array $close): array { - return trader_cdl3linestrike($open, $high, $low, $close); + return static::cdl3linestrike($open, $high, $low, $close); } /** @@ -359,10 +436,11 @@ public static function candleThreeLineStrike(array $open, array $high, array $lo * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleThreeOutsideUpDown(array $open, array $high, array $low, array $close): array { - return trader_cdl3outside($open, $high, $low, $close); + return static::cdl3outside($open, $high, $low, $close); } /** @@ -374,10 +452,11 @@ public static function candleThreeOutsideUpDown(array $open, array $high, array * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleThreeStarsInTheSouth(array $open, array $high, array $low, array $close): array { - return trader_cdl3starsinsouth($open, $high, $low, $close); + return static::cdl3starsinsouth($open, $high, $low, $close); } /** @@ -389,10 +468,11 @@ public static function candleThreeStarsInTheSouth(array $open, array $high, arra * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleThreeWhiteSoldiers(array $open, array $high, array $low, array $close): array { - return trader_cdl3whitesoldiers($open, $high, $low, $close); + return static::cdl3whitesoldiers($open, $high, $low, $close); } /** @@ -405,10 +485,11 @@ public static function candleThreeWhiteSoldiers(array $open, array $high, array * @param float $penetration Percentage of penetration of a candle within another candle. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleAbandonedBaby(array $open, array $high, array $low, array $close, float $penetration = null): array { - return trader_cdlabandonedbaby($open, $high, $low, $close, $penetration); + return static::cdlabandonedbaby($open, $high, $low, $close, $penetration); } /** @@ -420,10 +501,11 @@ public static function candleAbandonedBaby(array $open, array $high, array $low, * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleAdvanceBlock(array $open, array $high, array $low, array $close): array { - return trader_cdladvanceblock($open, $high, $low, $close); + return static::cdladvanceblock($open, $high, $low, $close); } /** @@ -435,10 +517,11 @@ public static function candleAdvanceBlock(array $open, array $high, array $low, * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleBeltHold(array $open, array $high, array $low, array $close): array { - return trader_cdlbelthold($open, $high, $low, $close); + return static::cdlbelthold($open, $high, $low, $close); } /** @@ -450,10 +533,11 @@ public static function candleBeltHold(array $open, array $high, array $low, arra * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleBreakaway(array $open, array $high, array $low, array $close): array { - return trader_cdlbreakaway($open, $high, $low, $close); + return static::cdlbreakaway($open, $high, $low, $close); } /** @@ -465,10 +549,11 @@ public static function candleBreakaway(array $open, array $high, array $low, arr * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleClosingMarubozu(array $open, array $high, array $low, array $close): array { - return trader_cdlclosingmarubozu($open, $high, $low, $close); + return static::cdlclosingmarubozu($open, $high, $low, $close); } /** @@ -480,10 +565,11 @@ public static function candleClosingMarubozu(array $open, array $high, array $lo * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleConcealingBabySwallow(array $open, array $high, array $low, array $close): array { - return trader_cdlconcealbabyswall($open, $high, $low, $close); + return static::cdlconcealbabyswall($open, $high, $low, $close); } /** @@ -495,10 +581,11 @@ public static function candleConcealingBabySwallow(array $open, array $high, arr * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleCounterattack(array $open, array $high, array $low, array $close): array { - return trader_cdlcounterattack($open, $high, $low, $close); + return static::cdlcounterattack($open, $high, $low, $close); } /** @@ -511,10 +598,11 @@ public static function candleCounterattack(array $open, array $high, array $low, * @param float $penetration Percentage of penetration of a candle within another candle. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleDarkCloudCover(array $open, array $high, array $low, array $close, float $penetration = null): array { - return trader_cdldarkcloudcover($open, $high, $low, $close, $penetration); + return static::cdldarkcloudcover($open, $high, $low, $close, $penetration); } /** @@ -526,10 +614,11 @@ public static function candleDarkCloudCover(array $open, array $high, array $low * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleDoji(array $open, array $high, array $low, array $close): array { - return trader_cdldoji($open, $high, $low, $close); + return static::cdldoji($open, $high, $low, $close); } /** @@ -541,10 +630,11 @@ public static function candleDoji(array $open, array $high, array $low, array $c * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleDojiStar(array $open, array $high, array $low, array $close): array { - return trader_cdldojistar($open, $high, $low, $close); + return static::cdldojistar($open, $high, $low, $close); } /** @@ -556,10 +646,11 @@ public static function candleDojiStar(array $open, array $high, array $low, arra * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleDragonflyDoji(array $open, array $high, array $low, array $close): array { - return trader_cdldragonflydoji($open, $high, $low, $close); + return static::cdldragonflydoji($open, $high, $low, $close); } /** @@ -571,10 +662,11 @@ public static function candleDragonflyDoji(array $open, array $high, array $low, * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleEngulfingPattern(array $open, array $high, array $low, array $close): array { - return trader_cdlengulfing($open, $high, $low, $close); + return static::cdlengulfing($open, $high, $low, $close); } /** @@ -587,10 +679,11 @@ public static function candleEngulfingPattern(array $open, array $high, array $l * @param float $penetration Percentage of penetration of a candle within another candle. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleEveningDojiStar(array $open, array $high, array $low, array $close, float $penetration = null): array { - return trader_cdleveningdojistar($open, $high, $low, $close, $penetration); + return static::cdleveningdojistar($open, $high, $low, $close, $penetration); } /** @@ -603,10 +696,11 @@ public static function candleEveningDojiStar(array $open, array $high, array $lo * @param float $penetration Percentage of penetration of a candle within another candle. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleEveningStar(array $open, array $high, array $low, array $close, float $penetration = null): array { - return trader_cdleveningstar($open, $high, $low, $close, $penetration); + return static::cdleveningstar($open, $high, $low, $close, $penetration); } /** @@ -618,10 +712,11 @@ public static function candleEveningStar(array $open, array $high, array $low, a * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleUpDownGapsSideBySideWhiteLines(array $open, array $high, array $low, array $close): array { - return trader_cdlgapsidesidewhite($open, $high, $low, $close); + return static::cdlgapsidesidewhite($open, $high, $low, $close); } /** @@ -633,10 +728,11 @@ public static function candleUpDownGapsSideBySideWhiteLines(array $open, array $ * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleGravestoneDoji(array $open, array $high, array $low, array $close): array { - return trader_cdlgravestonedoji($open, $high, $low, $close); + return static::cdlgravestonedoji($open, $high, $low, $close); } /** @@ -648,10 +744,11 @@ public static function candleGravestoneDoji(array $open, array $high, array $low * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleHammer(array $open, array $high, array $low, array $close): array { - return trader_cdlhammer($open, $high, $low, $close); + return static::cdlhammer($open, $high, $low, $close); } /** @@ -663,10 +760,11 @@ public static function candleHammer(array $open, array $high, array $low, array * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleHangingMan(array $open, array $high, array $low, array $close): array { - return trader_cdlhangingman($open, $high, $low, $close); + return static::cdlhangingman($open, $high, $low, $close); } /** @@ -678,10 +776,11 @@ public static function candleHangingMan(array $open, array $high, array $low, ar * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleHarami(array $open, array $high, array $low, array $close): array { - return trader_cdlharami($open, $high, $low, $close); + return static::cdlharami($open, $high, $low, $close); } /** @@ -693,10 +792,11 @@ public static function candleHarami(array $open, array $high, array $low, array * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleHaramiCross(array $open, array $high, array $low, array $close): array { - return trader_cdlharamicross($open, $high, $low, $close); + return static::cdlharamicross($open, $high, $low, $close); } /** @@ -708,10 +808,11 @@ public static function candleHaramiCross(array $open, array $high, array $low, a * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleHighWave(array $open, array $high, array $low, array $close): array { - return trader_cdlhighwave($open, $high, $low, $close); + return static::cdlhighwave($open, $high, $low, $close); } /** @@ -723,10 +824,11 @@ public static function candleHighWave(array $open, array $high, array $low, arra * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleHikkake(array $open, array $high, array $low, array $close): array { - return trader_cdlhikkake($open, $high, $low, $close); + return static::cdlhikkake($open, $high, $low, $close); } /** @@ -738,10 +840,11 @@ public static function candleHikkake(array $open, array $high, array $low, array * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleModifiedHikkake(array $open, array $high, array $low, array $close): array { - return trader_cdlhikkakemod($open, $high, $low, $close); + return static::cdlhikkakemod($open, $high, $low, $close); } /** @@ -753,10 +856,11 @@ public static function candleModifiedHikkake(array $open, array $high, array $lo * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleHomingPigeon(array $open, array $high, array $low, array $close): array { - return trader_cdlhomingpigeon($open, $high, $low, $close); + return static::cdlhomingpigeon($open, $high, $low, $close); } /** @@ -768,10 +872,11 @@ public static function candleHomingPigeon(array $open, array $high, array $low, * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleIdenticalThreeCrows(array $open, array $high, array $low, array $close): array { - return trader_cdlidentical3crows($open, $high, $low, $close); + return static::cdlidentical3crows($open, $high, $low, $close); } /** @@ -783,10 +888,11 @@ public static function candleIdenticalThreeCrows(array $open, array $high, array * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleInNeck(array $open, array $high, array $low, array $close): array { - return trader_cdlinneck($open, $high, $low, $close); + return static::cdlinneck($open, $high, $low, $close); } /** @@ -798,10 +904,11 @@ public static function candleInNeck(array $open, array $high, array $low, array * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleInvertedHammer(array $open, array $high, array $low, array $close): array { - return trader_cdlinvertedhammer($open, $high, $low, $close); + return static::cdlinvertedhammer($open, $high, $low, $close); } /** @@ -813,10 +920,11 @@ public static function candleInvertedHammer(array $open, array $high, array $low * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleKicking(array $open, array $high, array $low, array $close): array { - return trader_cdlkicking($open, $high, $low, $close); + return static::cdlkicking($open, $high, $low, $close); } /** @@ -828,10 +936,11 @@ public static function candleKicking(array $open, array $high, array $low, array * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleKickingByLength(array $open, array $high, array $low, array $close): array { - return trader_cdlkickingbylength($open, $high, $low, $close); + return static::cdlkickingbylength($open, $high, $low, $close); } /** @@ -843,10 +952,11 @@ public static function candleKickingByLength(array $open, array $high, array $lo * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleLadderBottom(array $open, array $high, array $low, array $close): array { - return trader_cdlladderbottom($open, $high, $low, $close); + return static::cdlladderbottom($open, $high, $low, $close); } /** @@ -858,10 +968,11 @@ public static function candleLadderBottom(array $open, array $high, array $low, * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleLongLeggedDoji(array $open, array $high, array $low, array $close): array { - return trader_cdllongleggeddoji($open, $high, $low, $close); + return static::cdllongleggeddoji($open, $high, $low, $close); } /** @@ -873,10 +984,11 @@ public static function candleLongLeggedDoji(array $open, array $high, array $low * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleLongLine(array $open, array $high, array $low, array $close): array { - return trader_cdllongline($open, $high, $low, $close); + return static::cdllongline($open, $high, $low, $close); } /** @@ -888,10 +1000,11 @@ public static function candleLongLine(array $open, array $high, array $low, arra * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleMarubozu(array $open, array $high, array $low, array $close): array { - return trader_cdlmarubozu($open, $high, $low, $close); + return static::cdlmarubozu($open, $high, $low, $close); } /** @@ -903,10 +1016,11 @@ public static function candleMarubozu(array $open, array $high, array $low, arra * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleMatchingLow(array $open, array $high, array $low, array $close): array { - return trader_cdlmatchinglow($open, $high, $low, $close); + return static::cdlmatchinglow($open, $high, $low, $close); } /** @@ -919,10 +1033,11 @@ public static function candleMatchingLow(array $open, array $high, array $low, a * @param float $penetration Percentage of penetration of a candle within another candle. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleMatHold(array $open, array $high, array $low, array $close, float $penetration = null): array { - return trader_cdlmathold($open, $high, $low, $close, $penetration); + return static::cdlmathold($open, $high, $low, $close, $penetration); } /** @@ -935,10 +1050,11 @@ public static function candleMatHold(array $open, array $high, array $low, array * @param float $penetration Percentage of penetration of a candle within another candle. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleMorningDojiStar(array $open, array $high, array $low, array $close, float $penetration = null): array { - return trader_cdlmorningdojistar($open, $high, $low, $close, $penetration); + return static::cdlmorningdojistar($open, $high, $low, $close, $penetration); } /** @@ -951,10 +1067,11 @@ public static function candleMorningDojiStar(array $open, array $high, array $lo * @param float $penetration Percentage of penetration of a candle within another candle. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleMorningStar(array $open, array $high, array $low, array $close, float $penetration = null): array { - return trader_cdlmorningstar($open, $high, $low, $close, $penetration); + return static::cdlmorningstar($open, $high, $low, $close, $penetration); } /** @@ -966,10 +1083,11 @@ public static function candleMorningStar(array $open, array $high, array $low, a * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleOnNeck(array $open, array $high, array $low, array $close): array { - return trader_cdlonneck($open, $high, $low, $close); + return static::cdlonneck($open, $high, $low, $close); } /** @@ -981,10 +1099,11 @@ public static function candleOnNeck(array $open, array $high, array $low, array * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candlePiercing(array $open, array $high, array $low, array $close): array { - return trader_cdlpiercing($open, $high, $low, $close); + return static::cdlpiercing($open, $high, $low, $close); } /** @@ -996,10 +1115,11 @@ public static function candlePiercing(array $open, array $high, array $low, arra * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleRickshawMan(array $open, array $high, array $low, array $close): array { - return trader_cdlrickshawman($open, $high, $low, $close); + return static::cdlrickshawman($open, $high, $low, $close); } /** @@ -1011,10 +1131,11 @@ public static function candleRickshawMan(array $open, array $high, array $low, a * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleRisingFallingThreeMethods(array $open, array $high, array $low, array $close): array { - return trader_cdlrisefall3methods($open, $high, $low, $close); + return static::cdlrisefall3methods($open, $high, $low, $close); } /** @@ -1026,10 +1147,11 @@ public static function candleRisingFallingThreeMethods(array $open, array $high, * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleSeparatingLines(array $open, array $high, array $low, array $close): array { - return trader_cdlseparatinglines($open, $high, $low, $close); + return static::cdlseparatinglines($open, $high, $low, $close); } /** @@ -1041,10 +1163,11 @@ public static function candleSeparatingLines(array $open, array $high, array $lo * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleShootingStar(array $open, array $high, array $low, array $close): array { - return trader_cdlshootingstar($open, $high, $low, $close); + return static::cdlshootingstar($open, $high, $low, $close); } /** @@ -1056,10 +1179,11 @@ public static function candleShootingStar(array $open, array $high, array $low, * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleShortLine(array $open, array $high, array $low, array $close): array { - return trader_cdlshortline($open, $high, $low, $close); + return static::cdlshortline($open, $high, $low, $close); } /** @@ -1071,10 +1195,11 @@ public static function candleShortLine(array $open, array $high, array $low, arr * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleSpinningTop(array $open, array $high, array $low, array $close): array { - return trader_cdlspinningtop($open, $high, $low, $close); + return static::cdlspinningtop($open, $high, $low, $close); } /** @@ -1086,10 +1211,11 @@ public static function candleSpinningTop(array $open, array $high, array $low, a * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleStalled(array $open, array $high, array $low, array $close): array { - return trader_cdlstalledpattern($open, $high, $low, $close); + return static::cdlstalledpattern($open, $high, $low, $close); } /** @@ -1101,10 +1227,11 @@ public static function candleStalled(array $open, array $high, array $low, array * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleStickSandwich(array $open, array $high, array $low, array $close): array { - return trader_cdlsticksandwich($open, $high, $low, $close); + return static::cdlsticksandwich($open, $high, $low, $close); } /** @@ -1116,10 +1243,11 @@ public static function candleStickSandwich(array $open, array $high, array $low, * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleTakuri(array $open, array $high, array $low, array $close): array { - return trader_cdltakuri($open, $high, $low, $close); + return static::cdltakuri($open, $high, $low, $close); } /** @@ -1131,10 +1259,11 @@ public static function candleTakuri(array $open, array $high, array $low, array * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleTasukiGap(array $open, array $high, array $low, array $close): array { - return trader_cdltasukigap($open, $high, $low, $close); + return static::cdltasukigap($open, $high, $low, $close); } /** @@ -1146,10 +1275,11 @@ public static function candleTasukiGap(array $open, array $high, array $low, arr * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleThrusting(array $open, array $high, array $low, array $close): array { - return trader_cdlthrusting($open, $high, $low, $close); + return static::cdlthrusting($open, $high, $low, $close); } /** @@ -1161,10 +1291,11 @@ public static function candleThrusting(array $open, array $high, array $low, arr * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleTristar(array $open, array $high, array $low, array $close): array { - return trader_cdltristar($open, $high, $low, $close); + return static::cdltristar($open, $high, $low, $close); } /** @@ -1176,10 +1307,11 @@ public static function candleTristar(array $open, array $high, array $low, array * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleUniqueThreeRiver(array $open, array $high, array $low, array $close): array { - return trader_cdlunique3river($open, $high, $low, $close); + return static::cdlunique3river($open, $high, $low, $close); } /** @@ -1191,10 +1323,11 @@ public static function candleUniqueThreeRiver(array $open, array $high, array $l * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleUpsideGapTwoCrows(array $open, array $high, array $low, array $close): array { - return trader_cdlupsidegap2crows($open, $high, $low, $close); + return static::cdlupsidegap2crows($open, $high, $low, $close); } /** @@ -1206,192 +1339,232 @@ public static function candleUpsideGapTwoCrows(array $open, array $high, array $ * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function candleUpsideDownsideGapThreeMethods(array $open, array $high, array $low, array $close): array { - return trader_cdlxsidegap3methods($open, $high, $low, $close); + return static::cdlxsidegap3methods($open, $high, $low, $close); } /** * Vector Ceil + * * Calculates the next highest integer for each value in real and returns the resulting array. * * @param array $real Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function mathCeiling(array $real): array { - return trader_ceil($real); + return static::ceil($real); } /** * Chande Momentum Oscillator * + * A technical momentum indicator invented by the technical analyst Tushar Chande. + * It is created by calculating the difference between the sum of all recent gains and the sum of all recent losses and then dividing the result by the sum of all price movement over the period. + * This oscillator is similar to other momentum indicators such as the Relative Strength Index and the Stochastic Oscillator because it is range bounded (+100 and -100). + * * @param array $real Array of real values. * @param int $timePeriod Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function chandeMomentumOscillator(array $real, integer $timePeriod): array + public static function chandeMomentumOscillator(array $real, int $timePeriod): array { - return trader_cmo($real, $timePeriod); + return static::cmo($real, $timePeriod); } /** * Pearson's Correlation Coefficient (r) * + * A type of correlation coefficient that represents the relationship between two variables that are measured on the same interval or ratio scale. + * * @param array $real0 Array of real values. * @param array $real1 Array of real values. * @param int|null $timePeriod Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function pearsonCorrelationCoefficient(array $real0, array $real1, integer $timePeriod = null): array + public static function pearsonCorrelationCoefficient(array $real0, array $real1, int $timePeriod = null): array { - return trader_correl($real0, $real1, $timePeriod); + return static::correl($real0, $real1, $timePeriod); } /** * Vector Trigonometric Cos + * * Calculates the cosine for each value in real and returns the resulting array. * * @param array $real Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function mathCosine(array $real): array { - return trader_cos($real); + return static::cos($real); } /** * Vector Trigonometric Cosh + * * Calculates the hyperbolic cosine for each value in real and returns the resulting array. * * @param array $real Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function mathHyperbolicCosine(array $real): array { - return trader_cosh($real); + return static::cosh($real); } /** * Double Exponential Moving Average * + * A technical indicator developed by Patrick Mulloy that first appeared in the February, 1994 Technical Analysis of Stocks & Commodities. + * The DEMA is a calculation based on both a single exponential moving average (EMA) and a double EMA. + * * @param array $real Array of real values. * @param int $timePeriod Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function doubleExponentialMovingAverage(array $real, integer $timePeriod): array + public static function doubleExponentialMovingAverage(array $real, int $timePeriod): array { - return trader_dema($real, $timePeriod); + return static::dema($real, $timePeriod); } /** * Vector Arithmetic Div + * * Divides each value from real0 by the corresponding value from real1 and returns the resulting array. * * @param array $real0 Array of real values. * @param array $real1 Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function mathDivision(array $real0, array $real1): array { - return trader_div($real0, $real1); + return static::div($real0, $real1); } /** * Directional Movement Index * + * The directional movement index (DMI) is an indicator developed by J. Welles Wilder for identifying when a definable trend is present in an instrument. + * That is, the DMI tells whether an instrument is trending or not. + * * @param array $high High price, array of real values. * @param array $low Low price, array of real values. * @param array $close Closing price, array of real values. * @param int|null $timePeriod Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function directionalMovementIndex(array $high, array $low, array $close, integer $timePeriod = null): array + public static function directionalMovementIndex(array $high, array $low, array $close, int $timePeriod = null): array { - return trader_dx($high, $low, $close, $timePeriod); + return static::dx($high, $low, $close, $timePeriod); } /** * Exponential Moving Average * + * An exponential moving average (EMA) is a type of moving average that is similar to a simple moving average, except that more weight is given to the latest data. + * It's also known as the exponentially weighted moving average. + * This type of moving average reacts faster to recent price changes than a simple moving average. + * * @param array $real Array of real values. * @param int $timePeriod Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function exponentialMovingAverage(array $real, integer $timePeriod): array + public static function exponentialMovingAverage(array $real, int $timePeriod): array { - return trader_ema($real, $timePeriod); + return static::ema($real, $timePeriod); } /** * Get error code + * * Get error code of the last operation. * * @return int Returns the error code identified by one of the TRADER_ERR_* constants. + * @throws \Exception */ - public static function errorNumber(): integer + public static function errorNumber(): int { - return trader_errno(); + return static::errno(); } /** * Vector Arithmetic Exp + * * Calculates e raised to the power of each value in real. Returns an array with the calculated data. * * @param array $real Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function mathExponent(array $real): array { - return trader_exp($real); + return static::exp($real); } /** * Vector Floor + * * Calculates the next lowest integer for each value in real and returns the resulting array. * * @param array $real Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function mathFloor(array $real): array { - return trader_floor($real); + return static::floor($real); } /** * Get compatibility mode + * * Get compatibility mode which affects the way calculations are done by all the extension functions. * * @return int Returns the compatibility mode id which can be identified by TRADER_COMPATIBILITY_* series of constants. + * @throws \Exception */ - public static function getCompatibilityMode(): integer + public static function getCompatibilityMode(): int { - return trader_get_compat(); + return static::get_compat(); } /** * Get unstable period + * * Get unstable period factor for a particular function. * * @param int $functionId Function ID the factor to be read for. TRADER_FUNC_UNST_* series of constants should be used. * * @return int Returns the unstable period factor for the corresponding function. + * @throws \Exception */ - public static function getUnstablePeriod(integer $functionId): integer + public static function getUnstablePeriod(int $functionId): int { - return trader_get_unstable_period($functionId); + return static::get_unstable_period($functionId); } /** @@ -1400,10 +1573,11 @@ public static function getUnstablePeriod(integer $functionId): integer * @param array $real Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function hilbertTransformDominantCyclePeriod(array $real): array { - return trader_ht_dcperiod($real); + return static::ht_dcperiod($real); } /** @@ -1412,22 +1586,24 @@ public static function hilbertTransformDominantCyclePeriod(array $real): array * @param array $real Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function hilbertTransformDominantCyclePhase(array $real): array { - return trader_ht_dcphase($real); + return static::ht_dcphase($real); } /** * Hilbert Transform - Phasor Components * - * @param array $real Array of real values. + * @param array $real Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function hilbertTransformPhasorComponents(array $real): array { - return trader_ht_phasor($real); + return static::ht_phasor($real); } /** @@ -1436,10 +1612,11 @@ public static function hilbertTransformPhasorComponents(array $real): array * @param array $real Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function hilbertTransformSineWave(array $real): array { - return trader_ht_sine($real); + return static::ht_sine($real); } /** @@ -1448,10 +1625,11 @@ public static function hilbertTransformSineWave(array $real): array * @param array $real Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function hilbertTransformInstantaneousTrendLine(array $real): array { - return trader_ht_trendline($real); + return static::ht_trendline($real); } /** @@ -1460,23 +1638,30 @@ public static function hilbertTransformInstantaneousTrendLine(array $real): arra * @param array $real Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function hilbertTransformTrendVsCycleMode(array $real): array { - return trader_ht_trendmode($real); + return static::ht_trendmode($real); } /** * Kaufman Adaptive Moving Average * + * Developed by Perry Kaufman, Kaufman's Adaptive Moving Average (KAMA) is a moving average designed to account for market noise or volatility. + * KAMA will closely follow prices when the price swings are relatively small and the noise is low. + * KAMA will adjust when the price swings widen and follow prices from a greater distance. + * This trend-following indicator can be used to identify the overall trend, time turning points and filter price movements. + * * @param array $real Array of real values. * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function kaufmanAdaptiveMovingAverage(array $real, integer $timePeriod = null): array + public static function kaufmanAdaptiveMovingAverage(array $real, int $timePeriod = null): array { - return trader_kama($real, $timePeriod); + return static::kama($real, $timePeriod); } /** @@ -1486,23 +1671,25 @@ public static function kaufmanAdaptiveMovingAverage(array $real, integer $timePe * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function linearRegressionAnlge(array $real, integer $timePeriod = null): array + public static function linearRegressionAngle(array $real, int $timePeriod = null): array { - return trader_linearreg_angle($real, $timePeriod); + return static::linearreg_angle($real, $timePeriod); } /** - * Linear Regression Angle + * Linear Regression Intercept * * @param array $real Array of real values. * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function linearRegressionIntercept(array $real, integer $timePeriod = null): array + public static function linearRegressionIntercept(array $real, int $timePeriod = null): array { - return trader_linearreg_intercept($real, $timePeriod); + return static::linearreg_intercept($real, $timePeriod); } /** @@ -1512,10 +1699,11 @@ public static function linearRegressionIntercept(array $real, integer $timePerio * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function linearRegressionSlope(array $real, integer $timePeriod = null): array + public static function linearRegressionSlope(array $real, int $timePeriod = null): array { - return trader_linearreg_slope($real, $timePeriod); + return static::linearreg_slope($real, $timePeriod); } /** @@ -1525,36 +1713,41 @@ public static function linearRegressionSlope(array $real, integer $timePeriod = * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function linearRegression(array $real, integer $timePeriod = null): array + public static function linearRegression(array $real, int $timePeriod = null): array { - return trader_linearreg($real, $timePeriod); + return static::linearreg($real, $timePeriod); } /** * Vector Log Natural + * * Calculates the natural logarithm for each value in real and returns the resulting array. * * @param array $real Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function mathLogarithmNatural(array $real): array { - return trader_ln($real); + return static::ln($real); } /** * Vector Log10 + * * Calculates the base-10 logarithm for each value in real and returns the resulting array. * * @param array $real Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function mathLogarithmBase10(array $real): array { - return trader_log10($real); + return static::log10($real); } /** @@ -1565,10 +1758,11 @@ public static function mathLogarithmBase10(array $real): array * @param int $mAType Type of Moving Average. TRADER_MA_TYPE_* series of constants should be used. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function movingAverage(array $real, integer $timePeriod = null, integer $mAType = null): array + public static function movingAverage(array $real, int $timePeriod = null, int $mAType = null): array { - return trader_ma($real, $timePeriod, $mAType); + return static::ma($real, $timePeriod, $mAType); } /** @@ -1580,10 +1774,11 @@ public static function movingAverage(array $real, integer $timePeriod = null, in * @param int|null $signalPeriod Smoothing for the signal line (nb of period). Valid range from 1 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function movingAverageConvergenceDivergence(array $real, integer $fastPeriod = null, integer $slowPeriod = null, integer $signalPeriod = null): array + public static function movingAverageConvergenceDivergence(array $real, int $fastPeriod = null, int $slowPeriod = null, int $signalPeriod = null): array { - return trader_macd($real, $fastPeriod, $slowPeriod, $signalPeriod); + return static::macd($real, $fastPeriod, $slowPeriod, $signalPeriod); } /** @@ -1597,10 +1792,11 @@ public static function movingAverageConvergenceDivergence(array $real, integer $ * @param int|null $signalPeriod Smoothing for the signal line (nb of period). Valid range from 1 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function movingAverageConvergenceDivergenceExtended(array $real, integer $fastPeriod = null, integer $fastMAType = null, integer $slowPeriod = null, integer $slowMAType = null, integer $signalPeriod = null): array + public static function movingAverageConvergenceDivergenceExtended(array $real, int $fastPeriod = null, int $fastMAType = null, int $slowPeriod = null, int $slowMAType = null, int $signalPeriod = null): array { - return trader_macdext($real, $fastPeriod, $fastMAType, $slowPeriod, $slowMAType, $signalPeriod); + return static::macdext($real, $fastPeriod, $fastMAType, $slowPeriod, $slowMAType, $signalPeriod); } /** @@ -1610,10 +1806,11 @@ public static function movingAverageConvergenceDivergenceExtended(array $real, i * @param int|null $signalPeriod Smoothing for the signal line (nb of period). Valid range from 1 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function movingAverageConvergenceDivergenceFixed(array $real, integer $signalPeriod = null): array + public static function movingAverageConvergenceDivergenceFixed(array $real, int $signalPeriod = null): array { - return trader_macd($real, $signalPeriod); + return static::macdfix($real, $signalPeriod); } /** @@ -1624,10 +1821,11 @@ public static function movingAverageConvergenceDivergenceFixed(array $real, inte * @param float|null $slowLimit Lower limit use in the adaptive algorithm. Valid range from 0.01 to 0.99. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function mesaAdaptiveMovingAverage(array $real, float $fastLimit = null, float $slowLimit = null): array { - return trader_mama($real, $fastLimit, $slowLimit); + return static::mama($real, $fastLimit, $slowLimit); } /** @@ -1640,10 +1838,11 @@ public static function mesaAdaptiveMovingAverage(array $real, float $fastLimit = * @param int|null $mAType Type of Moving Average. TRADER_MA_TYPE_* series of constants should be used. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function movingAverageVariablePeriod(array $real, array $periods, integer $minPeriod = null, integer $maxPeriod = null, integer $mAType = null): array + public static function movingAverageVariablePeriod(array $real, array $periods, int $minPeriod = null, int $maxPeriod = null, int $mAType = null): array { - return trader_mavp($real, $periods, $minPeriod, $maxPeriod, $mAType); + return static::mavp($real, $periods, $minPeriod, $maxPeriod, $mAType); } /** @@ -1653,10 +1852,11 @@ public static function movingAverageVariablePeriod(array $real, array $periods, * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function mathMax(array $real, integer $timePeriod = null): array + public static function mathMax(array $real, int $timePeriod = null): array { - return trader_max($real, $timePeriod); + return static::max($real, $timePeriod); } /** @@ -1666,10 +1866,11 @@ public static function mathMax(array $real, integer $timePeriod = null): array * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function mathMaxIndex(array $real, integer $timePeriod = null): array + public static function mathMaxIndex(array $real, int $timePeriod = null): array { - return trader_maxindex($real, $timePeriod); + return static::maxindex($real, $timePeriod); } /** @@ -1679,10 +1880,11 @@ public static function mathMaxIndex(array $real, integer $timePeriod = null): ar * @param array $low Low price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function mathMedianPrice(array $high, array $low): array { - return trader_medprice($high, $low); + return static::medprice($high, $low); } /** @@ -1695,10 +1897,11 @@ public static function mathMedianPrice(array $high, array $low): array * @param int $timePeriod Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function moneyFlowIndex(array $high, array $low, array $close, array $volume, integer $timePeriod = null): array + public static function moneyFlowIndex(array $high, array $low, array $close, array $volume, int $timePeriod = null): array { - return trader_mfi($high, $low, $close, $volume, $timePeriod); + return static::mfi($high, $low, $close, $volume, $timePeriod); } /** @@ -1708,10 +1911,11 @@ public static function moneyFlowIndex(array $high, array $low, array $close, arr * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function midpoint(array $real, integer $timePeriod = null): array + public static function middlePoint(array $real, int $timePeriod = null): array { - return trader_midpoint($real, $timePeriod); + return static::midpoint($real, $timePeriod); } /** @@ -1722,10 +1926,11 @@ public static function midpoint(array $real, integer $timePeriod = null): array * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function midpointPrice(array $high, array $low, integer $timePeriod = null) + public static function middlePointPrice(array $high, array $low, int $timePeriod = null): array { - return trader_midprice($high, $low, $timePeriod); + return static::midprice($high, $low, $timePeriod); } /** @@ -1735,10 +1940,11 @@ public static function midpointPrice(array $high, array $low, integer $timePerio * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function mathMin(array $real, integer $timePeriod = null): array + public static function mathMin(array $real, int $timePeriod = null): array { - return trader_min($real, $timePeriod); + return static::min($real, $timePeriod); } /** @@ -1748,10 +1954,11 @@ public static function mathMin(array $real, integer $timePeriod = null): array * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function mathMinIndex(array $real, integer $timePeriod = null): array + public static function mathMinIndex(array $real, int $timePeriod = null): array { - return trader_minindex($real, $timePeriod); + return static::minindex($real, $timePeriod); } /** @@ -1761,10 +1968,11 @@ public static function mathMinIndex(array $real, integer $timePeriod = null): ar * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function mathMinMax(array $real, integer $timePeriod = null): array + public static function mathMinMax(array $real, int $timePeriod = null): array { - return trader_minmax($real, $timePeriod); + return static::minmax($real, $timePeriod); } /** @@ -1774,10 +1982,11 @@ public static function mathMinMax(array $real, integer $timePeriod = null): arra * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function mathMinMaxIndex(array $real, integer $timePeriod = null): array + public static function mathMinMaxIndex(array $real, int $timePeriod = null): array { - return trader_minmaxindex($real, $timePeriod); + return static::minmaxindex($real, $timePeriod); } /** @@ -1789,10 +1998,11 @@ public static function mathMinMaxIndex(array $real, integer $timePeriod = null): * @param int $timePeriod Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function minusDirectionalIndicator(array $high, array $low, array $close, integer $timePeriod = null): array + public static function minusDirectionalIndicator(array $high, array $low, array $close, int $timePeriod = null): array { - return trader_minus_di($high, $low, $close, $timePeriod); + return static::minus_di($high, $low, $close, $timePeriod); } /** @@ -1803,10 +2013,11 @@ public static function minusDirectionalIndicator(array $high, array $low, array * @param int $timePeriod Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function minusDirectionalMovement(array $high, array $low, integer $timePeriod = null): array + public static function minusDirectionalMovement(array $high, array $low, int $timePeriod = null): array { - return trader_minus_dm($high, $low, $timePeriod); + return static::minus_dm($high, $low, $timePeriod); } /** @@ -1816,10 +2027,11 @@ public static function minusDirectionalMovement(array $high, array $low, integer * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function momentum(array $real, integer $timePeriod = null): array + public static function momentum(array $real, int $timePeriod = null): array { - return trader_mom($real, $timePeriod); + return static::mom($real, $timePeriod); } /** @@ -1830,10 +2042,11 @@ public static function momentum(array $real, integer $timePeriod = null): array * @param array $real1 Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function mathMultiply(array $real0, array $real1): array { - return trader_mult($real0, $real1); + return static::mult($real0, $real1); } /** @@ -1845,10 +2058,11 @@ public static function mathMultiply(array $real0, array $real1): array * @param int $timePeriod Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function normalizedAverageTrueRange(array $high, array $low, array $close, integer $timePeriod = null): array + public static function normalizedAverageTrueRange(array $high, array $low, array $close, int $timePeriod = null): array { - return trader_natr($high, $low, $close, $timePeriod); + return static::natr($high, $low, $close, $timePeriod); } /** @@ -1858,10 +2072,11 @@ public static function normalizedAverageTrueRange(array $high, array $low, array * @param array $volume Volume traded, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function onBalanceVolume(array $real, array $volume): array { - return trader_obv($real, $volume); + return static::obv($real, $volume); } /** @@ -1873,10 +2088,11 @@ public static function onBalanceVolume(array $real, array $volume): array * @param int $timePeriod Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function plusDirectionalIndicator(array $high, array $low, array $close, integer $timePeriod = null): array + public static function plusDirectionalIndicator(array $high, array $low, array $close, int $timePeriod = null): array { - return trader_plus_di($high, $low, $close, $timePeriod); + return static::plus_di($high, $low, $close, $timePeriod); } /** @@ -1887,10 +2103,11 @@ public static function plusDirectionalIndicator(array $high, array $low, array $ * @param int $timePeriod Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function plusDirectionalMovement(array $high, array $low, integer $timePeriod = null): array + public static function plusDirectionalMovement(array $high, array $low, int $timePeriod = null): array { - return trader_plus_dm($high, $low, $timePeriod); + return static::plus_dm($high, $low, $timePeriod); } /** @@ -1902,10 +2119,11 @@ public static function plusDirectionalMovement(array $high, array $low, integer * @param int|null $mAType Type of Moving Average. TRADER_MA_TYPE_* series of constants should be used. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function percentagePriceOscillator(array $real, integer $fastPeriod = null, integer $slowPeriod = null, integer $mAType = null): array + public static function percentagePriceOscillator(array $real, int $fastPeriod = null, int $slowPeriod = null, int $mAType = null): array { - return trader_ppo($real, $fastPeriod, $slowPeriod, $mAType); + return static::ppo($real, $fastPeriod, $slowPeriod, $mAType); } /** @@ -1915,10 +2133,11 @@ public static function percentagePriceOscillator(array $real, integer $fastPerio * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function rateOfChange(array $real, integer $timePeriod = null): array + public static function rateOfChange(array $real, int $timePeriod = null): array { - return trader_roc($real, $timePeriod); + return static::roc($real, $timePeriod); } /** @@ -1928,10 +2147,11 @@ public static function rateOfChange(array $real, integer $timePeriod = null): ar * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function rateOfChangePercentage(array $real, integer $timePeriod = null): array + public static function rateOfChangePercentage(array $real, int $timePeriod = null): array { - return trader_rocp($real, $timePeriod); + return static::rocp($real, $timePeriod); } /** @@ -1941,10 +2161,11 @@ public static function rateOfChangePercentage(array $real, integer $timePeriod = * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function rateOfChangeRatio100(array $real, integer $timePeriod = null): array + public static function rateOfChangeRatio100(array $real, int $timePeriod = null): array { - return trader_rocr100($real, $timePeriod); + return static::rocr100($real, $timePeriod); } /** @@ -1954,10 +2175,11 @@ public static function rateOfChangeRatio100(array $real, integer $timePeriod = n * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function rateOfChangeRatio(array $real, integer $timePeriod = null): array + public static function rateOfChangeRatio(array $real, int $timePeriod = null): array { - return trader_rocr($real, $timePeriod); + return static::rocr($real, $timePeriod); } /** @@ -1967,10 +2189,11 @@ public static function rateOfChangeRatio(array $real, integer $timePeriod = null * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function relativeStrengthIndex(array $real, integer $timePeriod = null): array + public static function relativeStrengthIndex(array $real, int $timePeriod = null): array { - return trader_rsi($real, $timePeriod); + return static::rsi($real, $timePeriod); } /** @@ -1982,10 +2205,11 @@ public static function relativeStrengthIndex(array $real, integer $timePeriod = * @param float|null $maximum Acceleration Factor Maximum value. Valid range from 0 to TRADER_REAL_MAX. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function parabolicSAR(array $high, array $low, float $acceleration = null, float $maximum = null): array { - return trader_sar($high, $low, $acceleration, $maximum); + return static::sar($high, $low, $acceleration, $maximum); } /** @@ -2003,10 +2227,11 @@ public static function parabolicSAR(array $high, array $low, float $acceleration * @param float|null $accelerationMaxShort Acceleration Factor maximum value for the Short direction. Valid range from 0 to TRADER_REAL_MAX. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function parabolicSARExtended(array $high, array $low, float $startValue = null, float $offsetOnReverse = null, float $accelerationInitLong = null, float $accelerationLong = null, float $accelerationMaxLong = null, float $accelerationInitShort = null, float $accelerationShort = null, float $accelerationMaxShort = null): array { - return trader_sarext($high, $low, $startValue, $offsetOnReverse, $accelerationInitLong, $accelerationLong, $accelerationMaxLong, $accelerationInitShort, $accelerationShort, $accelerationMaxShort); + return static::sarext($high, $low, $startValue, $offsetOnReverse, $accelerationInitLong, $accelerationLong, $accelerationMaxLong, $accelerationInitShort, $accelerationShort, $accelerationMaxShort); } /** @@ -2014,10 +2239,12 @@ public static function parabolicSARExtended(array $high, array $low, float $star * Set compatibility mode which will affect the way calculations are done by all the extension functions. * * @param int $compatId Compatibility Id. TRADER_COMPATIBILITY_* series of constants should be used. + * + * @throws \Exception */ - public static function setCompatibilityMode(integer $compatId) + public static function setCompatibilityMode(int $compatId) { - return trader_set_compat($compatId); + static::set_compat($compatId); } /** @@ -2026,10 +2253,12 @@ public static function setCompatibilityMode(integer $compatId) * * @param int $functionId Function ID the factor should be set for. TRADER_FUNC_UNST_* constant series can be used to affect the corresponding function. * @param int $timePeriod Unstable period value. + * + * @throws \Exception */ - public static function setUnstablePeriod(integer $functionId, integer $timePeriod) + public static function setUnstablePeriod(int $functionId, int $timePeriod) { - return trader_set_unstable_period($functionId, $timePeriod); + static::set_unstable_period($functionId, $timePeriod); } /** @@ -2039,10 +2268,11 @@ public static function setUnstablePeriod(integer $functionId, integer $timePerio * @param array $real Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function mathSine(array $real): array { - return trader_sin($real); + return static::sin($real); } /** @@ -2052,10 +2282,11 @@ public static function mathSine(array $real): array * @param array $real Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function mathHyperbolicSine(array $real): array { - return trader_sinh($real); + return static::sinh($real); } /** @@ -2065,10 +2296,11 @@ public static function mathHyperbolicSine(array $real): array * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function simpleMovingAverage(array $real, integer $timePeriod = null): array + public static function simpleMovingAverage(array $real, int $timePeriod = null): array { - return trader_sma($real, $timePeriod); + return static::sma($real, $timePeriod); } /** @@ -2078,10 +2310,11 @@ public static function simpleMovingAverage(array $real, integer $timePeriod = nu * @param array $real Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function mathSquareRoot(array $real): array { - return trader_sqrt($real); + return static::sqrt($real); } /** @@ -2092,10 +2325,11 @@ public static function mathSquareRoot(array $real): array * @param float $nbDev * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function standardDeviation(array $real, integer $timePeriod = null, float $nbDev = null): array + public static function standardDeviation(array $real, int $timePeriod = null, float $nbDev = null): array { - return trader_stddev($real, $timePeriod, $nbDev); + return static::stddev($real, $timePeriod, $nbDev); } /** @@ -2111,10 +2345,11 @@ public static function standardDeviation(array $real, integer $timePeriod = null * @param int|null $slowD_MAType Type of Moving Average for Slow-D. TRADER_MA_TYPE_* series of constants should be used. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function stochastic(array $high, array $low, array $close, integer $fastK_Period = null, integer $slowK_Period = null, integer $slowK_MAType = null, integer $slowD_Period = null, integer $slowD_MAType = null): array + public static function stochastic(array $high, array $low, array $close, int $fastK_Period = null, int $slowK_Period = null, int $slowK_MAType = null, int $slowD_Period = null, int $slowD_MAType = null): array { - return trader_stoch($high, $low, $close, $fastK_Period, $slowK_Period, $slowK_MAType, $slowD_Period, $slowD_MAType); + return static::stoch($high, $low, $close, $fastK_Period, $slowK_Period, $slowK_MAType, $slowD_Period, $slowD_MAType); } /** @@ -2128,10 +2363,11 @@ public static function stochastic(array $high, array $low, array $close, integer * @param int|null $fastD_MAType Type of Moving Average for Fast-D. TRADER_MA_TYPE_* series of constants should be used. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function stochasticFast(array $high, array $low, array $close, integer $fastK_Period = null, integer $fastD_Period = null, integer $fastD_MAType = null): array + public static function stochasticFast(array $high, array $low, array $close, int $fastK_Period = null, int $fastD_Period = null, int $fastD_MAType = null): array { - return trader_stochf($high, $low, $close, $fastK_Period, $fastD_Period, $fastD_MAType); + return static::stochf($high, $low, $close, $fastK_Period, $fastD_Period, $fastD_MAType); } /** @@ -2144,10 +2380,11 @@ public static function stochasticFast(array $high, array $low, array $close, int * @param int|null $fastD_MAType Type of Moving Average for Fast-D. TRADER_MA_TYPE_* series of constants should be used. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function stochasticRelativeStrengthIndex(array $real, integer $timePeriod = null, integer $fastK_Period = null, integer $fastD_Period = null, integer $fastD_MAType = null): array + public static function stochasticRelativeStrengthIndex(array $real, int $timePeriod = null, int $fastK_Period = null, int $fastD_Period = null, int $fastD_MAType = null): array { - return trader_stochrsi($real, $timePeriod, $fastK_Period, $fastD_Period, $fastD_MAType); + return static::stochrsi($real, $timePeriod, $fastK_Period, $fastD_Period, $fastD_MAType); } /** @@ -2158,10 +2395,11 @@ public static function stochasticRelativeStrengthIndex(array $real, integer $tim * @param array $real1 Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function mathSubtraction(array $real0, array $real1): array { - return trader_sub($real0, $real1); + return static::sub($real0, $real1); } /** @@ -2171,10 +2409,11 @@ public static function mathSubtraction(array $real0, array $real1): array * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function mathSummation(array $real, integer $timePeriod = null): array + public static function mathSummation(array $real, int $timePeriod = null): array { - return trader_sum($real, $timePeriod); + return static::sum($real, $timePeriod); } /** @@ -2185,10 +2424,11 @@ public static function mathSummation(array $real, integer $timePeriod = null): a * @param float $vFactor Volume Factor. Valid range from 1 to 0. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function tripleExponentialMovingAverageT3(array $real, integer $timePeriod = null, float $vFactor = null): array + public static function tripleExponentialMovingAverageT3(array $real, int $timePeriod = null, float $vFactor = null): array { - return trader_t3($real, $timePeriod, $vFactor); + return static::t3($real, $timePeriod, $vFactor); } /** @@ -2198,10 +2438,11 @@ public static function tripleExponentialMovingAverageT3(array $real, integer $ti * @param array $real Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function mathTangent(array $real): array { - return trader_tan($real); + return static::tan($real); } /** @@ -2211,10 +2452,11 @@ public static function mathTangent(array $real): array * @param array $real Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function mathHyperbolicTangent(array $real): array { - return trader_tanh($real); + return static::tanh($real); } /** @@ -2224,10 +2466,11 @@ public static function mathHyperbolicTangent(array $real): array * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function tripleExponentialMovingAverage(array $real, integer $timePeriod = null): array + public static function tripleExponentialMovingAverage(array $real, int $timePeriod = null): array { - return trader_tema($real, $timePeriod); + return static::tema($real, $timePeriod); } /** @@ -2238,10 +2481,11 @@ public static function tripleExponentialMovingAverage(array $real, integer $time * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function trueRange(array $high, array $low, array $close): array { - return trader_trange($high, $low, $close); + return static::trange($high, $low, $close); } /** @@ -2251,10 +2495,11 @@ public static function trueRange(array $high, array $low, array $close): array * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function triangularMovingAverage(array $real, integer $timePeriod = null): array + public static function triangularMovingAverage(array $real, int $timePeriod = null): array { - return trader_trima($real, $timePeriod); + return static::trima($real, $timePeriod); } /** @@ -2264,10 +2509,11 @@ public static function triangularMovingAverage(array $real, integer $timePeriod * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function tripleExponentialAverage(array $real, integer $timePeriod = null): array + public static function tripleExponentialAverage(array $real, int $timePeriod = null): array { - return trader_trix($real, $timePeriod); + return static::trix($real, $timePeriod); } /** @@ -2277,10 +2523,11 @@ public static function tripleExponentialAverage(array $real, integer $timePeriod * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function timeSeriesForecast(array $real, integer $timePeriod = null): array + public static function timeSeriesForecast(array $real, int $timePeriod = null): array { - return trader_tsf($real, $timePeriod); + return static::tsf($real, $timePeriod); } /** @@ -2291,10 +2538,11 @@ public static function timeSeriesForecast(array $real, integer $timePeriod = nul * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function typicalPrice(array $high, array $low, array $close): array { - return trader_typprice($high, $low, $close); + return static::typprice($high, $low, $close); } /** @@ -2308,10 +2556,11 @@ public static function typicalPrice(array $high, array $low, array $close): arra * @param int|null $timePeriod3 Number of bars for 3rd period. Valid range from 1 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function ultimateOscillator(array $high, array $low, array $close, integer $timePeriod1 = null, integer $timePeriod2 = null, integer $timePeriod3 = null): array + public static function ultimateOscillator(array $high, array $low, array $close, int $timePeriod1 = null, int $timePeriod2 = null, int $timePeriod3 = null): array { - return trader_ultosc($high, $low, $close, $timePeriod1, $timePeriod2, $timePeriod3); + return static::ultosc($high, $low, $close, $timePeriod1, $timePeriod2, $timePeriod3); } /** @@ -2322,10 +2571,11 @@ public static function ultimateOscillator(array $high, array $low, array $close, * @param float $nbDev * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function variance(array $real, integer $timePeriod = null, float $nbDev = null): array + public static function variance(array $real, int $timePeriod = null, float $nbDev = null): array { - return trader_var($real, $timePeriod, $nbDev); + return static::var($real, $timePeriod, $nbDev); } /** @@ -2336,25 +2586,27 @@ public static function variance(array $real, integer $timePeriod = null, float $ * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function weightedClosePrice(array $high, array $low, array $close): array { - return trader_wclprice($high, $low, $close); + return static::wclprice($high, $low, $close); } /** * Williams' %R * - * @param array $high High price, array of real values. - * @param array $low Low price, array of real values. - * @param array $close Closing price, array of real values. + * @param array $high High price, array of real values. + * @param array $low Low price, array of real values. + * @param array $close Closing price, array of real values. * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function williamsR(array $high, array $low, array $close, integer $timePeriod = null): array + public static function williamsR(array $high, array $low, array $close, int $timePeriod = null): array { - return trader_willr($high, $low, $close, $timePeriod); + return static::willr($high, $low, $close, $timePeriod); } /** @@ -2364,11 +2616,11 @@ public static function williamsR(array $high, array $low, array $close, integer * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function weightedMovingAverage(array $real, integer $timePeriod = null): array + public static function weightedMovingAverage(array $real, int $timePeriod = null): array { - return trader_wma($real, $timePeriod); + return static::wma($real, $timePeriod); } - } diff --git a/source/TraderTrait.php b/source/TraderTrait.php index c557c23..d64515f 100644 --- a/source/TraderTrait.php +++ b/source/TraderTrait.php @@ -12,62 +12,97 @@ trait TraderTrait { - static $TRADER_MA_TYPE_SMA = 0; - static $TRADER_MA_TYPE_EMA = 1; - static $TRADER_MA_TYPE_WMA = 2; - static $TRADER_MA_TYPE_DEMA = 3; - static $TRADER_MA_TYPE_TEMA = 4; - static $TRADER_MA_TYPE_TRIMA = 5; - static $TRADER_MA_TYPE_KAMA = 6; - static $TRADER_MA_TYPE_MAMA = 7; - static $TRADER_MA_TYPE_T3 = 8; - static $TRADER_REAL_MIN = -3.0000000000000002E+37; - static $TRADER_REAL_MAX = 3.0000000000000002E+37; - static $TRADER_FUNC_UNST_ADX = 0; - static $TRADER_FUNC_UNST_ADXR = 1; - static $TRADER_FUNC_UNST_ATR = 2; - static $TRADER_FUNC_UNST_CMO = 3; - static $TRADER_FUNC_UNST_DX = 4; - static $TRADER_FUNC_UNST_EMA = 5; - static $TRADER_FUNC_UNST_HT_DCPERIOD = 6; - static $TRADER_FUNC_UNST_HT_DCPHASE = 7; - static $TRADER_FUNC_UNST_HT_PHASOR = 8; - static $TRADER_FUNC_UNST_HT_TRENDLINE = 10; - static $TRADER_FUNC_UNST_HT_TRENDMODE = 11; - static $TRADER_FUNC_UNST_KAMA = 12; - static $TRADER_FUNC_UNST_MAMA = 13; - static $TRADER_FUNC_UNST_MFI = 14; - static $TRADER_FUNC_UNST_MINUS_DI = 15; - static $TRADER_FUNC_UNST_MINUS_DM = 16; - static $TRADER_FUNC_UNST_NATR = 17; - static $TRADER_FUNC_UNST_PLUS_DI = 18; - static $TRADER_FUNC_UNST_PLUS_DM = 19; - static $TRADER_FUNC_UNST_RSI = 20; - static $TRADER_FUNC_UNST_STOCHRSI = 21; - static $TRADER_FUNC_UNST_T3 = 22; - static $TRADER_FUNC_UNST_ALL = 23; - static $TRADER_FUNC_UNST_NONE = -1; - static $TRADER_COMPATIBILITY_DEFAULT = 0; - static $TRADER_COMPATIBILITY_METASTOCK = 1; - static $TRADER_ERR_SUCCESS = 0; - static $TRADER_ERR_LIB_NOT_INITIALIZE = 1; - static $TRADER_ERR_BAD_PARAM = 2; - static $TRADER_ERR_ALLOC_ERR = 3; - static $TRADER_ERR_GROUP_NOT_FOUND = 4; - static $TRADER_ERR_FUNC_NOT_FOUND = 5; - static $TRADER_ERR_INVALID_HANDLE = 6; - static $TRADER_ERR_INVALID_PARAM_HOLDER = 7; - static $TRADER_ERR_INVALID_PARAM_HOLDER_TYPE = 8; - static $TRADER_ERR_INVALID_PARAM_FUNCTION = 9; - static $TRADER_ERR_INPUT_NOT_ALL_INITIALIZE = 10; - static $TRADER_ERR_OUTPUT_NOT_ALL_INITIALIZE = 11; - static $TRADER_ERR_OUT_OF_RANGE_START_INDEX = 12; - static $TRADER_ERR_OUT_OF_RANGE_END_INDEX = 13; - static $TRADER_ERR_INVALID_LIST_TYPE = 14; - static $TRADER_ERR_BAD_OBJECT = 15; - static $TRADER_ERR_NOT_SUPPORTED = 16; - static $TRADER_ERR_INTERNAL_ERROR = 5000; - static $TRADER_ERR_UNKNOWN_ERROR = 65535; + public static $TRADER_MA_TYPE_SMA = 0; + public static $TRADER_MA_TYPE_EMA = 1; + public static $TRADER_MA_TYPE_WMA = 2; + public static $TRADER_MA_TYPE_DEMA = 3; + public static $TRADER_MA_TYPE_TEMA = 4; + public static $TRADER_MA_TYPE_TRIMA = 5; + public static $TRADER_MA_TYPE_KAMA = 6; + public static $TRADER_MA_TYPE_MAMA = 7; + public static $TRADER_MA_TYPE_T3 = 8; + public static $TRADER_REAL_MIN = -3.0000000000000002E+37; + public static $TRADER_REAL_MAX = 3.0000000000000002E+37; + public static $TRADER_FUNC_UNST_ADX = 0; + public static $TRADER_FUNC_UNST_ADXR = 1; + public static $TRADER_FUNC_UNST_ATR = 2; + public static $TRADER_FUNC_UNST_CMO = 3; + public static $TRADER_FUNC_UNST_DX = 4; + public static $TRADER_FUNC_UNST_EMA = 5; + public static $TRADER_FUNC_UNST_HT_DCPERIOD = 6; + public static $TRADER_FUNC_UNST_HT_DCPHASE = 7; + public static $TRADER_FUNC_UNST_HT_PHASOR = 8; + public static $TRADER_FUNC_UNST_HT_TRENDLINE = 10; + public static $TRADER_FUNC_UNST_HT_TRENDMODE = 11; + public static $TRADER_FUNC_UNST_KAMA = 12; + public static $TRADER_FUNC_UNST_MAMA = 13; + public static $TRADER_FUNC_UNST_MFI = 14; + public static $TRADER_FUNC_UNST_MINUS_DI = 15; + public static $TRADER_FUNC_UNST_MINUS_DM = 16; + public static $TRADER_FUNC_UNST_NATR = 17; + public static $TRADER_FUNC_UNST_PLUS_DI = 18; + public static $TRADER_FUNC_UNST_PLUS_DM = 19; + public static $TRADER_FUNC_UNST_RSI = 20; + public static $TRADER_FUNC_UNST_STOCHRSI = 21; + public static $TRADER_FUNC_UNST_T3 = 22; + public static $TRADER_FUNC_UNST_ALL = 23; + public static $TRADER_FUNC_UNST_NONE = -1; + public static $TRADER_COMPATIBILITY_DEFAULT = 0; + public static $TRADER_COMPATIBILITY_METASTOCK = 1; + public static $TRADER_ERR_SUCCESS = 0; + public static $TRADER_ERR_LIB_NOT_INITIALIZE = 1; + public static $TRADER_ERR_BAD_PARAM = 2; + public static $TRADER_ERR_ALLOC_ERR = 3; + public static $TRADER_ERR_GROUP_NOT_FOUND = 4; + public static $TRADER_ERR_FUNC_NOT_FOUND = 5; + public static $TRADER_ERR_INVALID_HANDLE = 6; + public static $TRADER_ERR_INVALID_PARAM_HOLDER = 7; + public static $TRADER_ERR_INVALID_PARAM_HOLDER_TYPE = 8; + public static $TRADER_ERR_INVALID_PARAM_FUNCTION = 9; + public static $TRADER_ERR_INPUT_NOT_ALL_INITIALIZE = 10; + public static $TRADER_ERR_OUTPUT_NOT_ALL_INITIALIZE = 11; + public static $TRADER_ERR_OUT_OF_RANGE_START_INDEX = 12; + public static $TRADER_ERR_OUT_OF_RANGE_END_INDEX = 13; + public static $TRADER_ERR_INVALID_LIST_TYPE = 14; + public static $TRADER_ERR_BAD_OBJECT = 15; + public static $TRADER_ERR_NOT_SUPPORTED = 16; + public static $TRADER_ERR_INTERNAL_ERROR = 5000; + public static $TRADER_ERR_UNKNOWN_ERROR = 65535; + + protected static $errorArray = [ + 1 => "Library not initialized", + 2 => "Bad parameter", + 3 => "Allocation error", + 4 => "Group not found", + 5 => "Function not found", + 6 => "Invalid handle", + 7 => "Invalid parameter holder", + 8 => "Invalid parameter holder type", + 9 => "Invalid parameter function", + 10 => "Input not all initialized", + 11 => "Output not all initialized", + 12 => "Out of range on start index", + 13 => "Out of range on end index", + 14 => "Invalid list type", + 15 => "Bad object", + 16 => "Not supported", + 5000 => "Internal error", + 65535 => "Unknown error", + ]; + + /** + * @throws \Exception + */ + protected static function checkForError() + { + $errorNumber = trader_errno(); + switch ($errorNumber) { + case static::$TRADER_ERR_SUCCESS: + return; + default: + throw new \Exception(static::$errorArray[$errorNumber], $errorNumber); + } + } /** * Calculates the arc cosine for each value in real and returns the resulting array. @@ -75,10 +110,14 @@ trait TraderTrait * @param array $real Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function acos(array $real): array { - return trader_acos($real); + $return = trader_acos($real); + static::checkForError(); + + return $return; } /** @@ -90,10 +129,14 @@ public static function acos(array $real): array * @param array $volume Volume traded, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function ad(array $high, array $low, array $close, array $volume): array { - return trader_ad($high, $low, $close, $volume); + $return = trader_ad($high, $low, $close, $volume); + static::checkForError(); + + return $return; } /** @@ -103,100 +146,137 @@ public static function ad(array $high, array $low, array $close, array $volume): * @param array $real1 Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function add(array $real0, array $real1): array { - return trader_add($real0, $real1); + $return = trader_add($real0, $real1); + static::checkForError(); + + return $return; } /** * Chaikin A/D Oscillator * - * @param array $high High price, array of real values. - * @param array $low Low price, array of real values. - * @param array $close Closing price, array of real values. - * @param array $volume Volume traded, array of real values. - * @param int|null $fastPeriod Number of period for the fast MA. Valid range from 2 to 100000. - * @param int|null $slowPeriod Number of period for the slow MA. Valid range from 2 to 100000. + * @param array $high High price, array of real values. + * @param array $low Low price, array of real values. + * @param array $close Closing price, array of real values. + * @param array $volume Volume traded, array of real values. + * @param int $fastPeriod [OPTIONAL] [DEFAULT 3] Number of period for the fast MA. Valid range from 2 to 100000. + * @param int $slowPeriod [OPTIONAL] [DEFAULT 10] Number of period for the slow MA. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function adosc(array $high, array $low, array $close, array $volume, integer $fastPeriod = null, integer $slowPeriod = null): array + public static function adosc(array $high, array $low, array $close, array $volume, int $fastPeriod = null, int $slowPeriod = null): array { - return trader_adosc($high, $low, $close, $volume, $fastPeriod, $slowPeriod); + $fastPeriod = $fastPeriod ?? 3; + $slowPeriod = $slowPeriod ?? 10; + $return = trader_adosc($high, $low, $close, $volume, $fastPeriod, $slowPeriod); + static::checkForError(); + + return $return; } /** * Average Directional Movement Index * - * @param array $high High price, array of real values. - * @param array $low Low price, array of real values. - * @param array $close Closing price, array of real values. - * @param int|null $timePeriod Number of period. Valid range from 2 to 100000. + * @param array $high High price, array of real values. + * @param array $low Low price, array of real values. + * @param array $close Closing price, array of real values. + * @param int $timePeriod [OPTIONAL] [DEFAULT 14] Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function adx(array $high, array $low, array $close, integer $timePeriod = null): array + public static function adx(array $high, array $low, array $close, int $timePeriod = null): array { - return trader_adx($high, $low, $close, $timePeriod); + $timePeriod = $timePeriod ?? 14; + $return = trader_adx($high, $low, $close, $timePeriod); + static::checkForError(); + + return $return; } /** * Average Directional Movement Index Rating * - * @param array $high High price, array of real values. - * @param array $low Low price, array of real values. - * @param array $close Closing price, array of real values. - * @param int|null $timePeriod Number of period. Valid range from 2 to 100000. + * @param array $high High price, array of real values. + * @param array $low Low price, array of real values. + * @param array $close Closing price, array of real values. + * @param int $timePeriod [OPTIONAL] [DEFAULT 14] Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function adxr(array $high, array $low, array $close, integer $timePeriod = null): array + public static function adxr(array $high, array $low, array $close, int $timePeriod = null): array { - return trader_adxr($high, $low, $close, $timePeriod); + $timePeriod = $timePeriod ?? 14; + $return = trader_adxr($high, $low, $close, $timePeriod); + static::checkForError(); + + return $return; } /** * Absolute Price Oscillator * - * @param array $real Array of real values. - * @param int|null $fastPeriod Number of period for the fast MA. Valid range from 2 to 100000. - * @param int|null $slowPeriod Number of period for the slow MA. Valid range from 2 to 100000. - * @param int|null $mAType Type of Moving Average. TRADER_MA_TYPE_* series of constants should be used. + * @param array $real Array of real values. + * @param int $fastPeriod [OPTIONAL] [DEFAULT 12] Number of period for the fast MA. Valid range from 2 to 100000. + * @param int $slowPeriod [OPTIONAL] [DEFAULT 26] Number of period for the slow MA. Valid range from 2 to 100000. + * @param int $mAType [OPTIONAL] [DEFAULT TRADER_MA_TYPE_SMA] Type of Moving Average. TRADER_MA_TYPE_* series of constants should be used. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function apo(array $real, integer $fastPeriod = null, integer $slowPeriod = null, integer $mAType = null): array + public static function apo(array $real, int $fastPeriod = null, int $slowPeriod = null, int $mAType = null): array { - return trader_apo($real, $fastPeriod, $slowPeriod, $mAType); + $fastPeriod = $fastPeriod ?? 12; + $slowPeriod = $slowPeriod ?? 26; + $mAType = $mAType ?? static::$TRADER_MA_TYPE_SMA; + $return = trader_apo($real, $fastPeriod, $slowPeriod, $mAType); + static::checkForError(); + + return $return; } /** * Aroon * - * @param array $high High price, array of real values. - * @param array $low Low price, array of real values. - * @param int|null $timePeriod Number of period. Valid range from 2 to 100000. + * @param array $high High price, array of real values. + * @param array $low Low price, array of real values. + * @param int $timePeriod [OPTIONAL] [DEFAULT 14] Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function aroon(array $high, array $low, integer $timePeriod = null): array + public static function aroon(array $high, array $low, int $timePeriod = null): array { - return trader_aroon($high, $low, $timePeriod); + $timePeriod = $timePeriod ?? 14; + $return = trader_aroon($high, $low, $timePeriod); + static::checkForError(); + + return $return; } /** * Aroon Oscillator * - * @param array $high High price, array of real values. - * @param array $low Low price, array of real values. - * @param int|null $timePeriod Number of period. Valid range from 2 to 100000. + * @param array $high High price, array of real values. + * @param array $low Low price, array of real values. + * @param int $timePeriod [OPTIONAL] [DEFAULT 14] Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function arronosc(array $high, array $low, integer $timePeriod = null): array + public static function aroonosc(array $high, array $low, int $timePeriod = null): array { - return trader_aroonosc($high, $low, $timePeriod); + $timePeriod = $timePeriod ?? 14; + $return = trader_aroonosc($high, $low, $timePeriod); + static::checkForError(); + + return $return; } /** @@ -206,10 +286,14 @@ public static function arronosc(array $high, array $low, integer $timePeriod = n * @param array $real Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function asin(array $real): array { - return trader_asin($real); + $return = trader_asin($real); + static::checkForError(); + + return $return; } /** @@ -219,25 +303,34 @@ public static function asin(array $real): array * @param array $real Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function atan(array $real): array { - return trader_atan($real); + $return = trader_atan($real); + static::checkForError(); + + return $return; } /** * Average True Range * - * @param array $high High price, array of real values. - * @param array $low Low price, array of real values. - * @param array $close Closing price, array of real values. - * @param int|null $timePeriod Number of period. Valid range from 2 to 100000. + * @param array $high High price, array of real values. + * @param array $low Low price, array of real values. + * @param array $close Closing price, array of real values. + * @param int $timePeriod [OPTIONAL] [DEFAULT 14] Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function atr(array $high, array $low, array $close, integer $timePeriod = null): array + public static function atr(array $high, array $low, array $close, int $timePeriod = null): array { - return trader_atr($high, $low, $close, $timePeriod); + $timePeriod = $timePeriod ?? 14; + $return = trader_atr($high, $low, $close, $timePeriod); + static::checkForError(); + + return $return; } /** @@ -249,40 +342,57 @@ public static function atr(array $high, array $low, array $close, integer $timeP * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function avgprice(array $open, array $high, array $low, array $close): array { - return trader_avgprice($open, $high, $low, $close); + $return = trader_avgprice($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** * Bollinger Bands * - * @param array $real Array of real values. - * @param int|null $timePeriod Number of period. Valid range from 2 to 100000. - * @param float|null $nbDevUp Deviation multiplier for upper band. Valid range from TRADER_REAL_MIN to TRADER_REAL_MAX. - * @param float|null $nbDevDn Deviation multiplier for lower band. Valid range from TRADER_REAL_MIN to TRADER_REAL_MAX. - * @param int|null $mAType Type of Moving Average. TRADER_MA_TYPE_* series of constants should be used. + * @param array $real Array of real values. + * @param int $timePeriod [OPTIONAL] [DEFAULT 5] Number of period. Valid range from 2 to 100000. + * @param float $nbDevUp [OPTIONAL] [DEFAULT 2.0] Deviation multiplier for upper band. Valid range from TRADER_REAL_MIN to TRADER_REAL_MAX. + * @param float $nbDevDn [OPTIONAL] [DEFAULT 2.0] Deviation multiplier for lower band. Valid range from TRADER_REAL_MIN to TRADER_REAL_MAX. + * @param int $mAType [OPTIONAL] [DEFAULT TRADER_MA_TYPE_SMA] Type of Moving Average. TRADER_MA_TYPE_* series of constants should be used. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function bbands(array $real, integer $timePeriod = null, float $nbDevUp = null, float $nbDevDn = null, integer $mAType = null): array + public static function bbands(array $real, int $timePeriod = null, float $nbDevUp = null, float $nbDevDn = null, int $mAType = null): array { - return trader_bbands($real, $timePeriod, $nbDevUp, $nbDevDn, $mAType); + $timePeriod = $timePeriod ?? 5; + $nbDevUp = $nbDevUp ?? 2.0; + $nbDevDn = $nbDevDn ?? 2.0; + $mAType = $mAType ?? static::$TRADER_MA_TYPE_SMA; + $return = trader_bbands($real, $timePeriod, $nbDevUp, $nbDevDn, $mAType); + static::checkForError(); + + return $return; } /** * Beta * - * @param array $real0 Array of real values. - * @param array $real1 Array of real values. - * @param int|null $timePeriod Number of period. Valid range from 2 to 100000. + * @param array $real0 Array of real values. + * @param array $real1 Array of real values. + * @param int $timePeriod [OPTIONAL] [DEFAULT 5] Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function beta(array $real0, array $real1, integer $timePeriod = null): array + public static function beta(array $real0, array $real1, int $timePeriod = null): array { - return trader_beta($real0, $real1, $timePeriod); + $timePeriod = $timePeriod ?? 5; + $return = trader_beta($real0, $real1, $timePeriod); + static::checkForError(); + + return $return; } /** @@ -294,25 +404,34 @@ public static function beta(array $real0, array $real1, integer $timePeriod = nu * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function bop(array $open, array $high, array $low, array $close): array { - return trader_bop($open, $high, $low, $close); + $return = trader_bop($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** * Commodity Channel Index * - * @param array $high High price, array of real values. - * @param array $low Low price, array of real values. - * @param array $close Closing price, array of real values. - * @param int|null $timePeriod Number of period. Valid range from 2 to 100000. + * @param array $high High price, array of real values. + * @param array $low Low price, array of real values. + * @param array $close Closing price, array of real values. + * @param int $timePeriod [OPTIONAL] [DEFAULT 14] Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function cci(array $high, array $low, array $close, integer $timePeriod = null): array + public static function cci(array $high, array $low, array $close, int $timePeriod = null): array { - return trader_cci($high, $low, $close, $timePeriod); + $timePeriod = $timePeriod ?? 14; + $return = trader_cci($high, $low, $close, $timePeriod); + static::checkForError(); + + return $return; } /** @@ -324,10 +443,14 @@ public static function cci(array $high, array $low, array $close, integer $timeP * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdl2crows(array $open, array $high, array $low, array $close): array { - return trader_cdl2crows($open, $high, $low, $close); + $return = trader_cdl2crows($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -339,10 +462,14 @@ public static function cdl2crows(array $open, array $high, array $low, array $cl * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdl3blackcrows(array $open, array $high, array $low, array $close): array { - return trader_cdl3blackcrows($open, $high, $low, $close); + $return = trader_cdl3blackcrows($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -354,10 +481,14 @@ public static function cdl3blackcrows(array $open, array $high, array $low, arra * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdl3inside(array $open, array $high, array $low, array $close): array { - return trader_cdl3inside($open, $high, $low, $close); + $return = trader_cdl3inside($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -369,10 +500,14 @@ public static function cdl3inside(array $open, array $high, array $low, array $c * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdl3linestrike(array $open, array $high, array $low, array $close): array { - return trader_cdl3linestrike($open, $high, $low, $close); + $return = trader_cdl3linestrike($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -384,10 +519,14 @@ public static function cdl3linestrike(array $open, array $high, array $low, arra * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdl3outside(array $open, array $high, array $low, array $close): array { - return trader_cdl3outside($open, $high, $low, $close); + $return = trader_cdl3outside($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -399,10 +538,14 @@ public static function cdl3outside(array $open, array $high, array $low, array $ * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdl3starsinsouth(array $open, array $high, array $low, array $close): array { - return trader_cdl3starsinsouth($open, $high, $low, $close); + $return = trader_cdl3starsinsouth($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -414,10 +557,14 @@ public static function cdl3starsinsouth(array $open, array $high, array $low, ar * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdl3whitesoldiers(array $open, array $high, array $low, array $close): array { - return trader_cdl3whitesoldiers($open, $high, $low, $close); + $return = trader_cdl3whitesoldiers($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -427,13 +574,18 @@ public static function cdl3whitesoldiers(array $open, array $high, array $low, a * @param array $high High price, array of real values. * @param array $low Low price, array of real values. * @param array $close Closing price, array of real values. - * @param float $penetration Percentage of penetration of a candle within another candle. + * @param float $penetration [OPTIONAL] [DEFAULT 0.3] Percentage of penetration of a candle within another candle. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdlabandonedbaby(array $open, array $high, array $low, array $close, float $penetration = null): array { - return trader_cdlabandonedbaby($open, $high, $low, $close, $penetration); + $penetration = $penetration ?? 0.3; + $return = trader_cdlabandonedbaby($open, $high, $low, $close, $penetration); + static::checkForError(); + + return $return; } /** @@ -445,10 +597,14 @@ public static function cdlabandonedbaby(array $open, array $high, array $low, ar * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdladvanceblock(array $open, array $high, array $low, array $close): array { - return trader_cdladvanceblock($open, $high, $low, $close); + $return = trader_cdladvanceblock($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -460,10 +616,14 @@ public static function cdladvanceblock(array $open, array $high, array $low, arr * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdlbelthold(array $open, array $high, array $low, array $close): array { - return trader_cdlbelthold($open, $high, $low, $close); + $return = trader_cdlbelthold($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -475,10 +635,14 @@ public static function cdlbelthold(array $open, array $high, array $low, array $ * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdlbreakaway(array $open, array $high, array $low, array $close): array { - return trader_cdlbreakaway($open, $high, $low, $close); + $return = trader_cdlbreakaway($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -490,10 +654,14 @@ public static function cdlbreakaway(array $open, array $high, array $low, array * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdlclosingmarubozu(array $open, array $high, array $low, array $close): array { - return trader_cdlclosingmarubozu($open, $high, $low, $close); + $return = trader_cdlclosingmarubozu($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -505,10 +673,14 @@ public static function cdlclosingmarubozu(array $open, array $high, array $low, * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdlconcealbabyswall(array $open, array $high, array $low, array $close): array { - return trader_cdlconcealbabyswall($open, $high, $low, $close); + $return = trader_cdlconcealbabyswall($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -520,10 +692,14 @@ public static function cdlconcealbabyswall(array $open, array $high, array $low, * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdlcounterattack(array $open, array $high, array $low, array $close): array { - return trader_cdlcounterattack($open, $high, $low, $close); + $return = trader_cdlcounterattack($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -533,13 +709,18 @@ public static function cdlcounterattack(array $open, array $high, array $low, ar * @param array $high High price, array of real values. * @param array $low Low price, array of real values. * @param array $close Closing price, array of real values. - * @param float $penetration Percentage of penetration of a candle within another candle. + * @param float $penetration [OPTIONAL] [DEFAULT 0.5] Percentage of penetration of a candle within another candle. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdldarkcloudcover(array $open, array $high, array $low, array $close, float $penetration = null): array { - return trader_cdldarkcloudcover($open, $high, $low, $close, $penetration); + $penetration = $penetration ?? 0.5; + $return = trader_cdldarkcloudcover($open, $high, $low, $close, $penetration); + static::checkForError(); + + return $return; } /** @@ -551,10 +732,14 @@ public static function cdldarkcloudcover(array $open, array $high, array $low, a * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdldoji(array $open, array $high, array $low, array $close): array { - return trader_cdldoji($open, $high, $low, $close); + $return = trader_cdldoji($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -566,10 +751,14 @@ public static function cdldoji(array $open, array $high, array $low, array $clos * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdldojistar(array $open, array $high, array $low, array $close): array { - return trader_cdldojistar($open, $high, $low, $close); + $return = trader_cdldojistar($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -581,10 +770,14 @@ public static function cdldojistar(array $open, array $high, array $low, array $ * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdldragonflydoji(array $open, array $high, array $low, array $close): array { - return trader_cdldragonflydoji($open, $high, $low, $close); + $return = trader_cdldragonflydoji($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -596,10 +789,14 @@ public static function cdldragonflydoji(array $open, array $high, array $low, ar * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdlengulfing(array $open, array $high, array $low, array $close): array { - return trader_cdlengulfing($open, $high, $low, $close); + $return = trader_cdlengulfing($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -609,13 +806,18 @@ public static function cdlengulfing(array $open, array $high, array $low, array * @param array $high High price, array of real values. * @param array $low Low price, array of real values. * @param array $close Closing price, array of real values. - * @param float $penetration Percentage of penetration of a candle within another candle. + * @param float $penetration [OPTIONAL] [DEFAULT 0.3] Percentage of penetration of a candle within another candle. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdleveningdojistar(array $open, array $high, array $low, array $close, float $penetration = null): array { - return trader_cdleveningdojistar($open, $high, $low, $close, $penetration); + $penetration = $penetration ?? 0.3; + $return = trader_cdleveningdojistar($open, $high, $low, $close, $penetration); + static::checkForError(); + + return $return; } /** @@ -625,13 +827,18 @@ public static function cdleveningdojistar(array $open, array $high, array $low, * @param array $high High price, array of real values. * @param array $low Low price, array of real values. * @param array $close Closing price, array of real values. - * @param float $penetration Percentage of penetration of a candle within another candle. + * @param float $penetration [OPTIONAL] [DEFAULT 0.3] Percentage of penetration of a candle within another candle. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdleveningstar(array $open, array $high, array $low, array $close, float $penetration = null): array { - return trader_cdleveningstar($open, $high, $low, $close, $penetration); + $penetration = $penetration ?? 0.3; + $return = trader_cdleveningstar($open, $high, $low, $close, $penetration); + static::checkForError(); + + return $return; } /** @@ -643,10 +850,14 @@ public static function cdleveningstar(array $open, array $high, array $low, arra * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdlgapsidesidewhite(array $open, array $high, array $low, array $close): array { - return trader_cdlgapsidesidewhite($open, $high, $low, $close); + $return = trader_cdlgapsidesidewhite($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -658,10 +869,14 @@ public static function cdlgapsidesidewhite(array $open, array $high, array $low, * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdlgravestonedoji(array $open, array $high, array $low, array $close): array { - return trader_cdlgravestonedoji($open, $high, $low, $close); + $return = trader_cdlgravestonedoji($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -673,10 +888,14 @@ public static function cdlgravestonedoji(array $open, array $high, array $low, a * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdlhammer(array $open, array $high, array $low, array $close): array { - return trader_cdlhammer($open, $high, $low, $close); + $return = trader_cdlhammer($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -688,10 +907,14 @@ public static function cdlhammer(array $open, array $high, array $low, array $cl * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdlhangingman(array $open, array $high, array $low, array $close): array { - return trader_cdlhangingman($open, $high, $low, $close); + $return = trader_cdlhangingman($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -703,10 +926,14 @@ public static function cdlhangingman(array $open, array $high, array $low, array * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdlharami(array $open, array $high, array $low, array $close): array { - return trader_cdlharami($open, $high, $low, $close); + $return = trader_cdlharami($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -718,10 +945,14 @@ public static function cdlharami(array $open, array $high, array $low, array $cl * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdlharamicross(array $open, array $high, array $low, array $close): array { - return trader_cdlharamicross($open, $high, $low, $close); + $return = trader_cdlharamicross($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -733,10 +964,14 @@ public static function cdlharamicross(array $open, array $high, array $low, arra * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdlhighwave(array $open, array $high, array $low, array $close): array { - return trader_cdlhighwave($open, $high, $low, $close); + $return = trader_cdlhighwave($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -748,10 +983,14 @@ public static function cdlhighwave(array $open, array $high, array $low, array $ * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdlhikkake(array $open, array $high, array $low, array $close): array { - return trader_cdlhikkake($open, $high, $low, $close); + $return = trader_cdlhikkake($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -763,10 +1002,14 @@ public static function cdlhikkake(array $open, array $high, array $low, array $c * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdlhikkakemod(array $open, array $high, array $low, array $close): array { - return trader_cdlhikkakemod($open, $high, $low, $close); + $return = trader_cdlhikkakemod($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -778,10 +1021,14 @@ public static function cdlhikkakemod(array $open, array $high, array $low, array * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdlhomingpigeon(array $open, array $high, array $low, array $close): array { - return trader_cdlhomingpigeon($open, $high, $low, $close); + $return = trader_cdlhomingpigeon($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -793,10 +1040,14 @@ public static function cdlhomingpigeon(array $open, array $high, array $low, arr * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdlidentical3crows(array $open, array $high, array $low, array $close): array { - return trader_cdlidentical3crows($open, $high, $low, $close); + $return = trader_cdlidentical3crows($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -808,10 +1059,14 @@ public static function cdlidentical3crows(array $open, array $high, array $low, * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdlinneck(array $open, array $high, array $low, array $close): array { - return trader_cdlinneck($open, $high, $low, $close); + $return = trader_cdlinneck($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -823,10 +1078,14 @@ public static function cdlinneck(array $open, array $high, array $low, array $cl * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdlinvertedhammer(array $open, array $high, array $low, array $close): array { - return trader_cdlinvertedhammer($open, $high, $low, $close); + $return = trader_cdlinvertedhammer($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -838,10 +1097,14 @@ public static function cdlinvertedhammer(array $open, array $high, array $low, a * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdlkicking(array $open, array $high, array $low, array $close): array { - return trader_cdlkicking($open, $high, $low, $close); + $return = trader_cdlkicking($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -853,10 +1116,14 @@ public static function cdlkicking(array $open, array $high, array $low, array $c * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdlkickingbylength(array $open, array $high, array $low, array $close): array { - return trader_cdlkickingbylength($open, $high, $low, $close); + $return = trader_cdlkickingbylength($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -868,10 +1135,14 @@ public static function cdlkickingbylength(array $open, array $high, array $low, * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdlladderbottom(array $open, array $high, array $low, array $close): array { - return trader_cdlladderbottom($open, $high, $low, $close); + $return = trader_cdlladderbottom($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -883,10 +1154,14 @@ public static function cdlladderbottom(array $open, array $high, array $low, arr * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdllongleggeddoji(array $open, array $high, array $low, array $close): array { - return trader_cdllongleggeddoji($open, $high, $low, $close); + $return = trader_cdllongleggeddoji($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -898,10 +1173,14 @@ public static function cdllongleggeddoji(array $open, array $high, array $low, a * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdllongline(array $open, array $high, array $low, array $close): array { - return trader_cdllongline($open, $high, $low, $close); + $return = trader_cdllongline($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -913,10 +1192,14 @@ public static function cdllongline(array $open, array $high, array $low, array $ * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdlmarubozu(array $open, array $high, array $low, array $close): array { - return trader_cdlmarubozu($open, $high, $low, $close); + $return = trader_cdlmarubozu($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -928,10 +1211,14 @@ public static function cdlmarubozu(array $open, array $high, array $low, array $ * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdlmatchinglow(array $open, array $high, array $low, array $close): array { - return trader_cdlmatchinglow($open, $high, $low, $close); + $return = trader_cdlmatchinglow($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -941,13 +1228,18 @@ public static function cdlmatchinglow(array $open, array $high, array $low, arra * @param array $high High price, array of real values. * @param array $low Low price, array of real values. * @param array $close Closing price, array of real values. - * @param float $penetration Percentage of penetration of a candle within another candle. + * @param float $penetration [OPTIONAL] [DEFAULT 0.5] Percentage of penetration of a candle within another candle. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdlmathold(array $open, array $high, array $low, array $close, float $penetration = null): array { - return trader_cdlmathold($open, $high, $low, $close, $penetration); + $penetration = $penetration ?? 0.5; + $return = trader_cdlmathold($open, $high, $low, $close, $penetration); + static::checkForError(); + + return $return; } /** @@ -957,13 +1249,18 @@ public static function cdlmathold(array $open, array $high, array $low, array $c * @param array $high High price, array of real values. * @param array $low Low price, array of real values. * @param array $close Closing price, array of real values. - * @param float $penetration Percentage of penetration of a candle within another candle. + * @param float $penetration [OPTIONAL] [DEFAULT 0.3] Percentage of penetration of a candle within another candle. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdlmorningdojistar(array $open, array $high, array $low, array $close, float $penetration = null): array { - return trader_cdlmorningdojistar($open, $high, $low, $close, $penetration); + $penetration = $penetration ?? 0.3; + $return = trader_cdlmorningdojistar($open, $high, $low, $close, $penetration); + static::checkForError(); + + return $return; } /** @@ -973,13 +1270,18 @@ public static function cdlmorningdojistar(array $open, array $high, array $low, * @param array $high High price, array of real values. * @param array $low Low price, array of real values. * @param array $close Closing price, array of real values. - * @param float $penetration Percentage of penetration of a candle within another candle. + * @param float $penetration [OPTIONAL] [DEFAULT 0.3] Percentage of penetration of a candle within another candle. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdlmorningstar(array $open, array $high, array $low, array $close, float $penetration = null): array { - return trader_cdlmorningstar($open, $high, $low, $close, $penetration); + $penetration = $penetration ?? 0.3; + $return = trader_cdlmorningstar($open, $high, $low, $close, $penetration); + static::checkForError(); + + return $return; } /** @@ -991,10 +1293,14 @@ public static function cdlmorningstar(array $open, array $high, array $low, arra * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdlonneck(array $open, array $high, array $low, array $close): array { - return trader_cdlonneck($open, $high, $low, $close); + $return = trader_cdlonneck($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -1006,10 +1312,14 @@ public static function cdlonneck(array $open, array $high, array $low, array $cl * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdlpiercing(array $open, array $high, array $low, array $close): array { - return trader_cdlpiercing($open, $high, $low, $close); + $return = trader_cdlpiercing($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -1021,10 +1331,14 @@ public static function cdlpiercing(array $open, array $high, array $low, array $ * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdlrickshawman(array $open, array $high, array $low, array $close): array { - return trader_cdlrickshawman($open, $high, $low, $close); + $return = trader_cdlrickshawman($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -1036,10 +1350,14 @@ public static function cdlrickshawman(array $open, array $high, array $low, arra * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdlrisefall3methods(array $open, array $high, array $low, array $close): array { - return trader_cdlrisefall3methods($open, $high, $low, $close); + $return = trader_cdlrisefall3methods($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -1051,10 +1369,14 @@ public static function cdlrisefall3methods(array $open, array $high, array $low, * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdlseparatinglines(array $open, array $high, array $low, array $close): array { - return trader_cdlseparatinglines($open, $high, $low, $close); + $return = trader_cdlseparatinglines($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -1066,10 +1388,14 @@ public static function cdlseparatinglines(array $open, array $high, array $low, * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdlshootingstar(array $open, array $high, array $low, array $close): array { - return trader_cdlshootingstar($open, $high, $low, $close); + $return = trader_cdlshootingstar($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -1081,10 +1407,14 @@ public static function cdlshootingstar(array $open, array $high, array $low, arr * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdlshortline(array $open, array $high, array $low, array $close): array { - return trader_cdlshortline($open, $high, $low, $close); + $return = trader_cdlshortline($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -1096,10 +1426,14 @@ public static function cdlshortline(array $open, array $high, array $low, array * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdlspinningtop(array $open, array $high, array $low, array $close): array { - return trader_cdlspinningtop($open, $high, $low, $close); + $return = trader_cdlspinningtop($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -1111,10 +1445,14 @@ public static function cdlspinningtop(array $open, array $high, array $low, arra * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdlstalledpattern(array $open, array $high, array $low, array $close): array { - return trader_cdlstalledpattern($open, $high, $low, $close); + $return = trader_cdlstalledpattern($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -1126,10 +1464,14 @@ public static function cdlstalledpattern(array $open, array $high, array $low, a * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdlsticksandwich(array $open, array $high, array $low, array $close): array { - return trader_cdlsticksandwich($open, $high, $low, $close); + $return = trader_cdlsticksandwich($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -1141,10 +1483,14 @@ public static function cdlsticksandwich(array $open, array $high, array $low, ar * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdltakuri(array $open, array $high, array $low, array $close): array { - return trader_cdltakuri($open, $high, $low, $close); + $return = trader_cdltakuri($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -1156,10 +1502,14 @@ public static function cdltakuri(array $open, array $high, array $low, array $cl * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdltasukigap(array $open, array $high, array $low, array $close): array { - return trader_cdltasukigap($open, $high, $low, $close); + $return = trader_cdltasukigap($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -1171,10 +1521,14 @@ public static function cdltasukigap(array $open, array $high, array $low, array * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdlthrusting(array $open, array $high, array $low, array $close): array { - return trader_cdlthrusting($open, $high, $low, $close); + $return = trader_cdlthrusting($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -1186,10 +1540,14 @@ public static function cdlthrusting(array $open, array $high, array $low, array * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdltristar(array $open, array $high, array $low, array $close): array { - return trader_cdltristar($open, $high, $low, $close); + $return = trader_cdltristar($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -1201,10 +1559,14 @@ public static function cdltristar(array $open, array $high, array $low, array $c * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdlunique3river(array $open, array $high, array $low, array $close): array { - return trader_cdlunique3river($open, $high, $low, $close); + $return = trader_cdlunique3river($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -1216,10 +1578,14 @@ public static function cdlunique3river(array $open, array $high, array $low, arr * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdlupsidegap2crows(array $open, array $high, array $low, array $close): array { - return trader_cdlupsidegap2crows($open, $high, $low, $close); + $return = trader_cdlupsidegap2crows($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -1231,10 +1597,14 @@ public static function cdlupsidegap2crows(array $open, array $high, array $low, * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cdlxsidegap3methods(array $open, array $high, array $low, array $close): array { - return trader_cdlxsidegap3methods($open, $high, $low, $close); + $return = trader_cdlxsidegap3methods($open, $high, $low, $close); + static::checkForError(); + + return $return; } /** @@ -1244,37 +1614,51 @@ public static function cdlxsidegap3methods(array $open, array $high, array $low, * @param array $real Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function ceil(array $real): array { - return trader_ceil($real); + $return = trader_ceil($real); + static::checkForError(); + + return $return; } /** * Chande Momentum Oscillator * * @param array $real Array of real values. - * @param int $timePeriod Number of period. Valid range from 2 to 100000. + * @param int $timePeriod [OPTIONAL] [DEFAULT 14] Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function cmo(array $real, integer $timePeriod): array + public static function cmo(array $real, int $timePeriod = null): array { - return trader_cmo($real, $timePeriod); + $timePeriod = $timePeriod ?? 14; + $return = trader_cmo($real, $timePeriod); + static::checkForError(); + + return $return; } /** * Pearson's Correlation Coefficient (r) * - * @param array $real0 Array of real values. - * @param array $real1 Array of real values. - * @param int|null $timePeriod Number of period. Valid range from 2 to 100000. + * @param array $real0 Array of real values. + * @param array $real1 Array of real values. + * @param int $timePeriod [OPTIONAL] [DEFAULT 30] Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function correl(array $real0, array $real1, integer $timePeriod = null): array + public static function correl(array $real0, array $real1, int $timePeriod = null): array { - return trader_correl($real0, $real1, $timePeriod); + $timePeriod = $timePeriod ?? 30; + $return = trader_correl($real0, $real1, $timePeriod); + static::checkForError(); + + return $return; } /** @@ -1284,10 +1668,14 @@ public static function correl(array $real0, array $real1, integer $timePeriod = * @param array $real Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cos(array $real): array { - return trader_cos($real); + $return = trader_cos($real); + static::checkForError(); + + return $return; } /** @@ -1297,23 +1685,32 @@ public static function cos(array $real): array * @param array $real Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function cosh(array $real): array { - return trader_cosh($real); + $return = trader_cosh($real); + static::checkForError(); + + return $return; } /** * Double Exponential Moving Average * * @param array $real Array of real values. - * @param int $timePeriod Number of period. Valid range from 2 to 100000. + * @param int $timePeriod [OPTIONAL] [DEFAULT 3.] Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function dema(array $real, integer $timePeriod): array + public static function dema(array $real, int $timePeriod = null): array { - return trader_dema($real, $timePeriod); + $timePeriod = $timePeriod ?? 30; + $return = trader_dema($real, $timePeriod); + static::checkForError(); + + return $return; } /** @@ -1324,38 +1721,52 @@ public static function dema(array $real, integer $timePeriod): array * @param array $real1 Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function div(array $real0, array $real1): array { - return trader_div($real0, $real1); + $return = trader_div($real0, $real1); + static::checkForError(); + + return $return; } /** * Directional Movement Index * - * @param array $high High price, array of real values. - * @param array $low Low price, array of real values. - * @param array $close Closing price, array of real values. - * @param int|null $timePeriod Number of period. Valid range from 2 to 100000. + * @param array $high High price, array of real values. + * @param array $low Low price, array of real values. + * @param array $close Closing price, array of real values. + * @param int $timePeriod [OPTIONAL] [DEFAULT 14] Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function dx(array $high, array $low, array $close, integer $timePeriod = null): array + public static function dx(array $high, array $low, array $close, int $timePeriod = null): array { - return trader_dx($high, $low, $close, $timePeriod); + $timePeriod = $timePeriod ?? 14; + $return = trader_dx($high, $low, $close, $timePeriod); + static::checkForError(); + + return $return; } /** * Exponential Moving Average * * @param array $real Array of real values. - * @param int $timePeriod Number of period. Valid range from 2 to 100000. + * @param int $timePeriod [OPTIONAL] [DEFAULT 30] Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function ema(array $real, integer $timePeriod): array + public static function ema(array $real, int $timePeriod = null): array { - return trader_ema($real, $timePeriod); + $timePeriod = $timePeriod ?? 30; + $return = trader_ema($real, $timePeriod); + static::checkForError(); + + return $return; } /** @@ -1363,10 +1774,14 @@ public static function ema(array $real, integer $timePeriod): array * Get error code of the last operation. * * @return int Returns the error code identified by one of the TRADER_ERR_* constants. + * @throws \Exception */ - public static function errno(): integer + public static function errno(): int { - return trader_errno(); + $return = trader_errno(); + static::checkForError(); + + return $return; } /** @@ -1376,10 +1791,14 @@ public static function errno(): integer * @param array $real Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function exp(array $real): array { - return trader_exp($real); + $return = trader_exp($real); + static::checkForError(); + + return $return; } /** @@ -1389,10 +1808,14 @@ public static function exp(array $real): array * @param array $real Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function floor(array $real): array { - return trader_floor($real); + $return = trader_floor($real); + static::checkForError(); + + return $return; } /** @@ -1400,10 +1823,14 @@ public static function floor(array $real): array * Get compatibility mode which affects the way calculations are done by all the extension functions. * * @return int Returns the compatibility mode id which can be identified by TRADER_COMPATIBILITY_* series of constants. + * @throws \Exception */ - public static function get_compat(): integer + public static function get_compat(): int { - return trader_get_compat(); + $return = trader_get_compat(); + static::checkForError(); + + return $return; } /** @@ -1413,10 +1840,14 @@ public static function get_compat(): integer * @param int $functionId Function ID the factor to be read for. TRADER_FUNC_UNST_* series of constants should be used. * * @return int Returns the unstable period factor for the corresponding function. + * @throws \Exception */ - public static function get_unstable_period(integer $functionId): integer + public static function get_unstable_period(int $functionId): int { - return trader_get_unstable_period($functionId); + $return = trader_get_unstable_period($functionId); + static::checkForError(); + + return $return; } /** @@ -1425,10 +1856,14 @@ public static function get_unstable_period(integer $functionId): integer * @param array $real Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function ht_dcperiod(array $real): array { - return trader_ht_dcperiod($real); + $return = trader_ht_dcperiod($real); + static::checkForError(); + + return $return; } /** @@ -1437,22 +1872,30 @@ public static function ht_dcperiod(array $real): array * @param array $real Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function ht_dcphase(array $real): array { - return trader_ht_dcphase($real); + $return = trader_ht_dcphase($real); + static::checkForError(); + + return $return; } /** * Hilbert Transform - Phasor Components * - * @param array $real Array of real values. + * @param array $real Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function ht_phasor(array $real): array { - return trader_ht_phasor($real); + $return = trader_ht_phasor($real); + static::checkForError(); + + return $return; } /** @@ -1461,10 +1904,14 @@ public static function ht_phasor(array $real): array * @param array $real Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function ht_sine(array $real): array { - return trader_ht_sine($real); + $return = trader_ht_sine($real); + static::checkForError(); + + return $return; } /** @@ -1473,10 +1920,14 @@ public static function ht_sine(array $real): array * @param array $real Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function ht_trendline(array $real): array { - return trader_ht_trendline($real); + $return = trader_ht_trendline($real); + static::checkForError(); + + return $return; } /** @@ -1485,75 +1936,104 @@ public static function ht_trendline(array $real): array * @param array $real Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function ht_trendmode(array $real): array { - return trader_ht_trendmode($real); + $return = trader_ht_trendmode($real); + static::checkForError(); + + return $return; } /** * Kaufman Adaptive Moving Average * - * @param array $real Array of real values. - * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. + * @param array $real Array of real values. + * @param int $timePeriod [OPTIONAL] [DEFAULT 30] Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function kama(array $real, integer $timePeriod = null): array + public static function kama(array $real, int $timePeriod = null): array { - return trader_kama($real, $timePeriod); + $timePeriod = $timePeriod ?? 30; + $return = trader_kama($real, $timePeriod); + static::checkForError(); + + return $return; } /** * Linear Regression Angle * - * @param array $real Array of real values. - * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. + * @param array $real Array of real values. + * @param int $timePeriod [OPTIONAL] [DEFAULT 14] Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function linearreg_angle(array $real, integer $timePeriod = null): array + public static function linearreg_angle(array $real, int $timePeriod = null): array { - return trader_linearreg_angle($real, $timePeriod); + $timePeriod = $timePeriod ?? 14; + $return = trader_linearreg_angle($real, $timePeriod); + static::checkForError(); + + return $return; } /** * Linear Regression Angle * - * @param array $real Array of real values. - * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. + * @param array $real Array of real values. + * @param int $timePeriod [OPTIONAL] [DEFAULT 14] Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function linearreg_intercept(array $real, integer $timePeriod = null): array + public static function linearreg_intercept(array $real, int $timePeriod = null): array { - return trader_linearreg_intercept($real, $timePeriod); + $timePeriod = $timePeriod ?? 14; + $return = trader_linearreg_intercept($real, $timePeriod); + static::checkForError(); + + return $return; } /** * Linear Regression Slope * - * @param array $real Array of real values. - * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. + * @param array $real Array of real values. + * @param int $timePeriod [OPTIONAL] [DEFAULT 14] Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function linearreg_slope(array $real, integer $timePeriod = null): array + public static function linearreg_slope(array $real, int $timePeriod = null): array { - return trader_linearreg_slope($real, $timePeriod); + $timePeriod = $timePeriod ?? 14; + $return = trader_linearreg_slope($real, $timePeriod); + static::checkForError(); + + return $return; } /** * Linear Regression * - * @param array $real Array of real values. - * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. + * @param array $real Array of real values. + * @param int $timePeriod [OPTIONAL] [DEFAULT 14] Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function linearreg(array $real, integer $timePeriod = null): array + public static function linearreg(array $real, int $timePeriod = null): array { - return trader_linearreg($real, $timePeriod); + $timePeriod = $timePeriod ?? 14; + $return = trader_linearreg($real, $timePeriod); + static::checkForError(); + + return $return; } /** @@ -1563,10 +2043,14 @@ public static function linearreg(array $real, integer $timePeriod = null): array * @param array $real Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function ln(array $real): array { - return trader_ln($real); + $return = trader_ln($real); + static::checkForError(); + + return $return; } /** @@ -1576,125 +2060,179 @@ public static function ln(array $real): array * @param array $real Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function log10(array $real): array { - return trader_log10($real); + $return = trader_log10($real); + static::checkForError(); + + return $return; } /** * Moving average * - * @param array $real Array of real values. - * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. - * @param int $mAType Type of Moving Average. TRADER_MA_TYPE_* series of constants should be used. + * @param array $real Array of real values. + * @param int $timePeriod [OPTIONAL] [DEFAULT 30] Number of period. Valid range from 2 to 100000. + * @param int $mAType [OPTIONAL] [DEFAULT TRADER_MA_TYPE_SMA] Type of Moving Average. TRADER_MA_TYPE_* series of constants should be used. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function ma(array $real, integer $timePeriod = null, integer $mAType = null): array + public static function ma(array $real, int $timePeriod = null, int $mAType = null): array { - return trader_ma($real, $timePeriod, $mAType); + $timePeriod = $timePeriod ?? 30; + $mAType = $mAType ?? static::$TRADER_MA_TYPE_SMA; + $return = trader_ma($real, $timePeriod, $mAType); + static::checkForError(); + + return $return; } /** * Moving Average Convergence/Divergence * - * @param array $real Array of real values. - * @param int|null $fastPeriod Number of period for the fast MA. Valid range from 2 to 100000. - * @param int|null $slowPeriod Number of period for the slow MA. Valid range from 2 to 100000. - * @param int|null $signalPeriod Smoothing for the signal line (nb of period). Valid range from 1 to 100000. + * @param array $real Array of real values. + * @param int $fastPeriod [OPTIONAL] [DEFAULT 12] Number of period for the fast MA. Valid range from 2 to 100000. + * @param int $slowPeriod [OPTIONAL] [DEFAULT 26] Number of period for the slow MA. Valid range from 2 to 100000. + * @param int $signalPeriod [OPTIONAL] [DEFAULT 9] Smoothing for the signal line (nb of period). Valid range from 1 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function macd(array $real, integer $fastPeriod = null, integer $slowPeriod = null, integer $signalPeriod = null): array + public static function macd(array $real, int $fastPeriod = null, int $slowPeriod = null, int $signalPeriod = null): array { - return trader_macd($real, $fastPeriod, $slowPeriod, $signalPeriod); + $fastPeriod = $fastPeriod ?? 12; + $slowPeriod = $slowPeriod ?? 26; + $signalPeriod = $signalPeriod ?? 9; + $return = trader_macd($real, $fastPeriod, $slowPeriod, $signalPeriod); + static::checkForError(); + + return $return; } /** * Moving Average Convergence/Divergence with controllable Moving Average type * - * @param array $real Array of real values. - * @param int|null $fastPeriod Number of period for the fast MA. Valid range from 2 to 100000. - * @param int|null $fastMAType Type of Moving Average for fast MA. TRADER_MA_TYPE_* series of constants should be used. - * @param int|null $slowPeriod Number of period for the slow MA. Valid range from 2 to 100000. - * @param int|null $slowMAType Type of Moving Average for fast MA. TRADER_MA_TYPE_* series of constants should be used. - * @param int|null $signalPeriod Smoothing for the signal line (nb of period). Valid range from 1 to 100000. + * @param array $real Array of real values. + * @param int $fastPeriod [OPTIONAL] [DEFAULT 12] Number of period for the fast MA. Valid range from 2 to 100000. + * @param int $fastMAType [OPTIONAL] [DEFAULT TRADER_MA_TYPE_SMA] Type of Moving Average for fast MA. TRADER_MA_TYPE_* series of constants should be used. + * @param int $slowPeriod [OPTIONAL] [DEFAULT 26] Number of period for the slow MA. Valid range from 2 to 100000. + * @param int $slowMAType [OPTIONAL] [DEFAULT TRADER_MA_TYPE_SMA] Type of Moving Average for fast MA. TRADER_MA_TYPE_* series of constants should be used. + * @param int $signalPeriod [OPTIONAL] [DEFAULT 9] Smoothing for the signal line (nb of period). Valid range from 1 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function macdext(array $real, integer $fastPeriod = null, integer $fastMAType = null, integer $slowPeriod = null, integer $slowMAType = null, integer $signalPeriod = null): array + public static function macdext(array $real, int $fastPeriod = null, int $fastMAType = null, int $slowPeriod = null, int $slowMAType = null, int $signalPeriod = null): array { - return trader_macdext($real, $fastPeriod, $fastMAType, $slowPeriod, $slowMAType, $signalPeriod); + $fastPeriod = $fastPeriod ?? 12; + $fastMAType = $fastMAType ?? static::$TRADER_MA_TYPE_SMA; + $slowPeriod = $slowPeriod ?? 26; + $slowMAType = $slowMAType ?? static::$TRADER_MA_TYPE_SMA; + $signalPeriod = $signalPeriod ?? 9; + $return = trader_macdext($real, $fastPeriod, $fastMAType, $slowPeriod, $slowMAType, $signalPeriod); + static::checkForError(); + + return $return; } /** * Moving Average Convergence/Divergence Fix 12/26 * - * @param array $real Array of real values. - * @param int|null $signalPeriod Smoothing for the signal line (nb of period). Valid range from 1 to 100000. + * @param array $real Array of real values. + * @param int $signalPeriod [OPTIONAL] [DEFAULT 9] Smoothing for the signal line (nb of period). Valid range from 1 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function macdfix(array $real, integer $signalPeriod = null): array + public static function macdfix(array $real, int $signalPeriod = null): array { - return trader_macd($real, $signalPeriod); + $signalPeriod = $signalPeriod ?? 9; + $return = trader_macdfix($real, $signalPeriod); + static::checkForError(); + + return $return; } /** * MESA Adaptive Moving Average * - * @param array $real Array of real values. - * @param float|null $fastLimit Upper limit use in the adaptive algorithm. Valid range from 0.01 to 0.99. - * @param float|null $slowLimit Lower limit use in the adaptive algorithm. Valid range from 0.01 to 0.99. + * @param array $real Array of real values. + * @param float $fastLimit [OPTIONAL] [DEFAULT 0.5] Upper limit use in the adaptive algorithm. Valid range from 0.01 to 0.99. + * @param float $slowLimit [OPTIONAL] [DEFAULT 0.05] Lower limit use in the adaptive algorithm. Valid range from 0.01 to 0.99. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function mama(array $real, float $fastLimit = null, float $slowLimit = null): array { - return trader_mama($real, $fastLimit, $slowLimit); + $fastLimit = $fastLimit ?? 0.5; + $slowLimit = $slowLimit ?? 0.05; + $return = trader_mama($real, $fastLimit, $slowLimit); + static::checkForError(); + + return $return; } /** * Moving average with variable period * - * @param array $real Array of real values. - * @param array $periods Array of real values. - * @param int|null $minPeriod Value less than minimum will be changed to Minimum period. Valid range from 2 to 100000 - * @param int|null $maxPeriod Value higher than maximum will be changed to Maximum period. Valid range from 2 to 100000 - * @param int|null $mAType Type of Moving Average. TRADER_MA_TYPE_* series of constants should be used. + * @param array $real Array of real values. + * @param array $periods Array of real values. + * @param int $minPeriod [OPTIONAL] [DEFAULT 2] Value less than minimum will be changed to Minimum period. Valid range from 2 to 100000 + * @param int $maxPeriod [OPTIONAL] [DEFAULT 30] Value higher than maximum will be changed to Maximum period. Valid range from 2 to 100000 + * @param int $mAType [OPTIONAL] [DEFAULT TRADER_MA_TYPE_SMA] Type of Moving Average. TRADER_MA_TYPE_* series of constants should be used. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function mavp(array $real, array $periods, integer $minPeriod = null, integer $maxPeriod = null, integer $mAType = null): array + public static function mavp(array $real, array $periods, int $minPeriod = null, int $maxPeriod = null, int $mAType = null): array { - return trader_mavp($real, $periods, $minPeriod, $maxPeriod, $mAType); + $minPeriod = $minPeriod ?? 2; + $maxPeriod = $maxPeriod ?? 30; + $mAType = $mAType ?? static::$TRADER_MA_TYPE_SMA; + $return = trader_mavp($real, $periods, $minPeriod, $maxPeriod, $mAType); + static::checkForError(); + + return $return; } /** * Highest value over a specified period * - * @param array $real Array of real values. - * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. + * @param array $real Array of real values. + * @param int $timePeriod [OPTIONAL] [DEFAULT 30] Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function max(array $real, integer $timePeriod = null): array + public static function max(array $real, int $timePeriod = null): array { - return trader_max($real, $timePeriod); + $timePeriod = $timePeriod ?? 30; + $return = trader_max($real, $timePeriod); + static::checkForError(); + + return $return; } /** * Index of highest value over a specified period * - * @param array $real Array of real values. - * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. + * @param array $real Array of real values. + * @param int $timePeriod [OPTIONAL] [DEFAULT 30] Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function maxindex(array $real, integer $timePeriod = null): array + public static function maxindex(array $real, int $timePeriod = null): array { - return trader_maxindex($real, $timePeriod); + $timePeriod = $timePeriod ?? 30; + $return = trader_maxindex($real, $timePeriod); + static::checkForError(); + + return $return; } /** @@ -1704,10 +2242,14 @@ public static function maxindex(array $real, integer $timePeriod = null): array * @param array $low Low price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function medprice(array $high, array $low): array { - return trader_medprice($high, $low); + $return = trader_medprice($high, $low); + static::checkForError(); + + return $return; } /** @@ -1717,92 +2259,127 @@ public static function medprice(array $high, array $low): array * @param array $low Low price, array of real values. * @param array $close Closing price, array of real values. * @param array $volume Volume traded, array of real values. - * @param int $timePeriod Number of period. Valid range from 2 to 100000. + * @param int $timePeriod [OPTIONAL] [DEFAULT 14] Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function mfi(array $high, array $low, array $close, array $volume, integer $timePeriod = null): array + public static function mfi(array $high, array $low, array $close, array $volume, int $timePeriod = null): array { - return trader_mfi($high, $low, $close, $volume, $timePeriod); + $timePeriod = $timePeriod ?? 14; + $return = trader_mfi($high, $low, $close, $volume, $timePeriod); + static::checkForError(); + + return $return; } /** * MidPoint over period * - * @param array $real Array of real values. - * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. + * @param array $real Array of real values. + * @param int $timePeriod [OPTIONAL] [DEFAULT 14] Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function midpoint(array $real, integer $timePeriod = null): array + public static function midpoint(array $real, int $timePeriod = null): array { - return trader_midpoint($real, $timePeriod); + $timePeriod = $timePeriod ?? 14; + $return = trader_midpoint($real, $timePeriod); + static::checkForError(); + + return $return; } /** * Midpoint Price over period * - * @param array $high High price, array of real values. - * @param array $low Low price, array of real values. - * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. + * @param array $high High price, array of real values. + * @param array $low Low price, array of real values. + * @param int $timePeriod [OPTIONAL] [DEFAULT 14] Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function midprice(array $high, array $low, integer $timePeriod = null) + public static function midprice(array $high, array $low, int $timePeriod = null): array { - return trader_midprice($high, $low, $timePeriod); + $timePeriod = $timePeriod ?? 14; + $return = trader_midprice($high, $low, $timePeriod); + static::checkForError(); + + return $return; } /** * Lowest value over a specified period * - * @param array $real Array of real values. - * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. + * @param array $real Array of real values. + * @param int $timePeriod [OPTIONAL] [DEFAULT 30] Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function min(array $real, integer $timePeriod = null): array + public static function min(array $real, int $timePeriod = null): array { - return trader_min($real, $timePeriod); + $timePeriod = $timePeriod ?? 30; + $return = trader_min($real, $timePeriod); + static::checkForError(); + + return $return; } /** * Index of lowest value over a specified period * - * @param array $real Array of real values. - * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. + * @param array $real Array of real values. + * @param int $timePeriod [OPTIONAL] [DEFAULT 30] Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function minindex(array $real, integer $timePeriod = null): array + public static function minindex(array $real, int $timePeriod = null): array { - return trader_minindex($real, $timePeriod); + $timePeriod = $timePeriod ?? 30; + $return = trader_minindex($real, $timePeriod); + static::checkForError(); + + return $return; } /** * Lowest and highest values over a specified period * - * @param array $real Array of real values. - * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. + * @param array $real Array of real values. + * @param int $timePeriod [OPTIONAL] [DEFAULT 30] Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function minmax(array $real, integer $timePeriod = null): array + public static function minmax(array $real, int $timePeriod = null): array { - return trader_minmax($real, $timePeriod); + $timePeriod = $timePeriod ?? 30; + $return = trader_minmax($real, $timePeriod); + static::checkForError(); + + return $return; } /** * Indexes of lowest and highest values over a specified period * - * @param array $real Array of real values. - * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. + * @param array $real Array of real values. + * @param int $timePeriod [OPTIONAL] [DEFAULT 30] Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function minmaxindex(array $real, integer $timePeriod = null): array + public static function minmaxindex(array $real, int $timePeriod = null): array { - return trader_minmaxindex($real, $timePeriod); + $timePeriod = $timePeriod ?? 30; + $return = trader_minmaxindex($real, $timePeriod); + static::checkForError(); + + return $return; } /** @@ -1811,13 +2388,18 @@ public static function minmaxindex(array $real, integer $timePeriod = null): arr * @param array $high High price, array of real values. * @param array $low Low price, array of real values. * @param array $close Closing price, array of real values. - * @param int $timePeriod Number of period. Valid range from 2 to 100000. + * @param int $timePeriod [OPTIONAL] [DEFAULT 14] Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function minus_di(array $high, array $low, array $close, integer $timePeriod = null): array + public static function minus_di(array $high, array $low, array $close, int $timePeriod = null): array { - return trader_minus_di($high, $low, $close, $timePeriod); + $timePeriod = $timePeriod ?? 14; + $return = trader_minus_di($high, $low, $close, $timePeriod); + static::checkForError(); + + return $return; } /** @@ -1825,26 +2407,36 @@ public static function minus_di(array $high, array $low, array $close, integer $ * * @param array $high High price, array of real values. * @param array $low Low price, array of real values. - * @param int $timePeriod Number of period. Valid range from 2 to 100000. + * @param int $timePeriod [OPTIONAL] [DEFAULT 14] Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function minus_dm(array $high, array $low, integer $timePeriod = null): array + public static function minus_dm(array $high, array $low, int $timePeriod = null): array { - return trader_minus_dm($high, $low, $timePeriod); + $timePeriod = $timePeriod ?? 14; + $return = trader_minus_dm($high, $low, $timePeriod); + static::checkForError(); + + return $return; } /** * Momentum * - * @param array $real Array of real values. - * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. + * @param array $real Array of real values. + * @param int $timePeriod [OPTIONAL] [DEFAULT 10] Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function mom(array $real, integer $timePeriod = null): array + public static function mom(array $real, int $timePeriod = null): array { - return trader_mom($real, $timePeriod); + $timePeriod = $timePeriod ?? 10; + $return = trader_mom($real, $timePeriod); + static::checkForError(); + + return $return; } /** @@ -1855,10 +2447,14 @@ public static function mom(array $real, integer $timePeriod = null): array * @param array $real1 Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function mult(array $real0, array $real1): array { - return trader_mult($real0, $real1); + $return = trader_mult($real0, $real1); + static::checkForError(); + + return $return; } /** @@ -1867,13 +2463,18 @@ public static function mult(array $real0, array $real1): array * @param array $high High price, array of real values. * @param array $low Low price, array of real values. * @param array $close Closing price, array of real values. - * @param int $timePeriod Number of period. Valid range from 2 to 100000. + * @param int $timePeriod [OPTIONAL] [DEFAULT 14] Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function natr(array $high, array $low, array $close, integer $timePeriod = null): array + public static function natr(array $high, array $low, array $close, int $timePeriod = null): array { - return trader_natr($high, $low, $close, $timePeriod); + $timePeriod = $timePeriod ?? 14; + $return = trader_natr($high, $low, $close, $timePeriod); + static::checkForError(); + + return $return; } /** @@ -1883,10 +2484,14 @@ public static function natr(array $high, array $low, array $close, integer $time * @param array $volume Volume traded, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function obv(array $real, array $volume): array { - return trader_obv($real, $volume); + $return = trader_obv($real, $volume); + static::checkForError(); + + return $return; } /** @@ -1895,13 +2500,18 @@ public static function obv(array $real, array $volume): array * @param array $high High price, array of real values. * @param array $low Low price, array of real values. * @param array $close Closing price, array of real values. - * @param int $timePeriod Number of period. Valid range from 2 to 100000. + * @param int $timePeriod [OPTIONAL] [DEFAULT 14] Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function plus_di(array $high, array $low, array $close, integer $timePeriod = null): array + public static function plus_di(array $high, array $low, array $close, int $timePeriod = null): array { - return trader_plus_di($high, $low, $close, $timePeriod); + $timePeriod = $timePeriod ?? 14; + $return = trader_plus_di($high, $low, $close, $timePeriod); + static::checkForError(); + + return $return; } /** @@ -1909,129 +2519,184 @@ public static function plus_di(array $high, array $low, array $close, integer $t * * @param array $high High price, array of real values. * @param array $low Low price, array of real values. - * @param int $timePeriod Number of period. Valid range from 2 to 100000. + * @param int $timePeriod [OPTIONAL] [DEFAULT 14] Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function plus_dm(array $high, array $low, integer $timePeriod = null): array + public static function plus_dm(array $high, array $low, int $timePeriod = null): array { - return trader_plus_dm($high, $low, $timePeriod); + $timePeriod = $timePeriod ?? 14; + $return = trader_plus_dm($high, $low, $timePeriod); + static::checkForError(); + + return $return; } /** * Percentage Price Oscillator * - * @param array $real Array of real values. - * @param int|null $fastPeriod Number of period for the fast MA. Valid range from 2 to 100000. - * @param int|null $slowPeriod Number of period for the slow MA. Valid range from 2 to 100000. - * @param int|null $mAType Type of Moving Average. TRADER_MA_TYPE_* series of constants should be used. + * @param array $real Array of real values. + * @param int $fastPeriod [OPTIONAL] [DEFAULT 12] Number of period for the fast MA. Valid range from 2 to 100000. + * @param int $slowPeriod [OPTIONAL] [DEFAULT 26] Number of period for the slow MA. Valid range from 2 to 100000. + * @param int $mAType [OPTIONAL] [DEFAULT TRADER_MA_TYPE_SMA] Type of Moving Average. TRADER_MA_TYPE_* series of constants should be used. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function ppo(array $real, integer $fastPeriod = null, integer $slowPeriod = null, integer $mAType = null): array + public static function ppo(array $real, int $fastPeriod = null, int $slowPeriod = null, int $mAType = null): array { - return trader_ppo($real, $fastPeriod, $slowPeriod, $mAType); + $fastPeriod = $fastPeriod ?? 12; + $slowPeriod = $slowPeriod ?? 26; + $mAType = $mAType ?? static::$TRADER_MA_TYPE_SMA; + $return = trader_ppo($real, $fastPeriod, $slowPeriod, $mAType); + static::checkForError(); + + return $return; } /** * Rate of change : ((price/prevPrice)-1)*100 * - * @param array $real Array of real values. - * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. + * @param array $real Array of real values. + * @param int $timePeriod [OPTIONAL] [DEFAULT 10] Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function roc(array $real, integer $timePeriod = null): array + public static function roc(array $real, int $timePeriod = null): array { - return trader_roc($real, $timePeriod); + $timePeriod = $timePeriod ?? 10; + $return = trader_roc($real, $timePeriod); + static::checkForError(); + + return $return; } /** * Rate of change Percentage: (price-prevPrice)/prevPrice * - * @param array $real Array of real values. - * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. + * @param array $real Array of real values. + * @param int $timePeriod [OPTIONAL] [DEFAULT 10] Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function rocp(array $real, integer $timePeriod = null): array + public static function rocp(array $real, int $timePeriod = null): array { - return trader_rocp($real, $timePeriod); + $timePeriod = $timePeriod ?? 10; + $return = trader_rocp($real, $timePeriod); + static::checkForError(); + + return $return; } /** * Rate of change ratio 100 scale: (price/prevPrice)*100 * - * @param array $real Array of real values. - * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. + * @param array $real Array of real values. + * @param int $timePeriod [OPTIONAL] [DEFAULT 10] Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function rocr100(array $real, integer $timePeriod = null): array + public static function rocr100(array $real, int $timePeriod = null): array { - return trader_rocr100($real, $timePeriod); + $timePeriod = $timePeriod ?? 10; + $return = trader_rocr100($real, $timePeriod); + static::checkForError(); + + return $return; } /** * Rate of change ratio: (price/prevPrice) * - * @param array $real Array of real values. - * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. + * @param array $real Array of real values. + * @param int $timePeriod [OPTIONAL] [DEFAULT 10] Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function rocr(array $real, integer $timePeriod = null): array + public static function rocr(array $real, int $timePeriod = null): array { - return trader_rocr($real, $timePeriod); + $timePeriod = $timePeriod ?? 10; + $return = trader_rocr($real, $timePeriod); + static::checkForError(); + + return $return; } /** * Relative Strength Index * - * @param array $real Array of real values. - * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. + * @param array $real Array of real values. + * @param int $timePeriod [OPTIONAL] [DEFAULT 14] Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function rsi(array $real, integer $timePeriod = null): array + public static function rsi(array $real, int $timePeriod = null): array { - return trader_rsi($real, $timePeriod); + $timePeriod = $timePeriod ?? 14; + $return = trader_rsi($real, $timePeriod); + static::checkForError(); + + return $return; } /** * Parabolic SAR * - * @param array $high High price, array of real values. - * @param array $low Low price, array of real values. - * @param float|null $acceleration Acceleration Factor used up to the Maximum value. Valid range from 0 to TRADER_REAL_MAX. - * @param float|null $maximum Acceleration Factor Maximum value. Valid range from 0 to TRADER_REAL_MAX. + * @param array $high High price, array of real values. + * @param array $low Low price, array of real values. + * @param float $acceleration [OPTIONAL] [DEFAULT 0.02] Acceleration Factor used up to the Maximum value. Valid range from 0 to TRADER_REAL_MAX. + * @param float $maximum [OPTIONAL] [DEFAULT 0.2] Acceleration Factor Maximum value. Valid range from 0 to TRADER_REAL_MAX. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function sar(array $high, array $low, float $acceleration = null, float $maximum = null): array { - return trader_sar($high, $low, $acceleration, $maximum); + $acceleration = $acceleration ?? 0.02; + $maximum = $maximum ?? 0.2; + $return = trader_sar($high, $low, $acceleration, $maximum); + static::checkForError(); + + return $return; } /** * Parabolic SAR - Extended * - * @param array $high High price, array of real values. - * @param array $low Low price, array of real values. - * @param float|null $startValue Start value and direction. 0 for Auto, >0 for Long, <0 for Short. Valid range from TRADER_REAL_MIN to TRADER_REAL_MAX. - * @param float|null $offsetOnReverse Percent offset added/removed to initial stop on short/long reversal. Valid range from 0 to TRADER_REAL_MAX. - * @param float|null $accelerationInitLong Acceleration Factor initial value for the Long direction. Valid range from 0 to TRADER_REAL_MAX. - * @param float|null $accelerationLong Acceleration Factor for the Long direction. Valid range from 0 to TRADER_REAL_MAX. - * @param float|null $accelerationMaxLong Acceleration Factor maximum value for the Long direction. Valid range from 0 to TRADER_REAL_MAX. - * @param float|null $accelerationInitShort Acceleration Factor initial value for the Short direction. Valid range from 0 to TRADER_REAL_MAX. - * @param float|null $accelerationShort Acceleration Factor for the Short direction. Valid range from 0 to TRADER_REAL_MAX. - * @param float|null $accelerationMaxShort Acceleration Factor maximum value for the Short direction. Valid range from 0 to TRADER_REAL_MAX. + * @param array $high High price, array of real values. + * @param array $low Low price, array of real values. + * @param float $startValue [OPTIONAL] [DEFAULT 0.0] Start value and direction. 0 for Auto, >0 for Long, <0 for Short. Valid range from TRADER_REAL_MIN to TRADER_REAL_MAX. + * @param float $offsetOnReverse [OPTIONAL] [DEFAULT 0.0] Percent offset added/removed to initial stop on short/long reversal. Valid range from 0 to TRADER_REAL_MAX. + * @param float $accelerationInitLong [OPTIONAL] [DEFAULT 0.02] Acceleration Factor initial value for the Long direction. Valid range from 0 to TRADER_REAL_MAX. + * @param float $accelerationLong [OPTIONAL] [DEFAULT 0.02] Acceleration Factor for the Long direction. Valid range from 0 to TRADER_REAL_MAX. + * @param float $accelerationMaxLong [OPTIONAL] [DEFAULT 0.2] Acceleration Factor maximum value for the Long direction. Valid range from 0 to TRADER_REAL_MAX. + * @param float $accelerationInitShort [OPTIONAL] [DEFAULT 0.02] Acceleration Factor initial value for the Short direction. Valid range from 0 to TRADER_REAL_MAX. + * @param float $accelerationShort [OPTIONAL] [DEFAULT 0.02] Acceleration Factor for the Short direction. Valid range from 0 to TRADER_REAL_MAX. + * @param float $accelerationMaxShort [OPTIONAL] [DEFAULT 0.2] Acceleration Factor maximum value for the Short direction. Valid range from 0 to TRADER_REAL_MAX. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function sarext(array $high, array $low, float $startValue = null, float $offsetOnReverse = null, float $accelerationInitLong = null, float $accelerationLong = null, float $accelerationMaxLong = null, float $accelerationInitShort = null, float $accelerationShort = null, float $accelerationMaxShort = null): array { - return trader_sarext($high, $low, $startValue, $offsetOnReverse, $accelerationInitLong, $accelerationLong, $accelerationMaxLong, $accelerationInitShort, $accelerationShort, $accelerationMaxShort); + $startValue = $startValue ?? 0.0; + $offsetOnReverse = $offsetOnReverse ?? 0.0; + $accelerationInitLong = $accelerationInitLong ?? 0.02; + $accelerationLong = $accelerationLong ?? 0.02; + $accelerationMaxLong = $accelerationMaxLong ?? 0.2; + $accelerationInitShort = $accelerationInitShort ?? 0.02; + $accelerationShort = $accelerationShort ?? 0.02; + $accelerationMaxShort = $accelerationMaxShort ?? 0.2; + $return = trader_sarext($high, $low, $startValue, $offsetOnReverse, $accelerationInitLong, $accelerationLong, $accelerationMaxLong, $accelerationInitShort, $accelerationShort, $accelerationMaxShort); + static::checkForError(); + + return $return; } /** @@ -2039,10 +2704,13 @@ public static function sarext(array $high, array $low, float $startValue = null, * Set compatibility mode which will affect the way calculations are done by all the extension functions. * * @param int $compatId Compatibility Id. TRADER_COMPATIBILITY_* series of constants should be used. + * + * @throws \Exception */ - public static function set_compat(integer $compatId) + public static function set_compat(int $compatId) { - return trader_set_compat($compatId); + trader_set_compat($compatId); + static::checkForError(); } /** @@ -2051,10 +2719,13 @@ public static function set_compat(integer $compatId) * * @param int $functionId Function ID the factor should be set for. TRADER_FUNC_UNST_* constant series can be used to affect the corresponding function. * @param int $timePeriod Unstable period value. + * + * @throws \Exception */ - public static function set_unstable_period(integer $functionId, integer $timePeriod) + public static function set_unstable_period(int $functionId, int $timePeriod) { - return trader_set_unstable_period($functionId, $timePeriod); + trader_set_unstable_period($functionId, $timePeriod); + static::checkForError(); } /** @@ -2064,10 +2735,14 @@ public static function set_unstable_period(integer $functionId, integer $timePer * @param array $real Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function sin(array $real): array { - return trader_sin($real); + $return = trader_sin($real); + static::checkForError(); + + return $return; } /** @@ -2077,23 +2752,32 @@ public static function sin(array $real): array * @param array $real Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function sinh(array $real): array { - return trader_sinh($real); + $return = trader_sinh($real); + static::checkForError(); + + return $return; } /** * Simple Moving Average * - * @param array $real Array of real values. - * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. + * @param array $real Array of real values. + * @param int $timePeriod [OPTIONAL] [DEFAULT 30] Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function sma(array $real, integer $timePeriod = null): array + public static function sma(array $real, int $timePeriod = null): array { - return trader_sma($real, $timePeriod); + $timePeriod = $timePeriod ?? 30; + $return = trader_sma($real, $timePeriod); + static::checkForError(); + + return $return; } /** @@ -2103,76 +2787,110 @@ public static function sma(array $real, integer $timePeriod = null): array * @param array $real Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function sqrt(array $real): array { - return trader_sqrt($real); + $return = trader_sqrt($real); + static::checkForError(); + + return $return; } /** * Standard Deviation * - * @param array $real Array of real values. - * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. - * @param float $nbDev + * @param array $real Array of real values. + * @param int $timePeriod [OPTIONAL] [DEFAULT 5] Number of period. Valid range from 2 to 100000. + * @param float $nbDev [OPTIONAL] [DEFAULT 1.0] Number of deviations * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function stddev(array $real, integer $timePeriod = null, float $nbDev = null): array + public static function stddev(array $real, int $timePeriod = null, float $nbDev = null): array { - return trader_stddev($real, $timePeriod, $nbDev); + $timePeriod = $timePeriod ?? 5; + $nbDev = $nbDev ?? 1.0; + $return = trader_stddev($real, $timePeriod, $nbDev); + static::checkForError(); + + return $return; } /** * Stochastic * - * @param array $high High price, array of real values. - * @param array $low Low price, array of real values. - * @param array $close Time period for building the Fast-K line. Valid range from 1 to 100000. - * @param int|null $fastK_Period Time period for building the Fast-K line. Valid range from 1 to 100000. - * @param int|null $slowK_Period Smoothing for making the Slow-K line. Valid range from 1 to 100000, usually set to 3. - * @param int|null $slowK_MAType Type of Moving Average for Slow-K. TRADER_MA_TYPE_* series of constants should be used. - * @param int|null $slowD_Period Smoothing for making the Slow-D line. Valid range from 1 to 100000. - * @param int|null $slowD_MAType Type of Moving Average for Slow-D. TRADER_MA_TYPE_* series of constants should be used. + * @param array $high High price, array of real values. + * @param array $low Low price, array of real values. + * @param array $close Time period for building the Fast-K line. Valid range from 1 to 100000. + * @param int $fastK_Period [OPTIONAL] [DEFAULT 5] Time period for building the Fast-K line. Valid range from 1 to 100000. + * @param int $slowK_Period [OPTIONAL] [DEFAULT 3] Smoothing for making the Slow-K line. Valid range from 1 to 100000, usually set to 3. + * @param int $slowK_MAType [OPTIONAL] [DEFAULT TRADER_MA_TYPE_SMA] Type of Moving Average for Slow-K. TRADER_MA_TYPE_* series of constants should be used. + * @param int $slowD_Period [OPTIONAL] [DEFAULT 3] Smoothing for making the Slow-D line. Valid range from 1 to 100000. + * @param int $slowD_MAType [OPTIONAL] [DEFAULT TRADER_MA_TYPE_SMA] Type of Moving Average for Slow-D. TRADER_MA_TYPE_* series of constants should be used. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function stoch(array $high, array $low, array $close, integer $fastK_Period = null, integer $slowK_Period = null, integer $slowK_MAType = null, integer $slowD_Period = null, integer $slowD_MAType = null): array + public static function stoch(array $high, array $low, array $close, int $fastK_Period = null, int $slowK_Period = null, int $slowK_MAType = null, int $slowD_Period = null, int $slowD_MAType = null): array { - return trader_stoch($high, $low, $close, $fastK_Period, $slowK_Period, $slowK_MAType, $slowD_Period, $slowD_MAType); + $fastK_Period = $fastK_Period ?? 5; + $slowK_Period = $slowK_Period ?? 3; + $slowK_MAType = $slowK_MAType ?? static::$TRADER_MA_TYPE_SMA; + $slowD_Period = $slowD_Period ?? 3; + $slowD_MAType = $slowD_MAType ?? static::$TRADER_MA_TYPE_SMA; + $return = trader_stoch($high, $low, $close, $fastK_Period, $slowK_Period, $slowK_MAType, $slowD_Period, $slowD_MAType); + static::checkForError(); + + return $return; } /** * Stochastic Fast * - * @param array $high High price, array of real values. - * @param array $low Low price, array of real values. - * @param array $close Time period for building the Fast-K line. Valid range from 1 to 100000. - * @param int|null $fastK_Period Time period for building the Fast-K line. Valid range from 1 to 100000. - * @param int|null $fastD_Period Smoothing for making the Fast-D line. Valid range from 1 to 100000, usually set to 3. - * @param int|null $fastD_MAType Type of Moving Average for Fast-D. TRADER_MA_TYPE_* series of constants should be used. + * @param array $high High price, array of real values. + * @param array $low Low price, array of real values. + * @param array $close Time period for building the Fast-K line. Valid range from 1 to 100000. + * @param int $fastK_Period [OPTIONAL] [DEFAULT 5] Time period for building the Fast-K line. Valid range from 1 to 100000. + * @param int $fastD_Period [OPTIONAL] [DEFAULT 3] Smoothing for making the Fast-D line. Valid range from 1 to 100000, usually set to 3. + * @param int $fastD_MAType [OPTIONAL] [DEFAULT TRADER_MA_TYPE_SMA] Type of Moving Average for Fast-D. TRADER_MA_TYPE_* series of constants should be used. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function stochf(array $high, array $low, array $close, integer $fastK_Period = null, integer $fastD_Period = null, integer $fastD_MAType = null): array + public static function stochf(array $high, array $low, array $close, int $fastK_Period = null, int $fastD_Period = null, int $fastD_MAType = null): array { - return trader_stochf($high, $low, $close, $fastK_Period, $fastD_Period, $fastD_MAType); + $fastK_Period = $fastK_Period ?? 5; + $fastD_Period = $fastD_Period ?? 3; + $fastD_MAType = $fastD_MAType ?? static::$TRADER_MA_TYPE_SMA; + $return = trader_stochf($high, $low, $close, $fastK_Period, $fastD_Period, $fastD_MAType); + static::checkForError(); + + return $return; } /** * Stochastic Relative Strength Index * - * @param array $real Array of real values. - * @param int|null $timePeriod Number of period. Valid range from 2 to 100000. - * @param int|null $fastK_Period Time period for building the Fast-K line. Valid range from 1 to 100000. - * @param int|null $fastD_Period Smoothing for making the Fast-D line. Valid range from 1 to 100000, usually set to 3. - * @param int|null $fastD_MAType Type of Moving Average for Fast-D. TRADER_MA_TYPE_* series of constants should be used. + * @param array $real Array of real values. + * @param int $timePeriod [OPTIONAL] [DEFAULT 14] Number of period. Valid range from 2 to 100000. + * @param int $fastK_Period [OPTIONAL] [DEFAULT 5] Time period for building the Fast-K line. Valid range from 1 to 100000. + * @param int $fastD_Period [OPTIONAL] [DEFAULT 3] Smoothing for making the Fast-D line. Valid range from 1 to 100000, usually set to 3. + * @param int $fastD_MAType [OPTIONAL] [DEFAULT TRADER_MA_TYPE_SMA] Type of Moving Average for Fast-D. TRADER_MA_TYPE_* series of constants should be used. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function stochrsi(array $real, integer $timePeriod = null, integer $fastK_Period = null, integer $fastD_Period = null, integer $fastD_MAType = null): array + public static function stochrsi(array $real, int $timePeriod = null, int $fastK_Period = null, int $fastD_Period = null, int $fastD_MAType = null): array { - return trader_stochrsi($real, $timePeriod, $fastK_Period, $fastD_Period, $fastD_MAType); + $timePeriod = $timePeriod ?? 14; + $fastK_Period = $fastK_Period ?? 5; + $fastD_Period = $fastD_Period ?? 3; + $fastD_MAType = $fastD_MAType ?? static::$TRADER_MA_TYPE_SMA; + $return = trader_stochrsi($real, $timePeriod, $fastK_Period, $fastD_Period, $fastD_MAType); + static::checkForError(); + + return $return; } /** @@ -2183,37 +2901,52 @@ public static function stochrsi(array $real, integer $timePeriod = null, integer * @param array $real1 Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function sub(array $real0, array $real1): array { - return trader_sub($real0, $real1); + $return = trader_sub($real0, $real1); + static::checkForError(); + + return $return; } /** * Summation * - * @param array $real Array of real values. - * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. + * @param array $real Array of real values. + * @param int $timePeriod [OPTIONAL] [DEFAULT 30] Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function sum(array $real, integer $timePeriod = null): array + public static function sum(array $real, int $timePeriod = null): array { - return trader_sum($real, $timePeriod); + $timePeriod = $timePeriod ?? 30; + $return = trader_sum($real, $timePeriod); + static::checkForError(); + + return $return; } /** * Triple Exponential Moving Average (T3) * - * @param array $real Array of real values. - * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. - * @param float $vFactor Volume Factor. Valid range from 1 to 0. + * @param array $real Array of real values. + * @param int $timePeriod [OPTIONAL] [DEFAULT 5] Number of period. Valid range from 2 to 100000. + * @param float $vFactor [OPTIONAL] [DEFAULT 0.7] Volume Factor. Valid range from 1 to 0. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function t3(array $real, integer $timePeriod = null, float $vFactor = null): array + public static function t3(array $real, int $timePeriod = null, float $vFactor = null): array { - return trader_t3($real, $timePeriod, $vFactor); + $timePeriod = $timePeriod ?? 5; + $vFactor = $vFactor ?? 0.7; + $return = trader_t3($real, $timePeriod, $vFactor); + static::checkForError(); + + return $return; } /** @@ -2223,10 +2956,14 @@ public static function t3(array $real, integer $timePeriod = null, float $vFacto * @param array $real Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function tan(array $real): array { - return trader_tan($real); + $return = trader_tan($real); + static::checkForError(); + + return $return; } /** @@ -2236,23 +2973,32 @@ public static function tan(array $real): array * @param array $real Array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function tanh(array $real): array { - return trader_tanh($real); + $return = trader_tanh($real); + static::checkForError(); + + return $return; } /** * Triple Exponential Moving Average * - * @param array $real Array of real values. - * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. + * @param array $real Array of real values. + * @param int $timePeriod [OPTIONAL] [DEFAULT 30] Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function tema(array $real, integer $timePeriod = null): array + public static function tema(array $real, int $timePeriod = null): array { - return trader_tema($real, $timePeriod); + $timePeriod = $timePeriod ?? 30; + $return = trader_tema($real, $timePeriod); + static::checkForError(); + + return $return; } /** @@ -2263,49 +3009,68 @@ public static function tema(array $real, integer $timePeriod = null): array * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function trange(array $high, array $low, array $close): array { - return trader_trange($high, $low, $close); + $return = trader_trange($high, $low, $close); + static::checkForError(); + + return $return; } /** * Triangular Moving Average * - * @param array $real Array of real values. - * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. + * @param array $real Array of real values. + * @param int $timePeriod [OPTIONAL] [DEFAULT 30] Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function trima(array $real, integer $timePeriod = null): array + public static function trima(array $real, int $timePeriod = null): array { - return trader_trima($real, $timePeriod); + $timePeriod = $timePeriod ?? 30; + $return = trader_trima($real, $timePeriod); + static::checkForError(); + + return $return; } /** * 1-day Rate-Of-Change (ROC) of a Triple Smooth EMA * - * @param array $real Array of real values. - * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. + * @param array $real Array of real values. + * @param int $timePeriod [OPTIONAL] [DEFAULT 30] Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function trix(array $real, integer $timePeriod = null): array + public static function trix(array $real, int $timePeriod = null): array { - return trader_trix($real, $timePeriod); + $timePeriod = $timePeriod ?? 30; + $return = trader_trix($real, $timePeriod); + static::checkForError(); + + return $return; } /** * Time Series Forecast * - * @param array $real Array of real values. - * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. + * @param array $real Array of real values. + * @param int $timePeriod [OPTIONAL] [DEFAULT 14] Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function tsf(array $real, integer $timePeriod = null): array + public static function tsf(array $real, int $timePeriod = null): array { - return trader_tsf($real, $timePeriod); + $timePeriod = $timePeriod ?? 14; + $return = trader_tsf($real, $timePeriod); + static::checkForError(); + + return $return; } /** @@ -2316,41 +3081,58 @@ public static function tsf(array $real, integer $timePeriod = null): array * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function typprice(array $high, array $low, array $close): array { - return trader_typprice($high, $low, $close); + $return = trader_typprice($high, $low, $close); + static::checkForError(); + + return $return; } /** * Ultimate Oscillator * - * @param array $high High price, array of real values. - * @param array $low Low price, array of real values. - * @param array $close Closing price, array of real values. - * @param int|null $timePeriod1 Number of bars for 1st period. Valid range from 1 to 100000. - * @param int|null $timePeriod2 Number of bars for 2nd period. Valid range from 1 to 100000. - * @param int|null $timePeriod3 Number of bars for 3rd period. Valid range from 1 to 100000. + * @param array $high High price, array of real values. + * @param array $low Low price, array of real values. + * @param array $close Closing price, array of real values. + * @param int $timePeriod1 [OPTIONAL] [DEFAULT 7] Number of bars for 1st period. Valid range from 1 to 100000. + * @param int $timePeriod2 [OPTIONAL] [DEFAULT 14] Number of bars for 2nd period. Valid range from 1 to 100000. + * @param int $timePeriod3 [OPTIONAL] [DEFAULT 28] Number of bars for 3rd period. Valid range from 1 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function ultosc(array $high, array $low, array $close, integer $timePeriod1 = null, integer $timePeriod2 = null, integer $timePeriod3 = null): array + public static function ultosc(array $high, array $low, array $close, int $timePeriod1 = null, int $timePeriod2 = null, int $timePeriod3 = null): array { - return trader_ultosc($high, $low, $close, $timePeriod1, $timePeriod2, $timePeriod3); + $timePeriod1 = $timePeriod1 ?? 7; + $timePeriod2 = $timePeriod2 ?? 14; + $timePeriod3 = $timePeriod3 ?? 28; + $return = trader_ultosc($high, $low, $close, $timePeriod1, $timePeriod2, $timePeriod3); + static::checkForError(); + + return $return; } /** * Variance * - * @param array $real Array of real values. - * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. - * @param float $nbDev + * @param array $real Array of real values. + * @param int $timePeriod [OPTIONAL] [DEFAULT 5] Number of period. Valid range from 2 to 100000. + * @param float $nbDev [OPTIONAL] [DEFAULT 1.0] Number of deviations * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function var(array $real, integer $timePeriod = null, float $nbDev = null): array + public static function var(array $real, int $timePeriod = null, float $nbDev = null): array { - return trader_var($real, $timePeriod, $nbDev); + $timePeriod = $timePeriod ?? 5; + $nbDev = $nbDev ?? 1.0; + $return = trader_var($real, $timePeriod, $nbDev); + static::checkForError(); + + return $return; } /** @@ -2361,39 +3143,52 @@ public static function var(array $real, integer $timePeriod = null, float $nbDev * @param array $close Closing price, array of real values. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ public static function wclprice(array $high, array $low, array $close): array { - return trader_wclprice($high, $low, $close); + $return = trader_wclprice($high, $low, $close); + static::checkForError(); + + return $return; } /** * Williams' %R * - * @param array $high High price, array of real values. - * @param array $low Low price, array of real values. - * @param array $close Closing price, array of real values. - * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. + * @param array $high High price, array of real values. + * @param array $low Low price, array of real values. + * @param array $close Closing price, array of real values. + * @param int $timePeriod [OPTIONAL] [DEFAULT 14] Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function willr(array $high, array $low, array $close, integer $timePeriod = null): array + public static function willr(array $high, array $low, array $close, int $timePeriod = null): array { - return trader_willr($high, $low, $close, $timePeriod); + $timePeriod = $timePeriod ?? 14; + $return = trader_willr($high, $low, $close, $timePeriod); + static::checkForError(); + + return $return; } /** * Weighted Moving Average * - * @param array $real Array of real values. - * @param null|int $timePeriod Number of period. Valid range from 2 to 100000. + * @param array $real Array of real values. + * @param int $timePeriod [OPTIONAL] [DEFAULT 30] Number of period. Valid range from 2 to 100000. * * @return array Returns an array with calculated data or false on failure. + * @throws \Exception */ - public static function wma(array $real, integer $timePeriod = null): array + public static function wma(array $real, int $timePeriod = null): array { - return trader_wma($real, $timePeriod); - } + $timePeriod = $timePeriod ?? 30; + $return = trader_wma($real, $timePeriod); + static::checkForError(); + return $return; + } -} \ No newline at end of file +}