use chrono::{Duration, Utc};
use rand::{thread_rng, Rng};
use crate::pocketoption::error::{PocketOptionError, PocketResult};
pub fn get_index() -> PocketResult<u64> {
let mut rng = thread_rng();
let rand = rng.gen_range(10..99);
let time = (Utc::now() + Duration::hours(2)).timestamp();
format!("{}{}", time, rand)
.parse::<u64>()
.map_err(|e| PocketOptionError::GeneralParsingError(e.to_string()))
}
pub fn is_otc(symbol: &str) -> bool {
symbol.ends_with("otc")
}