|
|
@@ -51,13 +51,15 @@ pub enum PositionModeEnum {
|
|
|
/// - `limits_close(HashMap<String, Vec<String>>)`: 可用交易币数量 `{"order_name": [c_id, o_id]}`;
|
|
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
|
pub struct OrderCommand {
|
|
|
- // 取消订单指令,数据结构例子:
|
|
|
+ // 取消订单指令
|
|
|
pub cancel: HashMap<String, Vec<String>>,
|
|
|
- // 检验指令,数据结构例子:(暂没找到例子)
|
|
|
+ // 检验指令
|
|
|
pub check: HashMap<String, Vec<String>>,
|
|
|
- // 限开指令,数据结构例子:(暂没找到例子)
|
|
|
+ // 限价开仓单
|
|
|
pub limits_open: HashMap<String, Vec<String>>,
|
|
|
- // 限收指令,数据结构例子:(暂没找到例子)
|
|
|
+ // 止损单
|
|
|
+ pub stop_loss: HashMap<String, Vec<String>>,
|
|
|
+ // 平仓订单
|
|
|
pub limits_close: HashMap<String, Vec<String>>,
|
|
|
}
|
|
|
|
|
|
@@ -67,6 +69,7 @@ impl OrderCommand {
|
|
|
cancel: Default::default(),
|
|
|
check: Default::default(),
|
|
|
limits_open: Default::default(),
|
|
|
+ stop_loss: Default::default(),
|
|
|
limits_close: Default::default(),
|
|
|
}
|
|
|
}
|
|
|
@@ -426,8 +429,8 @@ impl Position {
|
|
|
/// let mut params:BTreeMap<String,String> = BTreeMap::new();
|
|
|
/// params.insert("access_key".to_string(), "your_access_key".to_string());
|
|
|
/// params.insert("access_key".to_string(), "your_secret_key".to_string());
|
|
|
-/// let exchange = Exchange::new(ExchangeEnum::BinanceSwap, "BTC_USDT".to_string(), true, params);
|
|
|
/// ```
|
|
|
+/// let exchange = Exchange::new(ExchangeEnum::BinanceSwap, "BTC_USDT".to_string(), true, params);
|
|
|
/// 获取当前交易所交易模式
|
|
|
/// - fn get_self_exchange(&self) -> ExchangeEnum;
|
|
|
/// ```rust
|
|
|
@@ -436,10 +439,10 @@ impl Position {
|
|
|
/// # let mut params:BTreeMap<String,String> = BTreeMap::new();
|
|
|
/// # params.insert("access_key".to_string(), "your_access_key".to_string());
|
|
|
/// # params.insert("access_key".to_string(), "your_secret_key".to_string());
|
|
|
+/// ```
|
|
|
/// # let exchange = Exchange::new(ExchangeEnum::BinanceSwap, "BTC_USDT".to_string(), true, params);
|
|
|
-///
|
|
|
/// exchange.get_self_exchange();
|
|
|
-/// ```
|
|
|
+///
|
|
|
/// 获取当前是否使用高速模式
|
|
|
/// - fn get_self_is_colo(&self) -> bool;
|
|
|
/// ```rust
|
|
|
@@ -448,10 +451,11 @@ impl Position {
|
|
|
/// # let mut params:BTreeMap<String,String> = BTreeMap::new();
|
|
|
/// # params.insert("access_key".to_string(), "your_access_key".to_string());
|
|
|
/// # params.insert("access_key".to_string(), "your_secret_key".to_string());
|
|
|
+/// ```
|
|
|
/// # let exchange = Exchange::new(ExchangeEnum::BinanceSwap, "BTC_USDT".to_string(), true, params);
|
|
|
-///
|
|
|
/// exchange.get_self_is_colo();
|
|
|
-/// ```
|
|
|
+///
|
|
|
+///
|
|
|
/// 获取当前是否使用登录
|
|
|
/// - fn get_self_is_login(&self) -> bool;
|
|
|
/// ```rust
|
|
|
@@ -460,10 +464,11 @@ impl Position {
|
|
|
/// # let mut params:BTreeMap<String,String> = BTreeMap::new();
|
|
|
/// # params.insert("access_key".to_string(), "your_access_key".to_string());
|
|
|
/// # params.insert("access_key".to_string(), "your_secret_key".to_string());
|
|
|
+/// ```
|
|
|
/// # let exchange = Exchange::new(ExchangeEnum::BinanceSwap, "BTC_USDT".to_string(), true, params);
|
|
|
-///
|
|
|
/// exchange.get_self_is_login();
|
|
|
-/// ```
|
|
|
+///
|
|
|
+///
|
|
|
/// 获取登录params信息
|
|
|
/// - fn get_self_params(&self) -> BTreeMap<String, String>;
|
|
|
/// ```rust
|
|
|
@@ -472,10 +477,11 @@ impl Position {
|
|
|
/// # let mut params:BTreeMap<String,String> = BTreeMap::new();
|
|
|
/// # params.insert("access_key".to_string(), "your_access_key".to_string());
|
|
|
/// # params.insert("access_key".to_string(), "your_secret_key".to_string());
|
|
|
+/// ```
|
|
|
/// # let exchange = Exchange::new(ExchangeEnum::BinanceSwap, "BTC_USDT".to_string(), true, params);
|
|
|
-///
|
|
|
/// exchange.get_self_params();
|
|
|
-/// ```
|
|
|
+///
|
|
|
+///
|
|
|
/// 获取账号信息
|
|
|
/// - async fn get_account(&self, symbol: &str) -> Result<Account, Error>;
|
|
|
/// ```rust
|
|
|
@@ -484,10 +490,11 @@ impl Position {
|
|
|
/// # let mut params:BTreeMap<String,String> = BTreeMap::new();
|
|
|
/// # params.insert("access_key".to_string(), "your_access_key".to_string());
|
|
|
/// # params.insert("access_key".to_string(), "your_secret_key".to_string());
|
|
|
+/// ```
|
|
|
/// # let exchange = Exchange::new(ExchangeEnum::BinanceSwap, "BTC_USDT".to_string(), true, params);
|
|
|
-///
|
|
|
/// exchange.get_account()
|
|
|
-/// ```
|
|
|
+///
|
|
|
+///
|
|
|
/// 订阅账号信息
|
|
|
/// ```rust
|
|
|
/// # use std::collections::BTreeMap;
|
|
|
@@ -495,10 +502,11 @@ impl Position {
|
|
|
/// # let mut params:BTreeMap<String,String> = BTreeMap::new();
|
|
|
/// # params.insert("access_key".to_string(), "your_access_key".to_string());
|
|
|
/// # params.insert("access_key".to_string(), "your_secret_key".to_string());
|
|
|
+/// ```
|
|
|
/// # let exchange = Exchange::new(ExchangeEnum::BinanceSwap, "BTC_USDT".to_string(), true, params);
|
|
|
-///
|
|
|
/// exchange.subscribe_account();
|
|
|
-/// ```
|
|
|
+
|
|
|
+
|
|
|
#[async_trait]
|
|
|
pub trait Platform {
|
|
|
fn clone_box(&self) -> Box<dyn Platform + Send + Sync>;
|