1 个不稳定版本
0.1.0 | 2022 年 10 月 26 日 |
---|
#3 在 #luno
19KB
460 行
Luno-rs (异步)
使用 Rust 编写的 Luno API 包装器,Rust 语言的 Rust 程序 https://www.luno.com/en/developers/api.
依赖关系
- reqwest
- serde
- serde_json
- tokio
配置
- 将以下内容添加到 Cargo.toml 中
luno_rs = "0.1.1"
或luno_rs = { git="https://github.com/borngraced/luno-rs"}
- 从 luno.com 获取您的 API 密钥和密钥
- 在您的项目路由中创建 .env 文件,并使用以下方式配置:
API_KEY=myapikey
API_SECRET=myapisecret
- 将 Luno 客户端导入到您的项目中,并初始化
use luno_rs::Luno;
#[tokio::test] // any other async runtime can be used, not limited to tokio
async fn test_luno_async() {
dotenv::dotenv().ok();
let key = env::var("API_KEY").expect("Api Key doesn't exist yet, please add");
let secret = env::var("API_SECRET").expect("Api Key Secret doesn't exist yet, please add");
let luno = luno_rs::Luno::init(key, secret).await;
let balance = luno.get_all_balance().await;
assert!(tickers.is_ok());
let all_balance: Vec<Balance> = balance.unwrap();
print!("{balance:#?}")
}
常规方法(完成后将添加更多)
可用的端点
- create_account()
- get_all_balance()
- get_ticker(pair: "XBTNGN")
- get_all_tickers()
- get_full_order_book(pair: "XBTNGN")
- get_top_order_book(pair: "XBTNGN")
待办事项
- update_account_name
- list_pending_transactions
- list_transactions
- list_account_balances
- list_recent_trades
- get_candles
- get_markets_info
- list_orders
- list_trades
- post_market_order
- get_order
- post_limit_order
- cancel_order
- get_receiver_address
- create_receiver_address
- send
- estimate_send_fee
- list_withdrawal_request
- request_a_withdrawal
- get_withdrawal_request
- cancel_withdrawal_request
- list_transfers
- list_eneficiaries
贡献
请随意处理任何待办事项:)
依赖关系
~6–21MB
~281K SLoC