diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..f288702 --- /dev/null +++ b/COPYING @@ -0,0 +1,674 @@ + 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. + + + Copyright (C) + + 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: + + Copyright (C) + 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 +. diff --git a/README.md b/README.md index 0aa06ba..872b062 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,59 @@ -# Warning / Disclaimer +# Dabo (crypto bot) + +The software provided here is called dabo (crypto bot). + +## Warning / Disclaimer The software provided here does not guarantee any profits or function as well as sufficient security. Use at your own risk!!! This is a private project, which is based on amateur knowledge. Trading cryptocurrencies involves an enormous amount of risks and is considered highly speculative. It is strongly recommended to deal intensively with the subject and this bot before using it. Also, when using the possibility should be considered that due to an unfavorable market development, technical errors, bugs or other reasons, the entire invested capital can be lost. This software should therefore only be used if it is justifiable to lose the entire invested capital! -# Objective +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +It is still under development and is currently only partially functional. + +## Copyright / License + +Copyright (c) 2022-2024 Oliver Bohlen + +The software provided here is called dabo (crypto bot) + +dabo 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. + +dabo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY 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 dabo (see COPYING file). If not, see . + +## Data sources +Various data sources such as finance.yahoo.com and crypto exchanges available via ccxt are used. please check whether this is legal in your region before use. +- query1.finance.yahoo.com (economic data,...) +- 30rates.com (forecast) +- api.coingecko.com (Market-Cap) +- fapi.binance.com (OpenInterest,...) +- api.alternative.me (Fear and Greed) +- https://unpkg.com/lightweight-charts/dist/lightweight-charts.standalone.production.js (TradingView Lightweitgt Charts) +- ... + +## dependencies on other software products +- CCXT (https://www.ccxt.com | https://github.com/ccxt/ccxt) +- TradingView Lightweitgt Charts (https://de.tradingview.com/lightweight-charts/ | https://github.com/tradingview/lightweight-charts) +- bash, python +- several linux programs like bc, wget,... +- ... + +## Objective The dabo-bot is intended to help make and execute timely buy and sell decisions automatically in the fast-paced crypto environment. These decisions are made using one or more self-definable strategies. Various market data are available as a basis for decision-making, such as price trends, RSI, MACD and EMA indicators of various time intervals, Fear and Greed Index, S&P500 data,... -# Naming +## Naming The name Dabo comes from the Star Trek universe. Dabo was a roulette-style game of chance developed by the Ferengi. More information here: https://memory-alpha.fandom.com/wiki/Dabo I thought this fits quite well to the cryptotrading world and that's why I chose this name ;-) -# Structure +## Structure The Bot is splitted in the following parts: - dabo-bot: Basic Bot woth buy and sell decisions based on self-definable strategies @@ -30,47 +67,47 @@ The Bot is splitted in the following parts: For cummunicating with the exchange APIs CCXT is used: https://github.com/ccxt/ccxt -gaboishlib +gaboshlib Each part runs parallel to the others in its own docker-container. -# Features -## General: +## Features +### General: - theoretically compatible to supported CCXT exchanges. Tested with Phemex. Please let me know if there are problems with other exchanges. - parallel processing in separate docker containers -## Dabo Bot +### Dabo Bot - place limit and market orders and supports ... - ... leverage trading - ... short trades - ... margins cross and isolated -## Dabo Symbol Ticker +### Dabo Symbol Ticker - automatically finds all supported tokens and pairs and fetches continiously ... - ... symbols - ... and prices -## Dabo OHLCV Candle data +### Dabo OHLCV Candle data OHLCV = Open, High, Low, Close and Volume of a time unit - time units 1w, 1d, 4h, 1h, 15m and 5m - 4h, 1h, 15m and 5m from the respective stock exchange - 1d and 1w data from yahoo finace to have longer terms -## Dabo Indicators +### Dabo Indicators - data per time unit - time units 1w, 1d, 4h, 1h, 15m and 5m - self-calculated EMA12, 26 ,50, 100, 200, 400 and 800 - self-calculated RSI5, 14, 21 - self-calculated MACD -## Dabo Market Data +### Dabo Market Data - Yahoo Finance -## Dabo Orders +### Dabo Orders ## Dabo Transaction History - Support of additional Exchnages/Brokers JustTrade (CSV-Import) and Bitpanda (API+CSV-Import) -## Dabo Webpage +### Dabo Webpage - ReadOnly Overview - Consideration of trading fees - Automatic selection of cryptocurrencies to invest in - Filtering of cryptocurrencies by market capitalization (data via coingecko API) e.g. only trade the 50 largest by market capitalization if available on the exchange -- Notifications via Signal Messenger to groups +- Notifications via Matrix Messenger to groups - Individually selectable percentage of available capital per trade - automatic definition of time intervals (e.g. every minute / every five minutes) based on the change of the rates - Monitoring of overall market performance via own market performance index based for example on the MSCI World, leading currencies like BTC and ETH and their forecasts. @@ -83,19 +120,19 @@ OHLCV = Open, High, Low, Close and Volume of a time unit - Hedge mode (long and short positions the same time) not supported -## Buy conditions +### Buy conditions - definable RSI Indicator signals min/max (RSI5, 14 and 21) - definable MACD signals min/max - definable minimum growth in a definable time period -## Sell conditions +### Sell conditions - sell at defined loss limit - hold if the result would be negative - sell after certain time even if loss exists - definable RSI Indicator signals min/max - definable MACD signals min/max -# Why bash? +## Why bash? Yes, bash is not a language in which you write something like this in a normal way. To be honest, I'm more of a Linux admin than a programmer, so I do a lot of my work using bash. @@ -106,7 +143,7 @@ Originally this project was supposed to be a simple script to monitor prices of Finally, it's a hobby project and I have to see how and when I can find time for it, because there also has to be time for family, friends, work and other hobbies. If there is someone who would like to rewrite this bot in e.g. Python, I would be happy to support them as best I can with this task. Just let me know. -# How to use/install +## How to use/install Linux knowledge required! Needed a running Docker install. Traefik suggested, see @@ -116,18 +153,18 @@ https://gitea.ds9.dedyn.io/olli/debian.ansible.docker https://gitea.ds9.dedyn.io/olli/debian.ansible.traefik.server -## Download +### Download ``` git clone https://gitea.ds9.dedyn.io/olli/dabo.git cd dabo ``` -## Build container +### Build container ``` docker -l warn compose --ansi never build --progress=plain --pull --no-cache --force-rm ``` -## Configure +### Configure Edit docker-compose.yml or create docker-compose.override.yml to fit yout needs e.g. domain and network settings or basic auth, e.g. for traefik and letsencrypt: ``` echo ' @@ -170,14 +207,14 @@ networks: ``` -Optional: If you use signal-cli (https://gitea.ds9.dedyn.io/olli/debian.ansible.signal-cli.client) and want do receive Signal-Messages from the bot you can create an SSH-Key to allow sending Signal-Messages e.g.: +Optional: If you use matrix/matrix-commander (https://gitea.ds9.dedyn.io/olli/debian.ansible.matrix.server) and want do receive Matrix-Messages from the bot you can create an SSH-Key to allow sending Matrix-Messages e.g.: ``` mkdir -p home/.ssh ssh-keygen -f home/.ssh/id_ed25519 -N "" -t ed25519 chmod 700 home/.ssh cat home/.ssh/id_ed25519.pub ``` -and add Key on your signal-cli-Server to the authorized_keys of the signal-User +and add Key on your matrix-Server to the authorized_keys of the matrix-User Create Secrets file for your API Key(s) @@ -200,7 +237,7 @@ vim dabo-bot.conf Defaults in dabo/dabo-bot.conf -## Prepare/Create a stretegy +### Prepare/Create a stretegy IMPORTANT!!! @@ -226,7 +263,7 @@ strategies/buy.mannover-sulu-1.conf strategies/sell.command-kirk-3.conf ``` -## Create individual watch-assets.csv +### Create individual watch-assets.csv ``` cp dabo/watch-assets.csv watch-assets.csv ``` @@ -236,13 +273,13 @@ You can edit this file if you want do generate warnings or track your asstes/tra nano watch-assets.csv ``` -## Set Rights +### Set Rights Set Rights (UID 10000 for non-root-User in running container): ``` chown -R 10000:10000 dabo data home strategies dabo-bot.conf watch-assets.csv ``` -## Operational commands +### Operational commands Run/Restart: ``` docker compose down # if an old instance is running @@ -280,13 +317,13 @@ A Binance or OneTrading.com (ex BitpandaPro) account must exist and the API must The access data is stored in the file .binance-secrets in the project directory in the variables API_SECRET and API_KEY. The access rights to this file should be set to the minimum necessary for security reasons. -# Strategies +## Strategies You can put your own code into the strateghies it will be sourced by the bot. You can use available variables to set and read things. -## Variables to set +### Variables to set You can simply use the following varaibles to define things: @@ -323,7 +360,7 @@ local BUY_MINGROWTH_PERIOD local BUY_MINGROWTH ``` -## Variables with current values from the CSV files +### Variables with current values from the CSV files ``` # date from current timeframe ${f_date} @@ -382,7 +419,7 @@ ${f_support3} ${f_resist3} ``` -# Future ideas/featrues +## Future ideas/featrues - Crypto preferences (While/Blacklist for certain currencies) - Overview trades/profits/losses for tax declaration - Support for decentralized exchanges like uniswap to gain more "security" diff --git a/dabo-ansible.yml b/dabo-ansible.yml index 58e8854..1fb5d9b 100644 --- a/dabo-ansible.yml +++ b/dabo-ansible.yml @@ -98,8 +98,6 @@ group: docker marker: "# {mark} ANSIBLE MANAGED BLOCK" block: | - version: '3.6' - services: dabo-bot: diff --git a/dabo/analyze.sh b/dabo/analyze.sh index 4142dfe..12c524e 100755 --- a/dabo/analyze.sh +++ b/dabo/analyze.sh @@ -1,5 +1,24 @@ #!/bin/bash +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + + # cleanup rm -r /tmp/parallel-* /tmp/overall-result-* /tmp/g_analyze.sh-* diff --git a/dabo/calc-indicators-hist.sh b/dabo/calc-indicators-hist.sh index b77bcb9..806a3dd 100755 --- a/dabo/calc-indicators-hist.sh +++ b/dabo/calc-indicators-hist.sh @@ -1,5 +1,24 @@ #!/bin/bash +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + + . /dabo/dabo-prep.sh rm -f asset-histories/*.history.*.csv.indicators-calculating diff --git a/dabo/calc-levels.sh b/dabo/calc-levels.sh index 742bda8..acbe775 100755 --- a/dabo/calc-levels.sh +++ b/dabo/calc-levels.sh @@ -1,5 +1,24 @@ #!/bin/bash +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + + . /dabo/dabo-prep.sh rm -f asset-histories/*.history.*.csv.levels-calculating diff --git a/dabo/create_webpage.sh b/dabo/create_webpage.sh index 52c2a77..2197f4c 100755 --- a/dabo/create_webpage.sh +++ b/dabo/create_webpage.sh @@ -1,5 +1,24 @@ #!/bin/bash +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + + . /dabo/dabo-prep.sh while true diff --git a/dabo/dabo-bot.conf b/dabo/dabo-bot.conf index 39767ea..73d4020 100755 --- a/dabo/dabo-bot.conf +++ b/dabo/dabo-bot.conf @@ -23,7 +23,7 @@ LARGEST_MARKETCAP="250" SYMBOLS="ETH SOL" ## Signal Group for Notifications -SIGNAL_GROUP="Krypto-Bot" +NOTIFICATION_GROUP="Dabo-Bot" ## Percent from balance per invest. # Overwritten by MIN_NOTIONAL+X% from stock if lower diff --git a/dabo/dabo-bot.override.conf b/dabo/dabo-bot.override.conf index 2fa992c..533bd5f 100644 --- a/dabo/dabo-bot.override.conf +++ b/dabo/dabo-bot.override.conf @@ -1 +1 @@ -keep +#keep diff --git a/dabo/dabo-bot.sh b/dabo/dabo-bot.sh index 8ea8d32..b6cbfa7 100755 --- a/dabo/dabo-bot.sh +++ b/dabo/dabo-bot.sh @@ -1,5 +1,24 @@ #!/bin/bash +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + + . /dabo/dabo-prep.sh ### MAIN ### @@ -58,6 +77,8 @@ do INTERVAL_MIN=$(echo "${INTERVAL}/60-1" | bc -l | sed -r 's/^(-?)\./\10./' | cut -d\. -f1) [ -z "${INTERVAL_MIN}" ] && INTERVAL_MIN=1 + +####### TODO -> Funktionen überarbeiten ############ ### get general market data # Get coingecko data get_coingecko_data @@ -70,6 +91,7 @@ do then f_market_performance=$(cat MARKET_PERFORMANCE_LATEST) fi +####### TODO -> Funktionen überarbeiten ENDE ########### ## watch some manual defined assets @@ -82,8 +104,8 @@ do fi # Get current symbols - [ ${FULL_LOOP} = 1 ] && get_symbols_ticker - + #[ ${FULL_LOOP} = 1 ] && get_symbols_ticker + # Sell something? #check_for_sell diff --git a/dabo/dabo-prep.sh b/dabo/dabo-prep.sh index 8459319..cc626ab 100644 --- a/dabo/dabo-prep.sh +++ b/dabo/dabo-prep.sh @@ -1,3 +1,23 @@ +#!/bin/bash + +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + # functions BASEPATH=/dabo/htdocs @@ -21,6 +41,8 @@ set +a mkdir -p ${BASEPATH}/botdata/asset-histories cd ${BASEPATH}/botdata +ECO_ASSETS="DXY DOWJONES SP500 NASDAQ MSCIEAFE 10YRTREASURY OIL GOLD MSCIWORLD OILGAS KRE EUR-USD" + . ../../dabo-bot.conf . ../../dabo-bot.override.conf diff --git a/dabo/fetch-ohlcv-candles-indicators.sh b/dabo/fetch-ohlcv-candles-indicators.sh index f496585..d1a82ae 100755 --- a/dabo/fetch-ohlcv-candles-indicators.sh +++ b/dabo/fetch-ohlcv-candles-indicators.sh @@ -1,5 +1,24 @@ #!/bin/bash +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + + . /dabo/dabo-prep.sh interval=$1 diff --git a/dabo/fetch-orders.sh b/dabo/fetch-orders.sh index b0bc400..d4f896f 100755 --- a/dabo/fetch-orders.sh +++ b/dabo/fetch-orders.sh @@ -1,5 +1,24 @@ #!/bin/bash +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + + . /dabo/dabo-prep.sh while true diff --git a/dabo/fetch-symbols_ticker.sh b/dabo/fetch-symbols_ticker.sh index abc9417..57e3b7b 100755 --- a/dabo/fetch-symbols_ticker.sh +++ b/dabo/fetch-symbols_ticker.sh @@ -1,5 +1,24 @@ #!/bin/bash +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + + . /dabo/dabo-prep.sh while true diff --git a/dabo/fetch-transaction-history.sh b/dabo/fetch-transaction-history.sh index 1f0fee4..5d62988 100755 --- a/dabo/fetch-transaction-history.sh +++ b/dabo/fetch-transaction-history.sh @@ -1,5 +1,24 @@ #!/bin/bash +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + + . /dabo/dabo-prep.sh sleep 1800 diff --git a/dabo/functions/calc_ema.sh b/dabo/functions/calc_ema.sh index 5187ecb..1625c0f 100644 --- a/dabo/functions/calc_ema.sh +++ b/dabo/functions/calc_ema.sh @@ -1,3 +1,23 @@ +#!/bin/bash + +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + function calc_ema { g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@" diff --git a/dabo/functions/calc_macd.sh b/dabo/functions/calc_macd.sh index 022c4dd..0c52974 100644 --- a/dabo/functions/calc_macd.sh +++ b/dabo/functions/calc_macd.sh @@ -1,4 +1,23 @@ #!/bin/bash + +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + function calc_macd { g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@" diff --git a/dabo/functions/calc_rsi.sh b/dabo/functions/calc_rsi.sh index 93e9539..5130b0a 100644 --- a/dabo/functions/calc_rsi.sh +++ b/dabo/functions/calc_rsi.sh @@ -1,3 +1,23 @@ +#!/bin/bash + +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + function calc_rsi { g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@" diff --git a/dabo/functions/ccxt.sh b/dabo/functions/ccxt.sh index 8d9dfb3..9995ecf 100644 --- a/dabo/functions/ccxt.sh +++ b/dabo/functions/ccxt.sh @@ -1,3 +1,23 @@ +#!/bin/bash + +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + function f_ccxt { g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@" @@ -37,7 +57,7 @@ function f_ccxt { if [[ $TESTNET = true ]] then g_echo_note "ATTENTION: RUNNING IN TESTNET/SIMULATION/MOCK MODE OF EXCHANGE ${STOCK_EXCHANGE}!!!" - g_python "exchange.set_sandbox_mode(True)" || return 1 + g_python "${STOCK_EXCHANGE}.set_sandbox_mode(True)" || return 1 fi g_python "${STOCK_EXCHANGE}markets=${STOCK_EXCHANGE}.load_markets()" || return 1 f_ccxt_initialized="${f_ccxt_initialized}${STOCK_EXCHANGE}," @@ -70,7 +90,7 @@ function f_ccxt { # make the output jq-conform if json poutput # avoids errors like: "parse error: Invalid numeric literal at" f_ccxt_result=$(echo $f_ccxt_result | sed "s/'/\"/g; s/ None/ null/g; s/ True/ true/g; s/ False/ false/g; s/,,/,/g") - # sed is needed here because bash parameter substitution like down here hands with 100% cpu usage if the variable is large. Noticed with output about ~2.5M + # sed is needed here because bash parameter substitution like down here hangs with 100% cpu usage if the variable is large. Noticed with output about ~2.5M #f_ccxt_result=${f_ccxt_result//\'/\"} #f_ccxt_result=${f_ccxt_result// None/ null} #f_ccxt_result=${f_ccxt_result// True/ true} diff --git a/dabo/functions/charts.sh b/dabo/functions/charts.sh index 9caea5d..7d091b9 100644 --- a/dabo/functions/charts.sh +++ b/dabo/functions/charts.sh @@ -1,3 +1,23 @@ +#!/bin/bash + +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + function charts { if ! find ../lightweight-charts.standalone.production.js -mtime -1 2>/dev/null | grep -q "lightweight-charts.standalone.production.js" then diff --git a/dabo/functions/check_buy_conditions.sh b/dabo/functions/check_buy_conditions.sh index c54e846..423671b 100644 --- a/dabo/functions/check_buy_conditions.sh +++ b/dabo/functions/check_buy_conditions.sh @@ -1,3 +1,23 @@ +#!/bin/bash + +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + function check_buy_conditions { local f_ASSET_HIST_FILE="$1" diff --git a/dabo/functions/check_for_buy.sh b/dabo/functions/check_for_buy.sh index f5153c6..3b13d57 100644 --- a/dabo/functions/check_for_buy.sh +++ b/dabo/functions/check_for_buy.sh @@ -1,3 +1,23 @@ +#!/bin/bash + +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + function check_for_buy { g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@" diff --git a/dabo/functions/check_for_sell.sh b/dabo/functions/check_for_sell.sh index eae279d..e8dd4bd 100644 --- a/dabo/functions/check_for_sell.sh +++ b/dabo/functions/check_for_sell.sh @@ -1,3 +1,23 @@ +#!/bin/bash + +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + function check_for_sell { g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@" diff --git a/dabo/functions/check_sell_conditions.sh b/dabo/functions/check_sell_conditions.sh index c4c1232..10053ea 100644 --- a/dabo/functions/check_sell_conditions.sh +++ b/dabo/functions/check_sell_conditions.sh @@ -1,3 +1,23 @@ +#!/bin/bash + +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + function check_sell_conditions { local f_ASSET_HIST_FILE="$1" diff --git a/dabo/functions/currency_converter.sh b/dabo/functions/currency_converter.sh index 581c0f9..6ac0114 100644 --- a/dabo/functions/currency_converter.sh +++ b/dabo/functions/currency_converter.sh @@ -1,6 +1,26 @@ +#!/bin/bash + +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + function currency_converter { - #g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@" + g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@" local f_currency_amount=$1 local f_currency=$2 @@ -11,6 +31,13 @@ function currency_converter { local f_line f_rate f_histfile f_date_array f_stablecoin f_reverse + if [[ $f_currency_target =~ ^20.*-.*: ]] + then + g_echo_warn "${FUNCNAME}: Invalid target $f_currency_target" + g_traceback + return 1 + fi + # get current date if none given [ -z "$f_currency_date" ] && printf -v f_currency_date '%(%Y-%m-%d %H:%M:%S)T' diff --git a/dabo/functions/genchart.sh b/dabo/functions/genchart.sh index 1a45e87..3174537 100644 --- a/dabo/functions/genchart.sh +++ b/dabo/functions/genchart.sh @@ -1,3 +1,23 @@ +#!/bin/bash + +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + function genchart { # generate css chart (line diagram) from csv file or simple file with number per line - needed charts.css included in webppage local mark diff --git a/dabo/functions/get_asset.sh b/dabo/functions/get_asset.sh index 59be79c..e36beb7 100644 --- a/dabo/functions/get_asset.sh +++ b/dabo/functions/get_asset.sh @@ -1,3 +1,23 @@ +#!/bin/bash + +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + function get_asset { g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@" diff --git a/dabo/functions/get_balance.sh b/dabo/functions/get_balance.sh index 1b8e58e..c8bcdb7 100644 --- a/dabo/functions/get_balance.sh +++ b/dabo/functions/get_balance.sh @@ -1,3 +1,23 @@ +#!/bin/bash + +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + function get_balance { g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@" diff --git a/dabo/functions/get_bitpanda_api_transactions.sh b/dabo/functions/get_bitpanda_api_transactions.sh index 4eb534b..aff8336 100644 --- a/dabo/functions/get_bitpanda_api_transactions.sh +++ b/dabo/functions/get_bitpanda_api_transactions.sh @@ -1,3 +1,23 @@ +#!/bin/bash + +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + function get_bitpanda_api_transactions { g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@" diff --git a/dabo/functions/get_coingecko_data.sh b/dabo/functions/get_coingecko_data.sh index 93779f9..97d6493 100644 --- a/dabo/functions/get_coingecko_data.sh +++ b/dabo/functions/get_coingecko_data.sh @@ -1,3 +1,23 @@ +#!/bin/bash + +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + function get_coingecko_data { # get data from coingecko local f_gecko_currencies="usd eur" diff --git a/dabo/functions/get_ema.sh b/dabo/functions/get_ema.sh index 9e316d6..196364f 100644 --- a/dabo/functions/get_ema.sh +++ b/dabo/functions/get_ema.sh @@ -1,3 +1,23 @@ +#!/bin/bash + +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + function get_ema { local f_hist_file="$1" diff --git a/dabo/functions/get_indicators.sh b/dabo/functions/get_indicators.sh index 6398aa0..8fc6aa7 100644 --- a/dabo/functions/get_indicators.sh +++ b/dabo/functions/get_indicators.sh @@ -1,3 +1,23 @@ +#!/bin/bash + +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + function get_indicators_all { g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@" diff --git a/dabo/functions/get_justtrade_csv_transactions.sh b/dabo/functions/get_justtrade_csv_transactions.sh index d28d802..8eb2904 100644 --- a/dabo/functions/get_justtrade_csv_transactions.sh +++ b/dabo/functions/get_justtrade_csv_transactions.sh @@ -1,3 +1,23 @@ +#!/bin/bash + +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + function get_justtrade_csv_transactions { g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@" diff --git a/dabo/functions/get_levels.sh b/dabo/functions/get_levels.sh index f58f0ba..14a1d7a 100644 --- a/dabo/functions/get_levels.sh +++ b/dabo/functions/get_levels.sh @@ -1,9 +1,28 @@ #!/bin/bash +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + + function get_levels_all { g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@" - local f_levelsfile f_level f_symbol f_symbol_in_array f_price + local f_levelsfile f_level f_symbol f_symbol_in_array t_timeframe f_lines $f_relevant_lines get_symbols_ticker for f_symbol in "${f_symbols_array_trade[@]}" @@ -11,56 +30,67 @@ function get_levels_all { f_symbol=${f_symbol%%:*} f_symbol=${f_symbol//\/} - # check for data files - for f_levelsfile in "asset-histories/${f_symbol}.history.1d.csv" "asset-histories/${f_symbol}.history.4h.csv" "asset-histories/${f_symbol}.history.15m.csv" - do - [ -s "$f_levelsfile" ] || continue 2 - done - - # define target file - f_levelsfile="asset-histories/${f_symbol}.history.csv" - printf '%(%Y-%m-%d %H:%M:%S)T' >"${f_levelsfile}.levels-calculating" - g_echo_note "Estimating relevant levels of $f_symbol" - # get current price to reduce the range, save cpu-power and time f_symbol_in_array=${f_symbol/ /} f_price=${f_tickers_array[$f_symbol_in_array]} - # get relevant data max 30000 (+-15000) prices from current price - #mapfile -t f_prices < <((cut -d, -f3,4,5 "asset-histories/${f_symbol}.history.1d.csv" "asset-histories/${f_symbol}.history.4h.csv" "asset-histories/${f_symbol}.history.15m.csv" ; echo $f_price) | sed 's/,/\n/g' | sort -rnu | grep -C 15000 "^${f_price}$") - mapfile -t f_prices < <((cut -d, -f5 "asset-histories/${f_symbol}.history.1d.csv" "asset-histories/${f_symbol}.history.4h.csv" "asset-histories/${f_symbol}.history.15m.csv" ; echo $f_price) | sed 's/,/\n/g' | sort -rnu | grep -C 15000 "^${f_price}$") - - # calculate levels - get_levels && printf '%(%Y-%m-%d %H:%M:%S)T' >"${f_levelsfile}.levels-calculated" - rm -f "${f_levelsfile}.levels-calculating" - - # write new levels file - for f_level in "${f_levels[@]}" + for f_timeframe in 1w 1d #4h 1h 15m do - echo $f_level - done >"${f_levelsfile}.levels.new" - mv "${f_levelsfile}.levels.new" "${f_levelsfile}.levels" + + f_levelsfile="asset-histories/${f_symbol}.history.$f_timeframe.csv" + printf '%(%Y-%m-%d %H:%M:%S)T' >"${f_levelsfile}.levels-calculating" + g_echo_note "Estimating relevant levels of $f_levelsfile" + + get_levels "$f_levelsfile" && printf '%(%Y-%m-%d %H:%M:%S)T' >"${f_levelsfile}.levels-calculated" + + echo "${f_levels[@]}" >"${f_levelsfile}.levels.new" + mv "${f_levelsfile}.levels.new" "${f_levelsfile}.levels" + + echo "${f_zones[@]}" >"${f_levelsfile}.zones.new" + mv "${f_levelsfile}.zones.new" "${f_levelsfile}.zones" + + done + done } function get_levels { - + # estimates the relevant levels from price list from array f_prices and put then in array f_levels - # - needs array $f_prices with prices sorted from low to high and no duplicates (sort -nru) to analyze + # needs levels csv file with prices in ohlcv g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@" + + local f_levelsfile=$1 + if ! [ -s "$f_levelsfile" ] + then + g_echo_warn "file $f_levelsfile does not exist or is empty" + return 1 + fi + + # get number of lines in file and use only half of these numbers as relevant price lines to speed up things - later nearest numbers to the current price + f_lines=$(wc -l "${f_levelsfile}" | cut -d" " -f1) + f_relevant_lines=$(( $f_lines * 4 / 5 )) + [ $f_relevant_lines -gt 1000 ] && f_relevant_lines=1000 + + # read high, low and close, sort and use only relevant lines (near current price) + mapfile -t f_prices < <((cut -d, -f2,3,4,5 "$f_levelsfile" ; echo $f_price) | sed 's/,/\n/g' | sort -rnu | grep -C $f_relevant_lines "^${f_price}$") # if there is not enough or no price data - [ -z "${f_prices[100]}" ] && return 1 + if [ -z "${f_prices[100]}" ] + then + g_echo_note "not enough or no price data" + return 1 + fi # reset old levels var unset f_levels local f_min_occurrences i j f_level f_level_count f_level_prices f_level_first_price f_baseprice f_threshold_test - # some key points +# # some key points local f_lowest_price=${f_prices[-1]} local f_highest_price=${f_prices[1]} local f_number_of_prices=${#f_prices[@]} @@ -69,34 +99,64 @@ function get_levels { # calc threshold (avarage of percentual price difference) local f_price_range_percentage=${g_percentage_diff_result//-/} - g_calc "$f_price_range_percentage / $f_number_of_prices / 100" || return 1 - local f_threshold=$g_calc_result - # calc threshold in range (1/100 of percentual range) - g_calc "$f_price_range_percentage / 100" || return 1 - local f_threshold_in_range=$g_calc_result - - #echo "$f_threshold_in_range - $f_threshold - $f_price_range_percentage" - #return 0 +# g_calc "$f_price_range_percentage / $f_number_of_prices * 0.07" || return 1 +# local f_threshold=$g_calc_result +# # calc threshold in range (1/100 of percentual range) +# g_calc "$f_threshold * 11 " || return 1 +# local f_threshold_in_range=$g_calc_result - # how much occurencies / same prices have so show up for a defined level - percentage from number of prices - #local f_min_occurrences=3 - g_calc "$f_number_of_prices / 100 * 0.2" || return 1 - local f_min_occurrences=$g_calc_result + # how much occurencies / same prices have so show up for a defined level + local f_min_occurrences=7 + if [[ $f_levelsfile =~ \.1w\. ]] + then + g_calc "$f_price_range_percentage / $f_number_of_prices * 0.07" || return 1 + local f_threshold=$g_calc_result + g_calc "$f_threshold * 11 " || return 1 + local f_threshold_in_range=$g_calc_result + #f_threshold="0.0018" + #f_threshold_in_range="0.18" + f_min_occurrences=1 + fi + if [[ $f_levelsfile =~ \.1d\. ]] + then + g_calc "$f_price_range_percentage / $f_number_of_prices * 0.33" || return 1 + local f_threshold=$g_calc_result + g_calc "$f_threshold * 11 " || return 1 + local f_threshold_in_range=$g_calc_result + #f_threshold="0.009" + #f_threshold_in_range="0.09" + f_min_occurrences=7 + fi + if [[ $f_levelsfile =~ \.1h\.|\.4h\. ]] + then + #f_threshold="0.03" + #f_threshold_in_range="0.04" + f_min_occurrences=9 + fi + if [[ $f_levelsfile =~ \.15m\.|\.5m\. ]] + then + #f_threshold="0.01" + #f_threshold_in_range="0.03" + f_min_occurrences=11 + fi + echo "f_threshold_in_range $f_threshold_in_range - f_threshold $f_threshold - f_price_range_percentage $f_price_range_percentage - f_min_occurrences $f_min_occurrences - f_number_of_prices $f_number_of_prices" # Loop through the f_prices and compare each number with the next for ((i=0; i<${#f_prices[@]}-1; i++)) do #echo "$i of ${#f_prices[@]}" - # pair this and next elemtn + # pair this and next element j=$((i+1)) f_threshold_test=$f_threshold f_baseprice=${f_prices[i]} - # if we are in a level use first price of level + # if we are in a level use current avarage price of level if [ -n "$f_level_count" ] then + #g_calc "($f_level_prices)/$f_level_count" + #f_baseprice=$g_calc_result f_baseprice=$f_level_first_price f_threshold_test=$f_threshold_in_range fi @@ -108,13 +168,17 @@ function get_levels { if [ -z "$f_level_count" ] then # new level + unset f_zone f_level_count=2 f_level_prices="${f_prices[i]}+${f_prices[j]}" f_level_first_price=${f_prices[i]} + f_zone+=("${f_prices[i]}") + f_zone+=("${f_prices[j]}") else # add values to level f_level_count=$((f_level_count+1)) f_level_prices="$f_level_prices+${f_prices[j]}" + f_zone+=("${f_prices[j]}") fi #echo "level ($f_level_count): $f_level_prices" else @@ -124,9 +188,11 @@ function get_levels { #if [ "$f_level_count" -ge "$f_min_occurrences" ] if g_num_is_higher_equal $f_level_count $f_min_occurrences then - g_calc "($f_level_prices)/$f_level_count" - f_levels+=("$g_calc_result") - g_echo_note "adding significant level at $g_calc_result after reaching $f_level_count times" + g_median ${f_zone[@]} + f_levels+=("$g_median_result") + f_zones+=("${f_zone[0]},${f_zone[-1]},$f_level_count") + g_echo_note "adding significant zone at level $g_median_result after reaching $f_level_count times - Zone: ${f_zone[0]} - ${f_zone[-1]}" + fi f_level_prices="" f_level_count="" diff --git a/dabo/functions/get_marketdata.sh b/dabo/functions/get_marketdata.sh index bffefb7..596cac1 100644 --- a/dabo/functions/get_marketdata.sh +++ b/dabo/functions/get_marketdata.sh @@ -1,7 +1,31 @@ +#!/bin/bash + +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + function get_marketdata { g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@" + +### CPI Data: curl hapi.bls.gov/publicAPI/v2/timeseries/data/cpi | jq -a +### release dates: https://www.bls.gov/schedule/news_release/bls.ics + get_marketdata_from_url https://www.investing.com/economic-calendar/unemployment-rate-300/ US-UNEMPLOYMENT-INDEX get_marketdata_from_url https://www.investing.com/economic-calendar/cpi-733 US-CONSUMER-PRICE-INDEX get_marketdata_from_url https://www.investing.com/indices/fed-funds-composite-interest-rate-opinion US-FED-FEDERAL-FUNDS-RATE-INVERTED-INDEX diff --git a/dabo/functions/get_marketdata_yahoo.sh b/dabo/functions/get_marketdata_yahoo.sh index 9bdcf37..ec25df9 100644 --- a/dabo/functions/get_marketdata_yahoo.sh +++ b/dabo/functions/get_marketdata_yahoo.sh @@ -1,3 +1,23 @@ +#!/bin/bash + +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + function get_marketdata_yahoo { g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@" @@ -59,8 +79,11 @@ function get_marketdata_yahoo { [[ $f_item = "DEFI-USD" ]] && f_item="DEFI29200-USD" [[ $f_item = "TON-USD" ]] && f_item="TON11419-USD" [[ $f_item = "BRETT-USD" ]] && f_item="BRETT29743-USD" - [[ $f_item = "ADS-USD" ]] && f_item="%24ADS-USD" + #[[ $f_item = "ADS-USD" ]] && f_item="%24ADS-USD" + [[ $f_item = "AIT-USD" ]] && f_item="AIT28882-USD" [[ $f_item = "PT-USD" ]] && f_item="PT28582-USD" + [[ $f_item = "BLAST-USD" ]] && f_item="BLAST28480-USD" + [[ $f_item = "GRT-USD" ]] && f_item="GRT6719-USD" # end if already failed the last 5 minutes if [ -f "FAILED_YAHOO/${f_name}_HISTORIC_DOWNLOAD" ] @@ -85,6 +108,10 @@ function get_marketdata_yahoo { if [ "$f_timeframe" = "1d" ] || [ "$f_timeframe" = "1wk" ] || [ "$f_timeframe" = "1mo" ] then + # restrict to finished candles + [ "$f_timeframe" = "1d" ] && f_sec=$(TZ=US/NY date -d 'last day 0:00' '+%s') + [ "$f_timeframe" = "1wk" ] && f_sec=$(TZ=US/NY date -d 'last monday 0:00' '+%s') + [ "$f_timeframe" = "1mo" ] && f_sec=$(TZ=US/NY date -d "$(date -d "@$(date -d "last month" +%s)" +'%Y-%m-01')" +%s) # Download historical data from yahoo g_wget -O "${f_targetcsvtmp}" "https://query1.finance.yahoo.com/v7/finance/download/${f_item}?period1=0&period2=${f_sec}&interval=${f_timeframe}&events=history" 2>"${f_targetcsvtmp}".err else @@ -121,7 +148,7 @@ function get_marketdata_yahoo { # put the csvs together if [ -s "${f_targetcsv}" ] && [ -s "${f_targetcsvtmp}" ] then - egrep -h "^[1-9][0-9][0-9][0-9]-[0-1][0-9]-[0-9][0-9].*,[0-9]" "${f_targetcsvtmp}" "${f_targetcsv}" | sort -k1,2 -t, -u >"${f_targetcsv}.tmp" + egrep -h "^[1-9][0-9][0-9][0-9]-[0-1][0-9]-[0-9][0-9].*,[0-9]" "${f_targetcsv}" "${f_targetcsvtmp}" | sort -k1,2 -t, -u | sort -k1,1 -t, -u >"${f_targetcsv}.tmp" mv "${f_targetcsv}.tmp" "${f_targetcsv}" else egrep -h "^[1-9][0-9][0-9][0-9]-[0-1][0-9]-[0-9][0-9].*,[0-9]" "${f_targetcsvtmp}" | sort -k1,2 -t, -u >"$f_targetcsv" diff --git a/dabo/functions/get_ohlcv-candle.sh b/dabo/functions/get_ohlcv-candle.sh index c196475..4208f84 100644 --- a/dabo/functions/get_ohlcv-candle.sh +++ b/dabo/functions/get_ohlcv-candle.sh @@ -1,3 +1,23 @@ +#!/bin/bash + +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + function get_ohlcv-candles { g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@" @@ -7,9 +27,8 @@ function get_ohlcv-candles { [ -n $1 ] && f_timeframes=$1 # fetch economy candles from yahoo finance - local f_eco_assets="DXY DOWJONES SP500 NASDAQ MSCIEAFE 10YRTREASURY OIL GOLD MSCIWORLD OILGAS KRE EUR-USD" local f_eco_asset - for f_eco_asset in $f_eco_assets + for f_eco_asset in $ECO_ASSETS do for f_timeframe in $f_timeframes do diff --git a/dabo/functions/get_onetrading_csv_transactions.sh b/dabo/functions/get_onetrading_csv_transactions.sh index dc5ff68..3d2ebba 100644 --- a/dabo/functions/get_onetrading_csv_transactions.sh +++ b/dabo/functions/get_onetrading_csv_transactions.sh @@ -1,3 +1,23 @@ +#!/bin/bash + +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + function get_onetrading_csv_transactions { g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@" diff --git a/dabo/functions/get_orders.sh b/dabo/functions/get_orders.sh index ceb66a9..7b45314 100644 --- a/dabo/functions/get_orders.sh +++ b/dabo/functions/get_orders.sh @@ -1,3 +1,23 @@ +#!/bin/bash + +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + function get_orders { g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@" diff --git a/dabo/functions/get_positions.sh b/dabo/functions/get_positions.sh index 56f74cf..f5dc4e2 100644 --- a/dabo/functions/get_positions.sh +++ b/dabo/functions/get_positions.sh @@ -1,9 +1,31 @@ +#!/bin/bash + +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + function get_positions { g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@" local f_symbol f_symbols + get_symbols_ticker + # build python array of symbols for f_symbol in "${f_symbols_array_trade[@]}" do diff --git a/dabo/functions/get_range.sh b/dabo/functions/get_range.sh index 8ea2a2f..32ac0bc 100644 --- a/dabo/functions/get_range.sh +++ b/dabo/functions/get_range.sh @@ -1,5 +1,24 @@ #!/bin/bash +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + + function get_range { #g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@" diff --git a/dabo/functions/get_rsi_indicator.sh b/dabo/functions/get_rsi_indicator.sh index 5465bb8..14f7adc 100644 --- a/dabo/functions/get_rsi_indicator.sh +++ b/dabo/functions/get_rsi_indicator.sh @@ -1,3 +1,23 @@ +#!/bin/bash + +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + function get_rsi_indicator { #g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@" # get histfile diff --git a/dabo/functions/get_symbols_ticker.sh b/dabo/functions/get_symbols_ticker.sh index 3e84dd0..e5997bc 100644 --- a/dabo/functions/get_symbols_ticker.sh +++ b/dabo/functions/get_symbols_ticker.sh @@ -1,3 +1,23 @@ +#!/bin/bash + +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + function get_symbols_ticker { g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@" diff --git a/dabo/functions/get_transactions.sh b/dabo/functions/get_transactions.sh index 317b099..86617ae 100644 --- a/dabo/functions/get_transactions.sh +++ b/dabo/functions/get_transactions.sh @@ -1,8 +1,28 @@ +#!/bin/bash + +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + function get_transactions { g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@" - local f_exchange f_symbol f_symbol_file f_asset f_currency f_leverage f_convert_end_month f_convert_end_year f_symbol_file_csv f_symbol_file_csv_tmp f_start_date f_end_date f_convert_file f_fiat f_fiats + local f_exchange f_symbol f_symbol_file f_asset f_currency f_leverage f_convert_end_month f_convert_end_year f_symbol_file_csv f_symbol_file_csv_tmp f_start_date f_end_date f_convert_file f_fiat f_fiats f_return local DEFAULT_STOCK_EXCHANGE=$STOCK_EXCHANGE local DEFAULT_LEVERAGE=$LEVERAGE @@ -50,15 +70,28 @@ function get_transactions { # fetch only if not exists [ -f "$f_symbol_file" ] && continue - g_echo_note "fetching closed orders of $f_symbol on $f_exchange" - f_ccxt "print(${STOCK_EXCHANGE}.fetchMyTrades(symbol='$f_symbol', limit=500, params={'paginate': True}))" || continue - - # write to file - #[[ $f_ccxt_result = \[\] ]] && f_ccxt_result="" + g_echo_note "fetching closed orders of $f_symbol on ${STOCK_EXCHANGE}" + + # fetch and reset/store return code + f_return="" + f_ccxt "print(${STOCK_EXCHANGE}.fetchMyTrades(symbol='$f_symbol', limit=500, params={'paginate': True}))" || f_return=1 + + # write result even if its failed/empty for timestamp echo -n $f_ccxt_result >"$f_symbol_file" - # continue if no trade - #[ -z "$f_ccxt_result" ] && continue + # continue if fetch failed/empty + if [ -n "$f_return" ] + then + g_echo_note "fetch of $f_symbol on ${STOCK_EXCHANGE} failed no json output or empty - no trades" + continue + fi + + # check output for symbol + if ! [[ $f_ccxt_result =~ $f_symbol ]] + then + g_echo_warn "unexpectet return in \"$f_symbol_file\" Symbol $f_symbol not present!?" + continue + fi # get f_asset+f_currency from symbol (BTC/USDT) g_array "$f_symbol" f_symbol_array / @@ -89,11 +122,21 @@ function get_transactions { fi # generate csv + + # get spot buy/sell (posSide=="1") + cat "$f_symbol_file" | jq -r " +.[] | + select(.side==\"buy\" or .side==\"sell\") | + select(.info.posSide=null) | + select(.symbol!= null) | +.datetime + \",$f_leverage\" + .side + \",$f_asset,\" + (.amount|tostring) + \",$f_currency,\" + (.cost|tostring) + \",$f_exchange,\" + .fee.currency + \",\" + (.fee.cost|tostring) +" >>"$f_symbol_file_csv_tmp" + # get longs (posSide=="1") cat "$f_symbol_file" | jq -r " .[] | select(.side==\"buy\" or .side==\"sell\") | - select(.info.posSide==\"1\") | + select(.info.posSide=\"1\") | select(.symbol!= null) | .datetime + \",$f_leverage\" + .side + \",$f_asset,\" + (.amount|tostring) + \",$f_currency,\" + (.cost|tostring) + \",$f_exchange,\" + .fee.currency + \",\" + (.fee.cost|tostring) " >>"$f_symbol_file_csv_tmp" @@ -101,21 +144,30 @@ function get_transactions { # get shorts (posSide=="2") sell first, then buy (https://github.com/ccxt/ccxt/issues/22518) cat "$f_symbol_file" | jq -r " .[] | - select(.side==\"sell\") | + select(.side==\"buy\" or .side==\"sell\") | select(.info.posSide==\"2\") | - select(.symbol!= null) | - .side = \"sell\" | + select(.symbol!=null) | .datetime + \",$f_leverage\" + .side + \",$f_asset,\" + (.amount|tostring) + \",$f_currency,\" + (.cost|tostring) + \",$f_exchange,\" + .fee.currency + \",\" + (.fee.cost|tostring) + \",short\" " >>"$f_symbol_file_csv_tmp" - cat "$f_symbol_file" | jq -r " -.[] | - select(.side==\"buy\") | - select(.info.posSide==\"2\") | - select(.symbol!= null) | - .side = \"buy\" | -.datetime + \",$f_leverage\" + .side + \",$f_asset,\" + (.amount|tostring) + \",$f_currency,\" + (.cost|tostring) + \",$f_exchange,\" + .fee.currency + \",\" + (.fee.cost|tostring) + \",short\" -" >>"$f_symbol_file_csv_tmp" +# # get shorts (posSide=="2") sell first, then buy (https://github.com/ccxt/ccxt/issues/22518) +# cat "$f_symbol_file" | jq -r " +#.[] | +# select(.side==\"sell\") | +# select(.info.posSide==\"2\") | +# select(.symbol!=null) | +# .side = \"sell\" | +#.datetime + \",$f_leverage\" + .side + \",$f_asset,\" + (.amount|tostring) + \",$f_currency,\" + (.cost|tostring) + \",$f_exchange,\" + .fee.currency + \",\" + (.fee.cost|tostring) + \",short\" +#" >>"$f_symbol_file_csv_tmp" +# +# cat "$f_symbol_file" | jq -r " +#.[] | +# select(.side==\"buy\") | +# select(.info.posSide==\"2\") | +# select(.symbol!=null) | +# .side = \"buy\" | +#.datetime + \",$f_leverage\" + .side + \",$f_asset,\" + (.amount|tostring) + \",$f_currency,\" + (.cost|tostring) + \",$f_exchange,\" + .fee.currency + \",\" + (.fee.cost|tostring) + \",short\" +#" >>"$f_symbol_file_csv_tmp" if [ -s "$f_symbol_file_csv_tmp" ] then diff --git a/dabo/functions/get_values.sh b/dabo/functions/get_values.sh new file mode 100644 index 0000000..76676ad --- /dev/null +++ b/dabo/functions/get_values.sh @@ -0,0 +1,83 @@ +#!/bin/bash + +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + +function get_values { + + local f_assets="$@" + f_assets=${f_assets//:$CURRENCY/} + f_assets=${f_assets//\//} + + local f_eco_asset f_eco_assets f_asset f_time f_prefix f_histfile f_columns f_return f_levelsfile f_tmp_levels f_first + + for f_eco_asset in $ECO_ASSETS + do + if [ -z "$f_eco_assets" ] + then + f_eco_assets="ECONOMY-${f_eco_asset}" + else + f_eco_assets="$f_eco_assets ECONOMY-${f_eco_asset}" + fi + done + + # get current prices + get_symbols_ticker + # get values from csv files + f_first=true + for f_asset in $f_assets BTC${CURRENCY} $f_eco_assets + do + + # read latest ohlcv data and indicators per timeframe to vars + for f_time in 5m 15m 1h 4h 1d 1w + do + f_prefix="${f_asset}_${f_time}_" + [ "$f_first" = "true" ] && f_prefix="${f_time}_" + f_prefix=${f_prefix//-/_} + f_histfile="asset-histories/${f_asset}.history.${f_time}.csv" + if ! [ -s "$f_histfile" ] + then + g_echo_warn "file $f_histfile emty or does not exist" + f_return=1 + continue + fi + f_columns="${f_prefix}date,${f_prefix}open,${f_prefix}high,${f_prefix}low,${f_prefix}close,${f_prefix}volume,${f_prefix}change,${f_prefix}ath,${f_prefix}ema12,${f_prefix}ema26,${f_prefix}ema50,${f_prefix}ema100,${f_prefix}ema200,${f_prefix}ema400,${f_prefix}ema800,${f_prefix}rsi5,${f_prefix}rsi14,${f_prefix}rsi21,${f_prefix}macd,${f_prefix}macd_ema9_signal,${f_prefix}macd_histogram,${f_prefix}macd_histogram_signal,${f_prefix}macd_histogram_max,${f_prefix}macd_histogram_strength" + g_read_csv "${f_histfile}" 1 "$f_columns" + done + + # read current levels and price + f_levelsfile="asset-histories/${f_asset}.history.csv.levels" + if [ "$f_first" = "true" ] + then + [ -s "$f_levelsfile" ] && v_levels="$(cat "$f_levelsfile")" + v_price=${f_tickers_array[$f_asset]} + else + [ -s "$f_levelsfile" ] && declare -g v_${f_asset}_levels="$(cat "$f_levelsfile")" + [[ $f_asset =~ ECONOMY ]] || declare -g v_${f_asset}_price="${f_tickers_array[$f_asset]}" + fi + + unset f_first + + done + + + set 2>&1 | grep ^v_ | grep -v ^v_csv_array_associative >values + + return $f_return +} + diff --git a/dabo/functions/get_vars_from_csv.sh b/dabo/functions/get_vars_from_csv.sh index 50993f9..5a4de9e 100644 --- a/dabo/functions/get_vars_from_csv.sh +++ b/dabo/functions/get_vars_from_csv.sh @@ -1,3 +1,23 @@ +#!/bin/bash + +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + function get_vars_from_csv { unset f_empty_var diff --git a/dabo/functions/market_performance.sh b/dabo/functions/market_performance.sh index e0fdd29..0c10952 100644 --- a/dabo/functions/market_performance.sh +++ b/dabo/functions/market_performance.sh @@ -1,3 +1,23 @@ +#!/bin/bash + +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + function market_performance { g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@" diff --git a/dabo/functions/order.sh b/dabo/functions/order.sh index d5431ab..8a0d3c7 100644 --- a/dabo/functions/order.sh +++ b/dabo/functions/order.sh @@ -1,3 +1,23 @@ +#!/bin/bash + +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + function order { # Info for log g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@" diff --git a/dabo/functions/position_close.sh b/dabo/functions/position_close.sh index 5841ce5..35da028 100644 --- a/dabo/functions/position_close.sh +++ b/dabo/functions/position_close.sh @@ -1,3 +1,23 @@ +#!/bin/bash + +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + function position_close { # Info for log g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@" diff --git a/dabo/functions/score.sh b/dabo/functions/score.sh index 31df7c1..17d59cf 100644 --- a/dabo/functions/score.sh +++ b/dabo/functions/score.sh @@ -1,3 +1,23 @@ +#!/bin/bash + +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + function score { [ -z "${s_score}" ] && s_score=0 #s_score=$((s_score${1})) @@ -7,3 +27,4 @@ function score { s_score_hist="${s_score_hist} s_score=${s_score} (${1}) ${2}" } + diff --git a/dabo/functions/strategy.sh b/dabo/functions/strategy.sh new file mode 100644 index 0000000..f020a6c --- /dev/null +++ b/dabo/functions/strategy.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + +function strategy { + + unset s_score + unset s_SYMBOLS + + #find + #. "${f_strategy}" || return 1 + + get_values + get_symbols_ticker + + for f_symbol in "${f_symbols_array_trade[@]}" + do + echo $f_symbol + get_values $f_symbol + done + + + echo "Score: $s_score" + echo $s_score_hist + +} + diff --git a/dabo/functions/transactions_overview.sh b/dabo/functions/transactions_overview.sh index 3b7092b..9a16c5b 100644 --- a/dabo/functions/transactions_overview.sh +++ b/dabo/functions/transactions_overview.sh @@ -1,3 +1,23 @@ +#!/bin/bash + +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + function transactions_overview { g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@" @@ -21,7 +41,11 @@ function transactions_overview { mapfile -d, -t f_asset_per_exchange_array < <(echo $f_asset_per_exchange) f_asset=${f_asset_per_exchange_array[0]} f_exchange=${f_asset_per_exchange_array[1]%$'\n'} - + + # check values + [ -z "$f_asset" ] && continue + [ -z "$f_exchange" ] && continue + # Ignore stableCoins, EUR, USD [[ $f_asset = USDT ]] && continue [[ $f_asset = USDC ]] && continue @@ -51,6 +75,11 @@ function transactions_overview { f_type=${f_transaction_array[1]} f_asset_amount=${f_transaction_array[3]} f_currency=${f_transaction_array[4]} + if [ -z "$f_currency" ] + then + g_echo_warn "f_currency empty: $f_transaction" + continue + fi f_currency_amount=${f_transaction_array[5]} f_currency_amount_eur=0 f_fee_currency=${f_transaction_array[7]} diff --git a/dabo/functions/watch_assets.sh b/dabo/functions/watch_assets.sh index 8f9e438..b97cc81 100644 --- a/dabo/functions/watch_assets.sh +++ b/dabo/functions/watch_assets.sh @@ -1,3 +1,23 @@ +#!/bin/bash + +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + function watch_assets { local f_watch_assets_array diff --git a/dabo/functions/webpage.sh b/dabo/functions/webpage.sh index b6563f5..29c0cfd 100644 --- a/dabo/functions/webpage.sh +++ b/dabo/functions/webpage.sh @@ -1,3 +1,23 @@ +#!/bin/bash + +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + function webpage { g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@" diff --git a/dabo/functions/webpage_transactions.sh b/dabo/functions/webpage_transactions.sh index c86d140..f051fcd 100644 --- a/dabo/functions/webpage_transactions.sh +++ b/dabo/functions/webpage_transactions.sh @@ -1,3 +1,23 @@ +#!/bin/bash + +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + function webpage_transactions { # calculate totals from csv diff --git a/dabo/recalc-histories-example.sh b/dabo/recalc-histories-example.sh index 1592c6d..c0be2d1 100644 --- a/dabo/recalc-histories-example.sh +++ b/dabo/recalc-histories-example.sh @@ -1,4 +1,23 @@ -#!/bin/bash -e +#!/bin/bash + +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + . /etc/bash/gaboshlib.include diff --git a/dabo/recalc-times-before-example.sh b/dabo/recalc-times-before-example.sh index 8fe540d..d5b9586 100644 --- a/dabo/recalc-times-before-example.sh +++ b/dabo/recalc-times-before-example.sh @@ -1,4 +1,23 @@ -#!/bin/bash -e +#!/bin/bash + +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + . /etc/bash/gaboshlib.include diff --git a/dabo/restore-coingeckodata-example.sh b/dabo/restore-coingeckodata-example.sh index 98f22af..a869aa2 100644 --- a/dabo/restore-coingeckodata-example.sh +++ b/dabo/restore-coingeckodata-example.sh @@ -1,4 +1,23 @@ #!/bin/bash + +# Copyright (c) 2022-2024 olli +# +# This file is part of dabo (crypto bot). +# +# dabo 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. +# +# dabo 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 dabo. If not, see . + + mkdir final ls -1 *.history.csv | while read x do diff --git a/data/charts.js b/data/charts.js index 4100f37..47db6ad 100644 --- a/data/charts.js +++ b/data/charts.js @@ -1,6 +1,7 @@ const urlParams = new URLSearchParams(window.location.search); const symbol = urlParams.get('symbol'); const time = urlParams.get('time'); +const symbol2 = urlParams.get('symbol2'); const heightrsimacdchart = 100 @@ -163,7 +164,6 @@ const chartmacd = LightweightCharts.createChart(document.getElementById("contain }, height: heightrsimacdchart, - timeScale: { timeVisible: true, secondsVisible: false, @@ -306,10 +306,10 @@ fetch("/botdata/asset-histories/" + symbol + ".history." + time + ".csv", { cach // Lines for price levels -fetch("/botdata/asset-histories/" + symbol + ".history.csv.levels", { cache: 'no-store' }) +fetch("/botdata/asset-histories/" + symbol + ".history." + time + ".csv.levels", { cache: 'no-store' }) .then(response => response.text()) .then(text => { - const levels = text.split('\n'); + const levels = text.split(' '); levels.forEach(function(level) { candleSeries.createPriceLine({price: level, color: "blue", lineWidth: 0.5, lineStyle: 3, axisLabelVisible: true, title: 'Level'}); }); @@ -362,7 +362,7 @@ DXYchart.applyOptions({ horzAlign: 'top', vertAlign: 'left', color: '#DDD', - text: "DXY" + time, + text: symbol2 + " " + time, } }); @@ -415,7 +415,7 @@ const DXYlineSeriesRSI5 = DXYchartrsi.addLineSeries({ color: 'orange', lineWidth const DXYlineSeriesRSI14 = DXYchartrsi.addLineSeries({ color: 'yellow', lineWidth: 2, priceLineVisible: false, title: 'RSI14'}); const DXYlineSeriesRSI21 = DXYchartrsi.addLineSeries({ color: 'lightgreen', lineWidth: 1, lineStyle: 2, priceLineVisible: false, title: 'RSI21'}); -fetch("/botdata/asset-histories/ECONOMY-DXY.history." + time + ".csv", { cache: 'no-store' }) +fetch("/botdata/asset-histories/" + symbol2 + ".history." + time + ".csv", { cache: 'no-store' }) .then(response => response.text()) .then(data => { const DYXparsedData = parseCSV(data); @@ -540,6 +540,3 @@ DXYchart.subscribeCrosshairMove(param => { const dataPointmacd = getCrosshairDataPoint(DXYlineSeriesEMA50, param); syncCrosshair(chartmacd, lineSeriesMACD, dataPointrsi); }); - - - diff --git a/docker-compose.yml b/docker-compose.yml index 03ca304..9bc86e5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,8 +13,7 @@ services: # - ./watch-assets.csv:/dabo/watch-assets.csv - ./data:/dabo/htdocs:rw - ./home:/dabo/home:rw - - /usr/local/bin/notify.sh:/usr/local/bin/notify.sh:ro - - /usr/local/etc/notify.conf:/usr/local/etc/notify.conf:ro + - .notify.conf:/usr/local/etc/notify.conf:ro - /etc/localtime:/etc/localtime:ro deploy: resources: @@ -35,8 +34,7 @@ services: # - ./watch-assets.csv:/dabo/watch-assets.csv - ./data:/dabo/htdocs:rw - ./home:/dabo/home:rw - - /usr/local/bin/notify.sh:/usr/local/bin/notify.sh:ro - - /usr/local/etc/notify.conf:/usr/local/etc/notify.conf:ro + - ./notify.local.conf:/usr/local/etc/notify.conf:ro - /etc/localtime:/etc/localtime:ro entrypoint: /dabo/fetch-symbols_ticker.sh deploy: @@ -57,8 +55,7 @@ services: - ./dabo-bot.conf:/dabo/dabo-bot.override.conf - ./data:/dabo/htdocs:rw - ./home:/dabo/home:rw - - /usr/local/bin/notify.sh:/usr/local/bin/notify.sh:ro - - /usr/local/etc/notify.conf:/usr/local/etc/notify.conf:ro + - ./notify.local.conf:/usr/local/etc/notify.conf:ro - /etc/localtime:/etc/localtime:ro entrypoint: /dabo/fetch-ohlcv-candles-indicators.sh 5m 300 @@ -75,8 +72,7 @@ services: - ./dabo-bot.conf:/dabo/dabo-bot.override.conf - ./data:/dabo/htdocs:rw - ./home:/dabo/home:rw - - /usr/local/bin/notify.sh:/usr/local/bin/notify.sh:ro - - /usr/local/etc/notify.conf:/usr/local/etc/notify.conf:ro + - ./notify.local.conf:/usr/local/etc/notify.conf:ro - /etc/localtime:/etc/localtime:ro entrypoint: /dabo/fetch-ohlcv-candles-indicators.sh 15m 900 @@ -93,8 +89,7 @@ services: - ./dabo-bot.conf:/dabo/dabo-bot.override.conf - ./data:/dabo/htdocs:rw - ./home:/dabo/home:rw - - /usr/local/bin/notify.sh:/usr/local/bin/notify.sh:ro - - /usr/local/etc/notify.conf:/usr/local/etc/notify.conf:ro + - ./notify.local.conf:/usr/local/etc/notify.conf:ro - /etc/localtime:/etc/localtime:ro entrypoint: /dabo/fetch-ohlcv-candles-indicators.sh 1h 3600 @@ -111,8 +106,7 @@ services: - ./dabo-bot.conf:/dabo/dabo-bot.override.conf - ./data:/dabo/htdocs:rw - ./home:/dabo/home:rw - - /usr/local/bin/notify.sh:/usr/local/bin/notify.sh:ro - - /usr/local/etc/notify.conf:/usr/local/etc/notify.conf:ro + - ./notify.local.conf:/usr/local/etc/notify.conf:ro - /etc/localtime:/etc/localtime:ro entrypoint: /dabo/fetch-ohlcv-candles-indicators.sh 4h 3600 @@ -129,8 +123,7 @@ services: - ./dabo-bot.conf:/dabo/dabo-bot.override.conf - ./data:/dabo/htdocs:rw - ./home:/dabo/home:rw - - /usr/local/bin/notify.sh:/usr/local/bin/notify.sh:ro - - /usr/local/etc/notify.conf:/usr/local/etc/notify.conf:ro + - ./notify.local.conf:/usr/local/etc/notify.conf:ro - /etc/localtime:/etc/localtime:ro entrypoint: /dabo/fetch-ohlcv-candles-indicators.sh 1d @@ -147,8 +140,7 @@ services: - ./dabo-bot.conf:/dabo/dabo-bot.override.conf - ./data:/dabo/htdocs:rw - ./home:/dabo/home:rw - - /usr/local/bin/notify.sh:/usr/local/bin/notify.sh:ro - - /usr/local/etc/notify.conf:/usr/local/etc/notify.conf:ro + - ./notify.local.conf:/usr/local/etc/notify.conf:ro - /etc/localtime:/etc/localtime:ro entrypoint: /dabo/fetch-ohlcv-candles-indicators.sh 1w @@ -166,8 +158,7 @@ services: # - ./watch-assets.csv:/dabo/watch-assets.csv - ./data:/dabo/htdocs:rw - ./home:/dabo/home:rw - - /usr/local/bin/notify.sh:/usr/local/bin/notify.sh:ro - - /usr/local/etc/notify.conf:/usr/local/etc/notify.conf:ro + - ./notify.local.conf:/usr/local/etc/notify.conf:ro - /etc/localtime:/etc/localtime:ro entrypoint: /dabo/calc-indicators-hist.sh cpu_shares: 128 @@ -190,8 +181,7 @@ services: # - ./watch-assets.csv:/dabo/watch-assets.csv - ./data:/dabo/htdocs:rw - ./home:/dabo/home:rw - - /usr/local/bin/notify.sh:/usr/local/bin/notify.sh:ro - - /usr/local/etc/notify.conf:/usr/local/etc/notify.conf:ro + - ./notify.local.conf:/usr/local/etc/notify.conf:rw - /etc/localtime:/etc/localtime:ro entrypoint: /dabo/calc-levels.sh deploy: @@ -213,8 +203,7 @@ services: # - ./watch-assets.csv:/dabo/watch-assets.csv - ./data:/dabo/htdocs:rw - ./home:/dabo/home:rw - - /usr/local/bin/notify.sh:/usr/local/bin/notify.sh:ro - - /usr/local/etc/notify.conf:/usr/local/etc/notify.conf:ro + - ./notify.local.conf:/usr/local/etc/notify.conf:ro - /etc/localtime:/etc/localtime:ro entrypoint: /dabo/fetch-orders.sh deploy: @@ -236,8 +225,7 @@ services: # - ./watch-assets.csv:/dabo/watch-assets.csv - ./data:/dabo/htdocs:rw - ./home:/dabo/home:rw - - /usr/local/bin/notify.sh:/usr/local/bin/notify.sh:ro - - /usr/local/etc/notify.conf:/usr/local/etc/notify.conf:ro + - ./notify.local.conf:/usr/local/etc/notify.conf:ro - /etc/localtime:/etc/localtime:ro entrypoint: /dabo/fetch-transaction-history.sh cpu_shares: 128 @@ -260,8 +248,7 @@ services: ## - ./watch-assets.csv:/dabo/watch-assets.csv # - ./data:/dabo/htdocs:rw # - ./home:/dabo/home:rw -# - /usr/local/bin/notify.sh:/usr/local/bin/notify.sh:ro -# - /usr/local/etc/notify.conf:/usr/local/etc/notify.conf:ro +# - ./notify.local.conf:/usr/local/etc/notify.conf:ro # - /etc/localtime:/etc/localtime:ro # entrypoint: /dabo/test.sh # cpu_shares: 128 @@ -285,8 +272,7 @@ services: # - ./watch-assets.csv:/dabo/watch-assets.csv - ./data:/dabo/htdocs:rw - ./home:/dabo/home:rw - - /usr/local/bin/notify.sh:/usr/local/bin/notify.sh:ro - - /usr/local/etc/notify.conf:/usr/local/etc/notify.conf:ro + - ./notify.local.conf:/usr/local/etc/notify.conf:ro - /etc/localtime:/etc/localtime:ro entrypoint: /dabo/create_webpage.sh deploy: diff --git a/notify.conf b/notify.conf new file mode 100644 index 0000000..0d33ef7 --- /dev/null +++ b/notify.conf @@ -0,0 +1,2 @@ +tohost=sshuser@sshhost +default_togroup=message-group