Skip to content

Commit

Permalink
update get_price api
Browse files Browse the repository at this point in the history
  • Loading branch information
canonbrother committed Dec 19, 2024
1 parent 57b07bf commit 82d7bb6
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/ain-ocean/src/api/prices.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,16 +150,15 @@ async fn get_price(
) -> Result<Response<Option<PriceTickerResponse>>> {
let (token, currency) = parse_token_currency(&key)?;

let sort_key = price_repo.by_key.get(&(token.clone(), currency.clone()))?;
let Some(sort_key) = sort_key else {
return Ok(Response::new(None));
};
let price_ticker = ctx
.services
.price_ticker
.by_id
.list(
Some(([0xffu8; 4], [0xffu8; 4], token.clone(), currency.clone())),
SortOrder::Descending,
)?
.next()
.transpose()?;
.get(&sort_key)?;

let Some((_, price_ticker)) = price_ticker else {
return Ok(Response::new(None));
Expand Down

0 comments on commit 82d7bb6

Please sign in to comment.