use crate::v5::api::{
BybitApi,
post::Post,
};
use serde::{
Serialize,
Deserialize,
};
use anyhow::Result;
const PATH: &'static str = "/v5/order/disconnected-cancel-all";
impl BybitApi {
pub async fn set_dcp(&self, params: SetDCPParameters) -> Result<SetDCPResponse> {
self.post(PATH, Some(params)).await
}
}
#[derive(Debug, Clone, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SetDCPParameters {
time_window: u32,
}
impl SetDCPParameters {
pub fn new(time_window: u32) -> Self {
Self {
time_window
}
}
}
#[derive(Debug, Clone, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct SetDCPResponse {
ret_code: i32,
ret_msg: String,
}
impl SetDCPResponse {
pub fn ret_code(&self) -> i32 {
self.ret_code
}
pub fn set_ret_code(&mut self, ret_code: i32) {
self.ret_code = ret_code;
}
pub fn ret_msg(&self) -> &str {
&self.ret_msg
}
pub fn set_ret_msg(&mut self, ret_msg: String) {
self.ret_msg = ret_msg;
}
}