ThiS API connects with Bitfinex API. It's usefull for getting the bid-ask list, the effective price if a order is executed and the marketdepth based on the orderbook snapshot for a given pair name.
- Clone the repository.
- Run
cp .env.example .env
. - Run
npm i
. - Run
npm run start:watch
for running in dev mode. - The server will be available at
localhost:3000
.
- Run
npm run build
for generating a prod build. - Run
npm run eslint
for running eslint. - Run
npm run test
for running tests. - Run
npm run test <test name>
for running a specific test.
GET <host>/api/order/:pairName
Example:
curl --location --request GET 'localhost:3000/api/order/tBTCUSD'
Response:
{
"bids": [
{
"price": 1534.7,
"count": 6,
"amount": 3.325
},
...
],
"asks": [
{
"price": 1535.1,
"count": 1,
"amount": -1.6288315
},
...
]
}
POST <host>/api/order
Example:
curl --location --request POST 'localhost:3000/api/order' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "tETHUSD",
"operation": "sell",
"amount": "5",
"priceLimit": 7000
}'
Payload:
{
"name": "tETHUSD", // pair name
"operation": "sell", // type of operation
"amount": "5", // the desire amount to buy
"priceLimit": 7000 // the max price you are able to pay
}
Response:
{
"depth": "0.16%",
"totalPrice": "6738.50",
"totalCount": 5
}
Note: if priceLimit
is specified then it will return the max price and size you will be able to buy for a given price limit.
100% coverage