main.rs 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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 export_balance;
  13. pub mod export_ticker;
  14. pub mod hl_pr_utile;
  15. pub mod swap_bybit;
  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_ticker1.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. // if true {
  46. // info!("----------正在导出Ticker信息----------");
  47. // let config_clone = config_obj.ticker_info.clone();
  48. // if http::proxy::ParsingDetail::http_enable_proxy(config_clone.proxy_address.clone()) {
  49. // info!("检测有代理配置,配置走代理");
  50. // }
  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. // //time_interval -数据请求的时间间隔 毫秒级
  67. // hl_pr_utile::export_ticker("WLD_USDT", "GATE", "10M", (1 * 60)).await;
  68. // }
  69. }