use crate::client::AkShareClient;
use crate::error::Result;
use crate::types::Row;
impl AkShareClient {
pub async fn futures_spot_stock(&self, date: &str) -> Result<Vec<Row>> {
let url = "https://data.eastmoney.com/ifdata/xhgp.html";
let body = self
.get(url)
.header("User-Agent", "Mozilla/5.0")
.send()
.await?
.text()
.await?;
let mut items = Vec::new();
let mut row = Row::new();
row.insert("date".into(), serde_json::json!(date));
row.insert("source".into(), serde_json::json!("eastmoney"));
row.insert("html_len".into(), serde_json::json!(body.len()));
items.push(row);
Ok(items)
}
pub async fn futures_spot_stock_em(&self, category: &str) -> Result<Vec<Row>> {
let url = "https://data.eastmoney.com/ifdata/xhgp.html";
let body = self
.get(url)
.header("User-Agent", "Mozilla/5.0")
.send()
.await?
.text()
.await?;
let mut items = Vec::new();
let mut row = Row::new();
row.insert("category".into(), serde_json::json!(category));
row.insert("source".into(), serde_json::json!("eastmoney"));
row.insert("html_len".into(), serde_json::json!(body.len()));
items.push(row);
Ok(items)
}
}