| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- use std::collections::BTreeMap;
- use std::io::{Error};
- use async_trait::async_trait;
- use rust_decimal::Decimal;
- use crate::{Platform, ExchangeEnum, Account, Position, Ticker, Market, Order, OrderCommand};
- use exchanges::gate_spot_rest::GateSpotRest;
- #[allow(dead_code)]
- #[derive(Clone)]
- pub struct GateSpot {
- exchange: ExchangeEnum,
- symbol: String,
- is_colo: bool,
- params: BTreeMap<String, String>,
- request: GateSpotRest,
- }
- impl GateSpot {
- pub fn new(symbol: String, is_colo: bool, params: BTreeMap<String, String>) -> GateSpot {
- GateSpot {
- exchange: ExchangeEnum::GateSpot,
- symbol: symbol.to_uppercase(),
- is_colo,
- params: params.clone(),
- request: GateSpotRest::new(is_colo, params.clone()),
- }
- }
- }
- #[async_trait]
- impl Platform for GateSpot {
- // 克隆方法
- fn clone_box(&self) -> Box<dyn Platform + Send + Sync> { Box::new(self.clone()) }
- // 获取交易所模式
- fn get_self_exchange(&self) -> ExchangeEnum {
- ExchangeEnum::GateSpot
- }
- // 获取交易对
- fn get_self_symbol(&self) -> String { self.symbol.clone() }
- // 获取是否使用高速通道
- fn get_self_is_colo(&self) -> bool {
- self.is_colo
- }
- // 获取params信息
- fn get_self_params(&self) -> BTreeMap<String, String> {
- self.params.clone()
- }
- fn get_self_market(&self) -> Market { todo!() }
- fn get_request_delays(&self) -> Vec<i64> { todo!() }
- fn get_request_avg_delay(&self) -> Decimal { todo!() }
- fn get_request_max_delay(&self) -> i64 { todo!() }
- async fn get_server_time(&mut self) -> Result<String, Error> {
- todo!()
- }
- // 获取账号信息
- async fn get_account(&mut self) -> Result<Account, Error> {
- todo!()
- }
- // 获取仓位信息
- async fn get_position(&mut self) -> Result<Vec<Position>, Error> {
- todo!()
- }
- async fn get_positions(&mut self) -> Result<Vec<Position>, Error> {
- todo!()
- }
- // 获取市场行情
- async fn get_ticker(&mut self) -> Result<Ticker, Error> {
- todo!()
- }
- async fn get_market(&mut self) -> Result<Market, Error> {
- todo!()
- }
- async fn get_order_detail(&mut self, _order_id: &str, _custom_id: &str) -> Result<Order, Error> { todo!() }
- async fn get_orders_list(&mut self, _status: &str) -> Result<Vec<Order>, Error> {
- todo!()
- }
- async fn set_dual_mode(&mut self, _coin: &str, _is_dual_mode: bool) -> Result<String, Error> { todo!() }
- async fn set_dual_leverage(&mut self, _leverage: &str) -> Result<String, Error> {
- todo!()
- }
- async fn wallet_transfers(&mut self, _coin: &str, _from: &str, _to: &str, _amount: Decimal) -> Result<String, Error> { todo!() }
- async fn take_order(&mut self, _custom_id: &str, _origin_side: &str, _price: Decimal, _amount: Decimal) -> Result<Order, Error> { todo!() }
- async fn cancel_order(&mut self, _order_id: &str, _custom_id: &str) -> Result<Order, Error> { todo!() }
- async fn cancel_orders(&mut self) -> Result<Vec<Order>, Error> {
- todo!()
- }
- async fn command_order(&mut self, _order_command: OrderCommand) { todo!() }
- }
|