binance_spot.rs 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. // use std::collections::BTreeMap;
  2. // use std::io::{Error, ErrorKind};
  3. // use std::result::Result;
  4. // use async_trait::async_trait;
  5. // use rust_decimal::Decimal;
  6. // use rust_decimal_macros::dec;
  7. // use tracing::{warn};
  8. // use crate::{Platform, ExchangeEnum, Account, Position, Ticker, Market, Order, OrderCommand};
  9. // use exchanges::binance_spot_rest::BinanceSpotRest;
  10. // use global::trace_stack::TraceStack;
  11. //
  12. // #[allow(dead_code)]
  13. // #[derive(Clone)]
  14. // pub struct BinanceSpot {
  15. // exchange: ExchangeEnum,
  16. // symbol: String,
  17. // is_colo: bool,
  18. // params: BTreeMap<String, String>,
  19. // request: BinanceSpotRest,
  20. // }
  21. //
  22. // impl BinanceSpot {
  23. // pub fn new(symbol: String, is_colo: bool, params: BTreeMap<String, String>) -> BinanceSpot {
  24. // BinanceSpot {
  25. // exchange: ExchangeEnum::BinanceSpot,
  26. // symbol: symbol.to_uppercase(),
  27. // is_colo,
  28. // params: params.clone(),
  29. // request: BinanceSpotRest::new(is_colo, params.clone()),
  30. // }
  31. // }
  32. // }
  33. //
  34. //
  35. // #[async_trait]
  36. // impl Platform for BinanceSpot {
  37. // // 克隆方法
  38. // fn clone_box(&self) -> Box<dyn Platform + Send + Sync> { Box::new(self.clone()) }
  39. // // 获取交易所模式
  40. // fn get_self_exchange(&self) -> ExchangeEnum {
  41. // ExchangeEnum::BinanceSpot
  42. // }
  43. // // 获取交易对
  44. // fn get_self_symbol(&self) -> String { self.symbol.clone() }
  45. // // 获取是否使用高速通道
  46. // fn get_self_is_colo(&self) -> bool {
  47. // self.is_colo
  48. // }
  49. // // 获取登录params信息
  50. // fn get_self_params(&self) -> BTreeMap<String, String> {
  51. // self.params.clone()
  52. // }
  53. //
  54. // fn get_self_market(&self) -> Market {
  55. // warn!("binance_spot:该交易所方法未实现");
  56. // return Market::new();
  57. // }
  58. //
  59. // fn get_request_delays(&self) -> Vec<i64> {
  60. // warn!("binance_spot:该交易所方法未实现");
  61. // return vec![];
  62. // }
  63. //
  64. // fn get_request_avg_delay(&self) -> Decimal {
  65. // warn!("binance_spot:该交易所方法未实现");
  66. // return dec!(0);
  67. // }
  68. //
  69. // fn get_request_max_delay(&self) -> i64 {
  70. // warn!("binance_spot:该交易所方法未实现");
  71. // return 0;
  72. // }
  73. //
  74. // async fn get_server_time(&mut self) -> Result<String, Error> { Err(Error::new(ErrorKind::NotFound, "binance_spot:该交易所方法未实现".to_string())) }
  75. //
  76. // // 获取账号信息
  77. // async fn get_account(&mut self) -> Result<Account, Error> { Err(Error::new(ErrorKind::NotFound, "binance_spot:该交易所方法未实现".to_string())) }
  78. //
  79. // async fn get_spot_account(&mut self) -> Result<Vec<Account>, Error> { Err(Error::new(ErrorKind::NotFound, "binance_spot:该交易所方法未实现".to_string())) }
  80. //
  81. // // 获取仓位信息
  82. // async fn get_position(&mut self) -> Result<Vec<Position>, Error> { Err(Error::new(ErrorKind::NotFound, "binance_spot:该交易所方法未实现".to_string())) }
  83. //
  84. // async fn get_positions(&mut self) -> Result<Vec<Position>, Error> { Err(Error::new(ErrorKind::NotFound, "binance_spot:该交易所方法未实现".to_string())) }
  85. //
  86. // // 获取市场行情
  87. // async fn get_ticker(&mut self) -> Result<Ticker, Error> { Err(Error::new(ErrorKind::NotFound, "binance_spot:该交易所方法未实现".to_string())) }
  88. //
  89. // async fn get_ticker_symbol(&mut self, _symbol: String) -> Result<Ticker, Error> { Err(Error::new(ErrorKind::NotFound, "binance_spot:该交易所方法未实现".to_string())) }
  90. //
  91. // async fn get_market(&mut self) -> Result<Market, Error> { Err(Error::new(ErrorKind::NotFound, "binance_spot:该交易所方法未实现".to_string())) }
  92. //
  93. // async fn get_market_symbol(&mut self, _symbol: String) -> Result<Market, Error> { Err(Error::new(ErrorKind::NotFound, "binance_spot:该交易所方法未实现".to_string())) }
  94. //
  95. // async fn get_order_detail(&mut self, _order_id: &str, _custom_id: &str) -> Result<Order, Error> { Err(Error::new(ErrorKind::NotFound, "binance_spot:该交易所方法未实现".to_string())) }
  96. //
  97. // async fn get_orders_list(&mut self, _status: &str) -> Result<Vec<Order>, Error> { Err(Error::new(ErrorKind::NotFound, "binance_spot:该交易所方法未实现".to_string())) }
  98. //
  99. // async fn take_order(&mut self, _custom_id: &str, _origin_side: &str, _price: Decimal, _amount: Decimal) -> Result<Order, Error> { Err(Error::new(ErrorKind::NotFound, "binance_spot:该交易所方法未实现".to_string())) }
  100. //
  101. // async fn take_order_symbol(&mut self, _symbol: String, _ct_val: Decimal, _custom_id: &str, _origin_side: &str, _price: Decimal, _amount: Decimal) -> Result<Order, Error> { Err(Error::new(ErrorKind::NotFound, "binance_spot:该交易所方法未实现".to_string())) }
  102. //
  103. // async fn cancel_order(&mut self, _order_id: &str, _custom_id: &str) -> Result<Order, Error> { Err(Error::new(ErrorKind::NotFound, "binance_spot:该交易所方法未实现".to_string())) }
  104. //
  105. // async fn cancel_orders(&mut self) -> Result<Vec<Order>, Error> { Err(Error::new(ErrorKind::NotFound, "binance_spot:该交易所方法未实现".to_string())) }
  106. //
  107. // async fn cancel_orders_all(&mut self) -> Result<Vec<Order>, Error> { Err(Error::new(ErrorKind::NotFound, "binance_spot:该交易所方法未实现".to_string())) }
  108. //
  109. // async fn set_dual_mode(&mut self, _coin: &str, _is_dual_mode: bool) -> Result<String, Error> { Err(Error::new(ErrorKind::NotFound, "binance_spot:该交易所方法未实现".to_string())) }
  110. //
  111. // async fn set_dual_leverage(&mut self, _leverage: &str) -> Result<String, Error> { Err(Error::new(ErrorKind::NotFound, "binance_spot:该交易所方法未实现".to_string())) }
  112. //
  113. // async fn set_auto_deposit_status(&mut self, _status: bool) -> Result<String, Error> { Err(Error::new(ErrorKind::NotFound, "binance_spot:该交易所方法未实现".to_string())) }
  114. //
  115. // async fn wallet_transfers(&mut self, _coin: &str, _from: &str, _to: &str, _amount: Decimal) -> Result<String, Error> { Err(Error::new(ErrorKind::NotFound, "binance_spot:该交易所方法未实现".to_string())) }
  116. //
  117. // async fn command_order(&mut self, _order_command: OrderCommand, _trace_stack: TraceStack) { warn!("binance_spot:该交易所方法未实现"); }
  118. // }