Skip to content

Commit

Permalink
rpc add orderpair price (paritytech#224)
Browse files Browse the repository at this point in the history
  • Loading branch information
toxotguo authored Jan 18, 2019
1 parent fb5d13f commit 2cf7883
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions rpc/src/chainx/impl_rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -449,8 +449,17 @@ where
info.precision = pair.precision;
info.used = pair.used;

let price_key=<xspot::OrderPairPriceOf<Runtime>>::key_for(&i);
if let Some(price)=Self::pickout::<(Balance,Balance,BlockNumber)>(&state,&price_key)?{
info.last_price=price.0;
info.aver_price=price.1;
info.update_height=price.2;
}


pairs.push(info);
}

}
}

Expand Down
3 changes: 3 additions & 0 deletions rpc/src/chainx/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ pub struct PairInfo {
pub currency: String,
pub precision: u32, //价格精度
pub used: bool,
pub last_price:Balance,
pub aver_price:Balance,
pub update_height:BlockNumber,
}

#[derive(Debug, Default, PartialEq, Serialize)]
Expand Down
Binary file not shown.

0 comments on commit 2cf7883

Please sign in to comment.