Skip to content

Commit

Permalink
Coinmarketcap Deepbook Endpoints (#20453)
Browse files Browse the repository at this point in the history
## Description 

**Modified Endpoint 1:** 
/get_historical_volume/:pool_id -> /historical_volume/pool_name
Response will display pool as pool_name

Example call:

`/historical_volume/SUI_USDC,DEEP_USDC?start_time=1733152516&end_time=1733238917`

Example response:
`{"DEEP_USDC":24033500000000,"SUI_USDC":2647584300000000}`

**New Endpoint 1: /all_historical_volume**
Retrieves the pools stored in db and return volume for all pools within
time range

Example Call:
`/all_historical_volume?start_time=1733152516&end_time=1733238917`

Example Response:

`{"DEEP_USDC":23658150000000,"DEEP_SUI":5311220000000,"TYPUS_SUI":662314300000000,"SUI_USDC":3365051200000000,"WUSDC_USDC":7960304900000,"NS_USDC":783869300000,"NS_SUI":379958200000}`

**New Endpoint 2: /orderbook/:pool_name**
More information:
[https://docs.google.com/document/d/1S4urpzUnO2t7DmS_1dc4EL4tgnnbTObPYXvDeBnukCg/edit?tab=t.0#bookmark=kix.ojdax1m5sg58](url)

Required path:
`pool_name`: "LTC_BTC" 

Optional params: 
`level` (1 or 2): Level 1 – Only the best bid and ask. Level 2 –
Arranged by best bids and asks.
`depth`: Not defined or 0 = full order book Depth = 100 means 50 for
each bid/ask side. Cannot be 1.
All bids and asks returned are sorted by best to worst

Example call:
`/orderbook/SUI_USDC?depth=4`

Example output:

`{"timestamp":"1733252111939","bids":[["3.796","958.5"],["3.795","5000"]],"asks":[["3.799","1000"],["3.801","7238"]]}`

## Test plan 

How did you test the new or updated feature?

Tested locally

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol: 
- [ ] Nodes (Validators and Full nodes): 
- [x] Indexer: Deepbook Indexer
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [ ] CLI: 
- [ ] Rust SDK:
- [ ] REST API:
  • Loading branch information
leecchh authored Dec 4, 2024
1 parent 67c9096 commit aaf9347
Show file tree
Hide file tree
Showing 3 changed files with 319 additions and 12 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/sui-deepbook-indexer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ sui-indexer-builder.workspace = true
tempfile.workspace = true
axum.workspace = true
bigdecimal = { version = "0.4.5" }
serde_json = { version = "1.0", features = ["preserve_order"] }

[dev-dependencies]
hex-literal = "0.3.4"
Expand Down
Loading

0 comments on commit aaf9347

Please sign in to comment.