skyfffire 3 долоо хоног өмнө
commit
d86c930614

+ 2 - 0
.gitignore

@@ -0,0 +1,2 @@
+/target
+Cargo.lock

+ 8 - 0
.idea/.gitignore

@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml

+ 8 - 0
.idea/extended.iml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="EMPTY_MODULE" version="4">
+  <component name="NewModuleRootManager">
+    <content url="file://$MODULE_DIR$" />
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+  </component>
+</module>

+ 8 - 0
.idea/modules.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectModuleManager">
+    <modules>
+      <module fileurl="file://$PROJECT_DIR$/.idea/extended.iml" filepath="$PROJECT_DIR$/.idea/extended.iml" />
+    </modules>
+  </component>
+</project>

+ 7 - 0
.idea/vcs.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="" vcs="Git" />
+    <mapping directory="$PROJECT_DIR$/rust-crypto-lib-base" vcs="Git" />
+  </component>
+</project>

+ 87 - 0
Cargo.toml

@@ -0,0 +1,87 @@
+[package]
+name = "extended"
+version = "0.1.0"
+edition = "2024"
+
+[dependencies]
+# 异步运行时,选择 tokio,并启用完整特性集(包含多线程运行时、net, time, fs, process, signal 等)
+# "full" 特性非常方便开发,生产环境可以根据实际需求裁剪
+tokio = { version = "1", features = ["full"] }
+
+# HTTP 客户端,用于 REST API 请求(获取交易对、下单等)
+# - "json": 启用 JSON 支持,方便发送和接收 JSON 数据
+# - "tokio-native-tls": 与 tokio 集成,支持 HTTPS (SSL/TLS),使用系统的 TLS 实现
+reqwest = { version = "0.11", features = ["json", "tokio-native-tls"] }
+
+
+ring = "0.16.20"
+base64 = "0.13"
+
+futures-channel = "0.3.28"
+
+# 解压缩
+flate2 = "1.0"
+
+# WebSocket 客户端,基于 tokio 构建,用于订阅 K 线和深度
+tokio-tungstenite= { git = "https://github.com/skyfffire/tokio-tungstenite-proxy.git" }
+
+# futures 工具库,提供一些异步编程中常用的 trait 和工具
+# 包含了 Stream 的一些方法,例如 split 用于分离 WebSocket stream 的读写端
+futures-util = "0.3"
+
+# URL 解析和构建库,在处理交易所端点或配置代理时可能会用到
+url = "2"
+
+# 序列化和反序列化框架,用于将 Rust 结构体与各种数据格式相互转换
+# - "derive": 启用 derive 宏,方便自动实现 Serialize 和 Deserialize trait
+serde = { version = "1", features = ["derive"] }
+
+# serde 的 JSON 实现,用于处理交易所 API 的 JSON 数据和应用配置(如果使用 JSON 格式)
+serde_json = "1"
+
+# 日志和诊断框架,推荐使用 tracing,功能强大且适合异步应用
+tracing = "0.1"
+
+# tracing 的 subscriber 实现,用于配置日志输出格式、目的地等
+# - "env-filter": 允许通过 RUST_LOG 环境变量控制日志级别
+# - "fmt": 提供格式化输出到控制台
+# - "json": 可选,如果需要结构化 JSON 日志
+tracing-subscriber = { version = "0.3", features = ["json", "fmt", "env-filter", "registry", "time"] }
+
+# 用于日志文件按日期滚动
+tracing-appender = "0.2"
+
+# 日期和时间处理
+chrono = "0.4"
+# 时区数据库,用于获取 Asia/Shanghai 时区
+chrono-tz = "0.8"
+# 确保 time crate 的特性被启用
+time = { version = "0.3", features = ["macros", "formatting", "parsing", "local-offset"] }
+
+# 简化错误处理的库,方便快速构建可链式调用的错误
+anyhow = "1"
+
+# 用于定义自定义错误类型的库,与 anyhow 配合使用,让错误更具语义
+thiserror = "1"
+
+# 异步 SQL 数据库客户端,选择支持 tokio 和 SQLite 的版本,用于存储配置等
+# - "runtime-tokio": 使用 tokio 作为异步运行时
+# - "sqlite": 启用 SQLite 驱动
+# - "macros": 启用宏支持,用于 compile-time query checking (强烈推荐)
+# - "offline": 用于离线模式下的宏检查 (与 "macros" 配合使用)
+sqlx = { version = "0.7", features = ["runtime-tokio", "sqlite", "macros"] }
+backtrace = "0.3.74"
+
+prost = "0.11"
+hex = "0.4.3"
+
+##代替f64避免精度丢失
+rust_decimal = "1.32.0"
+rust_decimal_macros = "1.32.0"
+
+# =======================================================
+# 以下是一些在开发过程中可能会用到的devDependencies,只用于开发和测试,不包含在最终发布版本中
+[dev-dependencies]
+
+[build-dependencies]
+prost-build = "0.11" # 或者最新版本

+ 1 - 0
rust-crypto-lib-base

@@ -0,0 +1 @@
+Subproject commit edb3fa333ac7090ba76a624301e76b842c7399d2

+ 3 - 0
src/main.rs

@@ -0,0 +1,3 @@
+fn main() {
+    println!("Hello, world!");
+}