| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- use tracing::{error, info};
- use crate::export::html::ExportExchangeTickerInfo;
- use crate::utils::logs;
- pub mod binance_swap;
- pub mod gate_swap;
- pub mod utils;
- pub mod http;
- pub mod struct_standard;
- pub mod export;
- pub mod handle_ticker;
- #[tokio::main]
- async fn main() {
- logs::init_log_with_info();
- let config = utils::utils::get_config_info("./config.toml");
- if http::proxy::ParsingDetail::http_enable_proxy(config.proxy_address) {
- info!("检测有代理配置,配置走代理");
- }
- let symbol = config.symbol;
- let start_at = config.range_time[0].clone();
- let end_at = config.range_time[1].clone();
- let export_path = if config.export_path == "" { None } else { Option::from(config.export_path.as_str()) };
- let export_name = if config.export_name == "" { None } else { Option::from(config.export_name.as_str()) };
- let mut exchange_list = vec![];
- for exchange in config.exchanges {
- let exchange_up = exchange.to_uppercase();
- let exchange_result = match exchange_up.as_str() {
- "BINANCE" => {
- let ticker_info = handle_ticker::get_binance_ticker_info(&symbol, &start_at, &end_at).await;
- ExportExchangeTickerInfo {
- name: exchange.to_string(),
- ticker_info,
- }
- }
- "GATE" => {
- let ticker_info = handle_ticker::get_gate_ticker_info(&symbol, &start_at, &end_at).await;
- ExportExchangeTickerInfo {
- name: exchange.to_string(),
- ticker_info,
- }
- }
- _ => {
- error!("交易所输入错误!");
- panic!("交易所输入错误!")
- }
- };
- exchange_list.push(exchange_result);
- }
- export::html::export_html(exchange_list, &symbol, &start_at, &end_at, export_path, export_name);
- }
|