Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-implement Markets API service with pre-caching proxy + risq backend #20

Merged
merged 40 commits into from
Nov 12, 2019
Merged
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
eab7935
Replace entire PHP codebase with cloud-based caching reverse-proxy
wiz Oct 25, 2019
a3a8f1a
Basic GrqphQLQuery
Oct 26, 2019
e70e273
WIP currencies
Oct 26, 2019
fb358d7
/api/currencies working
Oct 26, 2019
f6432d3
Return int for Currencies.precision field
Oct 26, 2019
f90f9a2
Add /markets query
Oct 26, 2019
8e0035d
Add Offers query
Oct 27, 2019
01abf98
Add Depth query
Oct 27, 2019
b332137
Add Ticker query
Oct 27, 2019
61c6c4a
Add Trades query
Oct 27, 2019
d61bec0
Add Hloc query
Oct 27, 2019
e378cad
Add Volumes query
Oct 27, 2019
eb7faad
Simplify offers query. Requires risq v0.3.0
Oct 27, 2019
2002577
Merge pull request #3 from bodymindarts/risq-v0.3.0
wiz Oct 31, 2019
66d137a
Fix trades limit param
Nov 1, 2019
69939dd
Merge pull request #4 from bodymindarts/fix-trades
wiz Nov 1, 2019
0605579
Update backend/frontend hostnames
wiz Nov 1, 2019
08fe443
Add some testcases
wiz Nov 1, 2019
579edeb
Fix OffersQuery structure
Nov 2, 2019
9d09902
Query buy and sell fields
Nov 2, 2019
9aaa1f3
Merge pull request #5 from bodymindarts/fix-offers-query
wiz Nov 2, 2019
f17ca60
Merge pull request #6 from bodymindarts/buy-and-sell-ticker
wiz Nov 2, 2019
9ae70a9
Add appengine configuration to always have min 1 instance running
wiz Nov 2, 2019
52a3794
Tweak test script to just return HTTP response codes for now
wiz Nov 2, 2019
974c959
Fix index out of bounds exception when parsing query string
wiz Nov 2, 2019
6cbc473
Split into 2 testcases
wiz Nov 2, 2019
283c433
Handle timestamp=no in volumes
Nov 2, 2019
e1e2b52
Fix caching and CORS, update test cases
wiz Nov 2, 2019
9636ce4
Merge pull request #7 from bodymindarts/timestamp-no
wiz Nov 2, 2019
db2a821
Fix timestamp=no on hloc
Nov 3, 2019
661594f
Fix buys/sells for crypto offers (needs risq > 8b6c156)
Nov 3, 2019
3293229
Merge pull request #9 from bodymindarts/fix-crypto-offers
wiz Nov 4, 2019
27bb157
Fix for volume / amount display for altcoin markets
Nov 7, 2019
293ff03
Merge pull request #10 from bodymindarts/fix-altcoin-markets
wiz Nov 7, 2019
adc5443
Add market to Trades response (fix null page)
Nov 7, 2019
a497d3b
Merge pull request #11 from bodymindarts/add-market-to-trades
wiz Nov 8, 2019
a399ca7
Add missing org.graalvm.compiler jar dep to pom.xml
wiz Nov 8, 2019
a13d059
Fix NPE in queryString replacement code
wiz Nov 8, 2019
5568dea
Add API documentation, redirect to bisq website, redirect to https
wiz Nov 11, 2019
474f21b
Add log warning if unable to add data to memcache
wiz Nov 12, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
bitsquare_files/
settings.json
target/
.DS_Store
14 changes: 0 additions & 14 deletions 404.html

This file was deleted.

816 changes: 656 additions & 160 deletions LICENSE

Large diffs are not rendered by default.

69 changes: 27 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

27 changes: 0 additions & 27 deletions api/.htaccess

This file was deleted.

94 changes: 0 additions & 94 deletions api/README.md

This file was deleted.

1 change: 0 additions & 1 deletion api/VERSION

This file was deleted.

50 changes: 0 additions & 50 deletions api/currencies/apidoc.php

This file was deleted.

34 changes: 0 additions & 34 deletions api/currencies/index.php

This file was deleted.

47 changes: 0 additions & 47 deletions api/depth/apidoc.php

This file was deleted.

Loading