diff --git a/.gitignore b/.gitignore index d49e96f..e08c794 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -bitsquare_files/ -settings.json +target/ +.DS_Store diff --git a/404.html b/404.html deleted file mode 100644 index a0b7cba..0000000 --- a/404.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - -

Sorry, the requested content does not exist.

- - - diff --git a/LICENSE b/LICENSE index 65c5ca8..dba13ed 100644 --- a/LICENSE +++ b/LICENSE @@ -1,165 +1,661 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 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. - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser 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 -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are 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. + + 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. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + 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 Affero 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. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + 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 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 work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero 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 Affero 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 Affero 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 Affero 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 Affero 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + 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 AGPL, see +. diff --git a/README.md b/README.md index 5abe315..9606950 100644 --- a/README.md +++ b/README.md @@ -1,43 +1,28 @@ -# Bisq Markets Website+API -A simple web interface to view Bisq markets. +# Bisq Markets API + +Visit https://markets.bisq.network/api for the current API documentation. + +## Architecture + +This new architecture replaces the previous Bisq node -> JSON file -> PHP frontend. We now use Risq behind a caching reverse-proxy on Google Appengine to serve Bisq Markets data. + +## Proxy Caching Scheme + +HTTP cache = 60 seconds +memcache = 60 seconds +datastore = forever +``` +if (full query URL key exists in memcache) + return response +else + if (query live node succeeds) + insert into memcache + datastore + return response + else // query failed + if (full query URL key exists in datastore) + return response + else // not in datastore + return 502 +``` +## Demo -This is a bare-bones implementation that reads the JSON files created by Bisq -and publishes an API for web clients to access them. - -# Performance, or lack thereof. - -At present, no database is used and backend operations are very inefficient. - -This is OK for the moment as there is little Bisq data, but the implementation -will need to be optimized when Bisq volume picks up. - -I have separated the data access classes such that it should be simple to plugin -more efficient strategies. - -# Requirements - -* Apache or other webserver with php 5.5+ -* opcache extension. ( for data caching. will run without, but much slower. ) - -# Installation - -On ubuntu apcu can be installed with: - - apt-get install php5-apcu - -The website code can then be installed by: - -1. git clone this repository to your docroot or somewhere beneath it. -2. cp settings.json.example settings.json -3. edit settings.json and edit the value of "data_dir" to reflect the location of -the Bisq data files on your system. -4. Make sure that Bisq is running with flag --dumpStatistics true - -Navigate in your browser to your webserver docroot. - -That's it! - - -# API - -For now, just check out the API subdirectory. docs are todo. diff --git a/VERSION b/VERSION deleted file mode 100644 index 14e419c..0000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -bisq_market-v1.4.13 diff --git a/api/.htaccess b/api/.htaccess deleted file mode 100644 index fbbd9f0..0000000 --- a/api/.htaccess +++ /dev/null @@ -1,27 +0,0 @@ - -## Goal: prevent apache from redirecting URLs of the form -## http://server/api/hloc?market=xmr_btc -## to -## http://server/api/hloc/?market=xmr_btc -## -## To achieve this, we must first disable DirectorySlash -## and then redirect all subdirectory requests to subdir/index.php -## -## Another problem then arises that the "/api" url does not redirect -## to "/api/". This is fixed by using AllowNoSlash option and -## adding a client-side redirect just for this url. -## -## Other requests are not affected. - -DirectorySlash Off - -RewriteEngine on -RewriteOptions AllowNoSlash - -RewriteCond "%{REQUEST_URI}" "(.*)/api$" -RewriteRule ^(.*)/api$ %1/api/ [R] - -RewriteCond "%{REQUEST_FILENAME}" -d -RewriteCond "%{REQUEST_FILENAME}" "^.*/api/[A-z]+$" -RewriteRule ^(.*)$ $1/index.php [L] - diff --git a/api/README.md b/api/README.md deleted file mode 100644 index 8c933d5..0000000 --- a/api/README.md +++ /dev/null @@ -1,94 +0,0 @@ -# bitsquare_market APIs - -These APIs are open to the public with no authorization required. - -# API - -## /api/hloc - -Retrieves high-low-open-close data according to criteria. - -Params: -* market: eg 'dash_btc'. required. -* format: json | jsonpretty | csv. default: jsonpretty. -* timestamp: yes | no. return date as a timestamp. default: yes -* interval: minute|hour|day|month. - default: choose based on from/to. -* timestamp_from: start of date range. unix timestamp. default: 1970. -* timestamp_to: end of date range. unix timestamp. default: now. -* endcaps: bool. add a fake row at start and end of data. default: 0 -* fillgaps: bool. add a fake row for each interval with no trades. default: 0 - -Sample Call and Result: - -``` -curl "http://markets.bisq.network/api/hloc/?market=eur_btc&interval=day" -[ - { - "period_start": "2016-04-20T00:00:00+00:00", - "open": 374.61, - "high": 374.61, - "low": 374.61, - "close": 374.61, - "volume": 0.01, - "avg": 374.61 - }, -... - { - "period_start": "2016-07-28T00:00:00+00:00", - "open": 605.31, - "high": 623.18, - "low": 605.31, - "close": 623.18, - "volume": 1.25, - "avg": 614.245 - } -] -``` - - - -## /api/trades - -Retrieves trades for a given market according to criteria. - -Params: -* market: eg 'dash_btc'. omit for all markets. -* format: json | jsonpretty | csv. default: jsonpretty. -* timestamp_from: start of date range. unix timestamp. default: 0. -* timestamp_to: end of date range. unix timestamp. default: now. -* direction: 'buy', 'sell'. omit for both. -* limit: max trades. optional. -* sort: asc | desc. default = asc -* integeramounts: bool. return amounts as integer. default = true. -* fields: array -- specify which fields to return. -* available: "currency", "direction", "tradePrice", "tradeAmount", -* "tradeDate", "paymentMethod", "offerDate", -* "useMarketBasedPrice", "marketPriceMargin", -* "offerAmount", "offerMinAmount", "offerId", -* "depositTxId" - -Sample Call and Result: - -``` -curl "http://markets.bisq.network/api/trades/?market=eur_btc&limit=1" -[ - { - "currency": "EUR", - "direction": "SELL", - "tradePrice": 6231800, - "tradeAmount": 75000000, - "tradeDate": 1469740097748, - "paymentMethod": "SEPA", - "offerDate": 1469088232392, - "useMarketBasedPrice": true, - "marketPriceMargin": 0.05, - "offerAmount": 75000000, - "offerMinAmount": 10000000, - "offerId": "c9775e65-e1d4-41c6-b40b-d9c12a9575fb", - "depositTxId": "6af26d0dbbf0cd7bfffa3ee9fbab0177b418fbf2f0cfcbe8d5a9f36ca080dd3a", - "market": "eur_btc", - "total": 467385000000000 - } -] -``` diff --git a/api/VERSION b/api/VERSION deleted file mode 100644 index 938598b..0000000 --- a/api/VERSION +++ /dev/null @@ -1 +0,0 @@ -bisq-webservice-api-0.9.14 diff --git a/api/currencies/apidoc.php b/api/currencies/apidoc.php deleted file mode 100644 index 3d7ffc9..0000000 --- a/api/currencies/apidoc.php +++ /dev/null @@ -1,50 +0,0 @@ - 'basecurrency', 'desc' => 'base currency identifier', 'required' => false, 'values' => null, 'default' => 'BTC'], - ['param' => 'type', 'desc' => 'type of currencies to include in results', 'required' => false, 'values' => 'crypto | fiat | all', 'default' => 'all'], - ['param' => 'format', 'desc' => 'format of return data', 'required' => false, 'values' => 'json | jsonpretty', 'default' => 'jsonpretty'], - ]; - } - - static function get_examples() { - $examples = []; - $examples[] = - [ 'request' => '/currencies', - 'response' => <<< END -{ - "AED": { - "code": "AED", - "name": "United Arab Emirates Dirham", - "precision": 8, - "type": "fiat" - }, - "AIB": { - "code": "AIB", - "name": "Advanced Internet Blocks", - "precision": 8, - "type": "crypto" - }, - ... -} -END - ]; - - return $examples; - } - - static function get_notes() { - return ['In practice, the same currencies are available for every basecurrency so this API can be called just once, omitting the basecurrency parameter.']; - } - - static function get_seealso() { - return []; - } -} \ No newline at end of file diff --git a/api/currencies/index.php b/api/currencies/index.php deleted file mode 100644 index eeb210b..0000000 --- a/api/currencies/index.php +++ /dev/null @@ -1,34 +0,0 @@ -get_all_fiat(); break; - case 'crypto': $results = $currencies->get_all_crypto(); break; - case 'all': $results = $currencies->get_all_currencies(); break; - default: bail("Invalid value for type parameter"); break; - } - - echo json_encode( $results, $format == 'json' ? 0 : JSON_PRETTY_PRINT ); -} -catch( Exception $e ) { -// for dev/debug. - if( @$_GET['debug'] ) { - _global_exception_handler( $e ); - } - bail($e->getCode() == 2 ? $e->getMessage() : "An unexpected error occurred."); -} - -function bail($msg) { - $result = ["success" => 0, "error" => $msg ]; - die( json_encode( $result, $GLOBALS['format'] == 'json' ? 0 : JSON_PRETTY_PRINT ) ); -} \ No newline at end of file diff --git a/api/depth/apidoc.php b/api/depth/apidoc.php deleted file mode 100644 index ec6b317..0000000 --- a/api/depth/apidoc.php +++ /dev/null @@ -1,47 +0,0 @@ - 'market', 'desc' => 'market identifier', 'required' => true, 'values' => null, 'default' => null], - ['param' => 'format', 'desc' => 'format of return data', 'required' => false, 'values' => 'json | jsonpretty', 'default' => 'jsonpretty'], - ]; - } - - static function get_examples() { - $examples = []; - $examples[] = - [ 'request' => '/depth?market=xmr_btc', - 'response' => <<< END -{ - "xmr_btc": { - "buys": [ - "0.01432700", - "0.01403166", - "0.01403018", - ], - "sells": [ - "0.01523659", - "0.01523956", - ] - } -} -END - ]; - - return $examples; - } - - static function get_notes() { - return []; - } - - static function get_seealso() { - return ['offers']; - } -} \ No newline at end of file diff --git a/api/depth/index.php b/api/depth/index.php deleted file mode 100644 index 8f2aea7..0000000 --- a/api/depth/index.php +++ /dev/null @@ -1,51 +0,0 @@ - 0, "error" => $msg ]; - die( json_encode( $result, $GLOBALS['format'] == 'json' ? 0 : JSON_PRETTY_PRINT ) ); -} - -try { - $network = primary_market::determine_network_from_market($market); - - $offers = new offers($network); - - $criteria = ['market' => $market, - 'direction' => 'BUY', - 'integeramounts' => false, - 'sort' => 'desc' - ]; - $buys = $offers->get_offers( $criteria ); - - $criteria['direction'] = 'SELL'; - $criteria['sort'] = 'asc'; - $sells = $offers->get_offers( $criteria ); - - $results = []; - foreach( ['buys' => $buys, 'sells' => $sells] as $dir => $list ) { - foreach( $list as $offer ) { - $results[$dir][] = $offer['price']; - } - } - - $result = [ $market => $results ]; - echo json_encode( $result, $format == 'json' ? 0 : JSON_PRETTY_PRINT ); -} -catch( Exception $e ) { -// for dev/debug. - if( @$_GET['debug'] ) { - _global_exception_handler( $e ); - } - bail($e->getCode() == 2 ? $e->getMessage() : "An unexpected error occurred."); - -} diff --git a/api/hloc/apidoc.php b/api/hloc/apidoc.php deleted file mode 100644 index faab6f8..0000000 --- a/api/hloc/apidoc.php +++ /dev/null @@ -1,60 +0,0 @@ - 'market', 'desc' => 'market identifier', 'required' => true, 'values' => null, 'default' => null], - ['param' => 'interval', 'desc' => 'length of time blocks to summarize. auto will pick appropriate interval based on total time range', 'required' => false, 'values' => 'minute | half_hour | hour | half_day | day | week | month | year | auto', 'default' => 'auto'], - ['param' => 'timestamp_from', 'desc' => 'start time, in seconds since 1970', 'required' => false, 'values' => null, 'default' => '2016-01-01'], - ['param' => 'timestamp_to', 'desc' => 'end time, in seconds since 1970', 'required' => false, 'values' => null, 'default' => 'now'], - ['param' => 'format', 'desc' => 'format of return data. csv provides the most compact format.', 'required' => false, 'values' => 'csv | json | jsonpretty', 'default' => 'jsonpretty'], - ]; - } - - static function get_examples() { - $examples = []; - $examples[] = - [ 'request' => '/hloc?market=xmr_btc', - 'response' => <<< END -[ - { - "period_start": 1463875200, - "open": "0.00198039", - "high": "0.00198039", - "low": "0.00180809", - "close": "0.00180809", - "volume_left": "528.73200000", - "volume_right": "1.04300000", - "avg": "0.00197264" - }, - ... - { - "period_start": 1472342400, - "open": "0.00982318", - "high": "0.01911520", - "low": "0.00982318", - "close": "0.01530002", - "volume_left": "3412.86880000", - "volume_right": "47.21000000", - "avg": "0.01383294" - } -] -END - ]; - - return $examples; - } - - static function get_notes() { - return []; - } - - static function get_seealso() { - return []; - } -} \ No newline at end of file diff --git a/api/hloc/index.php b/api/hloc/index.php deleted file mode 100644 index cc22d2b..0000000 --- a/api/hloc/index.php +++ /dev/null @@ -1,173 +0,0 @@ - 0, "error" => $msg ]; - die( json_encode( $result, $GLOBALS['format'] == 'json' ? 0 : JSON_PRETTY_PRINT ) ); -} - -if( !$market ) { - bail( "market parameter missing." ); -} - -// make it harder to inject random things into the output. -if( $callback && (substr($callback, 0, 6) != 'jQuery' || - strlen($callback) > 50)) { - bail( "Invalid callback parameter." ); -} - - -try { - - $network = primary_market::determine_network_from_market($market); - - if ($start && !preg_match('/^[0-9]+$/', $start)) { - bail("Invalid start parameter: $start"); - } - if ($end && !preg_match('/^[0-9]+$/', $end)) { - bail("Invalid end parameter: $end"); - } - if( $interval && !in_array( $interval, ['minute', 'half_hour', 'hour', 'half_day', 'day', 'week', 'month', 'year', 'auto'] )) { - bail("Invalid interval parameter: $interval"); - } - - - // set some utility variables - $range = $end - $start; - - $summarizer = new summarize_trades($network); - - $criteria = ['market' => $market, - 'datetime_from' => $start, - 'datetime_to' => $end, - 'integeramounts' => false, - 'fields' => ['period_start','open','high','low','close', 'volume_left','volume_right', 'avg'], - 'sort' => 'asc', - 'fillgaps' => $fillgaps, - ]; - - switch( $interval ) { - - case 'minute': $rows = $summarizer->get_trade_summaries_minutes($criteria); break; - case 'half_hour': $rows = $summarizer->get_trade_summaries_half_hours($criteria); break; - case 'hour': $rows = $summarizer->get_trade_summaries_hours($criteria); break; - case 'half_day': $rows = $summarizer->get_trade_summaries_half_days($criteria); break; - case 'day': $rows = $summarizer->get_trade_summaries_days($criteria); break; - case 'week': $rows = $summarizer->get_trade_summaries_weeks($criteria); break; - case 'month': $rows = $summarizer->get_trade_summaries_months($criteria); break; - case 'year': $rows = $summarizer->get_trade_summaries_years($criteria); break; - - case 'auto': - default: - // find the right table - // two days range loads minute data - if($range <= 3600) { - // up to one hour range loads minutely data - $rows = $summarizer->get_trade_summaries_minutes($criteria); - } - else if($range <= 1 * 24 * 3600) { - // up to one day range loads half-hourly data - $rows = $summarizer->get_trade_summaries_half_hours($criteria); - } - elseif($range <= 3 * 24 * 3600) { - // up to 3 day range loads hourly data - $rows = $summarizer->get_trade_summaries_hours($criteria); - } - elseif($range <= 7 * 24 * 3600) { - // up to 7 day range loads half-daily data - $rows = $summarizer->get_trade_summaries_half_days($criteria); - } - elseif($range <= 60 * 24 * 3600) { - // up to 2 month range loads daily data - $rows = $summarizer->get_trade_summaries_days($criteria); - } - elseif($range <= 12 * 31 * 24 * 3600) { - // up to one year range loads weekly data - $rows = $summarizer->get_trade_summaries_weeks($criteria); - } - elseif($range <= 12 * 31 * 24 * 3600) { - // up to 5 year range loads monthly data - $rows = $summarizer->get_trade_summaries_months($criteria); - } - else { - // greater range loads yearly data - $rows = $summarizer->get_trade_summaries_years($criteria); - } - break; - } - - if( $endcaps) { - if( count($rows ) ) { - $first = $rows[0]; - $last = $rows[count($rows)-1]; - array_unshift( $rows, ['period_start' => $start, $first['open'], $first['open'], $first['open'], $first['open'], 0, 0, 0] ); - array_push( $rows, ['period_start' => $end, $last['close'], $last['close'], $last['close'], $last['close'], 0, 0, 0] ); - } - else { - array_unshift( $rows, ['period_start' => $start, 0, 0, 0, 0, 0, 0, 0] ); - array_push( $rows, ['period_start' => $end, 0, 0, 0, 0, 0, 0, 0] ); - } - } - - if( $format == 'jscallback' ) { - echo htmlentities($callback) . "([\n"; - foreach( $rows as $k => $row ) { - if( $milliseconds ) { - $row['period_start'] *= 1000; - } - echo "[" . implode( ",", $row ) . "]" . ($k == count($rows) -1 ? "\n" : ",\n"); - } - echo "])\n"; - } - else if( $format == 'csv') { - // serve response to client. - $fh = fopen( 'php://output', 'w'); - - fputcsv($fh, array_values( ['period_start','open','high','low','close','volume_left', 'volume_right', 'avg'] ) ); - - foreach( $rows as $k => $row ) { - if( !$timestamp ) { - $row['period_start'] = date('c', $row['period_start']); - } - fputcsv( $fh, $row ); - } - fclose( $fh ); - } - else { - if( !$timestamp ) { - foreach( $rows as $k => &$row ) { - $row['period_start'] = date('c', $row['period_start']); - - } - } - echo json_encode( $rows, $format == 'json' ? 0 : JSON_PRETTY_PRINT ); - } -} -catch( Exception $e ) { -// for dev/debug. - if( @$_GET['debug'] ) { - _global_exception_handler( $e ); - } - bail($e->getCode() == 2 ? $e->getMessage() : "An unexpected error occurred."); -} - - diff --git a/api/index.php b/api/index.php deleted file mode 100644 index 5821583..0000000 --- a/api/index.php +++ /dev/null @@ -1,173 +0,0 @@ -table_attrs = array( 'class' => 'bordered' ); - -$apiversion = file_get_contents( __DIR__ . '/VERSION' ); - -function rglob($pattern, $flags = 0) { - $files = glob($pattern, $flags); - foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR|GLOB_NOSORT) as $dir) { - $files = array_merge($files, rglob($dir.'/'.basename($pattern), $flags)); - } - return $files; -} - -function e($buf) { - return htmlentities( $buf ); -} - -function linkify($buf) { - return preg_replace('/\[(.*)\]\(http(.*)\)/', '\\1', $buf); -} - -?> - - - - - - - - - - - - -
-

Bisq public webservice APIs:

-

Version:

-
    - $api ): ?> -
  • - -
- - Error responses are documented here. - -
- - - $api ): ?> -
-
/api/
-
get_description())) ?>
-
- get_examples() as $example): ?> - -
-

Sample Request

-
-

Sample Response

-
-
- -
- -
-

Parameters

-
- table_with_header($api->get_params()) ?> -
-
- - get_notes()) ): ?> -
-

Notes

-
    - get_notes() as $note): ?> -
  • - -
-
- - - get_seealso()) ): ?> -
-

See Also

-
    - get_seealso() as $seealso): ?> -
  • - -
-
- - -
- - -
-

Error Responses

- -

Any errors such as invalid parameters will be in the following format

