Skip to content

Instantly share code, notes, and snippets.

@jayhuang75
Last active November 8, 2020 15:14
Show Gist options
  • Select an option

  • Save jayhuang75/c581bb8397ddf2ff338ea079d1c1cec9 to your computer and use it in GitHub Desktop.

Select an option

Save jayhuang75/c581bb8397ddf2ff338ea079d1c1cec9 to your computer and use it in GitHub Desktop.
coinbase_impl.rs
#[async_trait(?Send)]
impl Market for Coinbase {
async fn get_balances(&self) -> Result<f32, Box<dyn Error>> {
// coinbase API call
Ok(1.0)
}
async fn get_market_price(&self) -> Result<f32, Box<dyn Error>> {
// coinbase API call
let mut rng = rand::thread_rng();
Ok(rng.gen_range(0.0, 10.0))
}
async fn place_sell_order(&self, amount: f32) -> Result<f32, Box<dyn Error>> {
// coinbase API call
Ok(amount)
}
async fn place_buy_order(&self, amount: f32) -> Result<f32, Box<dyn Error>> {
// coinbase API call
Ok(amount)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment