Skip to content

Commit

Permalink
fixs
Browse files Browse the repository at this point in the history
  • Loading branch information
Axel-Jacobsen committed Dec 9, 2023
1 parent b372f77 commit e103019
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/market_handler.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
/// This does a lot of work!
/// The job of this file is to interact w/ the Manifold API,
/// keep track of information that the bots want, make bets
/// that the bots want, and make sure limits (api limits, risk
/// limits) are within bounds.
use std::collections::HashMap;
use std::env;
use std::sync::{
atomic::{AtomicBool, Ordering},
Arc,
};
use std::collections::HashMap;

use log::{error, info};
use tokio::sync::broadcast::{channel, Receiver, Sender};
Expand Down Expand Up @@ -98,7 +93,7 @@ impl MarketHandler {
.await
.unwrap();

match resp.json::<Vec<manifold_types::LiteMarket>>().await {
match response_into::<Vec<manifold_types::LiteMarket>>(resp).await {
Ok(mut markets) => {
if markets.len() == 1 {
Ok(markets.pop())
Expand Down Expand Up @@ -165,12 +160,11 @@ impl MarketHandler {
let mut params = query_params.clone();
params.push(("after".to_string(), most_recent_id.clone()));

let resp = get_endpoint("bets".to_string(), &params);

let bets = resp
let resp = get_endpoint("bets".to_string(), &params)
.await
.expect("Couldn't get bets from api")
.json::<Vec<manifold_types::Bet>>()
.expect("api error");

let bets = response_into::<Vec<manifold_types::Bet>>(resp)
.await
.expect("Couldn't convert json into Bet");

Expand Down

0 comments on commit e103019

Please sign in to comment.