main.rs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. use tracing::info;
  2. use crate::utils::logs;
  3. use crate::utils::utils::{BalanceConfigInfo, TickerConfigInfo};
  4. pub mod swap_binance;
  5. pub mod swap_gate;
  6. pub mod swap_okx;
  7. pub mod robot_data;
  8. pub mod utils;
  9. pub mod http;
  10. pub mod struct_standard;
  11. pub mod export_template;
  12. pub mod handle_ticker;
  13. pub mod export_balance;
  14. pub mod export_ticker;
  15. mod hl_pr_utile;
  16. struct ConfigList {
  17. ticker_info: TickerConfigInfo,
  18. balance_info: BalanceConfigInfo,
  19. }
  20. #[tokio::main]
  21. async fn main() {
  22. logs::init_log_with_info();
  23. let ticker_config = utils::utils::get_ticker_config_info("./config_ticker.toml");
  24. let balance_config = utils::utils::get_balance_config_info("./config_balance.toml");
  25. let config_obj = ConfigList {
  26. ticker_info: ticker_config,
  27. balance_info: balance_config,
  28. };
  29. // if config_obj.ticker_info.is_export {
  30. // info!("----------正在导出Ticker信息----------");
  31. // let config_clone = config_obj.ticker_info.clone();
  32. // if http::proxy::ParsingDetail::http_enable_proxy(config_clone.proxy_address.clone()) {
  33. // info!("检测有代理配置,配置走代理");
  34. // }
  35. // export_ticker::export_ticker(config_clone).await;
  36. // }
  37. // if config_obj.balance_info.is_export {
  38. // info!("----------正在导出Balance信息----------");
  39. // let config_clone = config_obj.balance_info.clone();
  40. // if http::proxy::ParsingDetail::http_enable_proxy(config_clone.proxy_address.clone()) {
  41. // info!("检测有代理配置,配置走代理");
  42. // }
  43. // export_balance::export_balance(config_clone).await;
  44. // }
  45. //根据帧 来查看数据,规则:根据当前币对选择 时间范围,的秒级 ticker 数量
  46. if config_obj.ticker_info.is_export {
  47. info!("----------正在导出Ticker信息----------");
  48. let config_clone = config_obj.ticker_info.clone();
  49. if http::proxy::ParsingDetail::http_enable_proxy(config_clone.proxy_address.clone()) {
  50. info!("检测有代理配置,配置走代理");
  51. }
  52. // "10M" => (1000 * 60 * 10),
  53. // "20M" => (1000 * 60 * 20),
  54. // "30M" => (1000 * 60 * 30),
  55. // "1H" => (1000 * 60 * 60 * 1),
  56. // "10H" => (1000 * 60 * 60 * 10),
  57. // "1D" => (1000 * 60 * 60 * 24),
  58. // "2D" => (1000 * 60 * 60 * 24 * 2),
  59. // "3D" => (1000 * 60 * 60 * 24 * 3),
  60. // "5D" => (1000 * 60 * 60 * 24 * 5),
  61. // "1Z" => (1000 * 60 * 60 * 24 * 7),
  62. // "2Z" => (1000 * 60 * 60 * 24 * 7 * 2),
  63. // "4Z" => (1000 * 60 * 60 * 24 * 7 * 4),
  64. // 提示: 1. 代码颗粒度为秒级,100毫秒与999毫秒都归纳于1秒之内,
  65. // 2. 不同币对成交量可能存在差异,当前查询是1000条已经是最大值,但是有点币对交易量只有几百,但是有的可能好几千,这个需要酌情调整
  66. hl_pr_utile::export_ticker("XRP_USDT","GATE","30M").await;
  67. }
  68. }