1 unstable release
new 0.1.0 | May 2, 2025 |
---|
#260 in Magic Beans
30KB
691 lines
crypto_trading
crypto_trading
is a wrapping library that allows you to easily use Binance's price information and various APIs.
Getting Started
you need to set up a .env file.
- Make
.env
file - Setting
BINANCE_SECRET_KEY
andBINANCE_API_KEY
- You add the dotenv crate dependency.
- Set the main statement as follows.
dotenv::dotenv().ok();
example
use crypto_trading::{adapter::common::BinanceCommon, port::binance_port::CommonPort};
#[tokio::main]
async fn main() {
dotenv::dotenv().ok();
let binance_common = BinanceCommon::new();
let klines = binance_common.get_kline("BTCUSDT", "1m", None).await.unwrap();
println!("{:?}", klines);
}
Can API
Refer to the Binance API site. https://developers.binance.com/docs/derivatives/usds-margined-futures/general-info
common
- kline data
trade
- change leverage
users
- get_account_balance
In the future, i will develop a way to wrap various APIs so that they can be used easily.
Dependencies
~9–21MB
~286K SLoC