π Upbit API for Rust
π μ¬μ©λ²
λ°©λ² 1: νκ²½ λ³μ μλ μ΄κΈ°ν (κΆμ₯)
use upbit;
async
λ°©λ² 2: ν μ€νΈμ© μ΄κΈ°ν
λ°©λ² 3: μλ μ€μ
use upbit;
set_access_key;
set_secret_key;
π Requirement
μ΄ λΌμ΄λΈλ¬λ¦¬λ openssl-sys ν¨ν€μ§κ° νμν©λλ€.
Linux (Ubuntu/Debian)
macOS
π¦ μ€μΉ
[]
= "1.15.0"
π§ μ€μ
λ°©λ² 1: .env νμΌ μ¬μ© (κΆμ₯)
- νλ‘μ νΈ λ£¨νΈμ
.envνμΌμ μμ±νμΈμ:
.env:
UPBIT_ACCESS_KEY="your_actual_access_key"
UPBIT_SECRET_KEY="your_actual_secret_key"
TEST_ACCESS_KEY="your_test_access_key"
TEST_SECRET_KEY="your_test_secret_key"
- μ½λμμ μ΄κΈ°ννμΈμ:
use upbit;
match init
λ°©λ² 2: Set Keys Manually
use upbit;
set_access_key;
set_secret_key;
use *;
// api_exchange
let account_info = get_account_info.await;
let order_chance = get_order_chance.await;
// [deprecated] let order_status_list = api_exchange::get_order_status_list().await;
let order_status = get_order_status_by_uuid.await;
let orders_status_open = get_order_status_list_by_uuids
let order_info = get_order_status_list_opened.await;
let orders_status_closed = get_order_status_list_closed.await;
let order_bid = order_by_price.await;
let order_ask = order_by_price.await;
let order_info = cancel_order.await;
// api_withdraw
let withdraw_result = withdraw_krw.await;
let withdraw_info = get_withdraw_info.await;
let withdraw_info_list = get_witrhdraw_info_list.await;
let withdraw_chance = get_withdraw_chance.await;
let withdraw_result_more_info = withdraw_coin.await;
// api_deposit
let deposit_result = deposit_krw.await
let deposit_result = get_deposit_info.await;
let deposit_result = get_deposit_info_list.await;
let coin_address_info = get_coin_address_info.await:
let coin_address_info_list = get_coin_address_info_list.await;
// api_quotation
let order_book_info = get_orderbook_info.await;
let ticker_snapshot = get_ticker_snapshot.await;
let recent_trade_list = get_trade_recent_list.await;
let market_state = get_market_state.await;
let chart_of_minute = get_candle_minute_list.await;
let chart_of_day = get_candle_day_list.await;
let chart_of_week = get_candle_week_list.await;
let chart_of_month = get_candle_month_list.await;
π TroubleShooting
1. You must have a static ip address to issue your own access key and secret key
2. Failed to run custom build command for openssl-sys vX.X.XX
If you have trouble installing with this error: failed to run custom build command for openssl-sys vX.X.XX,
try
macOS
$ brew install openssl@1.1
Arch Linux
$ sudo pacman -S pkg-config openssl
Debian and Ubuntu
$ sudo apt-get install pkg-config libssl-dev
Fedora
$ sudo dnf install pkg-config openssl-devel
referenced from https://github.com/sfackler/rust-openssl/issues/855#issuecomment-450057552