Skip to content

Quote Service provides quotes for digital currency trades using data from the FTX orderbook.

License

Notifications You must be signed in to change notification settings

mustafatufan/quote-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.