|
|
@@ -24,61 +24,6 @@ use standard::exchange::{Exchange, ExchangeEnum};
|
|
|
use standard::{kucoin_spot_handle, Order, Platform, utils};
|
|
|
// use standard::{bitget_spot_handle, Order, Platform, utils};
|
|
|
|
|
|
-#[derive(Debug, Deserialize, Clone)]
|
|
|
-pub struct AccountInfo {
|
|
|
- pub gate_access_key: String,
|
|
|
- pub gate_secret_key: String,
|
|
|
- pub binance_access_key: String,
|
|
|
- pub binance_secret_key: String,
|
|
|
- pub kucoin_access_key: String,
|
|
|
- pub kucoin_secret_key: String,
|
|
|
- pub kucoin_pass: String,
|
|
|
- pub okx_access_key: String,
|
|
|
- pub okx_secret_key: String,
|
|
|
- pub okx_pass: String,
|
|
|
- pub bitget_access_key: String,
|
|
|
- pub bitget_secret_key: String,
|
|
|
- pub bitget_pass: String,
|
|
|
-}
|
|
|
-
|
|
|
-impl AccountInfo {
|
|
|
- pub fn new() -> AccountInfo {
|
|
|
- AccountInfo {
|
|
|
- gate_access_key: "".to_string(),
|
|
|
- gate_secret_key: "".to_string(),
|
|
|
- binance_access_key: "".to_string(),
|
|
|
- binance_secret_key: "".to_string(),
|
|
|
- kucoin_access_key: "".to_string(),
|
|
|
- kucoin_secret_key: "".to_string(),
|
|
|
- kucoin_pass: "".to_string(),
|
|
|
- okx_access_key: "".to_string(),
|
|
|
- okx_secret_key: "".to_string(),
|
|
|
- okx_pass: "".to_string(),
|
|
|
- bitget_access_key: "".to_string(),
|
|
|
- bitget_secret_key: "".to_string(),
|
|
|
- bitget_pass: "".to_string(),
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-// 获取文件内容
|
|
|
-pub fn get_account_info(file_path: &str) -> AccountInfo {
|
|
|
- let file = File::open(file_path);
|
|
|
- let mut contents = String::new();
|
|
|
- let result = match file {
|
|
|
- Ok(mut value) => {
|
|
|
- value.read_to_string(&mut contents).unwrap_or_default();
|
|
|
- from_str(&contents).unwrap_or(AccountInfo::new())
|
|
|
- }
|
|
|
- Err(_) => {
|
|
|
- trace!("没有获取到账号配置文件!");
|
|
|
- AccountInfo::new()
|
|
|
- }
|
|
|
- };
|
|
|
- result
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
// 创建实体
|
|
|
#[allow(dead_code)]
|
|
|
pub async fn test_new_exchange(exchange: ExchangeEnum, symbol: &str) -> Box<dyn Platform> {
|
|
|
@@ -86,7 +31,7 @@ pub async fn test_new_exchange(exchange: ExchangeEnum, symbol: &str) -> Box<dyn
|
|
|
let (order_sender, _order_receiver): (Sender<Order>, Receiver<Order>) = channel(1024);
|
|
|
let (error_sender, _error_receiver): (Sender<Error>, Receiver<Error>) = channel(1024);
|
|
|
|
|
|
- let account_info = get_account_info("config.toml");
|
|
|
+ let account_info = global::account_info::get_account_info("../test_account.toml");
|
|
|
match exchange {
|
|
|
ExchangeEnum::BinanceSwap => {
|
|
|
let mut params: BTreeMap<String, String> = BTreeMap::new();
|