Skip to content

Latest commit

 

History

History
83 lines (59 loc) · 1.76 KB

README.md

File metadata and controls

83 lines (59 loc) · 1.76 KB

Quote Service

Quote Service provides quotes for digital currency trades using data from the FTX orderbook. It handles requests to buy or sell a particular amount of a currency (the base currency) with another currency (the quote currency).

Route

POST /quote

Request Body

  • action (String): Either “buy” or “sell”
  • base_currency (String): The currency to be bought or sold
  • quote_currency (String): The currency to quote the price in
  • amount (BigDecimal): The amount of the base currency to be traded - Note that it was String in the doc.

Request Body Example

{
  "action": "buy",
  "base_currency": "BTC",
  "quote_currency": "TRYB",
  "amount": 0.12
}

Response Body

  • total (String): Total quantity of quote currency - Note that it was String in the doc.
  • price (String): The per-unit cost of the base currency - Note that it was String in the doc.
  • currency (String): The quote currency

Response Body Example

{
  "total": 54610.212,
  "price": 455085.1,
  "currency": "TRYB"
}

Deployed Example

URL

https://api.tufan.ee/quote

Swagger

cURL

curl --location --request POST 'https://api.tufan.ee/quote' \
--header 'Content-Type: application/json' \
--data-raw '{
  "action": "buy",
  "base_currency": "BTC",
  "quote_currency": "TRYB",
  "amount": 0.12
}'

TODOs

1. Write more detailed tests in QuoteServiceImplTest
2. Test custom exceptions
  • InvalidAmountException
  • NoMarketException
  • ConnectionUnavailableException
3. Fix syntax of PriceType and QuoteAction enums

Enums should be uppercase.