Last active
November 8, 2020 15:14
-
-
Save jayhuang75/c581bb8397ddf2ff338ea079d1c1cec9 to your computer and use it in GitHub Desktop.
coinbase_impl.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #[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