[bisq-network/bisq-markets] Pr issue 6 (#11)

peertrade notifications at github.com
Sun Jul 8 06:53:18 UTC 2018


This implements the requests in issue 6 for the /trades api, namely:
1. include payment method in the response
2. include volume field to indicate precise amount of primary currency traded.

note that volume could be calculated previously by multiplying price*amount, but the floating point multiplication often leaves numbers like 1.999999999 instead of 2.

note also that primary currency does not mean basecurrency aka bitcoin.  Rather, primary currency is always the currency that is 2nd in the market identifer, eg xmr_btc, btc is primary.  or btc_usd, usd is primary.  The rule in bisq is that fiat currencies are always primary against basecurrency (btc), and basecurrency is primary against other cryptocurrencies.  So if one wants to know amount of btc traded for any given market, one would use this logic:
```
    list($left, $right) = explode('_', $market_id);
    $btc_amount = $right == 'BTC' ? $volume : $amount;
```
I needed to link to [PaymentMethod.java](https://raw.githubusercontent.com/bisq-network/bisq-core/master/src/main/java/bisq/core/payment/payload/PaymentMethod.java) in the apidoc, and it was escaping all html entities, so I added a capability to detect markdown-style links in an API description or notes.

**Sample Response**   ( from the updated apidoc )
```
[
    {
        "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
    },
    ...
]
```

You can view, comment on, or merge this pull request online at:

  https://github.com/bisq-network/bisq-markets/pull/11

-- Commit Summary --

  * fix: convert tradeVolume to decimal amount, as is already done with tradePrice and tradeAmount
  * Add fields tradeVolume and paymentMethod to result data
  * support markdown style links in api description and notes fields
  * document addition of volume and payment_method fields

-- File Changes --

    M api/index.php (8)
    M api/trades/apidoc.php (21)
    M api/trades/index.php (10)
    M lib/trades.class.php (3)

-- Patch Links --

https://github.com/bisq-network/bisq-markets/pull/11.patch
https://github.com/bisq-network/bisq-markets/pull/11.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq-markets/pull/11
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20180707/1d184b86/attachment.html>


More information about the bisq-github mailing list