crypto_rest_client/exchanges/bitget/
bitget_swap.rs1use super::super::utils::http_get;
2use crate::error::Result;
3use std::collections::BTreeMap;
4
5const BASE_URL: &str = "https://api.bitget.com";
6
7pub struct BitgetSwapRestClient {
12 _api_key: Option<String>,
13 _api_secret: Option<String>,
14}
15
16impl BitgetSwapRestClient {
17 pub fn new(api_key: Option<String>, api_secret: Option<String>) -> Self {
18 BitgetSwapRestClient { _api_key: api_key, _api_secret: api_secret }
19 }
20
21 pub fn fetch_l2_snapshot(symbol: &str) -> Result<String> {
27 gen_api!(format!("/api/mix/v1/market/depth?symbol={symbol}&limit=100"))
28 }
29
30 pub fn fetch_open_interest(symbol: &str) -> Result<String> {
36 gen_api!(format!("/api/mix/v1/market/open-interest?symbol={symbol}"))
37 }
38}