-
{ - "success": 0, - "error": "market parameter missing" -}
- -
- - - diff --git a/api/markets/apidoc.php b/api/markets/apidoc.php deleted file mode 100644 index 3cf68cb..0000000 --- a/api/markets/apidoc.php +++ /dev/null @@ -1,61 +0,0 @@ - 'format', 'desc' => 'format of return data', 'required' => false, 'values' => 'json | jsonpretty', 'default' => 'jsonpretty'], - ]; - } - - static function get_examples() { - $examples = []; - $examples[] = - [ 'request' => '/markets', - 'response' => <<< END - -{ - "1cr_btc": { - "pair": "1cr_btc", - "lname": "1CRedit", - "rname": "Bitcoin", - "lsymbol": "1CR", - "rsymbol": "BTC", - "lprecision": 8, - "rprecision": 8, - "ltype": "crypto", - "rtype": "crypto", - "name": "1CRedit\/Bitcoin" - }, - "btc_aud": { - "pair": "btc_aud", - "lname": "Bitcoin", - "rname": "Australian Dollar", - "lsymbol": "BTC", - "rsymbol": "AUD", - "lprecision": 8, - "rprecision": 2, - "ltype": "crypto", - "rtype": "fiat", - "name": "Bitcoin\/Australian Dollar" - }, - ... -} -END - ]; - - return $examples; - } - - static function get_notes() { - return []; - } - - static function get_seealso() { - return []; - } -} \ No newline at end of file diff --git a/api/markets/index.php b/api/markets/index.php deleted file mode 100644 index 0858183..0000000 --- a/api/markets/index.php +++ /dev/null @@ -1,32 +0,0 @@ -get_markets()); - } - - echo json_encode( $results, $format == 'json' ? 0 : JSON_PRETTY_PRINT ); -} -catch( Exception $e ) { -// for dev/debug. - if( @$_GET['debug'] ) { - _global_exception_handler( $e ); - } - bail($e->getCode() == 2 ? $e->getMessage() : "An unexpected error occurred."); - -} - -function bail($msg) { - $result = ["success" => 0, "error" => $msg ]; - die( json_encode( $result, $GLOBALS['format'] == 'json' ? 0 : JSON_PRETTY_PRINT ) ); -} \ No newline at end of file diff --git a/api/offers/apidoc.php b/api/offers/apidoc.php deleted file mode 100644 index 9080be2..0000000 --- a/api/offers/apidoc.php +++ /dev/null @@ -1,116 +0,0 @@ - 'market', 'desc' => 'market identifier', 'required' => true, 'values' => null, 'default' => null], - ['param' => 'direction', 'desc' => 'offer direction, omit or set null for both', 'required' => false, 'values' => 'BUY | SELL', 'default' => 'null'], - ['param' => 'format', 'desc' => 'format of return data', 'required' => false, 'values' => 'json | jsonpretty', 'default' => 'jsonpretty'], - ]; - } - - static function get_examples() { - $examples = []; - $examples[] = - [ 'request' => '/offers?market=xmr_btc', - 'response' => <<< END - -{ - "xmr_btc": { - "buys": [ - { - "offer_id": "b2ab53d4-8ffd-4138-aa8a-c7143d7fb123_0.4.9.4", - "offer_date": 1472239477119, - "direction": "BUY", - "min_amount": "0.10000000", - "amount": "6.77840000", - "price": "0.01475266", - "volume": "0.10000000", - "payment_method": "BLOCK_CHAINS", - "offer_fee_txid": "64ae7b5863c509ed0cb5ef9ec3ec4a197b4f77705fc7b2d3b82fb96bc3f3e872" - }, - ... - ], - "sells": [ - { - "offer_id": "6a31771b-3c1b-49f4-b403-12f8749646fa_0.4.9.4", - "offer_date": 1472570540023, - "direction": "SELL", - "min_amount": "0.40000000", - "amount": "25.54280000", - "price": "0.01565994", - "volume": "0.40000000", - "payment_method": "BLOCK_CHAINS", - "offer_fee_txid": "ee0bd1d55ba37bf14de59fd6a42263200b6485d2d5aff493ffeb82513c0b2637" - }, - ... - ] - } -} -END - ]; - - - $examples[] = - [ 'request' => '/offers?market=xmr_btc&direction=BUY', - 'response' => <<< END -{ - "xmr_btc": { - "buys": [ - { - "offer_id": "b2ab53d4-8ffd-4138-aa8a-c7143d7fb123_0.4.9.4", - "offer_date": 1472239477119, - "direction": "BUY", - "min_amount": "0.10000000", - "amount": "6.68520000", - "price": "0.01495824", - "volume": "0.10000000", - "payment_method": "BLOCK_CHAINS" - "offer_fee_txid": "64ae7b5863c509ed0cb5ef9ec3ec4a197b4f77705fc7b2d3b82fb96bc3f3e872" - }, - ... - ], - "sells": null - } -} -END - ]; - - - return $examples; - } - - static function get_notes() { - // Note: these are found at: - // https://github.com/bitsquare/bitsquare/blob/master/core/src/main/java/io/bitsquare/payment/PaymentMethod.java - $payment_methods = [ - "OK_PAY", - "PERFECT_MONEY", - "SEPA", - "NATIONAL_BANK", - "SAME_BANK", - "SPECIFIC_BANKS", - "SWISH", - "ALI_PAY", - "CLEAR_X_CHANGE", - "US_POSTAL_MONEY_ORDER", - "CASH_DEPOSIT", - "BLOCK_CHAINS", - ]; - - return ['payment_method in response will be one of: ' . implode( ', ', $payment_methods ), - 'payment_method values are defined in this file: https://github.com/bitsquare/bitsquare/blob/master/core/src/main/java/io/bitsquare/payment/PaymentMethod.java', - 'offer_fee_txid in response is the offer fee transaction ID in the bitcoin block chain', - 'offer_date in response is provided in milliseconds since 1970, not seconds. To get seconds, divide by 1000', - ]; - } - - static function get_seealso() { - return ['depth']; - } -} \ No newline at end of file diff --git a/api/offers/index.php b/api/offers/index.php deleted file mode 100644 index ef17aad..0000000 --- a/api/offers/index.php +++ /dev/null @@ -1,49 +0,0 @@ - 0, "error" => $msg ]; - die( json_encode( $result, $GLOBALS['format'] == 'json' ? 0 : JSON_PRETTY_PRINT ) ); -} - -try { - $network = primary_market::determine_network_from_market($market); - - $offers = new offers($network); - - $criteria = ['market' => $market, - 'direction' => 'BUY', - 'integeramounts' => false, - 'sort' => 'desc', - 'fields' => ['id' => 'offer_id', 'date' => 'offer_date', 'direction', 'minAmount' => 'min_amount', 'amount', 'price', 'volume', 'paymentMethod' => 'payment_method', 'offerFeeTxID' => 'offer_fee_txid'], - ]; - $buys = $direction == 'SELL' ? null : $offers->get_offers( $criteria ); - - $criteria['direction'] = 'SELL'; - $criteria['sort'] = 'asc'; - $sells = $direction == 'BUY' ? null : $offers->get_offers( $criteria ); - - $results = ['buys' => $buys, 'sells' => $sells]; - - $result = [ $market => $results ]; - echo json_encode( $result, $format == 'json' ? 0 : JSON_PRETTY_PRINT ); -} -catch( Exception $e ) { -// for dev/debug. - if( @$_GET['debug'] ) { - _global_exception_handler( $e ); - } - bail($e->getCode() == 2 ? $e->getMessage() : "An unexpected error occurred."); - -} diff --git a/api/ticker/apidoc.php b/api/ticker/apidoc.php deleted file mode 100644 index c192401..0000000 --- a/api/ticker/apidoc.php +++ /dev/null @@ -1,89 +0,0 @@ - 'market', 'desc' => 'market identifier', 'required' => false, 'values' => null, 'default' => null], - ['param' => 'format', 'desc' => 'format of return data', 'required' => false, 'values' => 'json | jsonpretty', 'default' => 'jsonpretty'], - ]; - } - - static function get_examples() { - $examples = []; - $examples[] = - [ 'request' => '/ticker?market=btc_eur', - 'response' => <<< END -{ - "btc_eur": { - "last": "524.17550000", - "high": "529.56210000", - "low": "510.20000000", - "volume_left": "2.76560000", - "volume_right": "1454.42950000", - "buy": "513.88580000", - "sell": "529.17120000" - } -} -END - ]; - - $examples[] = - [ 'request' => '/ticker', - 'response' => <<< END - -{ - "1cr_btc": null, - "btc_aud": { - "last": "728.89000000", - "high": "728.89000000", - "low": "728.89000000", - "volume_left": 0, - "volume_right": 0, - "buy": null, - "sell": null - }, - "btc_eur": { - "last": "524.17550000", - "high": "529.56210000", - "low": "510.20000000", - "volume_left": "2.76560000", - "volume_right": "1454.42950000", - "buy": "513.88580000", - "sell": "529.17120000" - }, - "xmr_btc": { - "last": "0.01437401", - "high": "0.01530723", - "low": "0.01437401", - "volume_left": "269.79720000", - "volume_right": "4.00000000", - "buy": "0.01427006", - "sell": "0.01545144" - } -} -END - ]; - - - return $examples; - } - - static function get_notes() { - return ["the response data can indicate the following market states: never traded, traded prior to 24 hours, traded within 24 hours", - "a null value for a market key indicates 'never traded'", - "volume_left or volume_right is 0 indicates 'traded prior to 24 hours'", - "volume_left or volume_right is > 0 indicates 'traded within 24 hours'", - "buy represents the highest buy offer at present, sell represents the lowest sell offer at present", - "either buy or sell may be null if there are not presently any respective offers" - ]; - } - - static function get_seealso() { - return []; - } -} \ No newline at end of file diff --git a/api/ticker/index.php b/api/ticker/index.php deleted file mode 100644 index a7bc3ce..0000000 --- a/api/ticker/index.php +++ /dev/null @@ -1,45 +0,0 @@ - $start, - 'datetime_to' => $end, - 'interval' => 'day', - 'integeramounts' => false, - ]; - - $result = null; - if( $market ) { - $network = primary_market::determine_network_from_market($market); - $ticker = new ticker($network); - $result = [$ticker->get_market_ticker($market, $criteria)]; - } - else { - $result = ticker::get_all_markets_ticker($criteria); - } - - echo json_encode( $result, $format == 'json' ? 0 : JSON_PRETTY_PRINT ); -} -catch( Exception $e ) { -// for dev/debug. - if( @$_GET['debug'] ) { - _global_exception_handler( $e ); - } - bail($e->getCode() == 2 ? $e->getMessage() : "An unexpected error occurred."); - -} - -function bail($msg) { - $result = ["success" => 0, "error" => $msg ]; - die( json_encode( $result, $GLOBALS['format'] == 'json' ? 0 : JSON_PRETTY_PRINT ) ); -} diff --git a/api/trades/apidoc.php b/api/trades/apidoc.php deleted file mode 100644 index a51e707..0000000 --- a/api/trades/apidoc.php +++ /dev/null @@ -1,67 +0,0 @@ - 'market', 'desc' => 'market identifier', 'required' => true, 'values' => ' | all', 'default' => null], - ['param' => 'format', 'desc' => 'format of return data', 'required' => false, 'values' => 'json | jsonpretty', 'default' => 'jsonpretty'], - ['param' => 'timestamp_from', 'desc' => 'start time, in seconds since 1970', 'required' => false, 'values' => null, 'default' => '2016-01-01'], - ['param' => 'timestamp_to', 'desc' => 'end time, in seconds since 1970', 'required' => false, 'values' => null, 'default' => 'now'], - ['param' => 'trade_id_from', 'desc' => 'identifies first trade to include', 'required' => false, 'values' => null, 'default' => null], - ['param' => 'trade_id_to', 'desc' => 'identifies last trade to include', 'required' => false, 'values' => null, 'default' => null], - ['param' => 'direction', 'desc' => 'trade direction: buy or sell. omit or leave null for both.', 'required' => false, 'values' => 'buy | sell', 'default' => null], - ['param' => 'limit', 'desc' => 'maximum trades to return. max is 2000.', 'required' => false, 'values' => null, 'default' => 100], - ['param' => 'sort', 'desc' => 'Sort by date', 'required' => false, 'values' => 'asc | desc', 'default' => 'desc'], - ]; - } - - static function get_examples() { - $examples = []; - $examples[] = - [ 'request' => '/trades?market=btc_eur&limit=2', - 'response' => <<< END -[ - { - "direction": "SELL", - "price": "2375.72500000", - "amount": "0.05000000", - "volume": "118.78620000", - "payment_method": "SEPA", - "trade_id": "BLBJHGL-b644851d-f822-418a-8035-955f7a02eff9-051", - "trade_date": 1501095828824 - }, - { - "direction": "SELL", - "price": "2148.50230000", - "amount": "0.20000000", - "volume": "429.70040000", - "payment_method": "SEPA", - "trade_id": "dcwyx9-1a89dece-5039-4ff7-89c9-7ed52b84bc88-051", - "trade_date": 1501088841011 - } -] -END - ]; - - return $examples; - } - - static function get_notes() { - return ["trade_date in response is provided in milliseconds since 1970, not seconds. To get seconds, divide by 1000", - 'if the market parameter is "all" then up to limit trades will be returned, date sorted, across all markets. Also a "market" field is added to each trade result.', - 'this api will return a maximum of 2000 trades per call', - 'if trade_id_from or trade_id_to is used and a matching trade is not found for each, then no results are returned', - 'The Bisq app does not presently use a trade_id internally. The trade_id in this api is actually the bisq offerId.', - 'Possible values for payment_method can change over time. For most current, see [PaymentMethod.java](https://raw.githubusercontent.com/bisq-network/bisq-core/master/src/main/java/bisq/core/payment/payload/PaymentMethod.java)', - ]; - } - - static function get_seealso() { - return []; - } -} \ No newline at end of file diff --git a/api/trades/index.php b/api/trades/index.php deleted file mode 100644 index 2a1c4a2..0000000 --- a/api/trades/index.php +++ /dev/null @@ -1,82 +0,0 @@ - 0, "error" => $msg ]; - die( json_encode( $result, $GLOBALS['format'] == 'json' ? 0 : JSON_PRETTY_PRINT ) ); -} - -if( !$market ) { - bail( "market parameter missing" ); -} - -try { - - $fields = ['market' => 'market', - 'direction', - 'tradePrice' => 'price', - 'tradeAmount' => 'amount', - 'tradeVolume' => 'volume', - 'paymentMethod' => 'payment_method', - 'offerId' => 'trade_id', - 'tradeDate' => 'trade_date', - ]; - if( $market != 'all' ) { - unset( $fields['market'] ); - } - - $criteria = [ - 'market' => $market == 'all' ? null : $market, - 'datetime_from' => @$_GET['timestamp_from'] ?: strtotime('2016-01-01'), - 'datetime_to' => @$_GET['timestamp_to'] ?: time(), - 'offer_id_from' => @$_GET['trade_id_from'], - 'offer_id_to' => @$_GET['trade_id_to'], - 'direction' => @$_GET['direction'], - 'limit' => @$_GET['limit'] ?: 100, - 'sort' => @$_GET['sort'] ?: 'desc', - 'integeramounts' => (bool)@$_GET['integeramounts'], - 'fields' => $fields - ]; - - $criteria['limit'] = $criteria['limit'] <= 2000 ? $criteria['limit'] : 2000; - - if($market == 'all') { - $networks = primary_market::get_network_list(); - - $results = []; - foreach( $networks as $network ) { - $trades = new trades($network); - $results = array_merge($results, $trades->get_trades($criteria)); - } - // now we must apply sort and limit to merged results. - usort($results, function ($a, $b) use($criteria) { - return $criteria['sort'] == 'asc' ? strcmp($a['trade_date'], $b['trade_date']) : - strcmp($b['trade_date'], $a['trade_date']); - }); - if(count($results) > $criteria['limit']) { - $results = array_slice($results, 0, $criteria['limit']); - } - } - else { - $network = primary_market::determine_network_from_market($market); - $trades = new trades($network); - $results = $trades->get_trades($criteria); - } - - echo json_encode( $results, $format == 'json' ? 0 : JSON_PRETTY_PRINT ); -} -catch( Exception $e ) { -// for dev/debug. - if( @$_GET['debug'] ) { - _global_exception_handler( $e ); - } - bail($e->getCode() == 2 ? $e->getMessage() : "An unexpected error occurred."); - -} diff --git a/api/volumes/apidoc.php b/api/volumes/apidoc.php deleted file mode 100644 index 4298163..0000000 --- a/api/volumes/apidoc.php +++ /dev/null @@ -1,54 +0,0 @@ - 'basecurrency', 'desc' => 'base currency identifier.', 'optional' => true, 'values' => null, 'default' => null], - ['param' => 'market', 'desc' => 'market identifier.', 'optional' => true, 'values' => null, 'default' => null], - ['param' => 'interval', 'desc' => 'length of time blocks to summarize. auto will pick appropriate interval based on total time range', 'required' => false, 'values' => 'minute | half_hour | hour | half_day | day | week | month | year | auto', 'default' => 'auto'], - ['param' => 'timestamp_from', 'desc' => 'start time, in seconds since 1970', 'required' => false, 'values' => null, 'default' => '2016-01-01'], - ['param' => 'timestamp_to', 'desc' => 'end time, in seconds since 1970', 'required' => false, 'values' => null, 'default' => 'now'], - ['param' => 'format', 'desc' => 'format of return data. csv provides the most compact format.', 'required' => false, 'values' => 'csv | json | jsonpretty', 'default' => 'jsonpretty'], - ]; - } - - static function get_examples() { - $examples = []; - $examples[] = - [ 'request' => '/volumes?basecurrency=BTC', - 'response' => <<< END -[ - { - "period_start": 1451606400, - "volume": "1128.38570000", - "num_trades": 2009 - }, - { - "period_start": 1483228800, - "volume": "1322.77960000", - "num_trades": 2376 - } -] -END - ]; - - return $examples; - } - - static function get_notes() { - return ['A Base currency is a blockchain (eg Bitcoin) that is traded against other currencies utilizing the base currency\'s multisig capability. eg XMR/BTC, LTC/BTC, BTC/USD, and BTC/EUR all use the base currency BTC. In contrast, XMR/LTC, BTC/LTC, LTC/EUR, LTC/USD all use the base currency LTC.', - 'Either basecurrency or market param must be specified.', - 'basecurrency must be supported by Bisq app.', - 'As of 2017-07-24, supported basecurrency are BTC, DOGE, LTC, DASH', - ]; - } - - static function get_seealso() { - return []; - } -} \ No newline at end of file diff --git a/api/volumes/index.php b/api/volumes/index.php deleted file mode 100644 index a42e433..0000000 --- a/api/volumes/index.php +++ /dev/null @@ -1,180 +0,0 @@ - 0, "error" => $msg ]; - die( json_encode( $result, $GLOBALS['format'] == 'json' ? 0 : JSON_PRETTY_PRINT ) ); -} - -if( !$market && !$basecurrency ) { - bail( "missing parameter. either market or basecurrency must be present." ); -} - -// make it harder to inject random things into the output. -if( $callback && (substr($callback, 0, 6) != 'jQuery' || - strlen($callback) > 50)) { - bail( "Invalid callback parameter." ); -} - -// normalize market=all to null. -if( $market == 'all') { - $market = null; -} - -try { - - $basecurrency = $market ? primary_market::determine_primary_market_symbol_from_market($market) : - primary_market::get_normalized_primary_market_symbol($basecurrency); - - $network = primary_market::get_network($basecurrency); - - if ($start && !preg_match('/^[0-9]+$/', $start)) { - bail("Invalid start parameter: $start"); - } - if ($end && !preg_match('/^[0-9]+$/', $end)) { - bail("Invalid end parameter: $end"); - } - if( $interval && !in_array( $interval, ['minute', 'half_hour', 'hour', 'half_day', 'day', 'week', 'month', 'year', 'auto'] )) { - bail("Invalid interval parameter: $interval"); - } - - - // set some utility variables - $range = $end - $start; - - $summarizer = new summarize_trades_multimarket($network); - - $criteria = ['datetime_from' => $start, - 'datetime_to' => $end, - 'integeramounts' => false, - 'fields' => ['period_start', 'volume', 'num_trades'], - 'sort' => 'asc', - 'fillgaps' => $fillgaps, - ]; - - switch( $interval ) { - - case 'minute': $rows = $summarizer->get_trade_summaries_minutes($criteria); break; - case 'half_hour': $rows = $summarizer->get_trade_summaries_half_hours($criteria); break; - case 'hour': $rows = $summarizer->get_trade_summaries_hours($criteria); break; - case 'half_day': $rows = $summarizer->get_trade_summaries_half_days($criteria); break; - case 'day': $rows = $summarizer->get_trade_summaries_days($criteria); break; - case 'week': $rows = $summarizer->get_trade_summaries_weeks($criteria); break; - case 'month': $rows = $summarizer->get_trade_summaries_months($criteria); break; - case 'year': $rows = $summarizer->get_trade_summaries_years($criteria); break; - - case 'auto': - default: - // find the right table - // two days range loads minute data - if($range <= 3600) { - // up to one hour range loads minutely data - $rows = $summarizer->get_trade_summaries_minutes($criteria); - } - else if($range <= 1 * 24 * 3600) { - // up to one day range loads half-hourly data - $rows = $summarizer->get_trade_summaries_half_hours($criteria); - } - elseif($range <= 3 * 24 * 3600) { - // up to 3 day range loads hourly data - $rows = $summarizer->get_trade_summaries_hours($criteria); - } - elseif($range <= 7 * 24 * 3600) { - // up to 7 day range loads half-daily data - $rows = $summarizer->get_trade_summaries_half_days($criteria); - } - elseif($range <= 60 * 24 * 3600) { - // up to 2 month range loads daily data - $rows = $summarizer->get_trade_summaries_days($criteria); - } - elseif($range <= 12 * 31 * 24 * 3600) { - // up to one year range loads weekly data - $rows = $summarizer->get_trade_summaries_weeks($criteria); - } - elseif($range <= 12 * 31 * 24 * 3600) { - // up to 5 year range loads monthly data - $rows = $summarizer->get_trade_summaries_months($criteria); - } - else { - // greater range loads yearly data - $rows = $summarizer->get_trade_summaries_years($criteria); - } - break; - } - - if( $endcaps) { - if( count($rows ) ) { - $first = $rows[0]; - $last = $rows[count($rows)-1]; - array_unshift( $rows, ['period_start' => $start, $first['open'], $first['open'], $first['open'], $first['open'], 0, 0, 0] ); - array_push( $rows, ['period_start' => $end, $last['close'], $last['close'], $last['close'], $last['close'], 0, 0, 0] ); - } - else { - array_unshift( $rows, ['period_start' => $start, 0, 0, 0, 0, 0, 0, 0] ); - array_push( $rows, ['period_start' => $end, 0, 0, 0, 0, 0, 0, 0] ); - } - } - - if( $format == 'jscallback' ) { - echo htmlentities($callback) . "([\n"; - foreach( $rows as $k => $row ) { - if( $milliseconds ) { - $row['period_start'] *= 1000; - } - echo "[" . implode( ",", $row ) . "]" . ($k == count($rows) -1 ? "\n" : ",\n"); - } - echo "])\n"; - } - else if( $format == 'csv') { - // serve response to client. - $fh = fopen( 'php://output', 'w'); - - fputcsv($fh, array_values( ['period_start','open','high','low','close','volume_left', 'volume_right', 'avg'] ) ); - - foreach( $rows as $k => $row ) { - if( !$timestamp ) { - $row['period_start'] = date('c', $row['period_start']); - } - fputcsv( $fh, $row ); - } - fclose( $fh ); - } - else { - if( !$timestamp ) { - foreach( $rows as $k => &$row ) { - $row['period_start'] = date('c', $row['period_start']); - - } - } - echo json_encode( $rows, $format == 'json' ? 0 : JSON_PRETTY_PRINT ); - } -} -catch( Exception $e ) { -// for dev/debug. - if( @$_GET['debug'] ) { - _global_exception_handler( $e ); - } - bail($e->getCode() == 2 ? $e->getMessage() : "An unexpected error occurred."); -} - - diff --git a/bitsquare_index.html b/bitsquare_index.html deleted file mode 100644 index e574e8e..0000000 --- a/bitsquare_index.html +++ /dev/null @@ -1,185 +0,0 @@ - - - - - - - - - - - - - - - - Bitsquare - The decentralized bitcoin exchange - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- - - - -
- - - -
- - - - -
- -
- -
TwitterRedditGoogle+DeliciousShare - -
- - - - - -
diff --git a/index-body-summary.php b/index-body-summary.php deleted file mode 100644 index c27f17d..0000000 --- a/index-body-summary.php +++ /dev/null @@ -1,421 +0,0 @@ -get_all_fiat(); - - // Obtain market summary info for today only. - $market_result = ['pchoose' => $pmarket_select, - 'choose' => $market_select, - 'market'=> $market_name, - 'market_date'=> 'All Time', - 'open'=> '--', - 'last'=> '--', - 'high'=> '--', - 'low'=> '--', - 'avg'=> '--', - 'volume_right' => '--' - ]; - - // get latest trades. - $trades = new trades($network); - $trades_result = $trades->get_trades( [ 'market' => null, - 'limit' => 100 ] ); -} -catch( Exception $e ) { -// for dev/debug. - if( @$_GET['debug'] ) { - _global_exception_handler( $e ); - } - include(dirname(__FILE__) . '/404.html'); -} - - -$table = new html_table(); -$table->htmlescape = false; -$table->timestampjs_col_names['tradeDate'] = true; - - -function ibs_basecurrency_meta($market, $use_basecurrency) { - global $markets_result; - global $pmarket; - $market = strtolower( str_replace( '/', '_', $market)); - $currmarket = $markets_result[$market]; - - $base_is_left = $pmarket == $currmarket['lsymbol']; - $use_left = ($base_is_left && $use_basecurrency) || - (!$base_is_left && !$use_basecurrency); - $symbol = $use_left ? $currmarket['lsymbol'] : $currmarket['rsymbol']; - - $key = $use_left ? 'lprecision' : 'rprecision'; - $precision = $currmarket[$key]; - - return [ - 'base_is_left' => $base_is_left, - 'use_left' => $use_left, - 'symbol' => $symbol, - 'precision' => $precision, - ]; - -} - -function ibs_display_currency_pair( $val_left, $val_right, $market, $use_basecurrency, $is_int=true ) { - - $meta = ibs_basecurrency_meta( $market, $use_basecurrency ); - extract( $meta ); - - $val = $use_left ? $val_left : $val_right; - $val = $is_int ? $val / 100000000 : $val; - return number_format( $val, $precision ) . ' ' . $symbol; -} - -function ibs_display_trade_price( $val, $row ) { - - $meta = ibs_basecurrency_meta( $row['currencyPair'], $use_basecurrency = false ); - extract( $meta ); - - $val = $val / 100000000; - return number_format( $val, $precision ) . ' ' . $symbol; -} - -function ibs_display_tradeamount_base( $val, $row ) { - return ibs_display_currency_pair( $row['tradeAmount'], $row['tradeVolume'], $row['currencyPair'], true ); -} - -function ibs_display_tradeamount_other( $val, $row ) { - return ibs_display_currency_pair( $row['tradeAmount'], $row['tradeVolume'], $row['currencyPair'], false ); -} - -?> - - - - - - - -table_attrs = array( 'class' => 'bordered', 'id' => 'market_info' ); ?> -table_with_header( array( $market_result ), - array( 'Base Currency', 'Currency', 'Market', 'Market Date (UTC)', "Open", "Last", "High", "Low", "Avg", "Volume" ), - array( 'pchoose', 'choose', 'market', 'market_date', 'open', 'last', 'high', 'low', 'avg', 'volume_right' ) ); ?> - - -
- There have been no trades in this base currency recently. -
- -
-
-
- -
Trade History( Last trades )
-table_attrs = array( 'class' => 'bordered', 'id' => 'trade_history', 'style'=>"border: none; box-shadow: none" ); ?> -
- -table_with_header( $trades_result, - array( 'Date', 'Action', 'Price', 'Amount in ' . $pmarket, 'Amount' ), - array( 'tradeDate', - 'direction' => ['cb_format' => function($val, $r) {return $val;}], - 'tradePrice' => ['cb_format' => 'ibs_display_trade_price'], - 'tradeAmount' => ['cb_format' => 'ibs_display_tradeamount_base'], - 'tradeVolume' => ['cb_format' => 'ibs_display_tradeamount_other'] ) - ); ?> -
- - - - diff --git a/index-body.php b/index-body.php deleted file mode 100644 index 5e3f1d0..0000000 --- a/index-body.php +++ /dev/null @@ -1,598 +0,0 @@ -get_markets_with_trades_or_offers($pmarket); - - // in case no markets have trades, we get all markets then. - if( !$markets_result ) { - $markets_result = $marketservice->get_markets($pmarket); - } - - // Sort by currency name. ( where currency is non-btc side of market ) - uasort( $markets_result, function( $a, $b ) use($pmarket) { - $aname = $a['lsymbol'] == $pmarket ? $a['rname'] : $a['lname']; - $bname = $b['lsymbol'] == $pmarket ? $b['rname'] : $b['lname']; - return strcmp( $aname, $bname ); - }); - - // create primary market select control. - $allparam = $allmarkets ? '&allmarkets=1' : ''; - $pmarket_select = sprintf( "\n"; - - - // create market select control. - $market_select = sprintf( "\n"; - - - // Display all markets summary if market not found. - if( !@$markets_result[$market]) { - require_once( 'index-body-summary.php' ); - return; - } - - $market_name = strtoupper( str_replace( '_', '/', $market)); - list( $curr_left, $curr_right ) = explode( '/', $market_name, 2); - $currmarket = $markets_result[$market]; - - // Obtain market summary info for today only. - $summarize_trades = new summarize_trades($network); - $market_result = $summarize_trades->get_trade_summaries_days( ['market' => $market, - 'datetime_from' => strtotime( 'today 00:00:00' ), - 'datetime_to' => strtotime( 'today 23:59:00' ), - 'limit' => 1 - ] ); - - $latest = @$market_result[0]; - - if( $latest ) { - $market_result = ['pchoose' => $pmarket_select, - 'choose' => $market_select, - 'market'=> $market_name, - 'market_date'=> date('Y-m-d'), - 'open'=> display_currency( $latest['open'], $curr_right ), - 'last'=> display_currency( $latest['close'], $curr_right ), - 'high'=> display_currency( $latest['high'], $curr_right ), - 'low'=> display_currency( $latest['low'], $curr_right ), - 'avg'=> display_currency( $latest['avg'], $curr_right ), - 'volume_right' => display_currency( $latest['volume_right'], $curr_right ) . " " . $curr_right - ]; - } - else { - $market_result = ['pchoose' => $pmarket_select, - 'choose' => $market_select, - 'market'=> $market_name, - 'market_date'=> date('Y-m-d'), - 'open'=> '--', - 'last'=> '--', - 'high'=> '--', - 'low'=> '--', - 'avg'=> '--', - 'volume_right' => '--' - ]; - } - - // get latest trades. - $trades = new trades($network); - $trades_result = $trades->get_trades( [ 'market' => $market, - 'limit' => 100 ] ); - - // get latest buy offers. - $offers = new offers($network); - - $offers_buy_result = $offers->get_offers( [ 'market' => $market, - 'direction' => 'BUY', - 'sort' => 'desc', - 'limit' => 100 ] ); - - $offers_sell_result = $offers->get_offers( [ 'market' => $market, - 'direction' => 'SELL', - 'sort' => 'asc', - 'limit' => 100 ] ); - - // add running totals for primary market. - foreach( [&$offers_buy_result, &$offers_sell_result] as &$results ) { - $sum = 0; - foreach( $results as &$row ) { - $sum += $row['volume']; - $row['sum'] = $sum; - } - } -} -catch( Exception $e ) { -// for dev/debug. - if( @$_GET['debug'] ) { - _global_exception_handler( $e ); - } - include(dirname(__FILE__) . '/404.html'); -} - - -$table = new html_table(); -$table->htmlescape = false; -$table->timestampjs_col_names['tradeDate'] = true; - -function display_currency( $val, $symbol, $is_int=true ) { - global $currmarket, $curr_left; - $key = $symbol == $curr_left ? 'lprecision' : 'rprecision'; - $precision = $currmarket[$key]; - $val = $is_int ? $val / 100000000 : $val; - return number_format( $val, $precision ); -} - -function display_currency_leftside( $val, $row ) { - list($left, $right) = explode( '/', $row['currencyPair'] ); - return display_currency( $val, $left ); -} - -function display_currency_rightside( $val, $row ) { - list($left, $right) = explode( '/', $row['currencyPair'] ); - return display_currency( $val, $right); -} - -?> - - - - - - - -table_attrs = array( 'class' => 'bordered', 'id' => 'market_info' ); ?> -table_with_header( array( $market_result ), - array( 'Base Currency', 'Currency', 'Market', 'Market Date (UTC)', "Open", "Last", "High", "Low", "Avg", "Volume" ), - array( 'pchoose', 'choose', 'market', 'market_date', 'open', 'last', 'high', 'low', 'avg', 'volume_right' ) ); ?> - - -
-
-
- - - - - -table_attrs = array( 'class' => 'unbordered' ); ?> - - - - - - - - -
Buy OffersSell Offers
-
-table_with_header( $offers_buy_result, - array( 'Price', $curr_left, $curr_right, "Sum($curr_right)" ), - [ 'price' => ['cb_format' => 'display_currency_rightside'], - 'amount' => ['cb_format' => 'display_currency_leftside'], - 'volume' => ['cb_format' => 'display_currency_rightside'], - 'sum' => ['cb_format' => 'display_currency_rightside'] - ] ); - -?> -
-
-
-table_with_header( $offers_sell_result, - array( 'Price', $curr_left, $curr_right, "Sum($curr_right)" ), - [ 'price' => ['cb_format' => 'display_currency_rightside'], - 'amount' => ['cb_format' => 'display_currency_leftside'], - 'volume' => ['cb_format' => 'display_currency_rightside'], - 'sum' => ['cb_format' => 'display_currency_rightside'] - ] ); -?> -
-
- - - - -
- There have been no trades in this market recently. -
- - -
Trade History( Last trades )
-table_attrs = array( 'class' => 'bordered', 'id' => 'trade_history', 'style'=>"border: none; box-shadow: none;" ); ?> -
- -table_with_header( $trades_result, - array( 'Date', 'Action', 'Price', "$curr_left", "$curr_right" ), - array( 'tradeDate', - 'direction' => ['cb_format' => function($val, $r) {$curr_left; return $val . ' ' . $GLOBALS['curr_left'];}], - 'tradePrice' => ['cb_format' => 'display_currency_rightside'], - 'tradeAmount' => ['cb_format' => 'display_currency_leftside'], - 'tradeVolume' => ['cb_format' => 'display_currency_rightside'] ) - ); ?> -
- - - - - - diff --git a/index.php b/index.php deleted file mode 100644 index 39c404c..0000000 --- a/index.php +++ /dev/null @@ -1,116 +0,0 @@ -= 60 ? $refresh : 60; // default to 60 secs. enforce 60 sec min. -} -?> - - - - - - - - - - Bisq Markets - - - - - - -
-
- -
- - -
- - -
- Looking for automated access to market data? Check out the API. -
- - - - - - - -
- -
- - -
-
- - diff --git a/lib/btcutil.class.php b/lib/btcutil.class.php deleted file mode 100644 index b5b3234..0000000 --- a/lib/btcutil.class.php +++ /dev/null @@ -1,57 +0,0 @@ -network = $network; - } - - /** - * returns all currences, sorted by code, with type identifer. - */ - public function get_all_currencies() { - - static $results = []; - if( @$results[$this->network] ) { - return $results[$this->network]; - } - - $fiat = $this->get_all_fiat(); - foreach( $fiat as &$f ) { - $f['type'] = 'fiat'; - } - - $crypto = $this->get_all_crypto(); - foreach( $crypto as &$c ) { - $c['type'] = 'crypto'; - } - $all = array_merge( $fiat, $crypto ); - ksort( $all ); - $results[$this->network] = $all; - - return $results[$this->network]; - } - - /** - * returns all fiat currences, sorted by code - */ - public function get_all_fiat() { - $json_file = sprintf( '%s/%s/db/fiat_currency_list.json', settings::get('data_dir'), $this->network); - - static $results = []; - if( @$results[$this->network] ) { - return $results[$this->network]; - } - - $buf = file_get_contents($json_file); - $start = strpos( $buf, '['); - $results[$this->network] = $this->add_keys( json_decode( substr($buf, $start), true ) ); - return $results[$this->network]; - } - - /** - * returns all crypto currences, sorted by code - */ - public function get_all_crypto() { - $json_file = sprintf( '%s/%s/db/crypto_currency_list.json', settings::get('data_dir'), $this->network); - - static $results = []; - if( @$results[$this->network] ) { - return $results[$this->network]; - } - - $buf = file_get_contents($json_file); - $start = strpos( $buf, "\n")-1; - $results[$this->network] = $this->add_keys( json_decode( substr($buf, $start), true ) ); - - return $results[$this->network]; - } - - /** - * turns currency list into assoc array for fast lookup by symbol. - */ - private function add_keys( $list ) { - $r = []; - foreach( $list as $v ) { - $k = $v['code']; - $r[$k] = $v; - } - return $r; - } - -} diff --git a/lib/filecache.class.php b/lib/filecache.class.php deleted file mode 100644 index f93f9c7..0000000 --- a/lib/filecache.class.php +++ /dev/null @@ -1,97 +0,0 @@ - 1, 'timestamp' => 1, 'datetime' => 1 ); - public $timestampjs_col_names = array(); - - function odd_even_style_css( $row_color = '#eeeeee', $row_color_alt = '#dddddd' ) { - return "tr.odd { background-color: $row_color; }\n" . - "tr.even { background-color: $row_color_alt; }\n"; - } - - function row( $row, $cols, $cnt ) { - - if( is_object( $row ) ) { - $row = get_object_vars( $row ); - } - $tr_attrs = $this->_get_attrs_buf( $this->tr_attrs ); - $td_attrs_orig = $this->_get_attrs_buf( $this->td_attrs ); - - $odd_or_even = $cnt % 2 == 0 ? 'even' : 'odd'; - $tr_attrs = "class='cnt-$cnt $odd_or_even' " . $tr_attrs; - $tr_id = $this->row_id_field ? sprintf( ' id = "%s"', sprintf( $this->row_id_mask, @$row[$this->row_id_field] ) ) : ''; - $tr_title = $this->row_title_field ? sprintf( ' title = "%s"', sprintf( $this->row_title_mask, @$row[$this->row_title_field] ) ) : ''; - - $buf = "\n"; - if( !$cols ) { - $cols = array_keys( $row ); - } - - foreach( $cols as $k => $key ) { - $td_attrs = $td_attrs_orig; // set/reset. - - // allow each column to have a callback. - if( is_array( $key )) { - $cb = @$key['cb_format']; - $val = @$row[$k]; - $val = is_callable( $cb ) ? call_user_func( $cb, $val, $row ) : null; - $key = $k; - } - else { - $val = @$row[$key]; - } - - // allow each row value to have its own callback - if( is_array( $val ) ) { - $cb = @$val['cb_format']; - $val = @$val['value']; - $val = is_callable( $cb ) ? call_user_func( $cb, $val, $row ) : null; - } - - if( is_numeric( $val ) && @$this->timestamptz_col_names[$key] ) { - $val = self::format_timestamp( $val ); - } - else if( is_numeric( $val ) && @$this->timestampjs_col_names[$key] ) { - $val = self::format_timestamp_js( $val ); - } - - if( is_bool( $val )) { - $val = $val ? 'Yes' : 'No'; - } - - $td_attrs = "class='td-$key' " . $td_attrs; - if( $this->right_align_numeric && is_numeric(@$val[0]) && is_numeric( str_replace(',', '', $val) )) { - $td_attrs .= " align='right'"; - } - $val = $this->htmlescape ? htmlentities( $val ) : $val; - $buf .= "" . $val . "\n"; - } - $buf .= "\n"; - - return $buf; - } - - static public function format_timestamp( $val ) { - $val_t = date('Y-m-d H:i:s T', $val ); - return ""; - } - - static public function format_timestamp_js( $val ) { - $val = $val/1000; // js uses milliseconds instead of seconds. - $val_t = date('Y-m-d H:i:s T', $val ); - return ""; - } - - - function header_row( $row ) { - $attrs = $this->_get_attrs_buf( $this->header_attrs ); - $buf = "\n"; - foreach( $row as $key => $val ) { - if( is_array( $val ) ) { - $val = @$val['text']; - } - $buf .= "" . $val . "\n"; - } - $buf .= "\n"; - return $buf; - } - - private function _get_attrs_buf( $attrs ) { - - $table_attrs = ''; - - if( is_array( $attrs ) ) { - $cnt = 0; - foreach( $attrs as $attr => $val ) { - $table_attrs .= ($cnt++ == 0 ? '' : ' ' ) . sprintf( '%s="%s"', $attr, $val ); - } - } - - return $table_attrs; - } - - function table_with_header( $rows, $header=null, $cols = null ) { - - if( !$header ) { - $header = @array_keys(reset($rows)); - } - - $attrs = $this->_get_attrs_buf( $this->table_attrs ); - - $buf = "\n"; - - $buf .= $this->header_row( $header ); - - $buf .= "\n"; - - $cnt = 1; - foreach( $rows as $row ) { - $buf .= $this->row( $row, $cols, $cnt ++ ); - } - $buf .= "\n"; - - $buf .= "
\n"; - return $buf; - } - - function table( $rows, $cols = null ) { - - $attrs = $this->_get_attrs_buf( $this->table_attrs ); - - $buf = "\n"; - - $cnt = 1; - foreach( $rows as $row ) { - $buf .= $this->row( $row, $cols, $cnt ++ ); - } - - $buf .= "
\n"; - return $buf; - } - - function table_from_assoc_array( $arr, $colmap = array(), $include_unmapped = true ) { - - $rows = array( ); - if( @count( $colmap ) && !$include_unmapped ) { - - foreach( $colmap as $key => $label ) { - - $val = @$arr[$key]; - - if( is_array( $label ) ) { - $label_tmp = @$label['label']; - $label['value'] = $val; - $val = $label; - $label = $label_tmp; - } - - $label = "$label"; - $rows[] = array( $label, $val ); - } - - return $this->table( $rows ); - - } - - foreach( $arr as $key => $val ) { - $label = @$colmap[$key]; - if( !$label && !$include_unmapped ) { - continue; - } - $label = $label ? $label : $key; - $label = "$label"; - $rows[] = array( $label, $val ); - } - - return $this->table( $rows ); - - } - - - function table_from_object( $obj, $colmap = array(), $include_unmapped = true ) { - - $attrs = get_object_vars( $obj ); - return $this->table_from_assoc_array( $attrs, $colmap, $include_unmapped ); - - } - - -} diff --git a/lib/markets.class.php b/lib/markets.class.php deleted file mode 100644 index 4b2a7b9..0000000 --- a/lib/markets.class.php +++ /dev/null @@ -1,121 +0,0 @@ -network = $network; - } - - public function get_markets() { - static $cache = []; - if( @$cache[$this->network] ) { - return $cache[$this->network]; - } - - list($pmarket) = explode('_', $this->network); - $pmarket = strtoupper($pmarket); - - $currencies = new currencies($this->network); - $clist = $currencies->get_all_currencies(); - - $markets = []; - foreach( $clist as $symbol => $c ) { - - if( $symbol == $pmarket ) { - continue; - } - - // here we make fiat markets always primary, eg BTC/USD. - // and BTC always primary against other crypto, eg XMR/BTC. - // This is a kludge. should be getting this info from bitsquare json. - - $is_fiat = $c['type'] == 'fiat'; - $pmarketname = $clist[$pmarket]['name']; - - $lsymbol = $is_fiat ? $pmarket : $symbol; - $rsymbol = $is_fiat ? $symbol : $pmarket; - $lname = $is_fiat ? $pmarketname : $c['name']; - $rname = $is_fiat ? $c['name']: $pmarketname; - $ltype = $is_fiat ? 'crypto' : $c['type']; - $rtype = $is_fiat ? 'fiat' : 'crypto'; - $lprecision = 8; - $rprecision = $is_fiat ? 2 : 8; - - $pair = sprintf( '%s_%s', strtolower($lsymbol), strtolower($rsymbol) ); - $type = $is_fiat ? 'crypto/fiat' : 'crypto/crypto'; - - $market = ['pair' => $pair, - 'lname' => $lname, - 'rname' => $rname, - 'lsymbol' => $lsymbol, - 'rsymbol' => $rsymbol, - 'lprecision' => $lprecision, - 'rprecision' => $rprecision, - 'ltype' => $ltype, - 'rtype' => $rtype, - 'name' => sprintf( '%s/%s', $lname, $rname ), - ]; - // maybe add more attributes later. - $markets[$pair] = $market; - } - - ksort( $markets ); - $cache[$this->network] = $markets; - return $markets; - } - - public function get_markets_with_trades() { - $t = new trades($this->network); - $all = $t->get_all_trades(); - - $markets = $this->get_markets(); - $traded = []; - foreach( $all as $trade ) { - $pair = $trade['market']; - $market = @$markets[$pair]; - if( $market ) { - $traded[$pair] = $markets[$pair]; - } - } - - return $traded; - } - - public function get_markets_with_offers() { - $o = new offers($this->network); - $all = $o->get_all_offers(); - - $markets = $this->get_markets(); - $offered = []; - foreach( $all as $offer ) { - $pair = $offer['market']; - $market = @$markets[$pair]; - if( $market ) { - $offered[$pair] = $markets[$pair]; - } - } - - return $offered; - } - - - public function get_markets_with_trades_or_offers() { - return array_merge($this->get_markets_with_trades(), - $this->get_markets_with_offers() ); - } - - public function validate_market($market) { - $markets = $this->get_markets(); - $match = @$markets[$market]; - - if( !$match ) { - throw new Exception("Unknown market $market", 2); - } - } -} diff --git a/lib/offers.class.php b/lib/offers.class.php deleted file mode 100644 index a72550e..0000000 --- a/lib/offers.class.php +++ /dev/null @@ -1,163 +0,0 @@ -network = $network; - } - - /** - * criteria keys: - * + market: eg 'dash_btc', or 'all' - * + datetime_from: timestamp utc - * + datetime_to: timestamp utc - * + direction: 'buy', 'sell' - * + limit: max offers - * + sort: asc | desc default = asc ( by price ) - * + integeramounts: bool. default = true. - * + fields: array -- fields to return. optionally use key/val to map fields to another name. - * available: "currency", "direction", "price", "amount", - * "date", - * "useMarketBasedPrice", "marketPriceMargin", - * "amount", "minAmount", "id", - * "offerFeeTxId" - */ - public function get_offers( $criteria ) { - - $offers = $this->get_all_offers(); - extract( $criteria ); // puts keys in local namespace. - - $sort = @$sort ?: 'desc'; - $dtfrom_milli = @$datetime_from * 1000; - $dtto_milli = @$datetime_to * 1000; - $limit = @$limit ?: PHP_INT_MAX; - $integeramounts = isset($integeramounts) ? $integeramounts : true; - - if( $sort == 'asc') { - $offers = array_reverse( $offers ); - } - - $matches = []; - foreach( $offers as $offer ) { - if( @$market && $market != $offer['market']) { - continue; - } - if( $dtfrom_milli && $dtfrom_milli > $offer['date']) { - continue; - } - if( $dtto_milli && $dtto_milli < $offer['date']) { - continue; - } - if( @$direction && $direction != $offer['direction'] ) { - continue; - } - - if( !@$integeramounts ) { - $offer['price'] = btcutil::int_to_btc( $offer['price'] ); - $offer['amount'] = btcutil::int_to_btc( $offer['amount'] ); - $offer['volume'] = btcutil::int_to_btc( $offer['volume'] ); - $offer['minAmount'] = btcutil::int_to_btc( $offer['minAmount'] ); - } - - // convert to user specified field order list, if present. - if( @$fields ) { - $t = []; - foreach( $fields as $k => $f ) { - $old = is_string($k) ? $k : $f; - $new = $f; - $t[$new] = @$offer[$old]; - } - $matches[] = $t; - } - else { - $matches[] = $offer; - } - - if( count($matches) >= $limit ) { - break; - } - } - - return $matches; - } - - public function get_all_offers() { - $json_file = sprintf( '%s/%s/db/offers_statistics.json', settings::get('data_dir'), $this->network ); - return filecache::get( $json_file, 'all_offers_result', [$this, 'get_all_offers_worker'], [$json_file] ); - } - - /* This is only public so it can be used as callback for filecache class - */ - public function get_all_offers_worker($json_file) { - - // only needed to determine if currency is fiat or not. - $currencies = new currencies($this->network); - $currlist = $currencies->get_all_currencies(); - - // remove some garbage data at beginning of file, if present. - $fh = fopen( $json_file, 'r' ); - - // we use advisory locking. hopefully bitsquare does too? - if( !$fh || !flock( $fh, LOCK_SH ) ) { - bail( 500, "Internal Server Error" ); - } - $buf = stream_get_contents( $fh ); - fclose( $fh ); - - $start = strpos( $buf, "\n")-1; - $data = json_decode( substr($buf, $start), true ); - - // handle case of empty offers file. - if( !$data ) { - $data = []; - } - - // add market key - foreach( $data as $idx => &$offer ) { - - // change currencyCode to currency, to match trades class. - $curr = $offer['currency'] = $offer['currencyCode']; - unset( $offer['currencyCode'] ); - - list($left, $right) = explode('/', $offer['currencyPair'] ); - $cleft = @$currlist[$left]; - $cright = @$currlist[$right]; - if( !$cleft || !$cright ) { - unset( $data[$idx]); - continue; - } - - // Here we normalize integers to 8 units of precision. calling code depends on this. - // note: all currencies are presently specified with 8 units of precision in json files - // but this has not always been the case and could change in the future. - $offer['price'] = $offer['primaryMarketPrice'] * pow( 10, 8 - $cright['precision'] ); - $offer['amount'] = $offer['primaryMarketAmount'] * pow( 10, 8 - $cleft['precision'] ); - $offer['volume'] = $offer['primaryMarketVolume'] * pow( 10, 8 - $cright['precision'] ); - $offer['market'] = strtolower( str_replace( '/', '_', $offer['currencyPair'] ) ); - - // trade direction is given to us Bitcoin-centric. Here we make it refer to the left side of the market pair. - $offer['direction'] = $offer['primaryMarketDirection']; - } - - // sort desc by price. - usort( $data, function( $a, $b ) { - $a = $a['price']; - $b = $b['price']; - - if( $a == $b ) { - return 0; - } - return $a > $b ? -1 : 1; - }); - - return $data; - } -} diff --git a/lib/primary_market.class.php b/lib/primary_market.class.php deleted file mode 100644 index bb9fe89..0000000 --- a/lib/primary_market.class.php +++ /dev/null @@ -1,106 +0,0 @@ -getCode(), $e->getMessage(), $e->getFile(), $e->getLine(), $e->getTraceAsString() ); - while( ( $e = $e->getPrevious() ) ) { - $msg .= sprintf( "\nPrevious Exception. code: %s, message: %s\n%s : %s\n\nStack Trace:\n%s\n", $e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine(), $e->getTraceAsString() ); - } - echo $msg; - // error_log( $msg ); - strict_mode_mail_admin( 'Uncaught exception!', $msg ); - echo "\n\nNow exiting. Please report this problem to the software author\n\n"; - exit(1); -} - -/** - * This shutdown handler callback prints a message and sends email on any PHP fatal error - */ -function shutdown_handler() { - - $error = error_get_last(); - - $ignore = E_WARNING | E_NOTICE | E_USER_WARNING | E_USER_NOTICE | E_STRICT | E_DEPRECATED | E_USER_DEPRECATED; - if ( $error && ($error['type'] & $ignore) == 0) { - - // error keys: type, file, line, message - $msg = "Ouch! Encountered PHP Fatal Error. Shutting down.\n" . print_r( $error, true ); - echo $msg; - strict_mode_mail_admin( 'PHP Fatal Error!', $msg ); - } -} - -/** - * email admin if defined - */ -function strict_mode_mail_admin( $subject, $msg ) { - $subject = sprintf( '[%s] [%s] %s [pid: %s]', gethostname(), basename($_SERVER['PHP_SELF']), $subject, getmypid() ); - if( defined('ALERTS_MAIL_TO') ) { - mail( ALERTS_MAIL_TO, $subject, $msg ); - } - else { - echo "WARNING: ALERTS_MAIL_TO not defined in config. alert not sent with subject: $subject\n"; - } -} - - - - diff --git a/lib/summarize_trades.class.php b/lib/summarize_trades.class.php deleted file mode 100644 index 3313125..0000000 --- a/lib/summarize_trades.class.php +++ /dev/null @@ -1,272 +0,0 @@ -network = $network; - } - - private function summarize( $trades ) { - } - - public function get_trade_summaries_minutes( $criteria ) { - - // align to start of minute - $criteria['interval'] = 'minute'; - - return $this->get_trade_summaries( $criteria ); - } - - public function get_trade_summaries_10_minutes( $criteria ) { - - // align to start of 10 minutes - $criteria['interval'] = '10_minute'; - return $this->get_trade_summaries( $criteria ); - } - - public function get_trade_summaries_half_hours( $criteria ) { - - // align to start of half hour - $criteria['interval'] = 'half_hour'; - - return $this->get_trade_summaries( $criteria ); - } - - public function get_trade_summaries_hours( $criteria ) { - - // align to start of hour - $criteria['interval'] = 'hour'; - - return $this->get_trade_summaries( $criteria ); - } - - public function get_trade_summaries_half_days( $criteria ) { - - // align to start of day - $criteria['interval'] = 'half_day'; - - return $this->get_trade_summaries( $criteria ); - } - - public function get_trade_summaries_days( $criteria ) { - - // align to start of day - $criteria['interval'] = 'day'; - - return $this->get_trade_summaries( $criteria ); - } - - public function get_trade_summaries_weeks( $criteria ) { - - // align to start of first day of week. - $criteria['interval'] = 'week'; - - return $this->get_trade_summaries( $criteria ); - } - - public function get_trade_summaries_months( $criteria ) { - - // align to start of first day of month. - $criteria['interval'] = 'month'; - - return $this->get_trade_summaries( $criteria ); - } - - public function get_trade_summaries_years( $criteria ) { - - // align to start of first day of year. - $criteria['interval'] = 'year'; - - return $this->get_trade_summaries( $criteria ); - } - - - /** - * criteria keys: - * + market: eg 'dash_btc', or 'all'. required. - * + interval. required. in seconds. - * + datetime_from: timestamp utc. required. - * + datetime_to: timestamp utc. required. - * + one_period: if true, create only a single summary period. - * + direction: buy, sell - * + integeramounts: bool. default = true. - * + fillgaps: bool. default = false. - * + fields: array -- fields to return. - * available: "period_start", "open", "close", - * "high", "low", "avg", "volume" - */ - public function get_trade_summaries( $criteria ) { - extract( $criteria ); - $tradesobj = new trades($this->network); - unset( $criteria['fields'] ); - unset( $criteria['limit'] ); - $criteria['sort'] = 'asc'; - $criteria['integeramounts'] = true; - $integeramounts = isset($integeramounts) ? $integeramounts : true; - - $trades = $tradesobj->get_trades( $criteria ); - - $intervals = []; - - foreach( $trades as $trade ) { - $traded_at = $trade['tradeDate'] / 1000; - $interval_start = @$one_period ? $datetime_from : $this->interval_start($traded_at, $interval); - - if( !isset($intervals[$interval_start]) ) { - $intervals[$interval_start] = ['open' => 0, - 'close' => 0, - 'high' => 0, - 'low' => 0, - 'avg' => 0, - 'volume_right' => 0, - 'volume_left' => 0, - ]; - $intervals_prices[$interval_start] = []; - } - $period =& $intervals[$interval_start]; - $price = $trade['tradePrice']; - $direction = $trade['direction']; - $intervals_prices[$interval_start]['leftvol'][] = $trade['tradeAmount']; - $intervals_prices[$interval_start]['rightvol'][] = $trade['tradeVolume']; - - if( $price ) { - $plow = $period['low']; - $period['period_start'] = $interval_start; - $period['open'] = @$period['open'] ?: $price; - $period['close'] = $price; - $period['high'] = $price > $period['high'] ? $price : $period['high']; - $period['low'] = ($plow && $price > $plow) ? $period['low'] : $price; -// print_r($intervals_prices[$interval_start]); -// var_dump( array_sum($intervals_prices[$interval_start]['volume_left']), array_sum($intervals_prices[$interval_start]['price']) ); echo "\n----\n"; - $period['avg'] = array_sum($intervals_prices[$interval_start]['rightvol']) / array_sum($intervals_prices[$interval_start]['leftvol']) * 100000000; - $period['volume_left'] += $trade['tradeAmount']; - $period['volume_right'] += $trade['tradeVolume']; - } - } - - // generate intervals in gaps. - // note: this is a slow operation. best not to use this option if possible. - if( @$fillgaps ) { - $secs = $this->interval_secs( $interval ); - if( $secs < 0 ) { - throw new Exception( "invalid interval seconds $secs for interval $interval" ); - } - - $next = $datetime_from; - $cnt = 0; - $max = 50000; // avoid breaking server. ;-) - while( $next < $datetime_to && $cnt++ < $max ) { - $interval_start = $this->interval_start($next, $interval); - - $cur = @$intervals[$interval_start]; - if( !$cur ) { - if( $fillgaps === 'random' ) { - $open = @$prev_close ?: 50; - $close = rand( $open - $open / 2, $open + $open / 2); - $high = rand( $open, $open + $open / 3); - $low = rand( $open - $open / 3, $open ); - $avg = rand( $low, $high ); - $volume = rand( 1, 100 ); - $amount = rand( 1, 100 ); - $prev_close = $close; - } - $cur = ['period_start' => $interval_start, - 'open' => @$open, - 'close' => @$close, - 'high' => @$high, - 'low' => @$low, - 'avg' => @$avg, - 'volume_right' => @$volume, - 'volume_left' => @$amount, - ]; - $intervals[$interval_start] = $cur; - } - else { - $prev_close = $cur['close']; - } - $next += $secs + 1; - } - ksort( $intervals ); - } - - - if( @$fields || !@$integeramounts ) { - foreach( $intervals as $k => &$period ) { - - if(!@$integeramounts ) { - $period['open'] = btcutil::int_to_btc( $period['open'] ); - $period['close'] = btcutil::int_to_btc( $period['close'] ); - $period['high'] = btcutil::int_to_btc( $period['high'] ); - $period['low'] = btcutil::int_to_btc( $period['low'] ); - $period['avg'] = btcutil::int_to_btc( $period['avg'] ); - $period['volume_right'] = btcutil::int_to_btc( $period['volume_right'] ); - $period['volume_left'] = btcutil::int_to_btc( $period['volume_left'] ); - } - - // convert to user specified field order list, if present. - if( @$fields ) { - $p = []; - $t = $period; - foreach( $fields as $id => $f ) { - $old = is_string($id) ? $id : $f; - $new = $f; - $p[$new] = $period[$old]; - } - $period = $p; - } - } - } - - return array_values( $intervals ); - } - - protected function interval_start( $ts, $interval ) { - switch( $interval ) { - case 'minute': - return (int)($ts - ($ts % 60)); - case '10_minute': - return (int)($ts - ($ts % 600)); - case 'half_hour': - return (int)($ts - ($ts % 1800)); - case 'hour': - return (int)($ts - ($ts % 3600)); - case 'half_day': - return (int)($ts - ($ts % (3600*12))); - case 'day': - return strtotime( 'midnight today', $ts); - case 'week': - return strtotime( "midnight sunday last week", $ts ); - case 'month': - return strtotime( "midnight first day of this month", $ts ); - case 'year': - return strtotime( "midnight first day of january", $ts ); - default: - throw new exception( "Unsupported interval" ); - } - } - - protected function interval_end( $ts, $interval ) { - switch( $interval ) { - case '10_minute': - return ($this->interval_start($ts, $interval) + 600 -1); - case 'half_day': - return ($this->interval_start($ts, $interval) + 86400/2 -1); - case 'half_hour': - return ($this->interval_start($ts, $interval) + 3600/2 -1); - default: - return (strtotime("+1 $interval", $ts) -1); - } - } - - public function interval_secs( $interval ) { - $start = $this->interval_start( time(), $interval ); - return $this->interval_end( $start, $interval ) - $start; - } - - -} diff --git a/lib/summarize_trades_multimarket.class.php b/lib/summarize_trades_multimarket.class.php deleted file mode 100644 index a896dee..0000000 --- a/lib/summarize_trades_multimarket.class.php +++ /dev/null @@ -1,117 +0,0 @@ -network); - unset( $criteria['fields'] ); - unset( $criteria['limit'] ); - $criteria['sort'] = 'asc'; - $criteria['integeramounts'] = true; - $integeramounts = isset($integeramounts) ? $integeramounts : true; - - $trades = $tradesobj->get_trades( $criteria ); - - $intervals = []; - - $currencies = new currencies($this->network); - $fiat = $currencies->get_all_fiat(); - - foreach( $trades as $trade ) { - $traded_at = $trade['tradeDate'] / 1000; - $interval_start = @$one_period ? $datetime_from : $this->interval_start($traded_at, $interval); - - if( !isset($intervals[$interval_start]) ) { - $intervals[$interval_start] = ['volume' => 0, - 'num_trades' => 0, - ]; - $intervals_prices[$interval_start] = []; - } - - $is_fiat = isset($fiat[$trade['currency']]); - - $period =& $intervals[$interval_start]; - $period['period_start'] = $interval_start; - $period['volume'] += $is_fiat ? $trade['tradeAmount'] : $trade['tradeVolume']; - $period['num_trades'] ++; - } - - // generate intervals in gaps. - // note: this is a slow operation. best not to use this option if possible. - if( @$fillgaps ) { - $secs = $this->interval_secs( $interval ); - if( $secs < 0 ) { - throw new Exception( "invalid interval seconds $secs for interval $interval" ); - } - - $next = $datetime_from; - $cnt = 0; - $max = 50000; // avoid breaking server. ;-) - while( $next < $datetime_to && $cnt++ < $max ) { - $interval_start = $this->interval_start($next, $interval); - - $cur = @$intervals[$interval_start]; - if( !$cur ) { - if( $fillgaps === 'random' ) { - $volume = rand( 1, 100 ); - $num_trades = rand( 0, 30 ); - } - $cur = ['period_start' => $interval_start, - 'volume' => @$volume ?: 0, - 'num_trades' => @$num_trades ?: 0, - ]; - $intervals[$interval_start] = $cur; - } - $next += $secs + 1; - } - ksort( $intervals ); - } - - - if( @$fields || !@$integeramounts ) { - foreach( $intervals as $k => &$period ) { - - if(!@$integeramounts ) { - $period['volume'] = btcutil::int_to_btc( $period['volume'] ); - } - - // convert to user specified field order list, if present. - if( @$fields ) { - $p = []; - $t = $period; - foreach( $fields as $id => $f ) { - $old = is_string($id) ? $id : $f; - $new = $f; - $p[$new] = $period[$old]; - } - $period = $p; - } - } - } - - return array_values( $intervals ); - } -} diff --git a/lib/ticker.class.php b/lib/ticker.class.php deleted file mode 100644 index ca8ab0e..0000000 --- a/lib/ticker.class.php +++ /dev/null @@ -1,101 +0,0 @@ -network = $network; - } - - public function get_market_ticker( $market, $criteria ) { - - $criteria['market'] = $market; - $criteria['fields'] = ['close' => 'last', 'high','low','volume_left','volume_right']; - $criteria['one_period'] = true; - - $summarizer = new summarize_trades($this->network); - - // ensure we will only have a single period result row from summarize_trades. - $timerange = $criteria['datetime_to'] - $criteria['datetime_from']; - $interval_secs = $summarizer->interval_secs( $criteria['interval'] ) + 1; - if( $timerange > $interval_secs ) { - throw new Exception( "time range ($timerange) is greater than interval period ($interval_secs)" ); - } - $periods = $summarizer->get_trade_summaries($criteria); - - // summarizer only returns a single period because we set one_period flag. - $ticker = @$periods[0]; - - if( !$ticker ) { - $last = $this->get_market_last( $market ); - if( !$last ) { - return null; - } - if( !@$criteria['integeramounts'] ) { - $last = btcutil::int_to_btc( $last ); - } - - $ticker = [ - 'last' => $last, - 'high' => $last, - 'low' => $last, - 'volume_left' => 0, - 'volume_right' => 0, - ]; - } - - $offers = new offers($this->network); - - $criteria = ['market' => $market, - 'datetime_from' => $criteria['datetime_from'], - 'datetime_to' => $criteria['datetime_to'], - 'integeramounts' => $criteria['integeramounts'], - 'direction' => 'BUY', - 'sort' => 'asc', - 'limit' => 1, - ]; - $buys = $offers->get_offers( $criteria ); - - $criteria['direction'] = 'SELL'; - $criteria['sort'] = 'asc'; - $sells = $offers->get_offers( $criteria ); - - $ticker['buy'] = @$buys[0]['price']; - $ticker['sell'] = @$sells[0]['price']; - - return $ticker; - } - - public function get_market_last( $market ) { - $trades = new trades($this->network); - $trade = $trades->get_last_trade_by_market( $market ); - return @$trade['tradePrice']; - } - - public static function get_all_markets_ticker( $criteria ) { - - $result = []; - - $networks = primary_market::get_network_list(); - foreach( $networks as $network ) { - $ticker = new ticker($network); - - $markets = new markets($network); - foreach( $markets->get_markets() as $market ) { - $pair = $market['pair']; - $result[$pair] = $ticker->get_market_ticker( $pair, $criteria); - } - } - - return $result; - } - -} diff --git a/lib/trades.class.php b/lib/trades.class.php deleted file mode 100644 index bb82819..0000000 --- a/lib/trades.class.php +++ /dev/null @@ -1,237 +0,0 @@ -network = $network; - $this->json_file = sprintf( '%s/%s/db/trade_statistics.json', settings::get('data_dir'), $network); - } - - /** - * criteria keys: - * + market: eg 'dash_btc', or 'all' - * + datetime_from: timestamp utc - * + datetime_to: timestamp utc - * + offer_id_from: bisq trade id - * + offer_id_to: bisq trade id - * + direction: 'buy', 'sell' - * + limit: max trades - * + sort: asc | desc. default = asc - * + integeramounts: bool. default = true. - * + fields: array -- fields to return. optionally use key/val to map fields to another name. - * available: "currency", "direction", "tradePrice", "tradeAmount", - * "tradeDate", "paymentMethod", "offerDate", - * "useMarketBasedPrice", "marketPriceMargin", - * "offerAmount", "offerMinAmount", "offerId", - * "depositTxId" - */ - public function get_trades( $criteria ) { - - extract( $criteria ); // puts keys in local namespace. - - $market = @$market; - $trades = $market ? $this->get_trades_by_market( $market ) : - $this->get_all_trades(); - - $sort = @$sort ?: 'desc'; - $dtfrom_milli = @$datetime_from * 1000; - $dtto_milli = @$datetime_to * 1000; - $limit = @$limit ?: PHP_INT_MAX; - $direction = @$direction ? strtoupper( $direction ) : null; - $integeramounts = isset($integeramounts) ? $integeramounts : true; - $offer_id_from = @$offer_id_from; - $offer_id_to = @$offer_id_to; - - $offer_id_from_ts = null; - $offer_id_to_ts = null; - - $matches = []; - - - if( $sort == 'asc') { - $trades = array_reverse( $trades ); - } - - // note: the offer_id_from/to depends on iterating over trades in - // descending chronological order. - foreach( $trades as $trade ) { - if($offer_id_from == $trade['offerId']) { - $offer_id_from_ts = $trade['tradeDate']; - } - if($offer_id_to == $trade['offerId']) { - $offer_id_to_ts = $trade['tradeDate']; - } - - if($offer_id_to && $offer_id_to_ts === null) { - continue; - } - if( $offer_id_from && $offer_id_from_ts != null && $offer_id_from_ts != $trade['tradeDate'] ) { - continue; - } - - if( $market && $market != $trade['market']) { - continue; - } - if( $dtfrom_milli && $dtfrom_milli > $trade['tradeDate']) { - continue; - } - if( $dtto_milli && $dtto_milli < $trade['tradeDate']) { - continue; - } - if( $direction && $direction != $trade['direction'] ) { - continue; - } - - // Filter out bogus trades with BTC/BTC or XXX/XXX market. - // See github issue: https://github.com/bitsquare/bitsquare/issues/883 - list($left, $right) = explode('/', $trade['currencyPair']); - if( $left == $right ) { - continue; - } - - if( !@$integeramounts ) { - $trade['tradePrice'] = btcutil::int_to_btc( $trade['tradePrice'] ); - $trade['tradeAmount'] = btcutil::int_to_btc( $trade['tradeAmount'] ); - $trade['tradeVolume'] = btcutil::int_to_btc( $trade['tradeVolume'] ); - $trade['offerAmount'] = btcutil::int_to_btc( $trade['offerAmount'] ); - $trade['offerMinAmount'] = btcutil::int_to_btc( $trade['offerMinAmount'] ); - } - - // convert to user specified field order list, if present. - if( @$fields ) { - $t = []; - $t2 = $trade; - - foreach( $fields as $k => $f ) { - $old = is_string($k) ? $k : $f; - $new = $f; - $t[$new] = @$t2[$old]; - } - $trade = $t; - } - - $matches[] = $trade; - - if( count($matches) >= $limit ) { - break; - } - } - - // if we offer_id_from or to is specified and we did not - // find matching trade(s), then all trades are excluded from set. - if( ($offer_id_from && !$offer_id_from_ts) || - ($offer_id_to && !$offer_id_to_ts) ) { - $matches = []; - } - - - return $matches; - } - - public function get_last_trade_by_market( $market ) { - $results = filecache::get( $this->json_file, 'market_last_result', [$this, 'get_markets_trades_worker'] ); - return @$results[$market]['last']; - } - - public function get_trades_by_market( $market ) { - $results = filecache::get( $this->json_file, 'market_trades_result', [$this, 'get_markets_trades_worker'] ); - return @$results[$market]['trades'] ?: []; - } - - public function get_all_trades() { - return filecache::get( $this->json_file, 'all_trades_result', [$this, 'get_all_trades_worker'] ); - } - - /* This is only public so it can be used as callback for cache class - */ - public function get_markets_trades_worker() { - $all_trades = $this->get_all_trades(); - $results = []; - foreach( $all_trades as $trade ) { - $market = $trade['market']; - $mkt =& $results[$market]; - $mkt['trades'][] = $trade; - - // trades are in descending order. So to save the latest trade, - // we store the first one we find for each market. - if( !isset( $mkt['last'] )) { - $mkt['last'] = $trade; - } - } - return $results; - } - - - - /* This is only public so it can be used as callback for cache class - */ - public function get_all_trades_worker() { - $json_file = $this->json_file; - - // only needed to determine if currency is fiat or not. - $currencies = new currencies($this->network); - $currlist = $currencies->get_all_currencies(); - - // remove some garbage data at beginning of file, if present. - $fh = fopen( $json_file, 'r' ); - - // we use advisory locking. hopefully bitsquare does too? - if( !$fh || !flock( $fh, LOCK_SH ) ) { - bail( 500, "Internal Server Error" ); - } - $buf = stream_get_contents( $fh ); - fclose( $fh ); - - $ltc_start_ts = strtotime('2017-06-28') * 1000; - - $start = strpos( $buf, "\n")-1; - $data = json_decode( substr($buf, $start), true ); - - // handle case of empty trades file. - if( !$data ) { - $data = []; - } - - // add market key - foreach( $data as $idx => &$trade ) { - - list($left, $right) = explode('/', $trade['currencyPair'] ); - $cleft = @$currlist[$left]; - $cright = @$currlist[$right]; - if( !$cleft || !$cright ) { - // This weeds out any trades with symbols that are not defined in the currency*.json files. - unset( $data[$idx]); - continue; - } - - - // HACK: filter out LTC base currency trades before 2017-06-28, because the historic data has some - // bogus data that was made for testing or something. - if($this->network == 'ltc_mainnet' && $trade['tradeDate'] < $ltc_start_ts) { - unset( $data[$idx]); - continue; - } - - // Here we normalize integers to 8 units of precision. calling code depends on this. - // note: all currencies are presently specified with 8 units of precision in json files - // but this has not always been the case and could change in the future. - $trade['tradePrice'] = $trade['primaryMarketTradePrice'] * pow( 10, 8 - $cright['precision'] ); - $trade['tradeAmount'] = $trade['primaryMarketTradeAmount'] * pow( 10, 8 - $cleft['precision'] ); - $trade['tradeVolume'] = $trade['primaryMarketTradeVolume'] * pow( 10, 8 - $cright['precision'] ); - $trade['market'] = strtolower( str_replace( '/', '_', $trade['currencyPair'] ) ); - - // trade direction is given to us Bitcoin-centric. Here we make it refer to the left side of the market pair. - $trade['direction'] = $trade['primaryMarketDirection']; - } - return $data; - } - -} diff --git a/markets b/markets new file mode 100755 index 0000000..5f0a3a2 --- /dev/null +++ b/markets @@ -0,0 +1,65 @@ +#!/bin/bash +set -e + +PROJECT_PRODUCTION="bisq-markets" +HOSTNAME="https://markets.wiz.biz/" + +EXITCODE=0 +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +deploy() #{{{ +{ + echo "############################" + echo "Deploying to ${PROJECT_PRODUCTION}" + echo "############################" + + gcloud config set project "${PROJECT_PRODUCTION}" + mvn appengine:deploy +} #}}} +update_data() #{{{ +{ + curl -i "${HOSTNAME}/api/ticker&forceUpdate=1" & +} #}}} +cron_generate() #{{{ +{ + echo """ + + /api/ticker?&forceUpdate=1 + default + update /api/ticker every 60 seconds + every 60 seconds + """ +} #}}} +print_help() #{{{ +{ + echo "Usage: $0 [command]" + echo "Commands:" + echo "deploy" + echo "update_data" + echo "cron_generate" + EXITCODE=1 +} #}}} + +case "$1" in #{{{ + deploy) #{{{ + deploy + ;; + #}}} + update_data) #{{{ + update_data + ;; + #}}} + cron_generate) #{{{ + cron_generate + ;; + #}}} + *) #{{{ + print_help + ;; + #}}} +esac #}}} +#}}} + +exit ${EXITCODE} + +# vim: expandtab:foldmethod=marker wrap diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..e29cce6 --- /dev/null +++ b/pom.xml @@ -0,0 +1,150 @@ + + + + + + 4.0.0 + + war + + bisq + markets + 0.0.1 + + + + 1.8 + 1.8 + + false + + + + + + + + + + com.google.appengine + appengine-api-1.0-sdk + 1.9.76 + + + + javax.servlet + javax.servlet-api + 3.1.0 + jar + provided + + + org.tuckey + urlrewritefilter + 4.0.3 + + + com.google.code.gson + gson + 2.3.1 + compile + + + org.graalvm.compiler + compiler + 1.0.0-rc9 + + + + + + + com.google.appengine + appengine-testing + 1.9.76 + test + + + com.google.appengine + appengine-api-stubs + 1.9.76 + test + + + com.google.appengine + appengine-tools-sdk + 1.9.76 + test + + + + com.google.truth + truth + 0.42 + test + + + junit + junit + 4.13-beta-1 + test + + + org.mockito + mockito-core + 2.23.4 + test + + + + + + + ${project.build.directory}/${project.build.finalName}/WEB-INF/classes + + + + com.google.cloud.tools + appengine-maven-plugin + 1.3.1 + + + + org.apache.maven.plugins + maven-war-plugin + 2.6 + + true + + + + ${basedir}/src/main/webapp/WEB-INF + true + WEB-INF + + + ${basedir}/static + false + static + + + + + + + + diff --git a/settings.json.example b/settings.json.example deleted file mode 100644 index e2c8325..0000000 --- a/settings.json.example +++ /dev/null @@ -1,5 +0,0 @@ -{ -"data_dir": "/home/myuser/.local/share/Bitsquare", -"btc_network": "mainnet", -"ltc_network": "mainnet" -} diff --git a/src/main/java/bisq/markets/api/CachingProxy.java b/src/main/java/bisq/markets/api/CachingProxy.java new file mode 100644 index 0000000..d8d2633 --- /dev/null +++ b/src/main/java/bisq/markets/api/CachingProxy.java @@ -0,0 +1,756 @@ +package bisq.markets.api; + +// {{{ import +import static com.google.appengine.api.urlfetch.FetchOptions.Builder.*; + +//import bisq.markets.api.beans.*; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.io.InputStream; +import java.io.IOException; +import java.io.PrintWriter; +import java.io.UnsupportedEncodingException; +import java.net.HttpURLConnection; +import java.net.URL; +import java.net.MalformedURLException; +import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.HashMap; +import java.util.Map; + +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import com.google.appengine.api.datastore.DatastoreService; +import com.google.appengine.api.datastore.DatastoreServiceFactory; +import com.google.appengine.api.datastore.Entity; +import com.google.appengine.api.datastore.EntityNotFoundException; +import com.google.appengine.api.datastore.FetchOptions; +import com.google.appengine.api.datastore.Key; +import com.google.appengine.api.datastore.KeyFactory; +import com.google.appengine.api.datastore.Query; +import com.google.appengine.api.datastore.Query.Filter; +import com.google.appengine.api.datastore.Query.FilterPredicate; +import com.google.appengine.api.datastore.Query.FilterOperator; +import com.google.appengine.api.datastore.Query.CompositeFilter; +import com.google.appengine.api.datastore.Query.CompositeFilterOperator; +import com.google.appengine.api.datastore.Query.SortDirection; +import com.google.appengine.api.datastore.Query; +import com.google.appengine.api.datastore.PreparedQuery; +import com.google.appengine.api.datastore.Text; +import com.google.appengine.api.datastore.Transaction; + +import com.google.appengine.api.memcache.Expiration; +import com.google.appengine.api.memcache.MemcacheService; +import com.google.appengine.api.memcache.MemcacheService.SetPolicy; +import com.google.appengine.api.memcache.MemcacheServiceFactory; + +import com.google.appengine.api.utils.SystemProperty; +import com.google.appengine.api.urlfetch.HTTPHeader; +import com.google.appengine.api.urlfetch.HTTPMethod; +import com.google.appengine.api.urlfetch.HTTPRequest; +import com.google.appengine.api.urlfetch.HTTPResponse; +import com.google.appengine.api.urlfetch.URLFetchService; +import com.google.appengine.api.urlfetch.URLFetchServiceFactory; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonSyntaxException; +import com.google.gson.JsonParseException; +import org.graalvm.compiler.graph.Graph; + +// }}} + +@SuppressWarnings("serial") +public class CachingProxy extends HttpServlet +{ + // {{{ get appengine API instances + private static final DatastoreService DS = DatastoreServiceFactory.getDatastoreService(); + private static final MemcacheService mc = MemcacheServiceFactory.getMemcacheService(); + private static final Logger LOG = Logger.getLogger(CachingProxy.class.getName()); + // }}} + // {{{ static constants + // google cache should be >61 seconds and < 1 week + private static final int API_CACHE_SECONDS = 69; + // bisq markets node can sometimes be slow to respond + private static final double REQUEST_DEADLINE = 30.0; + + // hostnames used by this CDN app + private static final String FRONTEND_HOSTNAME_PRODUCTION = "markets.bisq.network"; + private static final String FRONTEND_HOSTNAME_DEVELOPMENT = "bisq-markets.appspot.com"; + + // hostnames of bisq markets node to source data from + private static final String RISQNODE_HOSTNAME_PRODUCTION = "https://markets.wiz.biz"; + private static final String RISQNODE_HOSTNAME_DEVELOPMENT = "https://markets.wiz.biz"; + private static final String RISQNODE_HOSTNAME_DEVSERVER = "http://127.0.0.1:7477"; + + // init gson + public static final Gson gson = new GsonBuilder().serializeNulls().setPrettyPrinting().create(); + // }}} + + private static final class MarketsApiResponseCache // {{{ + { + private static final String KIND = "MarketsApiResponseCache"; + private static final String RISQNODE_URL = "marketsapi_url"; + private static final String RISQNODE_RESPONSE = "marketsapi_response"; + } // }}} + + @Override + public void doGet(HttpServletRequest req, HttpServletResponse res) + throws IOException + { + // {{{ init + // autodetect locale from Accept-Language http request header + Locale langLocale = req.getLocale(); + + // get request source IP + String reqIP = req.getRemoteAddr(); + + // set default cache headers + setResponsePrivateCacheHeaders(res, 0); + + // set content type + res.setContentType("application/json; charset=UTF-8"); + + // get request URL + String reqURI = req.getRequestURI().toString(); + + // get query string, strip forceUpdate if present + String queryString = req.getQueryString(); + if (queryString != null) queryString = queryString.replaceAll("&forceUpdate=1", ""); + + // flag to force update of datastore/memcache + boolean forceUpdate = false; + if (req.getParameter("forceUpdate") != null) + forceUpdate = true; + + // settings to use datastore + boolean useCacheForMarketsApi = true; + boolean isDevelopment = isDevelopmentMode(req); + if (isDevelopment) + { + useCacheForMarketsApi = false; + LOG.log(Level.WARNING, "Caching disabled in development mode"); + } + + // get URI after /api for apiPath + String apiPath = reqURI.substring( "/api".length(), reqURI.length() ); + //LOG.log(Level.WARNING, "reqURI is "+reqURI); + //LOG.log(Level.WARNING, "apiPath is "+apiPath); + + // set CORS headers + setResponseCORS(res); + + // response nugget + Object responseData = new HashMap(); + // }}} + if (apiPath.equals("/ping")) // {{{ + { + res.getWriter().println("pong"); + return; + } // }}} + else if ( // {{{ + apiPath.startsWith("/currencies") || + apiPath.startsWith("/depth") || + apiPath.startsWith("/hloc") || + apiPath.startsWith("/markets") || + apiPath.startsWith("/offers") || + apiPath.startsWith("/ticker") || + apiPath.startsWith("/trades") || + apiPath.startsWith("/volumes") + ) + { + responseData = getCachedRisqData(req, reqURI, queryString, API_CACHE_SECONDS, useCacheForMarketsApi, forceUpdate); + } // }}} + else // {{{ 404 + { + res.sendError(404); + return; + } // }}} + //{{{ send response + + // return 503 if unable to get data + if (responseData == null) + { + res.sendError(503); + return; + } + + // set cache header if not a forced update + if (!forceUpdate) + setResponsePublicCacheHeaders(res, API_CACHE_SECONDS); + + // create result objects + String responseJsonString = gson.toJson(responseData); + + // send on wire + res.getWriter().println(responseJsonString); + // }}} + } + + private boolean isDevelopmentMode(HttpServletRequest req) // {{{ + { + boolean dev = false; + + if (SystemProperty.environment.value() == SystemProperty.Environment.Value.Development) + dev = true; + if (req.getServerName().equals(FRONTEND_HOSTNAME_DEVELOPMENT)) + dev = true; + + return dev; + } // }}} + + private void proxyRequestToMarketsApi(HttpServletRequest req, HttpServletResponse res, HTTPMethod reqMethod, String bisqMarketsURI, Class incomingRequestBean, Class outgoingRequestResponseBean) // {{{ + throws IOException + { + // sanitize json bodies by parsing to JSON bean objects + Object incomingRequestData = null; + Object outgoingRequestResponseData = null; + String sanitizedReqBody = null; + String queryString = req.getQueryString(); + String reqBody = null; + + if (incomingRequestBean != null) + { + try // parse json body of incoming request + { + reqBody = getBodyFromRequest(req); + LOG.log(Level.WARNING, "Got body: "+reqBody); + incomingRequestData = gson.fromJson(reqBody, incomingRequestBean); + } + catch (Exception e) + { + LOG.log(Level.WARNING, "Unable to parse body of incoming request"); + e.printStackTrace(); + res.sendError(400); + // TODO: send json body as error response + return; + } + + // convert sanitized request body back to json and send in outgoing request to backend + sanitizedReqBody = gson.toJson(incomingRequestData); + } + + if (reqMethod == HTTPMethod.POST && incomingRequestBean != null && incomingRequestData == null) + { + if (req.getHeader("Content-Encoding") != null) + LOG.log(Level.WARNING, "Content-Encoding is "+req.getHeader("Content-Encoding")); + if (req.getHeader("Content-Type") != null) + LOG.log(Level.WARNING, "Content-Type is "+req.getHeader("Content-Type")); + if (req.getHeader("Content-Length") != null) + LOG.log(Level.WARNING, "Content-Length is "+req.getHeader("Content-Length")); + LOG.log(Level.WARNING, "incomingRequestData is null!"); + res.sendError(400); + return; + } + + String reqURI = bisqMarketsURI; + + HTTPResponse bisqMarketsResponse = null; + if (incomingRequestBean == Map.class) + { + // pass original raw body to outgoing request + bisqMarketsResponse = requestData(reqMethod, buildRisqGraphURL(req, reqURI), getSafeHeadersFromRequest(req), reqBody); + } + else + { + // pass sanitized body to outgoing request + bisqMarketsResponse = requestData(reqMethod, buildRisqGraphURL(req, reqURI), getSafeHeadersFromRequest(req), sanitizedReqBody); + } + + if (bisqMarketsResponse == null) // request failed + { + res.sendError(503); + return; + } + + // get response code of outgoing request, set on incoming request response + Integer resCode = bisqMarketsResponse.getResponseCode(); + res.setStatus(resCode); + + // pass outgoing request's response's headers + setResponseHeadersFromBackendResponse(res, bisqMarketsResponse); + + String bisqMarketsResponseBody = null; + try // parse json body of outgoing request's response + { + if (resCode >= 400) + { + bisqMarketsResponseBody = getBodyFromResponse(bisqMarketsResponse); + //outgoingRequestResponseData = new MarketsApiErrorResponse(resCode, null, bisqMarketsResponseBody); + } + else if (outgoingRequestResponseBean != null) + { + bisqMarketsResponseBody = getBodyFromResponse(bisqMarketsResponse); + outgoingRequestResponseData = gson.fromJson(bisqMarketsResponseBody, outgoingRequestResponseBean); + } + } + catch (Exception e) + { + LOG.log(Level.WARNING, "Unable to parse outgoing request's response json body: "+e.toString()); + LOG.log(Level.WARNING, "Response body: "+bisqMarketsResponseBody); + e.printStackTrace(); + res.sendError(500); + // TODO: send json body as error response + return; + } + + // send 503 or default empty response object if no body + if (outgoingRequestResponseData == null) + { + //outgoingRequestResponseData = new MarketsApiErrorResponse(resCode); + res.sendError(503); + return; + } + + // pass sanitized body to incoming request's response + sendResponse(res, outgoingRequestResponseData); + } //}}} + + private void sendResponse(HttpServletResponse res, Object nugget) // {{{ + throws IOException + { + String jsonString = gson.toJson(nugget); + res.getWriter().println(jsonString); + // FIXME unescape JSON encoded HTML entities? ie. & is getting sent as \u0026 + } // }}} + private void sendResponse(HttpServletResponse res, String str) // {{{ + throws IOException + { + res.getWriter().println(str); + } // }}} + + private Map getQueryMap(String query) // {{{ + { + String[] params = query.split("&"); + Map map = new HashMap(); + for (String param : params) + { + String name, value; + try { name = param.split("=")[0]; } + catch (Exception e) { name = ""; } + try { value = param.split("=")[1]; } + catch (Exception e) { value = ""; } + map.put(name, value); + } + return map; + } // }}} + private String getBodyFromRequest(HttpServletRequest req) // {{{ + { + String contentType = req.getHeader("Content-Type"); + + if (contentType.equals("application/x-www-form-urlencoded")) + { + LOG.log(Level.WARNING, "Parsing as application/x-www-form-urlencoded"); + try // convert to json string + { + Map map = new HashMap(); + Map parameters = req.getParameterMap(); + for (String key : parameters.keySet()) + { + String[] values = req.getParameterValues(key); + if (values != null) + map.put(key, values[0]); + } + String jsonString = gson.toJson(map); + LOG.log(Level.INFO, "Got json string: "+jsonString); + return jsonString; + } + catch (Exception e) + { + e.printStackTrace(); + return null; + } + } + + // read request body + StringBuffer sb = new StringBuffer(); + InputStream inputStream = null; + BufferedReader reader = null; + + String line = null; + try + { + inputStream = req.getInputStream(); + if (inputStream != null) + { + reader = new BufferedReader(new InputStreamReader(inputStream)); + char[] charBuffer = new char[65535]; + int bytesRead = -1; + while ((bytesRead = reader.read(charBuffer)) > 0) + { + sb.append(charBuffer, 0, bytesRead); + } + } + else + { + sb.append(""); + } + } + catch (Exception e) + { + e.printStackTrace(); + } + finally + { + if (reader != null) + { + try + { + reader.close(); + } + catch (IOException e) + { + LOG.log(Level.WARNING, "Unable to read request body"); + e.printStackTrace(); + return null; + } + } + } + + // convert payload bytes to string + String reqBody = sb.toString(); + //if (reqBody != null && !reqBody.isEmpty()) + //LOG.log(Level.WARNING, "got payload: "+reqBody); + + return reqBody; + } // }}} + private String getBodyFromResponse(HTTPResponse response) // {{{ + { + String str = null; + + try // if we got response, convert to UTF-8 string + { + str = new String(response.getContent(), "UTF-8"); + } + catch (UnsupportedEncodingException e) + { + LOG.log(Level.WARNING, e.toString(), e); + str = null; + } + return str; + } // }}} + + private List getSafeHeadersFromRequest(HttpServletRequest req) // {{{ + { + List headers = new ArrayList(); + String safeHeaders[] = { + "Cookie" + ,"User-Agent" + }; + + // copy headers in "safe" list above + for (String headerName : safeHeaders) + if (req.getHeader(headerName) != null) + headers.add(new HTTPHeader(headerName, req.getHeader(headerName))); + + // add original IP header + /* + String reqIP = req.getRemoteAddr(); + HTTPHeader headerOriginalIP = new HTTPHeader("X-Original-IP", reqIP); + headers.add(headerOriginalIP); + */ + + return headers; + } // }}} + private void setResponseHeadersFromBackendResponse(HttpServletResponse res1, HTTPResponse res2) // {{{ + { + List headers = res2.getHeaders(); + String safeHeaders[] = { + "Set-Cookie" + }; + + for (HTTPHeader header : headers) + if (Arrays.asList(safeHeaders).contains(header.getName())) + res1.setHeader(header.getName(), header.getValue()); + } // }}} + + private void setResponseCORS(HttpServletResponse res) // {{{ + { + res.setHeader("Access-Control-Allow-Headers", "Access-Control-Allow-Headers, Origin, Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers"); + res.setHeader("Access-Control-Allow-Method", "GET,HEAD,OPTIONS,POST,PUT"); + res.setHeader("Access-Control-Allow-Origin", "*"); + } // }}} + private void setResponsePublicCacheHeaders(HttpServletResponse res, int seconds) // {{{ + { + res.setDateHeader("Expires", System.currentTimeMillis() + (1000 * seconds) ); + res.setHeader("Cache-Control", "public, max-age="+seconds); + } // }}} + private void setResponsePrivateCacheHeaders(HttpServletResponse res, int seconds) // {{{ + { + res.setDateHeader("Expires", System.currentTimeMillis() + (1000 * seconds) ); + res.setHeader("Cache-Control", "private, max-age="+seconds); + } // }}} + + private URL buildRisqGraphURL(HttpServletRequest req, String bisqMarketsURI) // {{{ + { + URL risqGraphURL = null; + + try // build risqGraphURL + { + // determine API endpoint + String risqNodeBaseURL = null; + + if (SystemProperty.environment.value() == SystemProperty.Environment.Value.Development) + { + // for local devserver - don't use TLS + risqNodeBaseURL = RISQNODE_HOSTNAME_DEVSERVER; + } + else if (req.getServerName().equals(FRONTEND_HOSTNAME_DEVELOPMENT)) // cloud development + { + risqNodeBaseURL = RISQNODE_HOSTNAME_DEVELOPMENT; + } + else // cloud production + { + risqNodeBaseURL = RISQNODE_HOSTNAME_PRODUCTION; + } + + risqGraphURL = new URL(risqNodeBaseURL + "/graphql"); + } + catch (MalformedURLException e) + { + risqGraphURL = null; + } + return risqGraphURL; + } // }}} + + private Object getCachedRisqData(HttpServletRequest req, String bisqMarketsURI, String bisqMarketsQueryString, int secondsToMemcache, boolean useCache, boolean forceUpdate) // {{{ + { + URL risqGraphURL = buildRisqGraphURL(req, bisqMarketsURI); + return getCachedData(risqGraphURL.toString(), bisqMarketsURI, bisqMarketsQueryString, secondsToMemcache, useCache, forceUpdate); + } // }}} + private Object getCachedData(String backendURL, String bisqMarketsURI, String queryString, int secondsToMemcache, boolean useCache, boolean forceUpdate) // {{{ + { + String response = null; + Object responseData = null; + boolean inMemcache = false; + boolean inDatastore = false; + + // strip forceUpdate=1 if present + String dataKey = bisqMarketsURI + "?" + queryString; + + // {{{ first check memcache, use backendURL as key + if (useCache) + response = (String)mc.get(dataKey); + + if (!forceUpdate && response != null) + { + responseData = parseJsonData(response); + if (responseData == null) + LOG.log(Level.WARNING, "Failed parsing memcache bisqMarkets response for "+backendURL); + else + inMemcache = true; + } + // }}} + // {{{ if not in memcache, try request it from backend node + if (responseData == null) + { + LOG.log(Level.WARNING, "Fetching data for "+bisqMarketsURI+" from "+backendURL); + GraphQLQuery query = null; + + try + { + Map queryMap = new HashMap(); + if (queryString != null) + queryMap = getQueryMap(queryString); + query = GraphQLQuery.forRequest(bisqMarketsURI, queryMap); + } + catch (Exception e) + { + LOG.log(Level.WARNING, "GraphQLQuery failed for "+dataKey); + } + if (query != null) + { + try + { + response = requestDataAsString(HTTPMethod.POST, new URL(backendURL), null, gson.toJson(query)); + } + catch (Exception e) + { + response = null; + } + } + if (response != null) + { + responseData = query.translateResponse(response); + if (responseData == null) + LOG.log(Level.WARNING, "Failed parsing requested bisqMarkets response for "+backendURL); + } + } + // }}} + // {{{ if successful, save response in memcache/datastore for next time + if (response != null && responseData != null) + { + if (useCache && !inMemcache) + { + LOG.log(Level.WARNING, "Adding memcache key for "+dataKey); + try + { + if (forceUpdate) + mc.put(dataKey, response, Expiration.byDeltaSeconds(secondsToMemcache), SetPolicy.SET_ALWAYS); + else + mc.put(dataKey, response, Expiration.byDeltaSeconds(secondsToMemcache), SetPolicy.ADD_ONLY_IF_NOT_PRESENT); + } + catch (Exception e) + { + LOG.log(Level.WARNING, "Unable to add memcache for "+dataKey+": "+e.toString()); + } + } + if (useCache && !inDatastore) + { + LOG.log(Level.WARNING, "Adding datastore key for "+dataKey); + Key cacheKey = KeyFactory.createKey(MarketsApiResponseCache.KIND, dataKey); + Transaction tx = DS.beginTransaction(); + Entity cache = new Entity(cacheKey); + try + { + cache.setProperty(MarketsApiResponseCache.RISQNODE_URL, dataKey); + Text responseText = new Text(response); + cache.setProperty(MarketsApiResponseCache.RISQNODE_RESPONSE, responseText); + DS.put(tx, cache); + tx.commit(); + } + catch (Exception e) + { + LOG.log(Level.WARNING, e.toString(), e); + } + finally + { + if (tx.isActive()) + { + tx.rollback(); + } + } + } + } + // }}} + // {{{ if backend node not available, try querying the datastore + if (useCache && !forceUpdate && responseData == null) + { + Key entityKey = KeyFactory.createKey(MarketsApiResponseCache.KIND, dataKey); + Filter bisqMarketsURLFilter = new FilterPredicate(Entity.KEY_RESERVED_PROPERTY, FilterOperator.EQUAL, entityKey); + response = null; + Entity result = null; + try + { + Query query = new Query(MarketsApiResponseCache.KIND) + .setFilter(bisqMarketsURLFilter); + PreparedQuery pq = DS.prepare(query); + result = pq.asSingleEntity(); + } + catch (Exception e) + { + LOG.log(Level.WARNING, e.toString(), e); + return null; + } + if (result != null) + { + Text responseText = (Text)result.getProperty(MarketsApiResponseCache.RISQNODE_RESPONSE); + response = (String)responseText.getValue(); + responseData = parseJsonData(response); + if (responseData == null) + LOG.log(Level.WARNING, "Failed parsing datastore bisqMarkets response for "+backendURL); + else + inDatastore = true; + } + } + //}}} + + return responseData; + } // }}} + + private Object parseJsonData(String jsonRaw) // {{{ + { + Object jsonData = null; + try // {{{ parse as JSON object + { + jsonData = new Gson().fromJson(jsonRaw, Map.class); + } + catch (JsonSyntaxException e1) + { + try // parse as JSON array + { + jsonData = new Gson().fromJson(jsonRaw, ArrayList.class); + } + catch (JsonSyntaxException e2) + { + LOG.log(Level.WARNING, e2.toString(), e2); + jsonData = null; + } + } // }}} + return jsonData; + } // }}} + + private String requestMarketsApiData(HttpServletRequest req, HTTPMethod requestMethod, String bisqMarketsURI, List headers, String body) // {{{ + { + URL bisqMarketsURL = buildRisqGraphURL(req, bisqMarketsURI); + return requestDataAsString(requestMethod, bisqMarketsURL, headers, body); + } // }}} + + private String requestDataAsString(HTTPMethod requestMethod, URL bisqMarketsURL, List headers, String body) // {{{ + { + String bisqMarketsResponse = null; + HTTPResponse response = requestData(requestMethod, bisqMarketsURL, headers, body); + if (response != null && (response.getResponseCode() == HttpURLConnection.HTTP_OK || response.getResponseCode() == HttpURLConnection.HTTP_CREATED)) + bisqMarketsResponse = getBodyFromResponse(response); + return bisqMarketsResponse; + } // }}} + + private HTTPResponse requestData(HTTPMethod requestMethod, URL bisqMarketsURL, List headers, String body) // {{{ + { + HTTPRequest request = new HTTPRequest(bisqMarketsURL, requestMethod, withDefaults().setDeadline(REQUEST_DEADLINE)); + HTTPResponse response = null; + + try + { + response = requestDataFetch(request, headers, body); + } + catch (IOException e) + { + // TODO log error requesting + LOG.log(Level.WARNING, e.toString(), e); + try + { + response = requestDataFetch(request, headers, body); + } + catch (Exception ee) + { + // TODO log error requesting + response = null; + LOG.log(Level.WARNING, ee.toString(), ee); + } + } + catch (Exception e) + { + // TODO log error requesting + response = null; + LOG.log(Level.WARNING, e.toString(), e); + } + return response; + } // }}} + private HTTPResponse requestDataFetch(HTTPRequest request, List headers, String body) // {{{ + throws IOException, UnsupportedEncodingException + { + URLFetchService urlFetchService = URLFetchServiceFactory.getURLFetchService(); + + if (headers != null) + for (HTTPHeader header : headers) + request.setHeader(header); + + if (body != null) + { + request.setHeader(new HTTPHeader("Content-type", "application/json")); + request.setPayload(body.getBytes("UTF-8")); + } + + return urlFetchService.fetch(request); + } // }}} +} + +// vim: ts=4:expandtab:foldmethod=marker wrap diff --git a/src/main/java/bisq/markets/api/GraphQLQuery.java b/src/main/java/bisq/markets/api/GraphQLQuery.java new file mode 100644 index 0000000..ae88ae1 --- /dev/null +++ b/src/main/java/bisq/markets/api/GraphQLQuery.java @@ -0,0 +1,342 @@ +package bisq.markets.api; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.reflect.TypeToken; + +import java.util.*; +import java.util.List; +import java.util.logging.Logger; + +public abstract class GraphQLQuery { + private static final Logger LOG = Logger.getLogger(GraphQLQuery.class.getName()); + private static final Gson gson = new GsonBuilder().serializeNulls().setPrettyPrinting().create(); + + static bisq.markets.api.GraphQLQuery forRequest(String path, Map params) { + if (path.startsWith("/api/currencies")) { + return new CurrenciesQuery(); + }else if (path.startsWith("/api/markets")) { + return new MarketsQuery(); + }else if (path.startsWith("/api/offers")) { + return new OffersQuery(params); + }else if (path.startsWith("/api/depth")) { + return new DepthQuery(params); + }else if (path.startsWith("/api/ticker")) { + return new TickerQuery(params); + }else if (path.startsWith("/api/trades")) { + return new TradesQuery(params); + }else if (path.startsWith("/api/hloc")) { + return new HlocQuery(params); + }else if (path.startsWith("/api/volumes")) { + return new VolumesQuery(params); + } else { + return null; + } + } + public abstract Object translateResponse(String response); + + private static class CurrenciesQuery extends GraphQLQuery { + private static class Currency { + String code; + String name; + String type; + int precision; + } + private static final String currenciesQuery = "{ currencies { code name precision type: currencyTypeLowerCase } }"; + private final String query = currenciesQuery; + + @Override + public Object translateResponse(String response) { + GraphQLResponse> currencies = gson.fromJson(response,new TypeToken>>(){}.getType()); + Iterator iter = currencies.getData().iterator(); + Map ret = new HashMap(); + while(iter.hasNext()) { + Currency currency = iter.next(); + ret.put(currency.code,currency); + } + return ret; + } + } + + private static class MarketsQuery extends GraphQLQuery { + private static class Market { + String pair; + String lname; + String rname; + String lsymbol; + String rsymbol; + int lprecision; + int rprecision; + String ltype; + String rtype; + } + private static final String marketsQuery = "{ markets { pair lname: lName rname: rName lsymbol: lSymbol lprecision: lPrecision rsymbol: rSymbol rprecision: rPrecision ltype: lTypeLowerCase rtype: rTypeLowerCase } }"; + private final String query = marketsQuery; + + @Override + public Object translateResponse(String response) { + GraphQLResponse> markets = gson.fromJson(response,new TypeToken>>(){}.getType()); + Iterator iter = markets.getData().iterator(); + Map ret = new HashMap(); + while(iter.hasNext()) { + Market market = iter.next(); + ret.put(market.pair,market); + } + return ret; + } + } + + private static class OffersQuery extends GraphQLQuery { + private static class OpenOffer implements Comparable { + String offer_id; + String market; + long offer_date; + String direction; + String min_amount; + String amount; + String price; + String volume; + String payment_method; + String offer_fee_txid; + + @Override + public int compareTo(OpenOffer o) { + if (price.length() - o.price.length() == 0 ){ + return price.compareTo(o.price); + } else { + return price.length() - o.price.length(); + } + } + } + private static final String offerFields = "{ " + + "market: marketPair offer_id: id offer_date: offerDate " + + "direction: btcDirection min_amount: formattedMinAmount " + + "amount: formattedBtcAmount price: formattedPrice " + + "volume: formattedBtcVolume payment_method: paymentMethodId " + + "offer_fee_txid: offerFeeTxId } "; + private static final String offersQuery = "query Offers($market: MarketPair!, $direction: Direction)" + + "{ offers(market: $market, direction: $direction) { " + + "buys: btcBuys " + offerFields + + "sells: btcSells " + offerFields + " } }"; + private final String query = offersQuery; + private final Map variables; + + OffersQuery(Map params){ + variables = params; + } + + @Override + public Object translateResponse(String response) { + GraphQLResponse>> offers = gson.fromJson(response,new TypeToken>>>(){}.getType()); + Map> buysAndSells = offers.getData(); + Map>> ret = new HashMap<>(); + ret.put(variables.get("market"), buysAndSells); + return ret; + } + } + + private static class DepthQuery extends GraphQLQuery { + private static class Depth { + List buys; + List sells; + } + private static final String depthQuery = "query Depth($market: MarketPair!)" + + "{ offers(market: $market) { " + + "buys: formattedBuyPrices sells: formattedSellPrices } }"; + private final String query = depthQuery; + private final Map variables; + + DepthQuery(Map params){ + variables = params; + } + + @Override + public Object translateResponse(String response) { + GraphQLResponse markets = gson.fromJson(response,new TypeToken>(){}.getType()); + Depth depth = markets.getData(); + Map ret = new HashMap<>(); + ret.put(variables.get("market"), depth); + return ret; + } + } + + private static class TickerQuery extends GraphQLQuery { + private static class Ticker { + String market; + String last; + String high; + String low; + String volume_left; + String volume_right; + String buy; + String sell; + } + private static final String tickerQuery = "query Ticker($market: MarketPair)" + + "{ ticker(market: $market) { market: marketPair " + + "last: formattedLast high: formattedHigh "+ + "low: formattedLow volume_left: formattedVolumeLeft " + + "volume_right: formattedVolumeRight buy: formattedBuy sell: formattedSell } }"; + private final String query = tickerQuery; + private final Map variables; + + TickerQuery(Map params){ + variables = params; + } + + @Override + public Object translateResponse(String response) { + GraphQLResponse> markets = gson.fromJson(response,new TypeToken>>(){}.getType()); + List tickers = markets.getData(); + if (variables.get("market") != null){ + return tickers; + } + Map ret = new HashMap<>(); + for (Ticker ticker : tickers) { + ret.put(ticker.market, ticker); + } + return ret; + } + } + + private static class TradesQuery extends GraphQLQuery { + private static class Trade { + String market; + String direction; + String price; + String amount; + String volume; + String payment_method; + String trade_id; + long trade_date; + } + private static final String tradesQuery = "query Trades($market: MarketPair! $direction: Direction "+ + "$timestamp_from: UnixSecs $timestamp_to: UnixSecs " + + "$limit: Int $sort: Sort ) { " + + "trades(market: $market direction: $direction timestampFrom: $timestamp_from " + + "timestampTo: $timestamp_to limit: $limit sort: $sort) " + + "{ market: marketPair direction price: formattedPrice amount: formattedAmount volume: formattedVolume " + + "payment_method: paymentMethodId trade_id: offerId trade_date: tradeDate } }"; + private final String query = tradesQuery; + + private final Map variables; + + TradesQuery(Map params){ + variables = new HashMap<>(); + Iterator> entries = params.entrySet().iterator(); + while (entries.hasNext()) { + Map.Entry next = entries.next(); + variables.put(next.getKey(), next.getValue()); + } + if (params.containsKey("limit")) { + variables.put("limit", Integer.parseInt(params.get("limit"))); + } + } + + @Override + public Object translateResponse(String response) { + GraphQLResponse> ret = gson.fromJson(response,new TypeToken>>(){}.getType()); + return ret.getData(); + } + } + + private static class HlocQuery extends GraphQLQuery { + private static class Hloc { + long period_start; + String periodStartDateTime; + String open; + String high; + String low; + String close; + String volume_left; + String volume_right; + String avg; + } + private static final String hlocQuery = "query Hloc($market: MarketPair! "+ + "$timestamp_from: UnixSecs $timestamp_to: UnixSecs " + + "$interval: Interval) { " + + "hloc(market: $market timestampFrom: $timestamp_from " + + "timestampTo: $timestamp_to interval: $interval) " + + "{ period_start: periodStart periodStartDateTime open: formattedOpen high: formattedHigh low: formattedLow " + + "close: formattedClose volume_left: formattedVolumeLeft volume_right: formattedVolumeRight "+ + "avg: formattedAvg } }"; + private final String query = hlocQuery; + + private final Map variables; + + HlocQuery(Map params){ + String interval = params.get("interval"); + if (interval != null) { + params.put("interval", interval.toUpperCase()); + } + variables = params; + } + + @Override + public Object translateResponse(String response) { + GraphQLResponse> res = gson.fromJson(response,new TypeToken>>(){}.getType()); + List> ret = new ArrayList<>(); + for (Hloc hloc : res.getData()) { + Map v = new HashMap<>(); + String timestamp = variables.get("timestamp"); + if (timestamp != null && timestamp.equals("no")) { + v.put("period_start", hloc.periodStartDateTime); + } else { + v.put("period_start", hloc.period_start); + } + v.put("open", hloc.open); + v.put("high", hloc.high); + v.put("low", hloc.low); + v.put("close", hloc.close); + v.put("volume_left", hloc.volume_left); + v.put("volume_right", hloc.volume_right); + v.put("avg", hloc.avg); + ret.add(v); + } + + return ret; + } + } + private static class VolumesQuery extends GraphQLQuery { + private static class Volume { + long period_start; + String periodStartDateTime; + String volume; + int num_trades; + } + private static final String volumeQuery = "query Volumes($market: MarketPair "+ + "$interval: Interval) { " + + "volumes(market: $market interval: $interval) " + + "{ period_start: periodStart periodStartDateTime volume: formattedVolume num_trades: numTrades } }"; + private final String query = volumeQuery; + + private final Map variables; + + VolumesQuery(Map params){ + String interval = params.get("interval"); + if (interval != null) { + params.put("interval", interval.toUpperCase()); + } + variables = params; + } + + @Override + public Object translateResponse(String response) { + GraphQLResponse> res = gson.fromJson(response,new TypeToken>>(){}.getType()); + List> ret = new ArrayList<>(); + for (Volume volume : res.getData()) { + Map v = new HashMap<>(); + String timestamp = variables.get("timestamp"); + if (timestamp != null && timestamp.equals("no")) { + v.put("period_start", volume.periodStartDateTime); + } else { + v.put("period_start", volume.period_start); + } + v.put("num_trades", volume.num_trades); + v.put("volume", volume.volume); + ret.add(v); + } + + return ret; + } + } +} diff --git a/src/main/java/bisq/markets/api/GraphQLResponse.java b/src/main/java/bisq/markets/api/GraphQLResponse.java new file mode 100644 index 0000000..d142649 --- /dev/null +++ b/src/main/java/bisq/markets/api/GraphQLResponse.java @@ -0,0 +1,11 @@ +package bisq.markets.api; + +import java.util.Map; + +public class GraphQLResponse { + Map data; + + public T getData() { + return data.values().iterator().next(); + } +} diff --git a/src/main/webapp/WEB-INF/appengine-web.xml b/src/main/webapp/WEB-INF/appengine-web.xml new file mode 100644 index 0000000..a892b11 --- /dev/null +++ b/src/main/webapp/WEB-INF/appengine-web.xml @@ -0,0 +1,50 @@ + + + + + bisq-markets + java8 + true + + F1 + + 1 + automatic + 30ms + automatic + 10 + + + + + + + + + static + + + + + + + + + + + + diff --git a/src/main/webapp/WEB-INF/cron.xml b/src/main/webapp/WEB-INF/cron.xml new file mode 100644 index 0000000..c12f2ef --- /dev/null +++ b/src/main/webapp/WEB-INF/cron.xml @@ -0,0 +1,169 @@ + + + + /api/BitcoinWizardRanking?peopleStart=0&peopleEnd=125&forceUpdate=1 + default + Hourly BitcoinWizardRanking job 1 + every 60 minutes + + + /api/BitcoinWizardRanking?peopleStart=125&peopleEnd=250&forceUpdate=1 + default + Hourly BitcoinWizardRanking job 2 + every 60 minutes + + + /api/BitcoinWizardRanking?peopleStart=250&peopleEnd=375&forceUpdate=1 + default + Hourly BitcoinWizardRanking job 3 + every 60 minutes + + + /api/BitcoinWizardRanking?peopleStart=375&peopleEnd=500&forceUpdate=1 + default + Hourly BitcoinWizardRanking job 4 + every 60 minutes + + + + + /api/BitcoinerShitcoinerRanking?peopleStart=0&peopleEnd=250&forceUpdate=1 + default + Hourly BitcoinerShitcoinerRanking job 1 + every 60 minutes + + + + /api/BitcoinerShitcoinerRanking?peopleStart=250&peopleEnd=500&forceUpdate=1 + default + Hourly BitcoinerShitcoinerRanking job 2 + every 60 minutes + + + + /api/BitcoinerShitcoinerRanking?peopleStart=500&peopleEnd=750&forceUpdate=1 + default + Hourly BitcoinerShitcoinerRanking job 3 + every 60 minutes + + + + /api/BitcoinerShitcoinerRanking?peopleStart=750&peopleEnd=1000&forceUpdate=1 + default + Hourly BitcoinerShitcoinerRanking job 4 + every 60 minutes + + + + /api/BitcoinerShitcoinerRanking?peopleStart=1000&peopleEnd=1250&forceUpdate=1 + default + Hourly BitcoinerShitcoinerRanking job 5 + every 60 minutes + + + + /api/BitcoinerShitcoinerRanking?peopleStart=1250&peopleEnd=1500&forceUpdate=1 + default + Hourly BitcoinerShitcoinerRanking job 6 + every 60 minutes + + + + /api/BitcoinerShitcoinerRanking?peopleStart=1500&peopleEnd=1750&forceUpdate=1 + default + Hourly BitcoinerShitcoinerRanking job 7 + every 60 minutes + + + + /api/BitcoinerShitcoinerRanking?peopleStart=1750&peopleEnd=2000&forceUpdate=1 + default + Hourly BitcoinerShitcoinerRanking job 8 + every 60 minutes + + + + /api/BitcoinerShitcoinerRanking?peopleStart=2000&peopleEnd=2250&forceUpdate=1 + default + Hourly BitcoinerShitcoinerRanking job 9 + every 60 minutes + + + + /api/BitcoinerShitcoinerRanking?peopleStart=2250&peopleEnd=2500&forceUpdate=1 + default + Hourly BitcoinerShitcoinerRanking job 10 + every 60 minutes + + + + /api/BitcoinerShitcoinerRanking?peopleStart=2500&peopleEnd=2750&forceUpdate=1 + default + Hourly BitcoinerShitcoinerRanking job 11 + every 60 minutes + + + + /api/BitcoinerShitcoinerRanking?peopleStart=2750&peopleEnd=3000&forceUpdate=1 + default + Hourly BitcoinerShitcoinerRanking job 12 + every 60 minutes + + + + /api/BitcoinerShitcoinerRanking?peopleStart=3000&peopleEnd=3250&forceUpdate=1 + default + Hourly BitcoinerShitcoinerRanking job 13 + every 60 minutes + + + + /api/BitcoinerShitcoinerRanking?peopleStart=3250&peopleEnd=3500&forceUpdate=1 + default + Hourly BitcoinerShitcoinerRanking job 14 + every 60 minutes + + + + /api/BitcoinerShitcoinerRanking?peopleStart=3500&peopleEnd=3750&forceUpdate=1 + default + Hourly BitcoinerShitcoinerRanking job 15 + every 60 minutes + + + + /api/BitcoinerShitcoinerRanking?peopleStart=3750&peopleEnd=4000&forceUpdate=1 + default + Hourly BitcoinerShitcoinerRanking job 16 + every 60 minutes + + + + /api/BitcoinerShitcoinerRanking?peopleStart=4000&peopleEnd=4250&forceUpdate=1 + default + Hourly BitcoinerShitcoinerRanking job 17 + every 60 minutes + + + + /api/BitcoinerShitcoinerRanking?peopleStart=4250&peopleEnd=4500&forceUpdate=1 + default + Hourly BitcoinerShitcoinerRanking job 18 + every 60 minutes + + + + /api/BitcoinerShitcoinerRanking?peopleStart=4500&peopleEnd=4750&forceUpdate=1 + default + Hourly BitcoinerShitcoinerRanking job 19 + every 60 minutes + + + + /api/BitcoinerShitcoinerRanking?peopleStart=4750&peopleEnd=5000&forceUpdate=1 + default + Hourly BitcoinerShitcoinerRanking job 20 + every 60 minutes + + + diff --git a/src/main/webapp/WEB-INF/urlrewrite.xml b/src/main/webapp/WEB-INF/urlrewrite.xml new file mode 100644 index 0000000..ec9dfca --- /dev/null +++ b/src/main/webapp/WEB-INF/urlrewrite.xml @@ -0,0 +1,27 @@ + + + + + + ^/$ + https://bisq.network/markets + + + + ^/api$ + /api/ + + + + ^markets.bisq.network$ + ^https://bisq.network$ + max-age=10886400; preload + https://bisq.network + GET, POST, OPTIONS + Access-Control-Allow-Origin, Cookie, Origin, Content-Type, Content-Range, Content-Disposition, Content-Description + true + 70 + ^/api/.* + - + + diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..9e0d2f9 --- /dev/null +++ b/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,57 @@ + + + + + + /* + + + CONFIDENTIAL + + + + + + + UrlRewriteFilter + org.tuckey.web.filters.urlrewrite.UrlRewriteFilter + + + + UrlRewriteFilter + / + /* + REQUEST + + + + CachingProxy + /api/* + + + + CachingProxy + bisq.markets.api.CachingProxy + + + + index.html + + + diff --git a/static/api/index.html b/static/api/index.html new file mode 100644 index 0000000..81f411a --- /dev/null +++ b/static/api/index.html @@ -0,0 +1,830 @@ + + + + + + + + + + + + +
+

Bisq public webservice APIs:

+

Version: bisq-webservice-api-0.9.14 +

+ + + Error responses are documented here. + +
+ + +
+
/api/currencies
+
Provides list of available currencies for a given base currency.
+
+
+

Sample Request

+ +

Sample Response

+
{ + "AED": { + "code": "AED", + "name": "United Arab Emirates Dirham", + "precision": 8, + "type": "fiat" + }, + "AIB": { + "code": "AIB", + "name": "Advanced Internet Blocks", + "precision": 8, + "type": "crypto" + }, + ... +}
+
+
+ +
+

Parameters

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
paramdescrequiredvaluesdefault
basecurrencybase currency identifierNoBTC
typetype of currencies to include in resultsNocrypto | fiat | allall
formatformat of return dataNojson | jsonprettyjsonpretty
+
+
+ +
+

Notes

+
    +
  • In practice, the same currencies are available for every basecurrency so this API can be called just once, omitting the basecurrency parameter.
  • +
+
+ + +
+
+
/api/depth
+
Provides list of open offer prices for a single market.
+
+
+

Sample Request

+ +

Sample Response

+
{ + "xmr_btc": { + "buys": [ + "0.01432700", + "0.01403166", + "0.01403018", + ], + "sells": [ + "0.01523659", + "0.01523956", + ] + } +}
+
+
+ +
+

Parameters

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
paramdescrequiredvaluesdefault
marketmarket identifierYes
formatformat of return dataNojson | jsonprettyjsonpretty
+
+
+ + +
+

See Also

+ +
+ +
+
+
/api/hloc
+
Provides hi/low/open/close data for a given market. This can be used to generate a candlestick chart.
+
+
+

Sample Request

+ +

Sample Response

+
[ + { + "period_start": 1463875200, + "open": "0.00198039", + "high": "0.00198039", + "low": "0.00180809", + "close": "0.00180809", + "volume_left": "528.73200000", + "volume_right": "1.04300000", + "avg": "0.00197264" + }, + ... + { + "period_start": 1472342400, + "open": "0.00982318", + "high": "0.01911520", + "low": "0.00982318", + "close": "0.01530002", + "volume_left": "3412.86880000", + "volume_right": "47.21000000", + "avg": "0.01383294" + } +]
+
+
+ +
+

Parameters

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
paramdescrequiredvaluesdefault
marketmarket identifierYes
intervallength of time blocks to summarize. auto will pick appropriate interval based on total time rangeNominute | half_hour | hour | half_day | day | week | month | year | autoauto
timestamp_fromstart time, in seconds since 1970No2016-01-01
timestamp_toend time, in seconds since 1970Nonow
formatformat of return data. csv provides the most compact format.Nocsv | json | jsonprettyjsonpretty
+
+
+ + + +
+
+
/api/markets
+
Provides list of available markets.
+
+
+

Sample Request

+ +

Sample Response

+
+{ + "1cr_btc": { + "pair": "1cr_btc", + "lname": "1CRedit", + "rname": "Bitcoin", + "lsymbol": "1CR", + "rsymbol": "BTC", + "lprecision": 8, + "rprecision": 8, + "ltype": "crypto", + "rtype": "crypto", + "name": "1CRedit\/Bitcoin" + }, + "btc_aud": { + "pair": "btc_aud", + "lname": "Bitcoin", + "rname": "Australian Dollar", + "lsymbol": "BTC", + "rsymbol": "AUD", + "lprecision": 8, + "rprecision": 2, + "ltype": "crypto", + "rtype": "fiat", + "name": "Bitcoin\/Australian Dollar" + }, + ... +}
+
+
+ +
+

Parameters

+
+ + + + + + + + + + + + + + + + + +
paramdescrequiredvaluesdefault
formatformat of return dataNojson | jsonprettyjsonpretty
+
+
+ + + +
+
+
/api/offers
+
Provides list of open offer details for a single market.
+
+
+

Sample Request

+ +

Sample Response

+
+{ + "xmr_btc": { + "buys": [ + { + "offer_id": "b2ab53d4-8ffd-4138-aa8a-c7143d7fb123_0.4.9.4", + "offer_date": 1472239477119, + "direction": "BUY", + "min_amount": "0.10000000", + "amount": "6.77840000", + "price": "0.01475266", + "volume": "0.10000000", + "payment_method": "BLOCK_CHAINS", + "offer_fee_txid": "64ae7b5863c509ed0cb5ef9ec3ec4a197b4f77705fc7b2d3b82fb96bc3f3e872" + }, + ... + ], + "sells": [ + { + "offer_id": "6a31771b-3c1b-49f4-b403-12f8749646fa_0.4.9.4", + "offer_date": 1472570540023, + "direction": "SELL", + "min_amount": "0.40000000", + "amount": "25.54280000", + "price": "0.01565994", + "volume": "0.40000000", + "payment_method": "BLOCK_CHAINS", + "offer_fee_txid": "ee0bd1d55ba37bf14de59fd6a42263200b6485d2d5aff493ffeb82513c0b2637" + }, + ... + ] + } +}
+
+
+

Sample Request

+ +

Sample Response

+
{ + "xmr_btc": { + "buys": [ + { + "offer_id": "b2ab53d4-8ffd-4138-aa8a-c7143d7fb123_0.4.9.4", + "offer_date": 1472239477119, + "direction": "BUY", + "min_amount": "0.10000000", + "amount": "6.68520000", + "price": "0.01495824", + "volume": "0.10000000", + "payment_method": "BLOCK_CHAINS" + "offer_fee_txid": "64ae7b5863c509ed0cb5ef9ec3ec4a197b4f77705fc7b2d3b82fb96bc3f3e872" + }, + ... + ], + "sells": null + } +}
+
+
+ +
+

Parameters

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
paramdescrequiredvaluesdefault
marketmarket identifierYes
directionoffer direction, omit or set null for bothNoBUY | SELLnull
formatformat of return dataNojson | jsonprettyjsonpretty
+
+
+ +
+

Notes

+
    +
  • payment_method in response will be one of: OK_PAY, PERFECT_MONEY, SEPA, NATIONAL_BANK, SAME_BANK, SPECIFIC_BANKS, SWISH, ALI_PAY, CLEAR_X_CHANGE, US_POSTAL_MONEY_ORDER, CASH_DEPOSIT, BLOCK_CHAINS
  • +
  • payment_method values are defined in this file: https://github.com/bitsquare/bitsquare/blob/master/core/src/main/java/io/bitsquare/payment/PaymentMethod.java
  • +
  • offer_fee_txid in response is the offer fee transaction ID in the bitcoin block chain
  • +
  • offer_date in response is provided in milliseconds since 1970, not seconds. To get seconds, divide by 1000
  • +
+
+ +
+

See Also

+ +
+ +
+
+
/api/ticker
+
Provides 24 hour price ticker for single market or all markets
+
+
+

Sample Request

+ +

Sample Response

+
{ + "btc_eur": { + "last": "524.17550000", + "high": "529.56210000", + "low": "510.20000000", + "volume_left": "2.76560000", + "volume_right": "1454.42950000", + "buy": "513.88580000", + "sell": "529.17120000" + } +}
+
+
+

Sample Request

+ +

Sample Response

+
+{ + "1cr_btc": null, + "btc_aud": { + "last": "728.89000000", + "high": "728.89000000", + "low": "728.89000000", + "volume_left": 0, + "volume_right": 0, + "buy": null, + "sell": null + }, + "btc_eur": { + "last": "524.17550000", + "high": "529.56210000", + "low": "510.20000000", + "volume_left": "2.76560000", + "volume_right": "1454.42950000", + "buy": "513.88580000", + "sell": "529.17120000" + }, + "xmr_btc": { + "last": "0.01437401", + "high": "0.01530723", + "low": "0.01437401", + "volume_left": "269.79720000", + "volume_right": "4.00000000", + "buy": "0.01427006", + "sell": "0.01545144" + } +}
+
+
+ +
+

Parameters

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
paramdescrequiredvaluesdefault
marketmarket identifierNo
formatformat of return dataNojson | jsonprettyjsonpretty
+
+
+ +
+

Notes

+
    +
  • the response data can indicate the following market states: never traded, traded prior to 24 hours, traded within 24 hours
  • +
  • a null value for a market key indicates 'never traded'
  • +
  • volume_left or volume_right is 0 indicates 'traded prior to 24 hours'
  • +
  • volume_left or volume_right is > 0 indicates 'traded within 24 hours'
  • +
  • buy represents the highest buy offer at present, sell represents the lowest sell offer at present
  • +
  • either buy or sell may be null if there are not presently any respective offers
  • +
+
+ + +
+
+
/api/trades
+
Provides list of completed trades for a single market.
+
+
+

Sample Request

+ +

Sample Response

+
[ + { + "direction": "SELL", + "price": "2375.72500000", + "amount": "0.05000000", + "volume": "118.78620000", + "payment_method": "SEPA", + "trade_id": "BLBJHGL-b644851d-f822-418a-8035-955f7a02eff9-051", + "trade_date": 1501095828824 + }, + { + "direction": "SELL", + "price": "2148.50230000", + "amount": "0.20000000", + "volume": "429.70040000", + "payment_method": "SEPA", + "trade_id": "dcwyx9-1a89dece-5039-4ff7-89c9-7ed52b84bc88-051", + "trade_date": 1501088841011 + } +]
+
+
+ +
+

Parameters

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
paramdescrequiredvaluesdefault
marketmarket identifierYes<market pair> | all
formatformat of return dataNojson | jsonprettyjsonpretty
timestamp_fromstart time, in seconds since 1970No2016-01-01
timestamp_toend time, in seconds since 1970Nonow
trade_id_fromidentifies first trade to includeNo
trade_id_toidentifies last trade to includeNo
directiontrade direction: buy or sell. omit or leave null for both.Nobuy | sell
limitmaximum trades to return. max is 2000.No100
sortSort by dateNoasc | descdesc
+
+
+ +
+

Notes

+
    +
  • trade_date in response is provided in milliseconds since 1970, not seconds. To get seconds, divide by 1000
  • +
  • if the market parameter is "all" then up to limit trades will be returned, date sorted, across all markets. Also a "market" field is added to each trade result.
  • +
  • this api will return a maximum of 2000 trades per call
  • +
  • if trade_id_from or trade_id_to is used and a matching trade is not found for each, then no results are returned
  • +
  • The Bisq app does not presently use a trade_id internally. The trade_id in this api is actually the bisq offerId.
  • +
  • Possible values for payment_method can change over time. For most current, see PaymentMethod.java
  • +
+
+ + +
+
+
/api/volumes
+
Provides periodic volume data in terms of base currency for one or all markets.
+
+
+

Sample Request

+ +

Sample Response

+
[ + { + "period_start": 1451606400, + "volume": "1128.38570000", + "num_trades": 2009 + }, + { + "period_start": 1483228800, + "volume": "1322.77960000", + "num_trades": 2376 + } +]
+
+
+ +
+

Parameters

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
paramdescoptionalvaluesdefault
basecurrencybase currency identifier.Yes
marketmarket identifier.Yes
intervallength of time blocks to summarize. auto will pick appropriate interval based on total time rangeNominute | half_hour | hour | half_day | day | week | month | year | autoauto
timestamp_fromstart time, in seconds since 1970No2016-01-01
timestamp_toend time, in seconds since 1970Nonow
formatformat of return data. csv provides the most compact format.Nocsv | json | jsonprettyjsonpretty
+
+
+ +
+

Notes

+
    +
  • A Base currency is a blockchain (eg Bitcoin) that is traded against other currencies utilizing the base currency's multisig capability. eg XMR/BTC, LTC/BTC, BTC/USD, and BTC/EUR all use the base currency BTC. In contrast, XMR/LTC, BTC/LTC, LTC/EUR, LTC/USD all use the base currency LTC.
  • +
  • Either basecurrency or market param must be specified.
  • +
  • basecurrency must be supported by Bisq app.
  • +
  • As of 2017-07-24, supported basecurrency are BTC, DOGE, LTC, DASH
  • +
+
+ + +
+ +
+

Error Responses

+ +

Any errors such as invalid parameters will be in the following format

+
{ + "success": 0, + "error": "market parameter missing" +}
+ +
+ + + diff --git a/css/bitsquare/addtoany.css b/static/css/bitsquare/addtoany.css similarity index 100% rename from css/bitsquare/addtoany.css rename to static/css/bitsquare/addtoany.css diff --git a/css/bitsquare/css.css b/static/css/bitsquare/css.css similarity index 100% rename from css/bitsquare/css.css rename to static/css/bitsquare/css.css diff --git a/css/bitsquare/style.css b/static/css/bitsquare/style.css similarity index 100% rename from css/bitsquare/style.css rename to static/css/bitsquare/style.css diff --git a/css/styles.css b/static/css/styles.css similarity index 100% rename from css/styles.css rename to static/css/styles.css diff --git a/favicon.ico b/static/favicon.ico similarity index 100% rename from favicon.ico rename to static/favicon.ico diff --git a/test-ajaxdata.php b/test-ajaxdata.php deleted file mode 100644 index ce5e3d8..0000000 --- a/test-ajaxdata.php +++ /dev/null @@ -1,569 +0,0 @@ -get_markets() : $marketservice->get_markets_with_trades(); - - // Default to eur market for now. - if( !$market || !@$markets_result[$market]) { - $market = "eur_btc"; - } - $market_name = strtoupper( str_replace( '_', '/', $market)); - $currmarket = $markets_result[$market]; - - // Obtain market summary info for today only. - $summarize_trades = new summarize_trades(); - $market_result = $summarize_trades->get_trade_summaries_days( ['market' => $market, - 'datetime_from' => strtotime( 'today 00:00:00' ), - 'datetime_to' => strtotime( 'today 23:59:00' ), - 'limit' => 1 - ] ); - // create market select control. - $allparam = $allmarkets ? '&allmarkets=1' : ''; - $market_select = sprintf( "\n"; - - $latest = @$market_result[0]; - if( $latest ) { - $market_result = ['choose' => $market_select, - 'market'=> $currmarket['name'], - 'market_date'=> date('Y-m-d'), - 'last'=> $latest['close'], - 'high'=> $latest['high'], - 'low'=> $latest['low'], - 'avg'=> $latest['avg'], - 'volume' => $latest['volume'] - ]; - } - else { - $market_result = ['choose' => $market_select, - 'market'=> $currmarket['name'], - 'market_date'=> date('Y-m-d'), - 'last'=> '--', - 'high'=> '--', - 'low'=> '--', - 'avg'=> '--', - 'volume' => '--' - ]; - } - - // get latest trades. - $trades = new trades(); - $trades_result = $trades->get_trades( [ 'market' => $market, - 'limit' => 100 ] ); -} -catch( Exception $e ) { -// for dev/debug. - _global_exception_handler( $e ); - include(dirname(__FILE__) . '/404.html'); -} - -list( $curr_left, $curr_right ) = explode( '_', $market, 2); - -$table = new html_table(); -$table->timestampjs_col_names['tradeDate'] = true; - -function display_crypto($val, $row) { - return $val / 100000000; -} -function display_fiat($val, $row) { - return $val / 10000; -} -function display_cryptotimesfiat($val, $row) { - return $val / 1000000000000; -} - -$amcharts_cdn = 'https://www.amcharts.com/lib/3'; -?> - - - - - - - - - - - - -table_attrs = array( 'class' => 'bordered', 'id' => 'market_info', 'style' => 'width: 800px' ); ?> -table_with_header( array( $market_result ), - array( 'Choose', 'Market', 'Date', "Last", "High", "Low", "Avg", "Volume" ), - array( 'choose', 'market', 'market_date', 'last', 'high', 'low', 'avg', 'volume' ) ); ?> - - -
- There have been no trades in this market recently. You can get the ball rolling by placing an order now. -
- -
-
-
- -

Trade History

( Last trades )
-table_attrs = array( 'class' => 'bordered', 'id' => 'trade_history', 'style' => 'width: 800px' ); ?> -
- -table_with_header( $trades_result, - array( 'Date', 'Action', 'Price', 'Size', 'Total' ), - array( 'tradeDate', - 'direction', - 'tradePrice' => ['cb_format' => 'display_fiat'], - 'tradeAmount' => ['cb_format' => 'display_crypto'], - 'total' => ['cb_format' => 'display_cryptotimesfiat'] ) ); ?> -
- - - - - - - - diff --git a/test-cachedata.php b/test-cachedata.php deleted file mode 100644 index 98e8ccf..0000000 --- a/test-cachedata.php +++ /dev/null @@ -1,580 +0,0 @@ -get_markets() : $marketservice->get_markets_with_trades(); - - // Default to eur market for now. - if( !$market || !@$markets_result[$market]) { - $market = "eur_btc"; - } - $currmarket = $markets_result[$market]; - $market_name = strtoupper( str_replace( '_', '/', $market)); - - // Obtain market summary info for today only. - $summarize_trades = new summarize_trades(); - $market_result = $summarize_trades->get_trade_summaries_days( ['market' => $market, - 'datetime_from' => strtotime( 'today 00:00:00' ), - 'datetime_to' => strtotime( 'today 23:59:00' ), - 'limit' => 1 - ] ); - // create market select control. - $allparam = $allmarkets ? '&allmarkets=1' : ''; - $market_select = sprintf( "\n"; - - $latest = @$market_result[0]; - if( $latest ) { - $market_result = ['choose' => $market_select, - 'market'=> $currmarket['name'], - 'market_date'=> date('Y-m-d'), - 'last'=> $latest['close'], - 'high'=> $latest['high'], - 'low'=> $latest['low'], - 'avg'=> $latest['avg'], - 'volume' => $latest['volume'] - ]; - } - else { - $market_result = ['choose' => $market_select, - 'market'=> $currmarket['name'], - 'market_date'=> date('Y-m-d'), - 'last'=> '--', - 'high'=> '--', - 'low'=> '--', - 'avg'=> '--', - 'volume' => '--' - ]; - } - - // get latest trades. - $trades = new trades(); - $trades_result = $trades->get_trades( [ 'market' => $market, - 'limit' => 100 ] ); -} -catch( Exception $e ) { -// for dev/debug. - _global_exception_handler( $e ); - include(dirname(__FILE__) . '/404.html'); -} - -list( $curr_left, $curr_right ) = explode( '_', $market, 2); - -$table = new html_table(); -$table->timestampjs_col_names['tradeDate'] = true; - -function display_crypto($val, $row) { - return $val / 100000000; -} -function display_fiat($val, $row) { - return $val / 10000; -} -function display_cryptotimesfiat($val, $row) { - return $val / 1000000000000; -} - -$amcharts_cdn = 'https://www.amcharts.com/lib/3'; -?> - - - - - - - - - - - - -table_attrs = array( 'class' => 'bordered', 'id' => 'market_info', 'style' => 'width: 800px' ); ?> -table_with_header( array( $market_result ), - array( 'Choose', 'Market', 'Date', "Last", "High", "Low", "Avg", "Volume" ), - array( 'choose', 'market', 'market_date', 'last', 'high', 'low', 'avg', 'volume' ) ); ?> - - -
- There have been no trades in this market recently. You can get the ball rolling by placing an order now. -
- -
-
-
- -

Trade History

( Last trades )
-table_attrs = array( 'class' => 'bordered', 'id' => 'trade_history', 'style' => 'width: 800px' ); ?> -
- -table_with_header( $trades_result, - array( 'Date', 'Action', 'Price', 'Size', 'Total' ), - array( 'tradeDate', - 'direction', - 'tradePrice' => ['cb_format' => 'display_fiat'], - 'tradeAmount' => ['cb_format' => 'display_crypto'], - 'total' => ['cb_format' => 'display_cryptotimesfiat'] ) ); ?> -
- - - - - - - - diff --git a/test/.gitignore b/test/.gitignore new file mode 100644 index 0000000..6156ba6 --- /dev/null +++ b/test/.gitignore @@ -0,0 +1,2 @@ +*.out +*.diff diff --git a/test/diff-all b/test/diff-all new file mode 100755 index 0000000..b016ade --- /dev/null +++ b/test/diff-all @@ -0,0 +1,12 @@ +#!/bin/zsh +PRODUCTION_HOSTNAME=markets.bisq.network +DEVELOPMENT_HOSTNAME=bisq-markets.appspot.com + +for query in `cat tests`;do + echo "${query}" + curl -n -s "https://${PRODUCTION_HOSTNAME}${query}" | jq -M . > ${PRODUCTION_HOSTNAME}.out + curl -n -s "https://${DEVELOPMENT_HOSTNAME}${query}" | jq -M . > ${DEVELOPMENT_HOSTNAME}.out + diff -w -u ${PRODUCTION_HOSTNAME}.out ${DEVELOPMENT_HOSTNAME}.out > diff + cat diff + rm diff +done diff --git a/test/test-all b/test/test-all new file mode 100755 index 0000000..0af405c --- /dev/null +++ b/test/test-all @@ -0,0 +1,12 @@ +#!/bin/zsh +DEVELOPMENT_HOSTNAME=bisq-markets.appspot.com +DEVELOPMENT_HOSTNAME=markets.bisq.network + +for query in `cat tests`;do + curl -s \ + -o /dev/null \ + --resolve "${DEVELOPMENT_HOSTNAME}:80:216.239.32.21" \ + -w "%{url_effective} %{http_code} %{time_total}\n" \ + "http://${DEVELOPMENT_HOSTNAME}${query}" & + sleep 0.1 +done diff --git a/test/tests b/test/tests new file mode 100644 index 0000000..17e2aa7 --- /dev/null +++ b/test/tests @@ -0,0 +1,2431 @@ +/api/volumes?basecurrency=btc&milliseconds=true×tamp=no&fillgaps=&interval=day +/api/ticker +/api/offers?market=btc_eur&limit=2000 +/api/offers?market=eth_btc&limit=2000 +/api/offers?market=btc_usd&limit=2000 +/api/offers?market=xmr_btc +/api/offers?market=etc_btc&limit=2000 +/api/offers?market=btc_aud&limit=2000 +/api/offers?market=ltc_btc&limit=2000 +/api/ticker/ +/api/markets +/api/ticker?market=btc_usd +/api/trades?market=ltc_btc×tamp_from=1568070287 +/api/trades?market=etc_btc×tamp_from=1564929693 +/api/offers?market=btc_brl +/api/trades?market=btc_aud×tamp_from=-62135596800 +/api/trades?market=btc_eur×tamp_from=-62135596800 +/api/trades?market=eth_btc×tamp_from=-62135596800 +/api/trades?market=btc_usd×tamp_from=-62135596800 +/api/trades?market=etc_btc×tamp_from=-62135596800 +/api/trades?market=ltc_btc×tamp_from=-62135596800 +/api/offers?market=btc_eur +/api/trades?market=eth_btc×tamp_from=1570798818 +/api/offers?market=btc_usd +/api/offers?market=btc_gbp +/api//ticker +/api/trades?market=btc_brl&limit=10 +/api/offers?market=bsq_btc +/api/trades?market=btc_zar&limit=10 +/api/trades?market=btc_ars&limit=10 +/api/trades?market=btc_aud&limit=10 +/api/trades?market=btc_clp&limit=10 +/api/trades?market=btc_cad&limit=10 +/api/trades?market=btc_dkk&limit=10 +/api/trades?market=btc_cny&limit=10 +/api/ticker?market=zen_btc +/api/trades?market=eth_btc×tamp_from=1569831289 +/api/trades?market=btc_eur&limit=10 +/api/trades?market=btc_usd +/api/trades?market=btc_gbp&limit=10 +/api/offers?market=btc_aud +/api/trades?market=btc_aud×tamp_from=1570943645 +/api/ticker?market=btc_brl +/api/trades?market=btc_ghs&limit=10 +/api/trades?market=btc_hkd&limit=10 +/api/trades?market=btc_jpy&limit=10 +/api/trades?market=btc_inr&limit=10 +/api/trades?market=btc_mxn&limit=10 +/api/trades?market=btc_myr&limit=10 +/api/trades?market=btc_ngn&limit=10 +/api/trades?market=btc_nok&limit=10 +/api/trades?market=btc_nzd&limit=10 +/api/trades?market=btc_ron&limit=10 +/api/trades?market=btc_rub&limit=10 +/api/trades?market=btc_pln&limit=10 +/api/trades?market=btc_php&limit=10 +/api/trades?market=btc_sek&limit=10 +/api/trades?market=btc_vnd&limit=10 +/api/trades?market=btc_thb&limit=10 +/api/trades?market=xrc_btc&limit=50 +/api/trades?market=dash_mro&limit=50 +/api/trades?market=space_btc&limit=50 +/api/trades?market=dash_nok&limit=50 +/api/trades?market=dash_lsl&limit=50 +/api/trades?market=ltc_sgd&limit=50 +/api/offers?market=eth_btc +/api/trades?market=xzc_doge&limit=50 +/api/trades?market=tmc_btc&limit=50 +/api/trades?market=ltc_qar&limit=50 +/api/trades?market=ltc_npr&limit=50 +/api/trades?market=dct_btc&limit=50 +/api/trades?market=dash_ugx&limit=50 +/api/trades?market=wrkz_btc&limit=50 +/api/trades?market=wild_btc&limit=50 +/api/trades?market=ltc_tjs&limit=50 +/api/trades?market=dash_xof&limit=50 +/api/trades?market=dash_ern&limit=50 +/api/trades?market=btc_dash&limit=50 +/api/trades?market=ubq_btc&limit=50 +/api/trades?market=ltc_mur&limit=50 +/api/trades?market=dash_pyg&limit=50 +/api/trades?market=dash_kmf&limit=50 +/api/trades?market=btc_mad&limit=50 +/api/trades?market=btc_fjd&limit=50 +/api/trades?market=btc_aoa&limit=50 +/api/trades?market=xdr_btc&limit=50 +/api/trades?market=vdn_dash&limit=50 +/api/trades?market=sf_dash&limit=50 +/api/trades?market=dash_sek&limit=50 +/api/trades?market=btc_kwd&limit=50 +/api/trades?market=zen_btc&limit=50 +/api/trades?market=part_btc&limit=50 +/api/trades?market=mile_btc&limit=50 +/api/trades?market=maid_ltc&limit=50 +/api/trades?market=ltc_usd&limit=50 +/api/trades?market=ltc_kmf&limit=50 +/api/trades?market=dash_thb&limit=50 +/api/trades?market=dash_inr&limit=50 +/api/trades?market=dash_crc&limit=50 +/api/trades?market=btc_xpf&limit=50 +/api/trades?market=btc_usd&limit=50 +/api/trades?market=btc_cad&limit=50 +/api/trades?market=doge_sdg&limit=50 +/api/trades?market=doge_btc&limit=50 +/api/trades?market=doge_afn&limit=50 +/api/trades?market=dmc_btc&limit=50 +/api/trades?market=btc_sll&limit=50 +/api/trades?market=btc_mwk&limit=50 +/api/trades?market=btc_isk&limit=50 +/api/trades?market=btc_hkd&limit=50 +/api/trades?market=btc_bif&limit=50 +/api/trades?market=ref_btc&limit=50 +/api/trades?market=mvt_ltc&limit=50 +/api/trades?market=ltc_xpf&limit=50 +/api/trades?market=doge_tzs&limit=50 +/api/trades?market=dash_gnf&limit=50 +/api/trades?market=bti_btc&limit=50 +/api/trades?market=btc_tjs&limit=50 +/api/trades?market=blur_btc&limit=50 +/api/trades?market=nbt_dash&limit=50 +/api/trades?market=ltc_lsl&limit=50 +/api/trades?market=doge_syp&limit=50 +/api/trades?market=doge_bbd&limit=50 +/api/trades?market=dash_btn&limit=50 +/api/trades?market=sc_doge&limit=50 +/api/trades?market=ltc_inr&limit=50 +/api/trades?market=drip_btc&limit=50 +/api/trades?market=doge_xaf&limit=50 +/api/trades?market=doge_pln&limit=50 +/api/trades?market=doge_lrd&limit=50 +/api/trades?market=btc_omr&limit=50 +/api/trades?market=mbyt_ltc&limit=50 +/api/trades?market=doge_mop&limit=50 +/api/trades?market=btc_rsd&limit=50 +/api/trades?market=qmcoin_btc&limit=50 +/api/trades?market=ppi_btc&limit=50 +/api/trades?market=alc_ltc&limit=50 +/api/trades?market=rto_btc&limit=50 +/api/trades?market=ltc_gnf&limit=50 +/api/trades?market=doge_cop&limit=50 +/api/trades?market=bchc_doge&limit=50 +/api/trades?market=pepecash_doge&limit=50 +/api/trades?market=nxt_dash&limit=50 +/api/trades?market=nim_btc&limit=50 +/api/trades?market=grin_btc&limit=50 +/api/trades?market=doge_nio&limit=50 +/api/trades?market=doge_khr&limit=50 +/api/trades?market=doge_gmd&limit=50 +/api/trades?market=dash_all&limit=50 +/api/trades?market=cage_btc&limit=50 +/api/trades?market=ltc_bwp&limit=50 +/api/trades?market=ltc_bgn&limit=50 +/api/trades?market=fto_btc&limit=50 +/api/trades?market=doge_egp&limit=50 +/api/trades?market=croat_btc&limit=50 +/api/trades?market=ltc_cup&limit=50 +/api/trades?market=eths_btc&limit=50 +/api/trades?market=doge_ils&limit=50 +/api/trades?market=dash_bdt&limit=50 +/api/trades?market=ltc_ern&limit=50 +/api/trades?market=ltc_djf&limit=50 +/api/trades?market=pix_btc&limit=50 +/api/trades?market=lcp_btc&limit=50 +/api/trades?market=dash_srd&limit=50 +/api/trades?market=dash_mdl&limit=50 +/api/trades?market=wac_btc&limit=50 +/api/trades?market=uno_btc&limit=50 +/api/trades?market=steem_ltc&limit=50 +/api/trades?market=ltc_bnd&limit=50 +/api/trades?market=kuma_btc&limit=50 +/api/trades?market=ella_doge&limit=50 +/api/trades?market=dash_top&limit=50 +/api/trades?market=dash_pab&limit=50 +/api/trades?market=dash_mxn&limit=50 +/api/trades?market=btc_sbd&limit=50 +/api/trades?market=wmcc_btc&limit=50 +/api/trades?market=trc_dash&limit=50 +/api/trades?market=ltc_kyd&limit=50 +/api/trades?market=ltc_hnl&limit=50 +/api/trades?market=eth_ltc&limit=50 +/api/trades?market=dash_zmw&limit=50 +/api/trades?market=dash_kyd&limit=50 +/api/trades?market=dash_hnl&limit=50 +/api/trades?market=cnmc_btc&limit=50 +/api/trades?market=cash2_btc&limit=50 +/api/trades?market=ltc_vnd&limit=50 +/api/trades?market=ltc_try&limit=50 +/api/trades?market=ltc_jmd&limit=50 +/api/trades?market=ltc_fkp&limit=50 +/api/trades?market=inxt_ltc&limit=50 +/api/trades?market=grans_btc&limit=50 +/api/trades?market=doge_sll&limit=50 +/api/trades?market=dash_vef&limit=50 +/api/trades?market=dash_fkp&limit=50 +/api/trades?market=mfc_ltc&limit=50 +/api/trades?market=ltc_pyg&limit=50 +/api/trades?market=ltc_aud&limit=50 +/api/trades?market=doge_uyu&limit=50 +/api/trades?market=doge_bif&limit=50 +/api/trades?market=dgm_btc&limit=50 +/api/trades?market=dash_mop&limit=50 +/api/trades?market=ltc_zwl&limit=50 +/api/trades?market=ltc_myr&limit=50 +/api/trades?market=ltc_crc&limit=50 +/api/trades?market=ltc_cdf&limit=50 +/api/trades?market=dvc_btc&limit=50 +/api/trades?market=doge_yer&limit=50 +/api/trades?market=doge_rsd&limit=50 +/api/trades?market=doge_mad&limit=50 +/api/trades?market=dmd_btc&limit=50 +/api/trades?market=dash_rub&limit=50 +/api/trades?market=dash_djf&limit=50 +/api/trades?market=dash_cad&limit=50 +/api/trades?market=btx_ltc&limit=50 +/api/trades?market=btc_thb&limit=50 +/api/trades?market=btc_lbp&limit=50 +/api/trades?market=ltc_bdt&limit=50 +/api/trades?market=ltc_amd&limit=50 +/api/trades?market=doge_tmt&limit=50 +/api/trades?market=doge_bzd&limit=50 +/api/trades?market=doge_aoa&limit=50 +/api/trades?market=zer_btc&limit=50 +/api/trades?market=xmn_btc&limit=50 +/api/trades?market=sib_dash&limit=50 +/api/trades?market=nano_btc&limit=50 +/api/trades?market=mt_dash&limit=50 +/api/trades?market=ltc_ssp&limit=50 +/api/trades?market=ltc_pen&limit=50 +/api/trades?market=ltc_nok&limit=50 +/api/trades?market=ltc_mga&limit=50 +/api/trades?market=grc_dash&limit=50 +/api/trades?market=doge_kwd&limit=50 +/api/trades?market=dash_nio&limit=50 +/api/trades?market=dash_ils&limit=50 +/api/trades?market=dai_ltc&limit=50 +/api/trades?market=btc_xof&limit=50 +/api/trades?market=btc_ugx&limit=50 +/api/trades?market=btc_shp&limit=50 +/api/trades?market=sem_ltc&limit=50 +/api/trades?market=odn_dash&limit=50 +/api/trades?market=nbt_btc&limit=50 +/api/trades?market=mdc_doge&limit=50 +/api/trades?market=mbyt_dash&limit=50 +/api/trades?market=maid_doge&limit=50 +/api/trades?market=ltc_rwf&limit=50 +/api/trades?market=lsk_dash&limit=50 +/api/trades?market=lbc_dash&limit=50 +/api/trades?market=iop_ltc&limit=50 +/api/trades?market=gbyte_doge&limit=50 +/api/trades?market=doge_mwk&limit=50 +/api/trades?market=dash_khr&limit=50 +/api/trades?market=dash_jmd&limit=50 +/api/trades?market=dash_ars&limit=50 +/api/trades?market=btc_std&limit=50 +/api/trades?market=btc_nzd&limit=50 +/api/trades?market=btc_kes&limit=50 +/api/trades?market=xcn_ltc&limit=50 +/api/trades?market=tusd_btc&limit=50 +/api/trades?market=mvt_dash&limit=50 +/api/trades?market=ltc_sek&limit=50 +/api/trades?market=ltc_mro&limit=50 +/api/trades?market=ltc_lrd&limit=50 +/api/trades?market=doge_omr&limit=50 +/api/trades?market=doge_czk&limit=50 +/api/trades?market=dash_xcd&limit=50 +/api/trades?market=dash_bmd&limit=50 +/api/trades?market=btc_zwl&limit=50 +/api/trades?market=btc_ron&limit=50 +/api/trades?market=btc_irr&limit=50 +/api/trades?market=btc_cny&limit=50 +/api/trades?market=tari_btc&limit=50 +/api/trades?market=sos_ltc&limit=50 +/api/trades?market=sc_dash&limit=50 +/api/trades?market=neet_dash&limit=50 +/api/trades?market=maza_btc&limit=50 +/api/trades?market=ltc_xof&limit=50 +/api/trades?market=ltc_thb&limit=50 +/api/trades?market=esp_doge&limit=50 +/api/trades?market=doge_idr&limit=50 +/api/trades?market=dash_uah&limit=50 +/api/trades?market=dash_sdg&limit=50 +/api/trades?market=dash_pln&limit=50 +/api/trades?market=btc_vnd&limit=50 +/api/trades?market=btc_gyd&limit=50 +/api/trades?market=xspec_ltc&limit=50 +/api/trades?market=rdd_ltc&limit=50 +/api/trades?market=ltc_ugx&limit=50 +/api/trades?market=doge_svc&limit=50 +/api/trades?market=doge_isk&limit=50 +/api/trades?market=doge_hkd&limit=50 +/api/trades?market=dcr_ltc&limit=50 +/api/trades?market=dash_szl&limit=50 +/api/trades?market=crea_dash&limit=50 +/api/trades?market=btc_php&limit=50 +/api/trades?market=btc_nad&limit=50 +/api/trades?market=btc_krw&limit=50 +/api/trades?market=sf_btc&limit=50 +/api/trades?market=scp_btc&limit=50 +/api/trades?market=roi_ltc&limit=50 +/api/trades?market=ltc_khr&limit=50 +/api/trades?market=ltc_egp&limit=50 +/api/trades?market=ltc_all&limit=50 +/api/trades?market=doge_scr&limit=50 +/api/trades?market=doge_pkr&limit=50 +/api/trades?market=doge_kgs&limit=50 +/api/trades?market=dash_egp&limit=50 +/api/trades?market=bzc_btc&limit=50 +/api/trades?market=btc_mmk&limit=50 +/api/trades?market=btc_dop&limit=50 +/api/trades?market=btc_brl&limit=50 +/api/trades?market=xdr0_btc&limit=50 +/api/trades?market=wow_ltc&limit=50 +/api/trades?market=pasc_btc&limit=50 +/api/trades?market=nxt_btc&limit=50 +/api/trades?market=nmc_dash&limit=50 +/api/trades?market=nilu_ltc&limit=50 +/api/trades?market=ltc_ils&limit=50 +/api/trades?market=lce_ltc&limit=50 +/api/trades?market=ich_dash&limit=50 +/api/trades?market=doge_ngn&limit=50 +/api/trades?market=doge_mnt&limit=50 +/api/trades?market=doge_cny&limit=50 +/api/trades?market=dash_lrd&limit=50 +/api/trades?market=cloak_btc&limit=50 +/api/trades?market=btg_ltc&limit=50 +/api/trades?market=btc_lyd&limit=50 +/api/trades?market=btc_ghs&limit=50 +/api/trades?market=btc_czk&limit=50 +/api/trades?market=btcc_ltc&limit=50 +/api/trades?market=xzc_dash&limit=50 +/api/trades?market=qwc_btc&limit=50 +/api/trades?market=ltc_gmd&limit=50 +/api/trades?market=ltc_btn&limit=50 +/api/trades?market=doge_wst&limit=50 +/api/trades?market=doge_lkr&limit=50 +/api/trades?market=doge_fjd&limit=50 +/api/trades?market=doge_bsd&limit=50 +/api/trades?market=din_ltc&limit=50 +/api/trades?market=bch_doge&limit=50 +/api/trades?market=ytn_ltc&limit=50 +/api/trades?market=vdn_btc&limit=50 +/api/trades?market=doge_twd&limit=50 +/api/trades?market=doge_gip&limit=50 +/api/trades?market=doge_dzd&limit=50 +/api/trades?market=doge_bam&limit=50 +/api/trades?market=dcr_btc&limit=50 +/api/trades?market=dash_gmd&limit=50 +/api/trades?market=btc_try&limit=50 +/api/trades?market=btc_mvr&limit=50 +/api/trades?market=btc_huf&limit=50 +/api/trades?market=xmy_btc&limit=50 +/api/trades?market=rin_dash&limit=50 +/api/trades?market=pepecash_dash&limit=50 +/api/trades?market=onion_ltc&limit=50 +/api/trades?market=dash_ttd&limit=50 +/api/trades?market=btc_eur&limit=50 +/api/trades?market=btc_azn&limit=50 +/api/trades?market=web_btc&limit=50 +/api/trades?market=prsn_btc&limit=50 +/api/trades?market=koto_ltc&limit=50 +/api/trades?market=doge_top&limit=50 +/api/trades?market=dash_vuv&limit=50 +/api/trades?market=dash_std&limit=50 +/api/trades?market=zel_btc&limit=50 +/api/trades?market=qbs_btc&limit=50 +/api/trades?market=post_ltc&limit=50 +/api/trades?market=phr_ltc&limit=50 +/api/trades?market=gmcn_btc&limit=50 +/api/trades?market=doge_aed&limit=50 +/api/trades?market=dash_cop&limit=50 +/api/trades?market=drgl_btc&limit=50 +/api/trades?market=dash_mzn&limit=50 +/api/trades?market=dash_afn&limit=50 +/api/trades?market=cred_ltc&limit=50 +/api/trades?market=pivx_ltc&limit=50 +/api/trades?market=frty_btc&limit=50 +/api/trades?market=doge_vef&limit=50 +/api/trades?market=doge_srd&limit=50 +/api/trades?market=dash_sar&limit=50 +/api/trades?market=aqua_ltc&limit=50 +/api/trades?market=acm_btc&limit=50 +/api/trades?market=zny_dash&limit=50 +/api/trades?market=pnc_doge&limit=50 +/api/trades?market=ltc_lak&limit=50 +/api/trades?market=grft_ltc&limit=50 +/api/trades?market=doge_rwf&limit=50 +/api/trades?market=doge_bnd&limit=50 +/api/trades?market=dash_pgk&limit=50 +/api/trades?market=dash_mkd&limit=50 +/api/trades?market=btc_bzd&limit=50 +/api/trades?market=zec_dash&limit=50 +/api/trades?market=xuez_dash&limit=50 +/api/trades?market=ella_dash&limit=50 +/api/trades?market=doge_pen&limit=50 +/api/trades?market=doge_jod&limit=50 +/api/trades?market=dash_btc&limit=50 +/api/trades?market=dash_bbd&limit=50 +/api/trades?market=burst_dash&limit=50 +/api/trades?market=wac_doge&limit=50 +/api/trades?market=inxt_doge&limit=50 +/api/trades?market=grc_ltc&limit=50 +/api/trades?market=etc_ltc&limit=50 +/api/trades?market=doge_cdf&limit=50 +/api/trades?market=doge_myr&limit=50 +/api/trades?market=btc_bhd&limit=50 +/api/trades?market=xmr_dash&limit=50 +/api/trades?market=wmcc_ltc&limit=50 +/api/trades?market=ltc_nad&limit=50 +/api/trades?market=ltc_htg&limit=50 +/api/trades?market=dash_lak&limit=50 +/api/trades?market=cdt_dash&limit=50 +/api/trades?market=btg_btc&limit=50 +/api/trades?market=btc_sdg&limit=50 +/api/trades?market=ltc_mmk&limit=50 +/api/trades?market=doge_mga&limit=50 +/api/trades?market=doge_kzt&limit=50 +/api/trades?market=doge_hrk&limit=50 +/api/trades?market=doge_gbp&limit=50 +/api/trades?market=doge_djf&limit=50 +/api/trades?market=doge_aud&limit=50 +/api/trades?market=dnet_dash&limit=50 +/api/trades?market=dash_awg&limit=50 +/api/trades?market=cred_btc&limit=50 +/api/trades?market=btc_nio&limit=50 +/api/trades?market=btc_ang&limit=50 +/api/trades?market=lytx_btc&limit=50 +/api/trades?market=ltc_twd&limit=50 +/api/trades?market=ltc_sbd&limit=50 +/api/trades?market=ltc_jpy&limit=50 +/api/trades?market=dash_gel&limit=50 +/api/trades?market=dash_doge&limit=50 +/api/trades?market=btc_wst&limit=50 +/api/trades?market=btc_mop&limit=50 +/api/trades?market=uno_doge&limit=50 +/api/trades?market=ltc_php&limit=50 +/api/trades?market=doge_zmw&limit=50 +/api/trades?market=dgm_ltc&limit=50 +/api/trades?market=darx_dash&limit=50 +/api/trades?market=xcp_dash&limit=50 +/api/trades?market=rdd_btc&limit=50 +/api/trades?market=ltc_brl&limit=50 +/api/trades?market=exc_dash&limit=50 +/api/trades?market=dvc_ltc&limit=50 +/api/trades?market=btc_twd&limit=50 +/api/trades?market=btc_pln&limit=50 +/api/trades?market=btc_gmd&limit=50 +/api/trades?market=betr_ltc&limit=50 +/api/trades?market=bchc_dash&limit=50 +/api/trades?market=alc_dash&limit=50 +/api/trades?market=sib_ltc&limit=50 +/api/trades?market=rmx_btc&limit=50 +/api/trades?market=neos_btc&limit=50 +/api/trades?market=ltc_wst&limit=50 +/api/trades?market=ltc_gel&limit=50 +/api/trades?market=ltc_clp&limit=50 +/api/trades?market=dash_jpy&limit=50 +/api/trades?market=dash_htg&limit=50 +/api/trades?market=dash_chf&limit=50 +/api/trades?market=btc_svc&limit=50 +/api/trades?market=btc_khr&limit=50 +/api/trades?market=pxl_dash&limit=50 +/api/trades?market=onion_btc&limit=50 +/api/trades?market=mec_btc&limit=50 +/api/trades?market=ltc_svc&limit=50 +/api/trades?market=lsk_ltc&limit=50 +/api/trades?market=ida_btc&limit=50 +/api/trades?market=etc_btc&limit=50 +/api/trades?market=dash_bob&limit=50 +/api/trades?market=btc_ils&limit=50 +/api/trades?market=btc_egp&limit=50 +/api/trades?market=sfsc_dash&limit=50 +/api/trades?market=scs_dash&limit=50 +/api/trades?market=nav_dash&limit=50 +/api/trades?market=dash_mmk&limit=50 +/api/trades?market=aeon_btc&limit=50 +/api/trades?market=mt_ltc&limit=50 +/api/trades?market=ltc_doge&limit=50 +/api/trades?market=ltc_azn&limit=50 +/api/trades?market=kek_btc&limit=50 +/api/trades?market=geo_btc&limit=50 +/api/trades?market=btc_lrd&limit=50 +/api/trades?market=trc_ltc&limit=50 +/api/trades?market=stl_dash&limit=50 +/api/trades?market=nmc_ltc&limit=50 +/api/trades?market=dash_nad&limit=50 +/api/trades?market=btc_crc&limit=50 +/api/trades?market=ask_btc&limit=50 +/api/trades?market=maza_ltc&limit=50 +/api/trades?market=lbc_ltc&limit=50 +/api/trades?market=beam_btc&limit=50 +/api/trades?market=post_btc&limit=50 +/api/trades?market=pivx_btc&limit=50 +/api/trades?market=pasc_doge&limit=50 +/api/trades?market=btc_btn&limit=50 +/api/trades?market=btc_bbd&limit=50 +/api/trades?market=dash_wst&limit=50 +/api/trades?market=dash_ngn&limit=50 +/api/trades?market=dash_kes&limit=50 +/api/trades?market=dcr_dash&limit=50 +/api/trades?market=dash_sbd&limit=50 +/api/trades?market=btc_afn&limit=50 +/api/trades?market=dash_syp&limit=50 +/api/trades?market=dash_php&limit=50 +/api/trades?market=stl_ltc&limit=50 +/api/trades?market=doge_ssp&limit=50 +/api/trades?market=dash_tzs&limit=50 +/api/trades?market=dash_svc&limit=50 +/api/trades?market=dash_pkr&limit=50 +/api/trades?market=btg_dash&limit=50 +/api/trades?market=sos_btc&limit=50 +/api/trades?market=maid_btc&limit=50 +/api/trades?market=ltc_xaf&limit=50 +/api/trades?market=ltc_tzs&limit=50 +/api/trades?market=doge_sar&limit=50 +/api/trades?market=dash_xaf&limit=50 +/api/trades?market=dash_mnt&limit=50 +/api/trades?market=dash_huf&limit=50 +/api/trades?market=dash_clp&limit=50 +/api/trades?market=burst_doge&limit=50 +/api/trades?market=btc_xcd&limit=50 +/api/trades?market=btc_uah&limit=50 +/api/trades?market=btc_tzs&limit=50 +/api/trades?market=btc_syp&limit=50 +/api/trades?market=wow_btc&limit=50 +/api/trades?market=trit_btc&limit=50 +/api/trades?market=ltc_bam&limit=50 +/api/trades?market=doge_mzn&limit=50 +/api/trades?market=doge_lak&limit=50 +/api/trades?market=doge_kes&limit=50 +/api/trades?market=dash_scr&limit=50 +/api/trades?market=dash_lbp&limit=50 +/api/trades?market=burst_ltc&limit=50 +/api/trades?market=btc_sek&limit=50 +/api/trades?market=wac_ltc&limit=50 +/api/trades?market=sfsc_doge&limit=50 +/api/trades?market=mfc_btc&limit=50 +/api/trades?market=ltc_pkr&limit=50 +/api/trades?market=doge_try&limit=50 +/api/trades?market=doge_lbp&limit=50 +/api/trades?market=doge_htg&limit=50 +/api/trades?market=doge_gel&limit=50 +/api/trades?market=doge_brl&limit=50 +/api/trades?market=dash_twd&limit=50 +/api/trades?market=dash_lkr&limit=50 +/api/trades?market=btc_xaf&limit=50 +/api/trades?market=zec_doge&limit=50 +/api/trades?market=mue_btc&limit=50 +/api/trades?market=ltc_kes&limit=50 +/api/trades?market=ltc_huf&limit=50 +/api/trades?market=ella_btc&limit=50 +/api/trades?market=doge_vnd&limit=50 +/api/trades?market=doge_mkd&limit=50 +/api/trades?market=doge_huf&limit=50 +/api/trades?market=doge_clp&limit=50 +/api/trades?market=doge_bob&limit=50 +/api/trades?market=dash_kgs&limit=50 +/api/trades?market=dash_gip&limit=50 +/api/trades?market=dash_dop&limit=50 +/api/trades?market=dash_cny&limit=50 +/api/trades?market=darx_ltc&limit=50 +/api/trades?market=btc_szl&limit=50 +/api/trades?market=btc_inr&limit=50 +/api/trades?market=uno_ltc&limit=50 +/api/trades?market=ltc_scr&limit=50 +/api/trades?market=doge_pgk&limit=50 +/api/trades?market=doge_nad&limit=50 +/api/trades?market=doge_mmk&limit=50 +/api/trades?market=dnet_ltc&limit=50 +/api/trades?market=din_btc&limit=50 +/api/trades?market=dash_ghs&limit=50 +/api/trades?market=cred_dash&limit=50 +/api/trades?market=cha_btc&limit=50 +/api/trades?market=btg_doge&limit=50 +/api/trades?market=btc_nok&limit=50 +/api/trades?market=btc_lsl&limit=50 +/api/trades?market=btc_kmf&limit=50 +/api/trades?market=zny_ltc&limit=50 +/api/trades?market=scs_ltc&limit=50 +/api/trades?market=ltc_syp&limit=50 +/api/trades?market=ltc_ngn&limit=50 +/api/trades?market=ltc_bsd&limit=50 +/api/trades?market=koto_btc&limit=50 +/api/trades?market=fjc_btc&limit=50 +/api/trades?market=etc_doge&limit=50 +/api/trades?market=dxo_btc&limit=50 +/api/trades?market=doge_ttd&limit=50 +/api/trades?market=doge_php&limit=50 +/api/trades?market=doge_azn&limit=50 +/api/trades?market=dcr_doge&limit=50 +/api/trades?market=dash_idr&limit=50 +/api/trades?market=dash_dzd&limit=50 +/api/trades?market=cred_doge&limit=50 +/api/trades?market=btc_sgd&limit=50 +/api/trades?market=btc_pyg&limit=50 +/api/trades?market=btc_npr&limit=50 +/api/trades?market=btc_mro&limit=50 +/api/trades?market=btc_ltc&limit=50 +/api/trades?market=ltc_aed&limit=50 +/api/trades?market=lce_btc&limit=50 +/api/trades?market=grft_btc&limit=50 +/api/trades?market=doge_zwl&limit=50 +/api/trades?market=dash_bam&limit=50 +/api/trades?market=dash_azn&limit=50 +/api/trades?market=dash_aed&limit=50 +/api/trades?market=cdt_ltc&limit=50 +/api/trades?market=xcp_doge&limit=50 +/api/trades?market=sos_dash&limit=50 +/api/trades?market=roi_btc&limit=50 +/api/trades?market=rdd_dash&limit=50 +/api/trades?market=mbgl_btc&limit=50 +/api/trades?market=ltc_mnt&limit=50 +/api/trades?market=koto_dash&limit=50 +/api/trades?market=exc_ltc&limit=50 +/api/trades?market=etc_dash&limit=50 +/api/trades?market=doge_vuv&limit=50 +/api/trades?market=doge_jpy&limit=50 +/api/trades?market=doge_ghs&limit=50 +/api/trades?market=doge_dkk&limit=50 +/api/trades?market=doge_awg&limit=50 +/api/trades?market=dnet_doge&limit=50 +/api/trades?market=din_dash&limit=50 +/api/trades?market=dash_bsd&limit=50 +/api/trades?market=dash_brl&limit=50 +/api/trades?market=btc_qar&limit=50 +/api/trades?market=btc_gnf&limit=50 +/api/trades?market=btc_cup&limit=50 +/api/trades?market=btc_bwp&limit=50 +/api/trades?market=btc_bdt&limit=50 +/api/trades?market=xuez_ltc&limit=50 +/api/trades?market=sub1x_btc&limit=50 +/api/trades?market=sc_btc&limit=50 +/api/trades?market=onion_dash&limit=50 +/api/trades?market=nor_btc&limit=50 +/api/trades?market=ltc_pln&limit=50 +/api/trades?market=ltc_lbp&limit=50 +/api/trades?market=ltc_ghs&limit=50 +/api/trades?market=ltc_cny&limit=50 +/api/trades?market=ltc_btc&limit=50 +/api/trades?market=inxt_btc&limit=50 +/api/trades?market=doge_sbd&limit=50 +/api/trades?market=doge_dop&limit=50 +/api/trades?market=doge_chf&limit=50 +/api/trades?market=btc_mur&limit=50 +/api/trades?market=btc_kpw&limit=50 +/api/trades?market=btc_ern&limit=50 +/api/trades?market=ltc_dop&limit=50 +/api/trades?market=lce_dash&limit=50 +/api/trades?market=sfsc_ltc&limit=50 +/api/trades?market=ltc_nio&limit=50 +/api/trades?market=ltc_afn&limit=50 +/api/trades?market=grft_dash&limit=50 +/api/trades?market=doge_std&limit=50 +/api/trades?market=btc_iqd&limit=50 +/api/trades?market=btc_gtq&limit=50 +/api/trades?market=pasc_ltc&limit=50 +/api/trades?market=nilu_btc&limit=50 +/api/trades?market=ltc_uah&limit=50 +/api/trades?market=doi_btc&limit=50 +/api/trades?market=betr_btc&limit=50 +/api/trades?market=pxl_ltc&limit=50 +/api/trades?market=ltc_xcd&limit=50 +/api/trades?market=ltc_szl&limit=50 +/api/trades?market=ltc_mop&limit=50 +/api/trades?market=ltc_kgs&limit=50 +/api/trades?market=ltc_gip&limit=50 +/api/trades?market=ltc_dzd&limit=50 +/api/trades?market=ltc_cop&limit=50 +/api/trades?market=geo_ltc&limit=50 +/api/trades?market=geo_dash&limit=50 +/api/trades?market=doge_lyd&limit=50 +/api/trades?market=dash_mwk&limit=50 +/api/trades?market=dash_isk&limit=50 +/api/trades?market=dash_hkd&limit=50 +/api/trades?market=btc_etb&limit=50 +/api/trades?market=zec_ltc&limit=50 +/api/trades?market=xmr_doge&limit=50 +/api/trades?market=trtl_btc&limit=50 +/api/trades?market=sib_btc&limit=50 +/api/trades?market=sem_dash&limit=50 +/api/trades?market=pivx_dash&limit=50 +/api/trades?market=mfc_dash&limit=50 +/api/trades?market=ltc_sdg&limit=50 +/api/trades?market=ltc_isk&limit=50 +/api/trades?market=ltc_idr&limit=50 +/api/trades?market=doge_krw&limit=50 +/api/trades?market=dash_sll&limit=50 +/api/trades?market=steem_doge&limit=50 +/api/trades?market=pzdc_btc&limit=50 +/api/trades?market=post_dash&limit=50 +/api/trades?market=maid_dash&limit=50 +/api/trades?market=ltc_pab&limit=50 +/api/trades?market=ltc_bbd&limit=50 +/api/trades?market=inxt_dash&limit=50 +/api/trades?market=doge_gyd&limit=50 +/api/trades?market=doge_bhd&limit=50 +/api/trades?market=btc_bgn&limit=50 +/api/trades?market=btc_all&limit=50 +/api/trades?market=ryo_btc&limit=50 +/api/trades?market=roi_dash&limit=50 +/api/trades?market=rdd_doge&limit=50 +/api/trades?market=nilu_dash&limit=50 +/api/trades?market=nav_doge&limit=50 +/api/trades?market=mvt_btc&limit=50 +/api/trades?market=ltc_lkr&limit=50 +/api/trades?market=doge_nzd&limit=50 +/api/trades?market=doge_byn&limit=50 +/api/trades?market=dash_rsd&limit=50 +/api/trades?market=dash_mad&limit=50 +/api/trades?market=wavi_btc&limit=50 +/api/trades?market=vxv_btc&limit=50 +/api/trades?market=usdc_btc&limit=50 +/api/trades?market=trc_btc&limit=50 +/api/trades?market=odn_btc&limit=50 +/api/trades?market=ltc_rub&limit=50 +/api/trades?market=doge_mvr&limit=50 +/api/trades?market=doge_irr&limit=50 +/api/trades?market=dmc_ltc&limit=50 +/api/trades?market=dash_omr&limit=50 +/api/trades?market=aus_btc&limit=50 +/api/trades?market=pepecash_btc&limit=50 +/api/trades?market=ltc_top&limit=50 +/api/trades?market=ltc_fjd&limit=50 +/api/trades?market=ltc_bmd&limit=50 +/api/trades?market=doge_eur&limit=50 +/api/trades?market=doge_ang&limit=50 +/api/trades?market=dash_uzs&limit=50 +/api/trades?market=dash_kwd&limit=50 +/api/trades?market=dash_bzd&limit=50 +/api/trades?market=btc_awg&limit=50 +/api/trades?market=aeur_btc&limit=50 +/api/trades?market=xcn_doge&limit=50 +/api/trades?market=nmc_btc&limit=50 +/api/trades?market=mt_btc&limit=50 +/api/trades?market=ltc_kwd&limit=50 +/api/trades?market=ltc_hkd&limit=50 +/api/trades?market=ltc_dash&limit=50 +/api/trades?market=doge_shp&limit=50 +/api/trades?market=dash_tnd&limit=50 +/api/trades?market=btc_cve&limit=50 +/api/trades?market=zoc_btc&limit=50 +/api/trades?market=post_doge&limit=50 +/api/trades?market=phr_dash&limit=50 +/api/trades?market=onion_doge&limit=50 +/api/trades?market=mdc_dash&limit=50 +/api/trades?market=max_btc&limit=50 +/api/trades?market=ltc_zmw&limit=50 +/api/trades?market=ltc_srd&limit=50 +/api/trades?market=ltc_mxn&limit=50 +/api/trades?market=ltc_cad&limit=50 +/api/trades?market=lbc_btc&limit=50 +/api/trades?market=doge_cve&limit=50 +/api/trades?market=dash_zar&limit=50 +/api/trades?market=dash_czk&limit=50 +/api/trades?market=btc_top&limit=50 +/api/trades?market=btcc_dash&limit=50 +/api/trades?market=btc_amd&limit=50 +/api/trades?market=xzc_btc&limit=50 +/api/trades?market=xspec_doge&limit=50 +/api/trades?market=xin_ltc&limit=50 +/api/trades?market=wow_dash&limit=50 +/api/trades?market=wild_ltc&limit=50 +/api/trades?market=qwark_ltc&limit=50 +/api/trades?market=pivx_doge&limit=50 +/api/trades?market=npw_btc&limit=50 +/api/trades?market=mbyt_btc&limit=50 +/api/trades?market=ltc_vef&limit=50 +/api/trades?market=ltc_ars&limit=50 +/api/trades?market=doge_ron&limit=50 +/api/trades?market=dash_fjd&limit=50 +/api/trades?market=btc_clp&limit=50 +/api/trades?market=btc_bob&limit=50 +/api/trades?market=alc_btc&limit=50 +/api/trades?market=xcp_ltc&limit=50 +/api/trades?market=ucc_btc&limit=50 +/api/trades?market=neet_btc&limit=50 +/api/trades?market=nav_ltc&limit=50 +/api/trades?market=ltc_mdl&limit=50 +/api/trades?market=lsk_btc&limit=50 +/api/trades?market=dct_ltc&limit=50 +/api/trades?market=btc_sar&limit=50 +/api/trades?market=btc_byn&limit=50 +/api/trades?market=rin_btc&limit=50 +/api/trades?market=iop_doge&limit=50 +/api/trades?market=gbyte_dash&limit=50 +/api/trades?market=dai_dash&limit=50 +/api/trades?market=cage_ltc&limit=50 +/api/trades?market=btc_lak&limit=50 +/api/trades?market=bchc_btc&limit=50 +/api/trades?market=zen_ltc&limit=50 +/api/trades?market=ytn_dash&limit=50 +/api/trades?market=xmr_ltc&limit=50 +/api/trades?market=grc_btc&limit=50 +/api/trades?market=doge_xpf&limit=50 +/api/trades?market=doge_usd&limit=50 +/api/trades?market=doge_tjs&limit=50 +/api/trades?market=dash_bif&limit=50 +/api/trades?market=btx_dash&limit=50 +/api/trades?market=btc_vef&limit=50 +/api/trades?market=btc_ssp&limit=50 +/api/trades?market=btc_mzn&limit=50 +/api/trades?market=pnc_dash&limit=50 +/api/trades?market=part_ltc&limit=50 +/api/trades?market=nah_ltc&limit=50 +/api/trades?market=eth_doge&limit=50 +/api/trades?market=dst_ltc&limit=50 +/api/trades?market=btc_pgk&limit=50 +/api/trades?market=priv_btc&limit=50 +/api/trades?market=crea_btc&limit=50 +/api/trades?market=btc_zmw&limit=50 +/api/trades?market=btc_mkd&limit=50 +/api/trades?market=btc_doge&limit=50 +/api/trades?market=bch_dash&limit=50 +/api/trades?market=btc_jpy&limit=50 +/api/trades?market=btc_htg&limit=50 +/api/trades?market=esp_dash&limit=50 +/api/trades?market=btc_gel&limit=50 +/api/trades?market=ich_btc&limit=50 +/api/trades?market=dash_aoa&limit=50 +/api/trades?market=betr_dash&limit=50 +/api/trades?market=ach_ltc&limit=50 +/api/trades?market=dash_mvr&limit=50 +/api/trades?market=dash_uyu&limit=50 +/api/trades?market=aqua_dash&limit=50 +/api/trades?market=dash_shp&limit=50 +/api/trades?market=dash_nzd&limit=50 +/api/trades?market=dash_lyd&limit=50 +/api/trades?market=btc_uzs&limit=50 +/api/trades?market=doge_ugx&limit=50 +/api/trades?market=dash_tmt&limit=50 +/api/trades?market=dash_ron&limit=50 +/api/trades?market=dash_krw&limit=50 +/api/trades?market=btc_tnd&limit=50 +/api/trades?market=btc_rwf&limit=50 +/api/trades?market=doge_ltc&limit=50 +/api/trades?market=dash_gyd&limit=50 +/api/trades?market=dash_eur&limit=50 +/api/trades?market=btc_zar&limit=50 +/api/trades?market=btc_srd&limit=50 +/api/trades?market=gbyte_btc&limit=50 +/api/trades?market=dst_dash&limit=50 +/api/trades?market=doge_kpw&limit=50 +/api/trades?market=dash_yer&limit=50 +/api/trades?market=dash_irr&limit=50 +/api/trades?market=dash_cve&limit=50 +/api/trades?market=cage_doge&limit=50 +/api/trades?market=btc_myr&limit=50 +/api/trades?market=doge_thb&limit=50 +/api/trades?market=doge_qar&limit=50 +/api/trades?market=doge_amd&limit=50 +/api/trades?market=dash_byn&limit=50 +/api/trades?market=btc_kzt&limit=50 +/api/trades?market=veil_btc&limit=50 +/api/trades?market=doge_xof&limit=50 +/api/trades?market=doge_sgd&limit=50 +/api/trades?market=doge_mur&limit=50 +/api/trades?market=btx_btc&limit=50 +/api/trades?market=btc_mga&limit=50 +/api/trades?market=doge_iqd&limit=50 +/api/trades?market=dmc_doge&limit=50 +/api/trades?market=dct_doge&limit=50 +/api/trades?market=doge_npr&limit=50 +/api/trades?market=dash_bhd&limit=50 +/api/trades?market=dash_ang&limit=50 +/api/trades?market=btc_pen&limit=50 +/api/trades?market=dai_btc&limit=50 +/api/trades?market=btc_dkk&limit=50 +/api/trades?market=ref_ltc&limit=50 +/api/trades?market=qwark_dash&limit=50 +/api/trades?market=ltc_czk&limit=50 +/api/trades?market=esp_btc&limit=50 +/api/trades?market=doge_gtq&limit=50 +/api/trades?market=doge_bgn&limit=50 +/api/trades?market=btc_jod&limit=50 +/api/trades?market=btc_chf&limit=50 +/api/trades?market=xspec_dash&limit=50 +/api/trades?market=ubq_ltc&limit=50 +/api/trades?market=steem_dash&limit=50 +/api/trades?market=hlm_btc&limit=50 +/api/trades?market=eth_dash&limit=50 +/api/trades?market=sf_ltc&limit=50 +/api/trades?market=mqx_btc&limit=50 +/api/trades?market=ltc_uzs&limit=50 +/api/trades?market=ltc_sll&limit=50 +/api/trades?market=ltc_omr&limit=50 +/api/trades?market=ltc_bif&limit=50 +/api/trades?market=doge_bwp&limit=50 +/api/trades?market=btc_bnd&limit=50 +/api/trades?market=part_doge&limit=50 +/api/trades?market=ltc_zar&limit=50 +/api/trades?market=ltc_tnd&limit=50 +/api/trades?market=ltc_eur&limit=50 +/api/trades?market=grans_ltc&limit=50 +/api/trades?market=doge_etb&limit=50 +/api/trades?market=crds_btc&limit=50 +/api/trades?market=btc_gbp&limit=50 +/api/trades?market=ltc_mwk&limit=50 +/api/trades?market=ltc_aoa&limit=50 +/api/trades?market=btc_hrk&limit=50 +/api/trades?market=ytn_btc&limit=50 +/api/trades?market=sem_btc&limit=50 +/api/trades?market=ppi_ltc&limit=50 +/api/trades?market=nah_dash&limit=50 +/api/trades?market=mdc_btc&limit=50 +/api/trades?market=ltc_rsd&limit=50 +/api/trades?market=ltc_mad&limit=50 +/api/trades?market=ltc_krw&limit=50 +/api/trades?market=ltc_irr&limit=50 +/api/trades?market=ltc_gyd&limit=50 +/api/trades?market=doge_cup&limit=50 +/api/trades?market=btc_aud&limit=50 +/api/trades?market=xin_dash&limit=50 +/api/trades?market=wild_doge&limit=50 +/api/trades?market=tmc_ltc&limit=50 +/api/trades?market=nbt_ltc&limit=50 +/api/trades?market=ltc_bzd&limit=50 +/api/trades?market=lobs_btc&limit=50 +/api/trades?market=iop_dash&limit=50 +/api/trades?market=btcc_btc&limit=50 +/api/trades?market=nxt_ltc&limit=50 +/api/trades?market=zen_doge&limit=50 +/api/trades?market=mask_btc&limit=50 +/api/trades?market=kuma_ltc&limit=50 +/api/trades?market=rto_ltc&limit=50 +/api/trades?market=phr_btc&limit=50 +/api/trades?market=xcn_dash&limit=50 +/api/trades?market=nim_ltc&limit=50 +/api/trades?market=bch_btc&limit=50 +/api/trades?market=pnc_btc&limit=50 +/api/trades?market=aqua_btc&limit=50 +/api/trades?market=ach_dash&limit=50 +/api/trades?market=dash_myr&limit=50 +/api/trades?market=dash_jod&limit=50 +/api/trades?market=dash_mga&limit=50 +/api/trades?market=dash_hrk&limit=50 +/api/trades?market=burst_btc&limit=50 +/api/trades?market=xuez_btc&limit=50 +/api/trades?market=trc_doge&limit=50 +/api/trades?market=stl_btc&limit=50 +/api/trades?market=ltc_jod&limit=50 +/api/trades?market=btdx_btc&limit=50 +/api/trades?market=btc_vuv&limit=50 +/api/trades?market=zny_btc&limit=50 +/api/trades?market=wmcc_dash&limit=50 +/api/trades?market=doge_mxn&limit=50 +/api/trades?market=dnet_btc&limit=50 +/api/trades?market=dash_ssp&limit=50 +/api/trades?market=xcp_btc&limit=50 +/api/trades?market=wac_dash&limit=50 +/api/trades?market=doge_pab&limit=50 +/api/trades?market=doge_mdl&limit=50 +/api/trades?market=doge_kyd&limit=50 +/api/trades?market=sib_doge&limit=50 +/api/trades?market=ltc_hrk&limit=50 +/api/trades?market=dash_gbp&limit=50 +/api/trades?market=darx_btc&limit=50 +/api/trades?market=btc_ttd&limit=50 +/api/trades?market=btc_kgs&limit=50 +/api/trades?market=bch_ltc&limit=50 +/api/trades?market=ade_btc&limit=50 +/api/trades?market=zec_btc&limit=50 +/api/trades?market=uno_dash&limit=50 +/api/trades?market=sfsc_btc&limit=50 +/api/trades?market=scs_btc&limit=50 +/api/trades?market=pink_btc&limit=50 +/api/trades?market=doge_sos&limit=50 +/api/trades?market=doge_hnl&limit=50 +/api/trades?market=doge_bmd&limit=50 +/api/trades?market=dash_kzt&limit=50 +/api/trades?market=btc_idr&limit=50 +/api/trades?market=xmr_btc&limit=50 +/api/trades?market=doge_jmd&limit=50 +/api/trades?market=doge_fkp&limit=50 +/api/trades?market=dash_zwl&limit=50 +/api/trades?market=dash_vnd&limit=50 +/api/trades?market=dash_try&limit=50 +/api/trades?market=dash_rwf&limit=50 +/api/trades?market=dash_pen&limit=50 +/api/trades?market=dash_dkk&limit=50 +/api/trades?market=dash_cdf&limit=50 +/api/trades?market=cdt_btc&limit=50 +/api/trades?market=btc_scr&limit=50 +/api/trades?market=btc_pkr&limit=50 +/api/trades?market=btc_ngn&limit=50 +/api/trades?market=arq_btc&limit=50 +/api/trades?market=rads_btc&limit=50 +/api/trades?market=ltz_btc&limit=50 +/api/trades?market=ltc_kzt&limit=50 +/api/trades?market=exc_btc&limit=50 +/api/trades?market=doge_tnd&limit=50 +/api/trades?market=doge_rub&limit=50 +/api/trades?market=doge_cad&limit=50 +/api/trades?market=dash_bnd&limit=50 +/api/trades?market=btc_dzd&limit=50 +/api/trades?market=mdc_ltc&limit=50 +/api/trades?market=ltc_sar&limit=50 +/api/trades?market=crea_ltc&limit=50 +/api/trades?market=btc_stn&limit=50 +/api/trades?market=btc_gip&limit=50 +/api/trades?market=rin_ltc&limit=50 +/api/trades?market=ltc_vuv&limit=50 +/api/trades?market=esp_ltc&limit=50 +/api/trades?market=dvc_dash&limit=50 +/api/trades?market=doge_ars&limit=50 +/api/trades?market=dgm_dash&limit=50 +/api/trades?market=pxl_btc&limit=50 +/api/trades?market=pasc_dash&limit=50 +/api/trades?market=mt_doge&limit=50 +/api/trades?market=ltc_pgk&limit=50 +/api/trades?market=ltc_mkd&limit=50 +/api/trades?market=grc_doge&limit=50 +/api/trades?market=doge_dash&limit=50 +/api/trades?market=btc_mnt&limit=50 +/api/trades?market=btc_lkr&limit=50 +/api/trades?market=nav_btc&limit=50 +/api/trades?market=maza_dash&limit=50 +/api/trades?market=ltc_gbp&limit=50 +/api/trades?market=doge_uzs&limit=50 +/api/trades?market=btc_bam&limit=50 +/api/trades?market=pnc_ltc&limit=50 +/api/trades?market=ltc_mzn&limit=50 +/api/trades?market=ltc_dkk&limit=50 +/api/trades?market=ltc_chf&limit=50 +/api/trades?market=doge_zar&limit=50 +/api/trades?market=btc_cop&limit=50 +/api/trades?market=btc_bsd&limit=50 +/api/trades?market=btc_aed&limit=50 +/api/trades?market=ltc_ttd&limit=50 +/api/trades?market=ltc_std&limit=50 +/api/trades?market=ird_btc&limit=50 +/api/trades?market=ich_ltc&limit=50 +/api/trades?market=gbyte_ltc&limit=50 +/api/trades?market=dash_aud&limit=50 +/api/trades?market=odn_ltc&limit=50 +/api/trades?market=xin_btc&limit=50 +/api/trades?market=neet_ltc&limit=50 +/api/trades?market=ltc_bob&limit=50 +/api/trades?market=ltc_awg&limit=50 +/api/trades?market=lsk_doge&limit=50 +/api/trades?market=lbc_doge&limit=50 +/api/trades?market=nmc_doge&limit=50 +/api/trades?market=dash_npr&limit=50 +/api/trades?market=dash_mur&limit=50 +/api/trades?market=dash_iqd&limit=50 +/api/trades?market=ltc_tmt&limit=50 +/api/trades?market=sf_doge&limit=50 +/api/trades?market=ltc_uyu&limit=50 +/api/trades?market=doge_sek&limit=50 +/api/trades?market=dash_sgd&limit=50 +/api/trades?market=ltc_shp&limit=50 +/api/trades?market=ltc_ron&limit=50 +/api/trades?market=doge_all&limit=50 +/api/trades?market=dmc_dash&limit=50 +/api/trades?market=dct_dash&limit=50 +/api/trades?market=dash_qar&limit=50 +/api/trades?market=dash_kpw&limit=50 +/api/trades?market=vdn_ltc&limit=50 +/api/trades?market=steem_btc&limit=50 +/api/trades?market=nbt_doge&limit=50 +/api/trades?market=mox_btc&limit=50 +/api/trades?market=mai_btc&limit=50 +/api/trades?market=ltc_nzd&limit=50 +/api/trades?market=ltc_kpw&limit=50 +/api/trades?market=ltc_etb&limit=50 +/api/trades?market=like_btc&limit=50 +/api/trades?market=doge_uah&limit=50 +/api/trades?market=doge_lsl&limit=50 +/api/trades?market=doge_kmf&limit=50 +/api/trades?market=dash_xpf&limit=50 +/api/trades?market=dash_cup&limit=50 +/api/trades?market=xcn_btc&limit=50 +/api/trades?market=wild_dash&limit=50 +/api/trades?market=nxt_doge&limit=50 +/api/trades?market=ltc_yer&limit=50 +/api/trades?market=ltc_mvr&limit=50 +/api/trades?market=ltc_gtq&limit=50 +/api/trades?market=kuma_dash&limit=50 +/api/trades?market=doge_szl&limit=50 +/api/trades?market=doge_pyg&limit=50 +/api/trades?market=doge_nok&limit=50 +/api/trades?market=doge_gnf&limit=50 +/api/trades?market=doge_btn&limit=50 +/api/trades?market=doge_bdt&limit=50 +/api/trades?market=dash_usd&limit=50 +/api/trades?market=dash_gtq&limit=50 +/api/trades?market=xspec_btc&limit=50 +/api/trades?market=sc_ltc&limit=50 +/api/trades?market=rto_dash&limit=50 +/api/trades?market=nim_dash&limit=50 +/api/trades?market=ltc_ang&limit=50 +/api/trades?market=doge_mro&limit=50 +/api/trades?market=doge_inr&limit=50 +/api/trades?market=dash_tjs&limit=50 +/api/trades?market=dash_ltc&limit=50 +/api/trades?market=tmc_dash&limit=50 +/api/trades?market=part_dash&limit=50 +/api/trades?market=ltc_lyd&limit=50 +/api/trades?market=ltc_cve&limit=50 +/api/trades?market=ltc_bhd&limit=50 +/api/trades?market=doge_xcd&limit=50 +/api/trades?market=doge_ern&limit=50 +/api/trades?market=doge_crc&limit=50 +/api/trades?market=dash_etb&limit=50 +/api/trades?market=ubq_dash&limit=50 +/api/trades?market=qwark_btc&limit=50 +/api/trades?market=pepecash_ltc&limit=50 +/api/trades?market=nah_btc&limit=50 +/api/trades?market=dac_btc&limit=50 +/api/trades?market=btc_uyu&limit=50 +/api/trades?market=btc_tmt&limit=50 +/api/trades?market=ref_dash&limit=50 +/api/trades?market=mcc_btc&limit=50 +/api/trades?market=ltc_iqd&limit=50 +/api/trades?market=ltc_byn&limit=50 +/api/trades?market=iop_btc&limit=50 +/api/trades?market=dash_amd&limit=50 +/api/trades?market=btc_yer&limit=50 +/api/trades?market=hatch_btc&limit=50 +/api/trades?market=dash_bwp&limit=50 +/api/trades?market=dash_bgn&limit=50 +/api/trades?market=cage_dash&limit=50 +/api/trades?market=btc_mxn&limit=50 +/api/trades?market=btc_djf&limit=50 +/api/trades?market=zen_dash&limit=50 +/api/trades?market=ppi_dash&limit=50 +/api/trades?market=gali_btc&limit=50 +/api/trades?market=btc_rub&limit=50 +/api/trades?market=btc_pab&limit=50 +/api/trades?market=btc_mdl&limit=50 +/api/trades?market=dst_btc&limit=50 +/api/trades?market=crcl_btc&limit=50 +/api/trades?market=btc_sos&limit=50 +/api/trades?market=btc_hnl&limit=50 +/api/trades?market=btc_cdf&limit=50 +/api/trades?market=xzc_ltc&limit=50 +/api/trades?market=eth_btc&limit=50 +/api/trades?market=ella_ltc&limit=50 +/api/trades?market=btm_btc&limit=50 +/api/trades?market=btc_kyd&limit=50 +/api/trades?market=btc_jmd&limit=50 +/api/trades?market=btc_fkp&limit=50 +/api/trades?market=btc_bmd&limit=50 +/api/trades?market=grans_dash&limit=50 +/api/trades?market=ple_btc&limit=50 +/api/trades?market=btc_ars&limit=50 +/api/trades?market=bchc_ltc&limit=50 +/api/trades?market=amit_btc&limit=50 +/api/trades?market=ach_btc&limit=50 +/api/trades?market=bsq_btc&limit=50 +/api/offers?market=ltc_btc +/api/offers?market=doge_btc +/api/offers?market=etc_btc +/api/offers?market=zec_btc +/api/offers?market=btc_cad +/api/offers?market=dcr_btc +/api/offers?market=xcp_btc +/api/offers?market=btc_pln +/api/offers?market=dash_btc +/api/offers?market=pivx_btc +/api/offers?market=grin_btc +/api/offers?market=nav_btc +/api/offers?market=zen_btc +/api/offers?market=xzc_btc +/api/offers?market=beam_btc +/api/offers?market=btc_rub +/api/offers?market=btc_cny +/api/offers?market=btc_jpy +/api/offers?market=btc_inr +/api/offers?market=btc_mxn +/api/offers?market=btc_thb +/api/offers?market=btc_chf +/api/offers?market=xspec_btc +/api/offers?market=uno_btc +/api/offers?market=croat_btc +/api/offers?market=dai_btc +/api/offers?market=cha_btc +/api/offers?market=trtl_btc +/api/offers?market=sf_btc +/api/offers?market=scp_btc +/api/offers?market=doi_btc +/api/offers?market=gbyte_btc +/api/offers?market=dxo_btc +/api/offers?market=hatch_btc +/api/offers?market=rads_btc +/api/offers?market=neos_btc +/api/offers?market=drgl_btc +/api/offers?market=ltz_btc +/api/offers?market=onion_btc +/api/offers?market=nmc_btc +/api/offers?market=btc_dkk +/api/offers?market=xrc_btc +/api/offers?market=sc_ltc +/api/offers?market=sc_btc +/api/offers?market=lsk_btc +/api/offers?market=xmr_ltc +/api/offers?market=cash2_btc +/api/offers?market=btm_btc +/api/offers?market=ltc_eur +/api/offers?market=btc_zar +/api/offers?market=btc_vuv +/api/offers?market=blur_btc +/api/offers?market=btc_ron +/api/offers?market=btc_vnd +/api/offers?market=btc_sek +/api/offers?market=ask_btc +/api/offers?market=aeon_btc +/api/offers?market=btc_ars +/api/offers?market=aus_btc +/api/offers?market=aeur_btc +/api/offers?market=btc_ngn +/api/offers?market=btc_php +/api/offers?market=btc_myr +/api/offers?market=btc_pgk +/api/offers?market=btc_nok +/api/offers?market=btc_bhd +/api/offers?market=btc_nzd +/api/offers?market=btc_omr +/api/offers?market=btc_huf +/api/offers?market=btc_ghs +/api/offers?market=btc_czk +/api/offers?market=btc_crc +/api/offers?market=btc_khr +/api/offers?market=btc_clp +/api/offers?market=btc_hkd +/api/offers?market=btc_ils +/api/offers?market=btc_gel +/api/offers?market=btc_ltc +/api/trades/?market=nxt_btc +/api/trades/?market=nav_btc +/api/trades/?market=ltz_btc +/api/trades/?market=dai_btc +/api/trades/?market=xrc_btc +/api/trades/?market=pivx_btc +/api/trades/?market=kek_btc +/api/trades/?market=btc_sek +/api/trades/?market=btc_czk +/api/trades/?market=zen_btc +/api/trades/?market=btc_dash +/api/trades/?market=btc_bhd +/api/trades/?market=mue_btc +/api/trades/?market=btc_khr +/api/trades/?market=btc_cad +/api/trades/?market=btc_aud +/api/trades/?market=xzc_btc +/api/trades/?market=usdc_btc +/api/trades/?market=dash_eur +/api/trades/?market=btc_cve +/api/trades/?market=btc_all +/api/trades/?market=onion_btc +/api/trades/?market=lcp_btc +/api/trades/?market=btc_kpw +/api/trades/?market=btc_brl +/api/trades/?market=xspec_btc +/api/trades/?market=btc_zar +/api/trades/?market=zer_btc +/api/trades/?market=btm_btc +/api/trades/?market=btc_jmd +/api/trades/?market=btc_gmd +/api/trades/?market=btc_fkp +/api/trades/?market=btc_djf +/api/trades/?market=btc_cop +/api/trades/?market=btc_bzd +/api/trades/?market=btc_gip +/api/trades/?market=btc_gbp +/api/trades/?market=btc_crc +/api/trades/?market=doge_btc +/api/trades/?market=dash_gbp +/api/trades/?market=crds_btc +/api/trades/?market=btc_usd +/api/trades/?market=btc_dop +/api/trades/?market=btc_bmd +/api/trades/?market=beam_btc +/api/trades/?market=arq_btc +/api/trades/?market=zec_btc +/api/trades/?market=post_btc +/api/trades/?market=ltc_eur +/api/trades/?market=btc_iqd +/api/trades/?market=btc_etb +/api/trades/?market=btc_aed +/api/trades/?market=uno_btc +/api/trades/?market=rads_btc +/api/trades/?market=grc_btc +/api/trades/?market=etc_btc +/api/trades/?market=btc_yer +/api/trades/?market=btc_vnd +/api/trades/?market=btc_jpy +/api/trades/?market=btc_jod +/api/trades/?market=btc_gtq +/api/trades/?market=btc_egp +/api/trades/?market=xcp_btc +/api/trades/?market=uno_doge +/api/trades/?market=tusd_btc +/api/trades/?market=trtl_btc +/api/trades/?market=croat_btc +/api/trades/?market=btc_isk +/api/trades/?market=acm_btc +/api/trades/?market=btc_mwk +/api/trades/?market=btc_ern +/api/trades/?market=btc_dkk +/api/trades/?market=btc_chf +/api/trades/?market=btc_bnd +/api/trades/?market=hlm_btc +/api/trades/?market=gmcn_btc +/api/trades/?market=fjc_btc +/api/trades/?market=btc_fjd +/api/trades/?market=btc_bam +/api/trades/?market=gali_btc +/api/trades/?market=btc_krw +/api/trades/?market=qwc_btc +/api/trades/?market=pepecash_btc +/api/trades/?market=pasc_btc +/api/trades/?market=lsk_btc +/api/trades/?market=btc_pab +/api/trades/?market=btc_mvr +/api/trades/?market=btc_dzd +/api/trades/?market=btc_cup +/api/trades/?market=btc_bwp +/api/trades/?market=aeon_btc +/api/trades/?market=web_btc +/api/trades/?market=uno_dash +/api/trades/?market=space_btc +/api/trades/?market=pink_btc +/api/trades/?market=neos_btc +/api/trades/?market=lbc_btc +/api/trades/?market=btc_xpf +/api/trades/?market=btc_wst +/api/trades/?market=btc_pen +/api/trades/?market=btc_lsl +/api/trades/?market=btc_kwd +/api/trades/?market=btc_hnl +/api/trades/?market=btc_bbd +/api/trades/?market=pnc_ltc +/api/trades/?market=grin_btc +/api/trades/?market=gbyte_btc +/api/trades/?market=btc_pgk +/api/trades/?market=btc_nad +/api/trades/?market=btc_lkr +/api/trades/?market=btc_kmf +/api/trades/?market=btc_hrk +/api/trades/?market=btc_eur +/api/trades/?market=btc_cny +/api/trades/?market=btc_bif +/api/trades/?market=btc_bgn +/api/trades/?market=btc_ang +/api/trades/?market=sib_btc +/api/trades/?market=ltc_dash +/api/trades/?market=darx_btc +/api/trades/?market=btc_vuv +/api/trades/?market=btc_tnd +/api/trades/?market=btc_nzd +/api/trades/?market=btc_mkd +/api/trades/?market=btc_ils +/api/trades/?market=btc_gnf +/api/trades/?market=btc_awg +/api/trades/?market=zel_btc +/api/trades/?market=ryo_btc +/api/trades/?market=btc_ttd +/api/trades/?market=btc_sos +/api/trades/?market=btc_pyg +/api/trades/?market=btc_omr +/api/trades/?market=btc_gyd +/api/trades/?market=btc_cdf +/api/trades/?market=uno_ltc +/api/trades/?market=iop_btc +/api/trades/?market=esp_btc +/api/trades/?market=cloak_btc +/api/trades/?market=btc_rwf +/api/trades/?market=btc_myr +/api/trades/?market=btc_mxn +/api/trades/?market=btc_mur +/api/trades/?market=btc_mad +/api/trades/?market=btc_ltc +/api/trades/?market=btc_gel +/api/trades/?market=btc_clp +/api/trades/?market=sdc_btc +/api/trades/?market=btc_npr +/api/trades/?market=btc_ngn +/api/trades/?market=btc_mro +/api/trades/?market=btc_lyd +/api/trades/?market=btc_lrd +/api/trades/?market=btc_kes +/api/trades/?market=btc_huf +/api/trades/?market=btc_htg +/api/trades/?market=nmc_btc +/api/trades/?market=btc_rub +/api/trades/?market=btc_pkr +/api/trades/?market=nbt_btc +/api/trades/?market=btc_try +/api/trades/?market=btc_sar +/api/trades/?market=btc_lbp +/api/trades/?market=btc_irr +/api/trades/?market=steem_btc +/api/trades/?market=rdd_btc +/api/trades/?market=btc_uah +/api/trades/?market=btc_tzs +/api/trades/?market=btc_php +/api/trades/?market=btc_mop +/api/trades/?market=lytx_btc +/api/trades/?market=btc_idr +/api/trades/?market=btc_hkd +/api/trades/?market=burst_btc +/api/trades/?market=btc_xof +/api/trades/?market=btc_svc +/api/trades/?market=btc_sgd +/api/trades/?market=btc_scr +/api/trades/?market=btc_qar +/api/trades/?market=btc_mdl +/api/trades/?market=btc_lak +/api/trades/?market=btc_kzt +/api/trades/?market=btc_kgs +/api/trades/?market=btc_amd +/api/trades/?market=dash_btc +/api/trades/?market=btc_uzs +/api/trades/?market=btc_twd +/api/trades/?market=btc_nok +/api/trades/?market=btc_mmk +/api/trades/?market=xmr_btc +/api/trades/?market=eth_btc +/api/trades/?market=btc_xaf +/api/trades/?market=btc_uyu +/api/trades/?market=btc_thb +/api/trades/?market=btc_mnt +/api/trades/?market=sc_btc +/api/trades/?market=btc_szl +/api/trades/?market=mt_btc +/api/trades/?market=btc_sll +/api/trades/?market=maid_btc +/api/trades/?market=ltc_btc +/api/trades/?market=btc_pln +/api/trades/?market=btc_syp +/api/trades/?market=dcr_btc +/api/trades/?market=btc_ugx +/api/ticker?market=sf_btc +/api/ticker?market=dxo_btc +/api/ticker?market=beam_btc +/api/ticker?market=gali_btc +/api/trades?market=btc_aud×tamp_from=1570621637 +/api/offers?market=wmcc_btc +/api/offers?market=xcn_ltc +/api/offers?market=steem_btc +/api/offers?market=wavi_btc +/api/offers?market=trc_btc +/api/offers?market=cnmc_btc +/api/offers?market=sib_btc +/api/offers?market=dac_btc +/api/offers?market=dash_eur +/api/offers?market=dash_gbp +/api/offers?market=sfsc_btc +/api/offers?market=crea_btc +/api/offers?market=sem_btc +/api/offers?market=rin_btc +/api/offers?market=rdd_btc +/api/offers?market=dmc_btc +/api/offers?market=dmd_btc +/api/offers?market=dnet_btc +/api/offers?market=ppi_btc +/api/offers?market=pnc_ltc +/api/offers?market=esp_btc +/api/offers?market=ella_btc +/api/offers?market=grc_btc +/api/offers?market=odn_btc +/api/offers?market=pepecash_btc +/api/offers?market=ltc_dash +/api/offers?market=pnc_btc +/api/offers?market=iop_btc +/api/offers?market=koto_btc +/api/offers?market=mt_btc +/api/offers?market=lbc_btc +/api/offers?market=pasc_btc +/api/offers?market=maza_btc +/api/offers?market=post_btc +/api/offers?market=nxt_btc +/api/offers?market=nbt_btc +/api/offers?market=maid_btc +/api/offers?market=xuez_btc +/api/offers?market=zoc_btc +/api/offers?market=burst_btc +/api/offers?market=btg_btc +/api/offers?market=ach_btc +/api/offers?market=aqua_btc +/api/offers?market=bch_btc +/api/offers?market=btc_dash +/api/offers?market=bchc_btc +/api/ticker?market=eth_btc +/api/trades?market=btc_aud×tamp_from=1570859040 +/api/ticker?market=btc_jpy +/api/trades?market=btc_aud×tamp_from=1570702704 +/api/offers?market=usdc_btc +/api/offers?market=tusd_btc +/api/trades?market=btc_aud×tamp_from=1570751414 +/api/trades?market=btc_eur×tamp_from=1570992437 +/api/ticker?market=btc_inr +/api/trades?market=btc_eur×tamp_from=1570647371 +/api/ticker?market=btc_gbp +/api/ticker?market=btc_mkd +/api/ticker?market=btc_kzt +/api/ticker?market=btc_lsl +/api/ticker?market=btc_gnf +/api/ticker?market=btc_mur +/api/ticker?market=btc_ern +/api/ticker?market=nmc_btc +/api/ticker?market=btc_pgk +/api/ticker?market=btc_kmf +/api/ticker?market=btc_jod +/api/ticker?market=btc_hrk +/api/ticker?market=drgl_btc +/api/ticker?market=darx_btc +/api/ticker?market=qwc_btc +/api/ticker?market=ple_btc +/api/ticker?market=btc_thb +/api/ticker?market=btc_ssp +/api/ticker?market=btc_sgd +/api/ticker?market=btc_npr +/api/ticker?market=btc_bam +/api/ticker?market=btc_zwl +/api/ticker?market=btc_mzn +/api/ticker?market=lytx_btc +/api/ticker?market=cloak_btc +/api/ticker?market=btc_sar +/api/ticker?market=btc_cad +/api/ticker?market=btc_bsd +/api/ticker?market=btc_djf +/api/ticker?market=mox_btc +/api/ticker?market=btc_vnd +/api/ticker?market=btc_qar +/api/ticker?market=btc_ugx +/api/ticker?market=btc_bif +/api/ticker?market=ask_btc +/api/ticker?market=btc_cop +/api/ticker?market=ade_btc +/api/ticker?market=btc_try +/api/ticker?market=eths_btc +/api/ticker?market=btc_aoa +/api/ticker?market=xrc_btc +/api/ticker?market=ird_btc +/api/ticker?market=gmcn_btc +/api/ticker?market=web_btc +/api/ticker?market=btc_xof +/api/ticker?market=ucc_btc +/api/ticker?market=btc_aed +/api/offers?market=btc_krw +/api/ticker?market=dcr_btc +/api/ticker?market=aeur_btc +/api/ticker?market=btc_mad +/api/ticker?market=btc_bwp +/api/ticker?market=usdc_btc +/api/ticker?market=bzc_btc +/api/ticker?market=btc_mwk +/api/ticker?market=btc_mnt +/api/ticker?market=sub1x_btc +/api/ticker?market=btc_eur +/api/ticker?market=xcp_btc +/api/ticker?market=rmx_btc +/api/ticker?market=crds_btc +/api/ticker?market=btc_lbp +/api/ticker?market=mue_btc +/api/ticker?market=btc_wst +/api/ticker?market=btc_chf +/api/ticker?market=onion_btc +/api/ticker?market=btc_yer +/api/ticker?market=btc_sll +/api/ticker?market=btc_all +/api/ticker?market=pzdc_btc +/api/ticker?market=btc_bnd +/api/ticker?market=btc_bdt +/api/ticker?market=xzc_btc +/api/ticker?market=lcp_btc +/api/ticker?market=btc_svc +/api/ticker?market=btc_ngn +/api/ticker?market=btc_krw +/api/ticker?market=btc_dop +/api/ticker?market=btc_aud +/api/ticker?market=mask_btc +/api/ticker?market=hatch_btc +/api/ticker?market=btc_uyu +/api/ticker?market=btc_twd +/api/ticker?market=frty_btc +/api/ticker?market=btc_mxn +/api/ticker?market=btc_tmt +/api/ticker?market=btc_ghs +/api/ticker?market=btc_omr +/api/ticker?market=btc_uzs +/api/ticker?market=btc_kes +/api/ticker?market=btc_cup +/api/ticker?market=btc_zar +/api/ticker?market=btc_xaf +/api/ticker?market=btc_nio +/api/ticker?market=btc_tzs +/api/ticker?market=btc_tnd +/api/ticker?market=btc_scr +/api/ticker?market=btc_mop +/api/ticker?market=btc_mdl +/api/ticker?market=btc_lkr +/api/ticker?market=btc_gyd +/api/ticker?market=btc_pln +/api/ticker?market=btc_irr +/api/ticker?market=btc_huf +/api/ticker?market=btc_byn +/api/ticker?market=btc_bob +/api/ticker?market=btc_bgn +/api/ticker?market=cash2_btc +/api/ticker?market=btc_pab +/api/ticker?market=btc_gip +/api/ticker?market=btc_rsd +/api/ticker?market=btc_kwd +/api/ticker?market=btc_kgs +/api/ticker?market=btc_fjd +/api/ticker?market=btc_isk +/api/ticker?market=btc_idr +/api/ticker?market=btc_hkd +/api/ticker?market=croat_btc +/api/ticker?market=btc_pkr +/api/ticker?market=btc_clp +/api/ticker?market=blur_btc +/api/ticker?market=btc_syp +/api/ticker?market=btc_rub +/api/ticker?market=btc_dzd +/api/ticker?market=btc_cve +/api/ticker?market=btc_sos +/api/ticker?market=btc_awg +/api/ticker?market=btc_amd +/api/ticker?market=amit_btc +/api/ticker?market=trtl_btc +/api/ticker?market=ryo_btc +/api/ticker?market=btc_sdg +/api/ticker?market=ltc_btc +/api/ticker?market=qbs_btc +/api/ticker?market=nav_btc +/api/ticker?market=mbgl_btc +/api/ticker?market=doge_btc +/api/ticker?market=etc_btc +/api/ticker?market=pink_btc +/api/offers/?market=croat_btc +/api/ticker?market=zec_btc +/api/ticker?market=hlm_btc +/api/ticker?market=xdr0_btc +/api/ticker?market=veil_btc +/api/offers/?market=btc_gbp +/api/offers/?market=btc_crc +/api/offers/?market=aus_btc +/api/offers/?market=btc_thb +/api/offers/?market=btc_ron +/api/offers/?market=btc_ars +/api/offers/?market=dxo_btc +/api/offers/?market=btc_pgk +/api/ticker?market=uno_btc +/api/offers/?market=btc_myr +/api/offers/?market=dash_btc +/api/offers/?market=btc_czk +/api/offers/?market=btc_sek +/api/offers/?market=neos_btc +/api/trades?market=btc_usd×tamp_from=1570947126 +/api/ticker?market=btc_nzd +/api/ticker?market=btc_nad +/api/ticker?market=btc_crc +/api/ticker?market=rads_btc +/api/ticker?market=btc_php +/api/ticker?market=btc_ars +/api/offers/?market=ltc_btc +/api/ticker?market=btc_mvr +/api/ticker?market=btc_cdf +/api/ticker?market=aus_btc +/api/ticker?market=aeon_btc +/api/ticker?market=btc_kpw +/api/ticker?market=btc_btn +/api/ticker?market=btc_ron +/api/ticker?market=btc_mmk +/api/ticker?market=btc_bmd +/api/ticker?market=btc_lak +/api/ticker?market=xspec_btc +/api/ticker?market=btc_ttd +/api/ticker?market=btc_tjs +/api/ticker?market=prsn_btc +/api/ticker?market=nor_btc +/api/ticker?market=btc_stn +/api/ticker?market=btc_dkk +/api/ticker?market=wrkz_btc +/api/ticker?market=btc_afn +/api/ticker?market=zer_btc +/api/ticker?market=grin_btc +/api/ticker?market=btc_lyd +/api/ticker?market=btc_xpf +/api/ticker?market=btc_vuv +/api/ticker?market=mqx_btc +/api/ticker?market=kek_btc +/api/ticker?market=btc_shp +/api/ticker?market=btc_sbd +/api/ticker?market=btc_iqd +/api/offers/?market=hatch_btc +/api/ticker?market=mai_btc +/api/ticker?market=btc_bbd +/api/ticker?market=space_btc +/api/ticker?market=btm_btc +/api/ticker?market=btc_etb +/api/ticker?market=btc_htg +/api/ticker?market=btc_gel +/api/ticker?market=crcl_btc +/api/offers/?market=btc_nok +/api/ticker?market=dash_btc +/api/ticker?market=fjc_btc +/api/ticker?market=btc_gtq +/api/offers/?market=btc_huf +/api/ticker?market=dst_btc +/api/offers/?market=scp_btc +/api/offers/?market=trtl_btc +/api/offers/?market=doge_btc +/api/trades?market=xmr_btc&limit=10 +/api/offers/?market=btc_omr +/api/offers/?market=btc_vuv +/api/offers/?market=xrc_btc +/api/offers/?market=uno_btc +/api/offers/?market=btc_nzd +/api/offers/?market=aeon_btc +/api/offers/?market=dai_btc +/api/offers/?market=zec_btc +/api/offers/?market=btc_clp +/api/offers/?market=btc_usd +/api/offers/?market=btc_rub +/api/offers/?market=xzc_btc +/api/offers/?market=btc_mxn +/api/ticker?market=btc_azn +/api/ticker?market=btc_ang +/api/offers/?market=etc_btc +/api/ticker?market=btc_bhd +/api/ticker?market=bsq_btc +/api/offers/?market=btc_gel +/api/offers/?market=eth_btc +/api/ticker?market=btc_bzd +/api/ticker?market=arq_btc +/api/offers/?market=btc_dkk +/api/offers/?market=btc_cad +/api/ticker?market=btc_myr +/api/ticker?market=btc_cny +/api/ticker?market=cha_btc +/api/ticker?market=btc_czk +/api/ticker?market=xmr_btc +/api/ticker?market=btc_zmw +/api/ticker?market=btc_xcd +/api/ticker?market=btc_mro +/api/ticker?market=btc_ils +/api/offers/?market=rads_btc +/api/ticker?market=btc_hnl +/api/ticker?market=acm_btc +/api/ticker?market=btc_uah +/api/ticker?market=btc_top +/api/ticker?market=btc_sek +/api/ticker?market=btc_mga +/api/ticker?market=btc_gmd +/api/ticker?market=btc_fkp +/api/ticker?market=btc_egp +/api/ticker?market=btc_vef +/api/ticker?market=btc_nok +/api/offers/?market=cha_btc +/api/offers/?market=btc_inr +/api/ticker?market=btc_jmd +/api/ticker?market=neos_btc +/api/ticker?market=btc_szl +/api/ticker?market=btc_srd +/api/ticker?market=btc_rwf +/api/ticker?market=btc_lrd +/api/offers/?market=btc_khr +/api/ticker?market=btc_pyg +/api/ticker?market=dai_btc +/api/ticker?market=zel_btc +/api/offers/?market=btc_brl +/api/ticker?market=vxv_btc +/api/ticker?market=scp_btc +/api/ticker?market=mile_btc +/api/ticker?market=btc_pen +/api/ticker?market=btc_kyd +/api/ticker?market=btc_khr +/api/ticker?market=ltz_btc +/api/offers/?market=xspec_btc +/api/offers/?market=btc_zar +/api/ticker?market=gbyte_btc +/api/offers/?market=xmr_btc +/api/ticker?market=ida_btc +/api/offers/?market=sf_btc +/api/offers/?market=btc_cny +/api/ticker?market=tusd_btc +/api/ticker?market=doi_btc +/api/offers/?market=nav_btc +/api/offers/?market=btc_vnd +/api/ticker?market=pivx_btc +/api/offers/?market=drgl_btc +/api/offers/?market=beam_btc +/api/ticker?market=qmcoin_btc +/api/offers/?market=grin_btc +/api/offers/?market=xcp_btc +/api/offers/?market=btc_ghs +/api/offers/?market=gbyte_btc +/api/offers/?market=btc_php +/api/offers/?market=zen_btc +/api/offers/?market=btc_ils +/api/offers/?market=btm_btc +/api/offers/?market=pivx_btc +/api/offers/?market=nmc_btc +/api/offers/?market=btc_bhd +/api/trades?market=ltc_btc&limit=10 +/api/offers/?market=btc_jpy +/api/offers/?market=btc_aud +/api/offers/?market=btc_ngn +/api/offers/?market=btc_chf +/api/offers/?market=btc_eur +/api/offers/?market=onion_btc +/api/offers/?market=dcr_btc +/api/offers/?market=btc_pln +/api/offers/?market=btc_hkd +/api/trades?market=btc_eur×tamp_from=1570831033 +/api/trades?market=btc_eur×tamp_from=1571088399 +/api/trades?market=btc_aud×tamp_from=1570794660 +/api/trades/?market=btc_eur&limit=1 +/api/hloc?market=drgl_btc +/api/offers/?market=btc_aud&direction=SELL +/api/offers/?market=btc_cad&direction=SELL +/api/offers/?market=btc_usd&direction=SELL +/api/ticker/?market=btc_eur +/api/offers/?market=btc_eur&direction=SELL +/api/ticker?market=zoc_btc +/api/offers/?market=btc_usd&direction=BUY +/api/offers/?market=btc_aud&direction=BUY +/api/offers/?market=btc_nzd&direction=SELL +/api/offers/?market=btc_nzd&direction=BUY +/api/offers/?market=btc_gbp&direction=SELL +/api/offers/?market=btc_cad&direction=BUY +/api/offers/?market=btc_gbp&direction=BUY +/api/offers/?market=btc_eur&direction=BUY +/api/trades?market=btc_usd×tamp_from=1570684037 +/api/trades?market=btc_usd×tamp_from=1570864071 +/api/trades?market=bsq_btc&limit=5000 +/api/trades?market=btc_eur×tamp_from=1570751772 +/api/trades?market=all&format=jsonpretty +/api/trades?market=btc_eur×tamp_from=1570923525 +/api/trades?market=btc_eur×tamp_from=1570895562 +/api/trades?market=btc_usd×tamp_from=1571030942 +/api/offers?market=amit_btc +/api/offers?market=ryo_btc +/api/offers?market=mqx_btc +/api/offers?market=btc_zwl +/api/offers?market=btc_tzs +/api/offers?market=acm_btc +/api/offers?market=kek_btc +/api/offers?market=darx_btc +/api/offers?market=zer_btc +/api/offers?market=btc_all +/api/offers?market=hlm_btc +/api/offers?market=btc_wst +/api/offers?market=btc_twd +/api/offers?market=btc_ttd +/api/offers?market=ida_btc +/api/offers?market=crds_btc +/api/offers?market=bzc_btc +/api/offers?market=btc_zmw +/api/offers?market=btc_xcd +/api/offers?market=btc_xaf +/api/offers?market=btc_uzs +/api/offers?market=btc_amd +/api/offers?market=arq_btc +/api/offers?market=wrkz_btc +/api/offers?market=mue_btc +/api/offers?market=mox_btc +/api/offers?market=lcp_btc +/api/offers?market=ird_btc +/api/offers?market=gmcn_btc +/api/offers?market=btc_try +/api/offers?market=btc_pkr +/api/offers?market=btc_npr +/api/offers?market=ucc_btc +/api/offers?market=prsn_btc +/api/offers?market=lytx_btc +/api/offers?market=gali_btc +/api/offers?market=btc_yer +/api/offers?market=btc_tnd +/api/offers?market=btc_tmt +/api/offers?market=btc_ang +/api/offers?market=sub1x_btc +/api/offers?market=fjc_btc +/api/offers?market=crcl_btc +/api/offers?market=btc_pyg +/api/offers?market=vxv_btc +/api/offers?market=frty_btc +/api/offers?market=btc_xpf +/api/offers?market=btc_syp +/api/offers?market=btc_cdf +/api/offers?market=btc_bam +/api/offers?market=btc_szl +/api/offers?market=btc_bgn +/api/offers?market=rmx_btc +/api/offers?market=mbgl_btc +/api/offers?market=mai_btc +/api/offers?market=dst_btc +/api/offers?market=cloak_btc +/api/offers?market=btc_xof +/api/offers?market=btc_mro +/api/offers?market=btc_bnd +/api/offers?market=btc_bdt +/api/offers?market=ade_btc +/api/offers?market=web_btc +/api/offers?market=veil_btc +/api/offers?market=qwc_btc +/api/offers?market=qbs_btc +/api/offers?market=pink_btc +/api/offers?market=nor_btc +/api/offers?market=mile_btc +/api/offers?market=eths_btc +/api/offers?market=btc_stn +/api/offers?market=btc_srd +/api/offers?market=pzdc_btc +/api/offers?market=btc_vef +/api/offers?market=btc_ugx +/api/offers?market=btc_uah +/api/offers?market=btc_top +/api/offers?market=btc_tjs +/api/offers?market=btc_sos +/api/offers?market=btc_scr +/api/offers?market=btc_mmk +/api/offers?market=btc_bsd +/api/offers?market=space_btc +/api/offers?market=btc_qar +/api/offers?market=btc_kpw +/api/offers?market=btc_bwp +/api/offers?market=btc_bbd +/api/offers?market=btc_awg +/api/trades?market=btc_usd×tamp_from=1570774885 +/api/offers?market=ple_btc +/api/offers?market=btc_shp +/api/offers?market=btc_rwf +/api/offers?market=btc_rsd +/api/offers?market=btc_mnt +/api/offers?market=btc_mkd +/api/offers?market=btc_btn +/api/offers?market=btc_aed +/api/offers?market=qmcoin_btc +/api/offers?market=btc_uyu +/api/offers?market=btc_sll +/api/offers?market=btc_pab +/api/offers?market=btc_bzd +/api/offers?market=btc_afn +/api/offers?market=mask_btc +/api/offers?market=btc_mwk +/api/offers?market=btc_mvr +/api/offers?market=btc_lsl +/api/offers?market=btc_azn +/api/offers?market=xdr0_btc +/api/offers?market=btc_sgd +/api/offers?market=btc_sar +/api/offers?market=btc_nad +/api/offers?market=btc_kwd +/api/offers?market=btc_jmd +/api/offers?market=btc_dzd +/api/offers?market=btc_bmd +/api/offers?market=btc_aoa +/api/offers?market=btc_ssp +/api/offers?market=btc_sbd +/api/offers?market=btc_mur +/api/offers?market=btc_lrd +/api/offers?market=btc_lak +/api/offers?market=btc_irr +/api/offers?market=btc_bob +/api/offers?market=zel_btc +/api/offers?market=btc_nio +/api/offers?market=btc_mzn +/api/offers?market=btc_svc +/api/offers?market=btc_sdg +/api/offers?market=btc_mop +/api/offers?market=btc_fkp +/api/offers?market=btc_egp +/api/offers?market=btc_mdl +/api/offers?market=btc_kgs +/api/offers?market=btc_htg +/api/offers?market=btc_cve +/api/offers?market=btc_lbp +/api/offers?market=btc_jod +/api/offers?market=btc_gip +/api/offers?market=btc_djf +/api/offers?market=btc_btc +/api/offers?market=btc_pen +/api/offers?market=btc_gtq +/api/offers?market=btc_etb +/api/offers?market=btc_lyd +/api/offers?market=btc_kyd +/api/offers?market=btc_kes +/api/offers?market=btc_bif +/api/offers?market=btc_isk +/api/offers?market=btc_gmd +/api/offers?market=btc_cup +/api/offers?market=btc_mga +/api/offers?market=btc_mad +/api/offers?market=btc_lkr +/api/offers?market=btc_kmf +/api/offers?market=btc_gnf +/api/offers?market=btc_dop +/api/offers?market=btc_byn +/api/offers?market=btc_iqd +/api/offers?market=btc_ern +/api/offers?market=btc_kzt +/api/offers?market=btc_gnt +/api/offers?market=btc_idr +/api/offers?market=btc_fjd +/api/offers?market=btc_cop +/api/offers?market=btc_hnl +/api/offers?market=btc_hrk +/api/offers?market=btc_gyd +/api/offers?market=lsk_rub +/api/offers?market=xcp_cad +/api/offers?market=rep_krw +/api/offers?market=rep_btc +/api/offers?market=lsk_usd +/api/offers?market=lsk_gnt +/api/offers?market=lsk_cny +/api/offers?market=xcp_xmr +/api/offers?market=xcp_gbp +/api/offers?market=xcp_cny +/api/offers?market=rep_usd +/api/offers?market=rep_gnt +/api/offers?market=lsk_eur +/api/offers?market=xcp_rub +/api/offers?market=xcp_pln +/api/offers?market=xcp_ltc +/api/offers?market=xcp_jpy +/api/offers?market=rep_pln +/api/offers?market=xcp_eur +/api/offers?market=rep_rub +/api/offers?market=rep_mxn +/api/offers?market=rep_eur +/api/offers?market=rep_eth +/api/offers?market=lsk_gbp +/api/offers?market=xcp_usd +/api/offers?market=lsk_jpy +/api/offers?market=lsk_cad +/api/offers?market=rep_xmr +/api/offers?market=rep_inr +/api/offers?market=rep_gbp +/api/offers?market=doge_usd +/api/offers?market=btc_xmr +/api/offers?market=xcp_mxn +/api/offers?market=xcp_krw +/api/offers?market=rep_jpy +/api/offers?market=rep_cny +/api/offers?market=eth_usd +/api/offers?market=eth_rub +/api/offers?market=eth_eur +/api/offers?market=xcp_inr +/api/offers?market=xcp_gnt +/api/offers?market=xcp_eth +/api/offers?market=rep_ltc +/api/offers?market=rep_cad +/api/offers?market=lsk_inr +/api/offers?market=eth_gnt +/api/offers?market=eth_cny +/api/offers?market=eth_gbp +/api/offers?market=doge_gnt +/api/offers?market=lsk_xmr +/api/offers?market=lsk_mxn +/api/offers?market=etc_usd +/api/offers?market=lsk_ltc +/api/offers?market=etc_gnt +/api/offers?market=xmr_usd +/api/offers?market=eth_cad +/api/offers?market=etc_krw +/api/offers?market=doge_rub +/api/offers?market=doge_cny +/api/offers?market=sc_mxn +/api/offers?market=lsk_pln +/api/offers?market=lsk_eth +/api/offers?market=xmr_gnt +/api/offers?market=lsk_krw +/api/offers?market=doge_inr +/api/offers?market=zec_mxn +/api/offers?market=zec_inr +/api/offers?market=xmr_inr +/api/offers?market=xmr_eth +/api/offers?market=sc_xmr +/api/offers?market=sc_eth +/api/offers?market=etc_eur +/api/offers?market=doge_gbp +/api/offers?market=doge_eur +/api/offers?market=zec_jpy +/api/offers?market=zec_cad +/api/offers?market=xmr_xmr +/api/offers?market=xmr_gbp +/api/offers?market=xmr_cny +/api/offers?market=sc_pln +/api/offers?market=eth_jpy +/api/offers?market=eth_inr +/api/offers?market=etc_rub +/api/offers?market=etc_gbp +/api/offers?market=etc_cny +/api/offers?market=zec_xmr +/api/offers?market=zec_usd +/api/offers?market=zec_eur +/api/offers?market=zec_cny +/api/offers?market=xmr_eur +/api/offers?market=sc_krw +/api/offers?market=sc_jpy +/api/offers?market=sc_cny +/api/offers?market=etc_xmr +/api/offers?market=etc_pln +/api/offers?market=doge_ltc +/api/offers?market=doge_jpy +/api/offers?market=zec_ltc +/api/offers?market=zec_gnt +/api/offers?market=zec_gbp +/api/offers?market=xmr_rub +/api/offers?market=sc_inr +/api/offers?market=sc_eur +/api/offers?market=ltc_usd +/api/offers?market=etc_jpy +/api/offers?market=zec_krw +/api/offers?market=zec_eth +/api/offers?market=xmr_jpy +/api/offers?market=sc_rub +/api/offers?market=etc_mxn +/api/offers?market=etc_ltc +/api/offers?market=etc_cad +/api/offers?market=doge_xmr +/api/offers?market=zec_rub +/api/offers?market=xmr_cad +/api/offers?market=sc_usd +/api/offers?market=sc_gnt +/api/offers?market=sc_cad +/api/offers?market=eth_ltc +/api/offers?market=etc_inr +/api/offers?market=etc_eth +/api/offers?market=doge_cad +/api/offers?market=eth_xmr +/api/offers?market=eth_eth +/api/offers?market=doge_krw +/api/offers?market=zec_pln +/api/offers?market=xmr_pln +/api/offers?market=xmr_mxn +/api/offers?market=sc_gbp +/api/offers?market=ltc_gnt +/api/offers?market=eth_mxn +/api/offers?market=doge_mxn +/api/offers?market=doge_eth +/api/offers?market=xmr_krw +/api/offers?market=ltc_jpy +/api/offers?market=doge_pln +/api/offers?market=eth_pln +/api/offers?market=ltc_mxn +/api/offers?market=ltc_xmr +/api/offers?market=ltc_ltc +/api/offers?market=ltc_eth +/api/offers?market=ltc_cad +/api/offers?market=ltc_rub +/api/offers?market=ltc_krw +/api/offers?market=ltc_gbp +/api/offers?market=ltc_cny +/api/offers?market=eth_krw +/api/offers?market=ltc_inr +/api/offers?market=btc_eth +/api/offers?market=ltc_pln +/api/trades?market=btc_aud×tamp_from=1570825544 +/api/trades?market=sfsc_btc +/api/trades?market=btc_usd×tamp_from=1570748098 +/api/trades?market=btc_usd×tamp_from=1570837356 +/api/trades?market=btc_usd×tamp_from=1571109241 +/api/trades?market=btc_usd×tamp_from=1570710634 +/api/ticker?market=eth_usdt +/api/ticker?market=eth_usd +/api/ticker?market=btc_usdt +/api/trades?market=btc_usd×tamp_from=1571056800 +/ +/api/trades?market=btc_eur×tamp_from=1570704285 +/api/trades?market=btc_eur×tamp_from=1570735788 +/api/trades?market=btc_aud×tamp_from=1570928421 +/api/trades?market=btc_usd×tamp_from=1570805915 +/api/trades?market=btc_usd×tamp_from=1570735150 +/api/trades?market=btc_aud×tamp_from=1570621639 +/api/trades?market=btc_usd×tamp_from=1570656232 +/api/trades?market=all&limit=200 +/api/trades?market=btc_usd×tamp_from=1570617546 +/api/trades?market=btc_eur×tamp_from=1570865354 +/api/trades?market=btc_eur×tamp_from=1570964770 +/api/trades?market=web_btc +/api/trades?market=btc_uyu +/api/trades?market=btc_try +/api/trades?market=qmcoin_btc +/api/trades?market=btc_tnd +/api/trades?market=usdc_btc +/api/trades?market=btc_xof +/api/trades?market=qwc_btc +/api/trades?market=space_btc +/api/trades?market=btc_zwl +/api/trades?market=btc_vef +/api/trades?market=btc_uzs +/api/trades?market=btc_twd +/api/trades?market=btc_svc +/api/trades?market=btc_mvr +/api/trades?market=acm_btc +/api/trades?market=crcl_btc +/api/trades?market=btc_tzs +/api/trades?market=btc_top +/api/trades?market=btc_syp +/api/trades?market=btc_sgd +/api/trades?market=btc_scr +/api/trades?market=btc_nad +/api/trades?market=ade_btc +/api/trades?market=mask_btc +/api/trades?market=crds_btc +/api/trades?market=btc_xpf +/api/trades?market=btc_sll +/api/trades?market=btc_qar +/api/trades?market=btc_mwk +/api/trades?market=zel_btc +/api/trades?market=pzdc_btc +/api/trades?market=nor_btc +/api/trades?market=dst_btc +/api/trades?market=btc_tjs +/api/trades?market=btc_rwf +/api/trades?market=btc_pab +/api/trades?market=ucc_btc +/api/trades?market=mox_btc +/api/trades?market=btc_xaf +/api/trades?market=btc_mzn +/api/trades?market=btc_krw +/api/trades?market=arq_btc +/api/trades?market=lytx_btc +/api/trades?market=gali_btc +/api/trades?market=frty_btc +/api/trades?market=eths_btc +/api/trades?market=btc_wst +/api/trades?market=btc_uah +/api/trades?market=btc_sos +/api/trades?market=btc_sar +/api/trades?market=btc_pyg +/api/trades?market=amit_btc +/api/currencies +/api/trades?market=rmx_btc +/api/trades?market=mile_btc +/api/trades?market=mbgl_btc +/api/trades?market=kek_btc +/api/trades?market=hlm_btc +/api/trades?market=btc_yer +/api/trades?market=btc_tmt +/api/trades?market=btc_stn +/api/trades?market=btc_pen +/api/trades?market=btc_mop +/api/trades?market=btc_mnt +/api/trades?market=btc_aed +/api/trades?market=tusd_btc +/api/trades?market=ryo_btc +/api/trades?market=prsn_btc +/api/trades?market=lcp_btc +/api/trades?market=cloak_btc +/api/trades?market=bzc_btc +/api/trades?market=btc_ttd +/api/trades?market=btc_srd +/api/trades?market=btc_sbd +/api/trades?market=btc_npr +/api/trades?market=pink_btc +/api/trades?market=mue_btc +/api/trades?market=btc_rsd +/api/trades?market=btc_pkr +/api/trades?market=btc_mkd +/api/trades?market=btc_mga +/api/trades?market=btc_lbp +/api/offers?market=btc_eur&direction=SELL +/api/trades?market=qbs_btc +/api/trades?market=ida_btc +/api/trades?market=fjc_btc +/api/trades?market=btc_zmw +/api/trades?market=btc_xcd +/api/trades?market=btc_ugx +/api/trades?market=btc_ssp +/api/trades?market=btc_shp +/api/trades?market=btc_nio +/api/trades?market=btc_iqd +/api/trades?market=wrkz_btc +/api/trades?market=mqx_btc +/api/trades?market=darx_btc +/api/trades?market=btc_szl +/api/trades?market=sub1x_btc +/api/trades?market=ird_btc +/api/trades?market=btc_sdg +/api/trades?market=btc_kwd +/api/trades?market=btc_idr +/api/trades?market=ple_btc +/api/trades?market=btc_mur +/api/trades?market=btc_mmk +/api/trades?market=btc_lsl +/api/trades?market=btc_lrd +/api/trades?market=btc_kmf +/api/trades?market=btc_irr +/api/trades?market=vxv_btc +/api/trades?market=veil_btc +/api/trades?market=mai_btc +/api/trades?market=btc_lak +/api/trades?market=btc_ang +/api/trades?market=btc_lyd +/api/trades?market=btc_kzt +/api/trades?market=btc_kgs +/api/trades?market=btc_isk +/api/trades?market=btc_afn +/api/trades?market=zer_btc +/api/trades?market=xdr0_btc +/api/trades?market=gmcn_btc +/api/trades?market=btc_bsd +/api/trades?market=btc_mro +/api/trades?market=btc_bif +/api/trades?market=btc_kyd +/api/trades?market=btc_bam +/api/trades?market=btc_bob +/api/trades?market=btc_mdl +/api/trades?market=btc_kpw +/api/trades?market=btc_jod +/api/trades?market=btc_gnf +/api/trades?market=btc_ern +/api/trades?market=btc_bnd +/api/trades?market=btc_awg +/api/trades?market=btc_aoa +/api/trades?market=btc_mad +/api/trades?market=btc_eur +/api/trades?market=btc_egp +/api/trades?market=btc_djf +/api/trades?market=btc_bgn +/api/trades?market=btc_bdt +/api/trades?market=btc_lkr +/api/trades?market=btc_kes +/api/trades?market=btc_gyd +/api/trades?market=btc_bmd +/api/trades?market=btc_all +/api/trades?market=btc_bzd +/api/trades?market=btc_btn +/api/trades?market=btc_etb +/api/trades?market=btc_cve +/api/trades?market=btc_bbd +/api/trades?market=btc_hrk +/api/trades?market=btc_hnl +/api/trades?market=btc_fjd +/api/trades?market=btc_dzd +/api/trades?market=btc_dop +/api/trades?market=btc_cop +/api/trades?market=btc_byn +/api/trades?market=btc_jmd +/api/trades?market=btc_fkp +/api/trades?market=btc_cup +/api/trades?market=btc_bwp +/api/trades?market=btc_gmd +/api/trades?market=btc_azn +/api/trades?market=btc_amd +/api/trades?market=btc_cdf +/api/trades?market=btc_htg +/api/trades?market=btc_gip +/api/trades?market=btc_gtq +/api/trades?market=sf_btc +/api/trades?market=xmr_btc +/api/trades?market=btc_eur×tamp_from=1571043684 +/api/trades?market=btc_eur×tamp_from=1570806617 +/api/trades?market=btc_usd×tamp_from=1570635523 +/api/trades?market=btc_brl +/api/trades?market=btc_usd×tamp_from=1570992211 +/api/trades?market=btc_eur×tamp_from=1570796963 +/api/trades?market=xspec_btc +/api/trades?market=eth_btc +/api/trades?market=btc_rub +/api/trades?market=btc_usd×tamp_from=1570795159 +/api/trades?market=btc_gbp +/api/trades?market=btc_aud +/api/trades?market=aeon_btc +/api/trades?market=xrc_btc +/api/trades?market=bsq_btc +/api/trades?market=ltc_btc +/api/trades?market=uno_btc +/api/trades?market=grin_btc +/api/trades?market=doge_btc +/api/trades?market=cash2_btc +/api/trades?market=btc_thb +/api/trades?market=dash_btc +/api/trades?market=btc_pln +/api/trades?market=btc_sek +/api/trades?market=btc_eur×tamp_from=1570619163 +/api/trades?market=beam_btc +/api/trades?market=btc_php +/api/trades?market=btc_nzd +/api/trades?market=btc_ngn +/api/trades?market=zec_btc +/api/trades?market=dxo_btc +/api/trades?market=btc_inr +/api/trades?market=btc_chf +/api/trades?market=dai_btc +/api/trades?market=btc_zar +/api/trades?market=scp_btc +/api/trades?market=btc_jpy +/api/trades?market=doi_btc +/api/trades?market=btc_nok +/api/trades?market=btc_ars +/api/trades?market=rads_btc +/api/trades?market=etc_btc +/api/trades?market=btc_pgk +/api/trades?market=btc_mxn +/api/trades?market=ask_btc +/api/trades?market=xzc_btc +/api/trades?market=croat_btc +/api/trades?market=btm_btc +/api/trades?market=btc_vnd +/api/trades?market=btc_ron +/api/trades?market=nav_btc +/api/trades?market=drgl_btc +/api/trades?market=btc_vuv +/api/trades?market=btc_cad +/api/trades?market=nmc_btc +/api/trades?market=btc_khr +/api/trades?market=btc_dkk +/api/trades?market=dcr_btc +/api/trades?market=zen_btc +/api/trades?market=ltz_btc +/api/trades?market=hatch_btc +/api/trades?market=gbyte_btc +/api/trades?market=cha_btc +/api/trades?market=btc_aud×tamp_from=1570845377 +/api/trades?market=aus_btc +/api/trades?market=onion_btc +/api/trades?market=btc_myr +/api/trades?market=btc_ils +/api/trades?market=blur_btc +/api/trades?market=trtl_btc +/api/trades?market=pivx_btc +/api/trades?market=neos_btc +/api/trades?market=btc_omr +/api/trades?market=btc_crc +/api/trades?market=btc_cny +/api/trades?market=btc_hkd +/api/trades?market=btc_czk +/api/trades?market=btc_clp +/api/trades?market=aeur_btc +/api/trades?market=btc_huf +/api/trades?market=xcp_btc +/api/trades?market=btc_gel +/api/trades?market=btc_ghs +/api/trades?market=btc_bhd diff --git a/widgets/head.html b/widgets/head.html deleted file mode 100644 index d45a99f..0000000 --- a/widgets/head.html +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/widgets/order_details.widget.html b/widgets/order_details.widget.html deleted file mode 100644 index fb529c8..0000000 --- a/widgets/order_details.widget.html +++ /dev/null @@ -1,77 +0,0 @@ -order_expire_time = $result->timest + $result->order_expires_secs; - $this->order_expire_time_text = strftime( '%c %Z', $this->order_expire_time ); - $this->order_expire_time_interval_text = $this->order_expire_time < time() ? '0 seconds (already expired)' : time_util::formatDateDiff( 'now', $this->order_expire_time_text ); - $result->expires_in = $this->order_expire_time_interval_text; - $expires_at_epoch = $result->timest + $result->order_expires_secs; - $expires_at = date('Y-m-d H:i:s T', $expires_at_epoch ); - $result->expires_at = ""; - $timest = date('Y-m-d H:i:s T', $result->timest ); - $result->timest = ""; - - $cancel_states = array( 'ENTERED', 'LIVE', 'PARTIAL' ); - $this->can_cancel = in_array( $result->status, $cancel_states ); - - $result_display_map = array( - 'market' => 'Market', - 'order_id' => 'Order ID', - 'status' => 'Status', - 'status_comment' => 'Status Comment', - 'type' => array( 'label' => 'Type', 'cb_format' => function($value) { $map = array( 'MKT' => 'Market', 'LMT' => 'Limit' ); return @$map[$value]; } ), - 'side' => 'Side', - 'size' => 'Size', - 'price' => $result->type == 'MKT' ? 'Price' : 'Limit Price', - 'avg_trade_price' => 'Average Trade Price', - 'timest' => 'Order Created', - 'expires_at' => 'Order Expires', - 'expires_in' => 'Expires In', - 'currency_symbol_source' => 'Deposit Currency', - 'currency_symbol_dest' => 'Payout Currency', - ); - if( !@$result->refund_address || !@$result->dest_address ) { - unset( $result_display_map['refund_address'] ); - unset( $result_display_map['dest_address'] ); - } - if( !$result->status_comment ) { - unset( $result_display_map['status_comment'] ); - } - if( $result->avg_trade_price == 0 ) { - unset( $result_display_map['avg_trade_price'] ); - } - if( !$this->can_cancel ) { - unset( $result_display_map['expires_in'] ); - unset( $result_display_map['expires_at'] ); - } - - if( $result->type == 'MKT' ) { - if( $result->size == 0 ) { - unset( $result_display_map['size'] ); - } - if( $result->price == 0 ) { - unset( $result_display_map['price'] ); - } - } - $this->result_display_map = $result_display_map; - $this->result = $result; - - } - - - function get_widget_html() { - $table = new html_table(); - $table->right_align_numeric = false; - $table->table_attrs = array( 'cellspacing' => 0, 'cellpadding' => 3, 'bgcolor' => 'lightgreen', 'class' => 'bordered', 'style' => 'width: 100%;'); - return $table->table_from_object( $this->result, $this->result_display_map, false ); - } - -} diff --git a/widgets/timezone-js.html b/widgets/timezone-js.html deleted file mode 100644 index bd5d708..0000000 --- a/widgets/timezone-js.html +++ /dev/null @@ -1,59 +0,0 @@ - elements on the page to localtime values. - * It ignores any