# binance.ex
[![Hex.pm Version](https://img.shields.io/hexpm/v/binance)](https://hex.pm/packages/binance)
[![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/binance)
[![Hex.pm Download Total](https://img.shields.io/hexpm/dt/binance)](https://hex.pm/packages/binance)
Unofficial Elixir wrapper for interacting with the [Binance API](https://github.com/binance/binance-spot-api-docs).
**NOTE: v2 is a full rewrite that's now fully auto-generated from the Binance docs. There are breaking changes, and it's not as battle-tested as v1 yet. If you don't need any of the new endpoints, [stick to v1](https://github.com/dvcrn/binance.ex/tree/v1) for now.**
## Installation
1. The package can be installed by adding `binance` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:binance, "~> 2.0.1"}
]
end
```
2. Add your Binance API credentials to your `config.exs` file, like so (you can create a new API
key [here](https://www.binance.com/en/my/settings/api-management)):
```
config :binance,
api_key: "xxx",
secret_key: "xxx",
end_point: "https://api.binance.us" # Add for the US API end point. The default is for "https://api.binance.com"
```
## Features
- Fully autogenerated from Binance documentation using metaprogramming
- Mandatory parameters are parsed into function arguments, optional parameters into `opts` in true elixir fashion
- Nice docs and typespecs (although currently with `any()`) for all endpoints:
```
iex(24)> h Binance.Trade.post_order
def post_order(symbol, side, type, opts \\ [])
@spec post_order(any(), any(), any(),
recvWindow: any(),
newOrderRespType: any(),
icebergQty: any(),
trailingDelta: any(),
stopPrice: any(),
strategyType: any(),
strategyId: any(),
newClientOrderId: any(),
price: any(),
quoteOrderQty: any(),
quantity: any(),
timeInForce: any(),
timestamp: any()
) :: {:ok, any()} | {:error, any()}
New Order (TRADE)
Send in a new order.
• LIMIT_MAKER are LIMIT orders that will be rejected if they would
immediately match and trade as a taker.
• STOP_LOSS and TAKE_PROFIT will execute a MARKET order when the
stopPrice is reached.
• Any LIMIT or LIMIT_MAKER type order can be made an iceberg order by
sending an icebergQty.
• Any order with an icebergQty MUST have timeInForce set to GTC.
• MARKET orders using quantity specifies how much a user wants to buy or
sell based on the market price.
• MARKET orders using quoteOrderQty specifies the amount the user wants
to spend (when buying) or receive (when selling) of the quote asset; the
correct quantity will be determined based on the market liquidity and
quoteOrderQty.
• MARKET orders using quoteOrderQty will not break LOT_SIZE filter rules;
the order will execute a quantity that will have the notional value as
close as possible to quoteOrderQty.
• same newClientOrderId can be accepted only when the previous one is
filled, otherwise the order will be rejected.
Trigger order price rules against market price for both MARKET and LIMIT
versions:
• Price above market price: STOP_LOSS BUY, TAKE_PROFIT SELL
• Price below market price: STOP_LOSS SELL, TAKE_PROFIT BUY
Weight(IP): 1
Details:
• METHOD: post
• URL: /api/v3/order
Mandatory params:
• symbol - Trading symbol, e.g. BNBUSDT
• side -
• type - Order type
Optional params:
• timestamp - timestamp
• timeInForce - Order time in force
• quantity - Order quantity
• quoteOrderQty - Quote quantity
• price - Order price
• newClientOrderId - A unique id among open orders. Automatically
generated if not sent.
• strategyId -
• strategyType - The value cannot be less than 1000000
• stopPrice - Used with STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, and
TAKE_PROFIT_LIMIT orders.
• trailingDelta - Used with STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, and
TAKE_PROFIT_LIMIT orders.
• icebergQty - Used with LIMIT, STOP_LOSS_LIMIT, and TAKE_PROFIT_LIMIT to
create an iceberg order.
• newOrderRespType - Set the response JSON. MARKET and LIMIT order types
default to FULL, all other orders default to ACK.
• recvWindow - The value cannot be greater than 60000
```
### Supported endpoints
### Group: BLVT
- get_blvt_redeem_record (get:/sapi/v1/blvt/redeem/record)
- get_blvt_subscribe_record (get:/sapi/v1/blvt/subscribe/record)
- get_blvt_token_info (get:/sapi/v1/blvt/tokenInfo)
- get_blvt_user_limit (get:/sapi/v1/blvt/userLimit)
- post_blvt_redeem (post:/sapi/v1/blvt/redeem)
- post_blvt_subscribe (post:/sapi/v1/blvt/subscribe)
### Group: BSwap
- get_bswap_add_liquidity_preview (get:/sapi/v1/bswap/addLiquidityPreview)
- get_bswap_claimed_history (get:/sapi/v1/bswap/claimedHistory)
- get_bswap_liquidity (get:/sapi/v1/bswap/liquidity)
- get_bswap_liquidity_ops (get:/sapi/v1/bswap/liquidityOps)
- get_bswap_pool_configure (get:/sapi/v1/bswap/poolConfigure)
- get_bswap_pools (get:/sapi/v1/bswap/pools)
- get_bswap_quote (get:/sapi/v1/bswap/quote)
- get_bswap_remove_liquidity_preview (get:/sapi/v1/bswap/removeLiquidityPreview)
- get_bswap_swap (get:/sapi/v1/bswap/swap)
- get_bswap_unclaimed_rewards (get:/sapi/v1/bswap/unclaimedRewards)
- post_bswap_claim_rewards (post:/sapi/v1/bswap/claimRewards)
- post_bswap_liquidity_add (post:/sapi/v1/bswap/liquidityAdd)
- post_bswap_liquidity_remove (post:/sapi/v1/bswap/liquidityRemove)
- post_bswap_swap (post:/sapi/v1/bswap/swap)
### Group: C2C
- get_c2c_order_match_list_user_order_history (get:/sapi/v1/c2c/orderMatch/listUserOrderHistory)
### Group: Convert
- get_convert_asset_info (get:/sapi/v1/convert/assetInfo)
- get_convert_exchange_info (get:/sapi/v1/convert/exchangeInfo)
- get_convert_order_status (get:/sapi/v1/convert/orderStatus)
- get_convert_trade_flow (get:/sapi/v1/convert/tradeFlow)
- post_convert_accept_quote (post:/sapi/v1/convert/acceptQuote)
- post_convert_get_quote (post:/sapi/v1/convert/getQuote)
### Group: Crypto Loans
- get_loan_borrow_history (get:/sapi/v1/loan/borrow/history)
- get_loan_collateral_data (get:/sapi/v1/loan/collateral/data)
- get_loan_income (get:/sapi/v1/loan/income)
- get_loan_loanable_data (get:/sapi/v1/loan/loanable/data)
- get_loan_ltv_adjustment_history (get:/sapi/v1/loan/ltv/adjustment/history)
- get_loan_ongoing_orders (get:/sapi/v1/loan/ongoing/orders)
- get_loan_repay_collateral_rate (get:/sapi/v1/loan/repay/collateral/rate)
- get_loan_repay_history (get:/sapi/v1/loan/repay/history)
- post_loan_adjust_ltv (post:/sapi/v1/loan/adjust/ltv)
- post_loan_borrow (post:/sapi/v1/loan/borrow)
- post_loan_customize_margin_call (post:/sapi/v1/loan/customize/margin_call)
- post_loan_repay (post:/sapi/v1/loan/repay)
### Group: Fiat
- get_fiat_orders (get:/sapi/v1/fiat/orders)
- get_fiat_payments (get:/sapi/v1/fiat/payments)
### Group: Futures
- get_futures_loan_adjust_collateral_history (get:/sapi/v1/futures/loan/adjustCollateral/history)
- get_futures_loan_borrow_history (get:/sapi/v1/futures/loan/borrow/history)
- get_futures_loan_interest_history (get:/sapi/v1/futures/loan/interestHistory)
- get_futures_loan_liquidation_history (get:/sapi/v1/futures/loan/liquidationHistory)
- get_futures_loan_repay_history (get:/sapi/v1/futures/loan/repay/history)
- get_futures_loan_wallet (get:/sapi/v2/futures/loan/wallet)
- get_futures_transfer (get:/sapi/v1/futures/transfer)
- post_futures_transfer (post:/sapi/v1/futures/transfer)
### Group: Futures Algo
- delete_algo_futures_order (delete:/sapi/v1/algo/futures/order)
- get_algo_futures_historical_orders (get:/sapi/v1/algo/futures/historicalOrders)
- get_algo_futures_open_orders (get:/sapi/v1/algo/futures/openOrders)
- get_algo_futures_sub_orders (get:/sapi/v1/algo/futures/subOrders)
- post_algo_futures_new_order_twap (post:/sapi/v1/algo/futures/newOrderTwap)
- post_algo_futures_new_order_vp (post:/sapi/v1/algo/futures/newOrderVp)
### Group: Gift Card
- get_giftcard_buy_code_token_limit (get:/sapi/v1/giftcard/buyCode/token-limit)
- get_giftcard_cryptography_rsa_public_key (get:/sapi/v1/giftcard/cryptography/rsa-public-key)
- get_giftcard_verify (get:/sapi/v1/giftcard/verify)
- post_giftcard_buy_code (post:/sapi/v1/giftcard/buyCode)
- post_giftcard_create_code (post:/sapi/v1/giftcard/createCode)
- post_giftcard_redeem_code (post:/sapi/v1/giftcard/redeemCode)
### Group: Margin
- delete_margin_order_list (delete:/sapi/v1/margin/orderList)
- post_margin_isolated_account (post:/sapi/v1/margin/isolated/account)
- get_margin_open_order_list (get:/sapi/v1/margin/openOrderList)
- get_margin_max_borrowable (get:/sapi/v1/margin/maxBorrowable)
- post_margin_order_oco (post:/sapi/v1/margin/order/oco)
- get_margin_max_transferable (get:/sapi/v1/margin/maxTransferable)
- get_margin_interest_rate_history (get:/sapi/v1/margin/interestRateHistory)
- get_margin_interest_history (get:/sapi/v1/margin/interestHistory)
- get_margin_my_trades (get:/sapi/v1/margin/myTrades)
- get_margin_transfer (get:/sapi/v1/margin/transfer)
- post_margin_isolated_transfer (post:/sapi/v1/margin/isolated/transfer)
- post_margin_loan (post:/sapi/v1/margin/loan)
- get_margin_loan (get:/sapi/v1/margin/loan)
- get_margin_account (get:/sapi/v1/margin/account)
- get_margin_isolated_transfer (get:/sapi/v1/margin/isolated/transfer)
- get_margin_isolated_pair (get:/sapi/v1/margin/isolated/pair)
- get_margin_isolated_margin_data (get:/sapi/v1/margin/isolatedMarginData)
- post_margin_transfer (post:/sapi/v1/margin/transfer)
- post_margin_order (post:/sapi/v1/margin/order)
- get_margin_order_list (get:/sapi/v1/margin/orderList)
- get_margin_order (get:/sapi/v1/margin/order)
- get_bnb_burn (get:/sapi/v1/bnbBurn)
- get_margin_all_assets (get:/sapi/v1/margin/allAssets)
- get_margin_all_orders (get:/sapi/v1/margin/allOrders)
- get_margin_isolated_account (get:/sapi/v1/margin/isolated/account)
- get_margin_force_liquidation_rec (get:/sapi/v1/margin/forceLiquidationRec)
- post_bnb_burn (post:/sapi/v1/bnbBurn)
- post_margin_repay (post:/sapi/v1/margin/repay)
- delete_margin_open_orders (delete:/sapi/v1/margin/openOrders)
- get_margin_pair (get:/sapi/v1/margin/pair)
- get_margin_all_pairs (get:/sapi/v1/margin/allPairs)
- get_margin_price_index (get:/sapi/v1/margin/priceIndex)
- get_margin_trade_coeff (get:/sapi/v1/margin/tradeCoeff)
- get_margin_isolated_margin_tier (get:/sapi/v1/margin/isolatedMarginTier)
- get_margin_dribblet (get:/sapi/v1/margin/dribblet)
- get_margin_repay (get:/sapi/v1/margin/repay)
- get_margin_cross_margin_data (get:/sapi/v1/margin/crossMarginData)
- delete_margin_order (delete:/sapi/v1/margin/order)
- get_margin_all_order_list (get:/sapi/v1/margin/allOrderList)
- get_margin_isolated_account_limit (get:/sapi/v1/margin/isolated/accountLimit)
- get_margin_isolated_all_pairs (get:/sapi/v1/margin/isolated/allPairs)
- get_margin_asset (get:/sapi/v1/margin/asset)
- get_margin_rate_limit_order (get:/sapi/v1/margin/rateLimit/order)
- get_margin_open_orders (get:/sapi/v1/margin/openOrders)
- delete_margin_isolated_account (delete:/sapi/v1/margin/isolated/account)
### Group: Market
- get_agg_trades (get:/api/v3/aggTrades)
- get_avg_price (get:/api/v3/avgPrice)
- get_depth (get:/api/v3/depth)
- get_exchange_info (get:/api/v3/exchangeInfo)
- get_historical_trades (get:/api/v3/historicalTrades)
- get_klines (get:/api/v3/klines)
- get_ping (get:/api/v3/ping)
- get_ticker (get:/api/v3/ticker)
- get_ticker_24hr (get:/api/v3/ticker/24hr)
- get_ticker_book_ticker (get:/api/v3/ticker/bookTicker)
- get_ticker_price (get:/api/v3/ticker/price)
- get_time (get:/api/v3/time)
- get_trades (get:/api/v3/trades)
- get_ui_klines (get:/api/v3/uiKlines)
### Group: Mining
- get_mining_hash_transfer_config_details_list (get:/sapi/v1/mining/hash-transfer/config/details/list)
- get_mining_hash_transfer_profit_details (get:/sapi/v1/mining/hash-transfer/profit/details)
- get_mining_payment_list (get:/sapi/v1/mining/payment/list)
- get_mining_payment_other (get:/sapi/v1/mining/payment/other)
- get_mining_payment_uid (get:/sapi/v1/mining/payment/uid)
- get_mining_pub_algo_list (get:/sapi/v1/mining/pub/algoList)
- get_mining_pub_coin_list (get:/sapi/v1/mining/pub/coinList)
- get_mining_statistics_user_list (get:/sapi/v1/mining/statistics/user/list)
- get_mining_statistics_user_status (get:/sapi/v1/mining/statistics/user/status)
- get_mining_worker_detail (get:/sapi/v1/mining/worker/detail)
- get_mining_worker_list (get:/sapi/v1/mining/worker/list)
- post_mining_hash_transfer_config (post:/sapi/v1/mining/hash-transfer/config)
- post_mining_hash_transfer_config_cancel (post:/sapi/v1/mining/hash-transfer/config/cancel)
### Group: NFT
- get_nft_history_deposit (get:/sapi/v1/nft/history/deposit)
- get_nft_history_transactions (get:/sapi/v1/nft/history/transactions)
- get_nft_history_withdraw (get:/sapi/v1/nft/history/withdraw)
- get_nft_user_get_asset (get:/sapi/v1/nft/user/getAsset)
### Group: Pay
- get_pay_transactions (get:/sapi/v1/pay/transactions)
### Group: Portfolio Margin
- get_portfolio_account (get:/sapi/v1/portfolio/account)
- get_portfolio_collateral_rate (get:/sapi/v1/portfolio/collateralRate)
- get_portfolio_pm_loan (get:/sapi/v1/portfolio/pmLoan)
- post_portfolio_repay (post:/sapi/v1/portfolio/repay)
### Group: Rebate
- get_rebate_tax_query (get:/sapi/v1/rebate/taxQuery)
### Group: Savings
- get_lending_daily_product_list (get:/sapi/v1/lending/daily/product/list)
- get_lending_daily_token_position (get:/sapi/v1/lending/daily/token/position)
- get_lending_daily_user_left_quota (get:/sapi/v1/lending/daily/userLeftQuota)
- get_lending_daily_user_redemption_quota (get:/sapi/v1/lending/daily/userRedemptionQuota)
- get_lending_project_list (get:/sapi/v1/lending/project/list)
- get_lending_project_position_list (get:/sapi/v1/lending/project/position/list)
- get_lending_union_account (get:/sapi/v1/lending/union/account)
- get_lending_union_interest_history (get:/sapi/v1/lending/union/interestHistory)
- get_lending_union_purchase_record (get:/sapi/v1/lending/union/purchaseRecord)
- get_lending_union_redemption_record (get:/sapi/v1/lending/union/redemptionRecord)
- post_lending_customized_fixed_purchase (post:/sapi/v1/lending/customizedFixed/purchase)
- post_lending_daily_purchase (post:/sapi/v1/lending/daily/purchase)
- post_lending_daily_redeem (post:/sapi/v1/lending/daily/redeem)
- post_lending_position_changed (post:/sapi/v1/lending/positionChanged)
### Group: Staking
- get_staking_personal_left_quota (get:/sapi/v1/staking/personalLeftQuota)
- get_staking_position (get:/sapi/v1/staking/position)
- get_staking_product_list (get:/sapi/v1/staking/productList)
- get_staking_staking_record (get:/sapi/v1/staking/stakingRecord)
- post_staking_purchase (post:/sapi/v1/staking/purchase)
- post_staking_redeem (post:/sapi/v1/staking/redeem)
- post_staking_set_auto_staking (post:/sapi/v1/staking/setAutoStaking)
### Group: Sub-Account
- post_sub_account_transfer_sub_to_master (post:/sapi/v1/sub-account/transfer/subToMaster)
- get_sub_account_futures_position_risk (get:/sapi/v2/sub-account/futures/positionRisk)
- post_sub_account_margin_enable (post:/sapi/v1/sub-account/margin/enable)
- get_sub_account_transfer_sub_user_history (get:/sapi/v1/sub-account/transfer/subUserHistory)
- get_capital_deposit_sub_address (get:/sapi/v1/capital/deposit/subAddress)
- get_sub_account_futures_internal_transfer (get:/sapi/v1/sub-account/futures/internalTransfer)
- get_sub_account_margin_account_summary (get:/sapi/v1/sub-account/margin/accountSummary)
- post_sub_account_futures_transfer (post:/sapi/v1/sub-account/futures/transfer)
- get_sub_account_assets (get:/sapi/v3/sub-account/assets)
- post_sub_account_margin_transfer (post:/sapi/v1/sub-account/margin/transfer)
- get_sub_account_sub_transfer_history (get:/sapi/v1/sub-account/sub/transfer/history)
- get_managed_subaccount_asset (get:/sapi/v1/managed-subaccount/asset)
- get_managed_subaccount_account_snapshot (get:/sapi/v1/managed-subaccount/accountSnapshot)
- post_sub_account_universal_transfer (post:/sapi/v1/sub-account/universalTransfer)
- post_sub_account_futures_internal_transfer (post:/sapi/v1/sub-account/futures/internalTransfer)
- get_sub_account_list (get:/sapi/v1/sub-account/list)
- post_sub_account_sub_account_api_ip_restriction_ip_list (post:/sapi/v1/sub-account/subAccountApi/ipRestriction/ipList)
- get_sub_account_sub_account_api_ip_restriction (get:/sapi/v1/sub-account/subAccountApi/ipRestriction)
- post_managed_subaccount_deposit (post:/sapi/v1/managed-subaccount/deposit)
- get_sub_account_spot_summary (get:/sapi/v1/sub-account/spotSummary)
- get_sub_account_api_restrictions_ip_restriction_third_party_list (get:/sapi/v1/sub-account/apiRestrictions/ipRestriction/thirdPartyList)
- post_sub_account_virtual_sub_account (post:/sapi/v1/sub-account/virtualSubAccount)
- get_sub_account_universal_transfer (get:/sapi/v1/sub-account/universalTransfer)
- post_managed_subaccount_withdraw (post:/sapi/v1/managed-subaccount/withdraw)
- post_sub_account_sub_account_api_ip_restriction (post:/sapi/v2/sub-account/subAccountApi/ipRestriction)
- get_sub_account_status (get:/sapi/v1/sub-account/status)
- delete_sub_account_sub_account_api_ip_restriction_ip_list (delete:/sapi/v1/sub-account/subAccountApi/ipRestriction/ipList)
- post_sub_account_blvt_enable (post:/sapi/v1/sub-account/blvt/enable)
- get_sub_account_futures_account (get:/sapi/v2/sub-account/futures/account)
- get_capital_deposit_sub_hisrec (get:/sapi/v1/capital/deposit/subHisrec)
- get_sub_account_margin_account (get:/sapi/v1/sub-account/margin/account)
- get_sub_account_futures_account_summary (get:/sapi/v2/sub-account/futures/accountSummary)
- post_sub_account_transfer_sub_to_sub (post:/sapi/v1/sub-account/transfer/subToSub)
- post_sub_account_futures_enable (post:/sapi/v1/sub-account/futures/enable)
### Group: Trade
- delete_open_orders (delete:/api/v3/openOrders)
- delete_order (delete:/api/v3/order)
- delete_order_list (delete:/api/v3/orderList)
- get_account (get:/api/v3/account)
- get_all_order_list (get:/api/v3/allOrderList)
- get_all_orders (get:/api/v3/allOrders)
- get_my_trades (get:/api/v3/myTrades)
- get_open_order_list (get:/api/v3/openOrderList)
- get_open_orders (get:/api/v3/openOrders)
- get_order (get:/api/v3/order)
- get_order_list (get:/api/v3/orderList)
- get_rate_limit_order (get:/api/v3/rateLimit/order)
- post_order (post:/api/v3/order)
- post_order_cancel_replace (post:/api/v3/order/cancelReplace)
- post_order_oco (post:/api/v3/order/oco)
- post_order_test (post:/api/v3/order/test)
### Group: User Data Stream
- delete_user_data_stream (delete:/sapi/v1/userDataStream)
- delete_user_data_stream_isolated (delete:/sapi/v1/userDataStream/isolated)
- post_user_data_stream (post:/sapi/v1/userDataStream)
- post_user_data_stream_isolated (post:/sapi/v1/userDataStream/isolated)
- put_user_data_stream (put:/sapi/v1/userDataStream)
- put_user_data_stream_isolated (put:/sapi/v1/userDataStream/isolated)
### Group: Wallet
- get_account_api_restrictions (get:/sapi/v1/account/apiRestrictions)
- get_account_api_trading_status (get:/sapi/v1/account/apiTradingStatus)
- get_account_snapshot (get:/sapi/v1/accountSnapshot)
- get_account_status (get:/sapi/v1/account/status)
- get_asset_asset_detail (get:/sapi/v1/asset/assetDetail)
- get_asset_asset_dividend (get:/sapi/v1/asset/assetDividend)
- get_asset_convert_transfer_query_by_page (get:/sapi/v1/asset/convert-transfer/queryByPage)
- get_asset_dribblet (get:/sapi/v1/asset/dribblet)
- get_asset_ledger_transfer_cloud_mining_query_by_page (get:/sapi/v1/asset/ledger-transfer/cloud-mining/queryByPage)
- get_asset_trade_fee (get:/sapi/v1/asset/tradeFee)
- get_asset_transfer (get:/sapi/v1/asset/transfer)
- get_capital_config_getall (get:/sapi/v1/capital/config/getall)
- get_capital_deposit_address (get:/sapi/v1/capital/deposit/address)
- get_capital_deposit_hisrec (get:/sapi/v1/capital/deposit/hisrec)
- get_capital_withdraw_history (get:/sapi/v1/capital/withdraw/history)
- get_system_status (get:/sapi/v1/system/status)
- post_account_disable_fast_withdraw_switch (post:/sapi/v1/account/disableFastWithdrawSwitch)
- post_account_enable_fast_withdraw_switch (post:/sapi/v1/account/enableFastWithdrawSwitch)
- post_asset_convert_transfer (post:/sapi/v1/asset/convert-transfer)
- post_asset_dust (post:/sapi/v1/asset/dust)
- post_asset_dust_btc (post:/sapi/v1/asset/dust-btc)
- post_asset_get_funding_asset (post:/sapi/v1/asset/get-funding-asset)
- post_asset_get_user_asset (post:/sapi/v3/asset/getUserAsset)
- post_asset_transfer (post:/sapi/v1/asset/transfer)
- post_capital_withdraw_apply (post:/sapi/v1/capital/withdraw/apply)
### Group: VIP Loans
- get_loan_vip_collateral_account (get:/sapi/v1/loan/vip/collateral/account)
- get_loan_vip_ongoing_orders (get:/sapi/v1/loan/vip/ongoing/orders)
- get_loan_vip_repay_history (get:/sapi/v1/loan/vip/repay/history)
- post_loan_vip_repay (post:/sapi/v1/loan/vip/repay)
## Caveats
- Most endpoints don't have proper response structs assigned to them yet due to them not being available in the docs, this will change over time
- Typespec for arguments is currently `any()`, same reason: lack of types in the definition used
## Usage
Documentation available at [https://hexdocs.pm/binance](https://hexdocs.pm/binance) (make sure you have 2.0.0 selected)
### Get all prices
```
iex> Binance.Market.get_ticker_price
{:ok,
[
%Binance.Structs.SymbolPrice{symbol: "ETHBTC", price: "0.06275000"},
%Binance.Structs.SymbolPrice{symbol: "LTCBTC", price: "0.00363100"},
%Binance.Structs.SymbolPrice{symbol: "BNBBTC", price: "0.00804100"},
%Binance.Structs.SymbolPrice{symbol: "NEOBTC", price: "0.00031420"},
%Binance.Structs.SymbolPrice{symbol: "QTUMETH", price: "0.00147800"},
%Binance.Structs.SymbolPrice{symbol: "EOSETH", price: "0.00039460"},
%Binance.Structs.SymbolPrice{symbol: "SNTETH", price: "0.00001240"},
%Binance.Structs.SymbolPrice{symbol: "BNTETH", price: "0.00020200"},
%Binance.Structs.SymbolPrice{symbol: "BCCBTC", price: "0.07908100"},
%Binance.Structs.SymbolPrice{symbol: "GASBTC", price: "0.00008800"},
%Binance.Structs.SymbolPrice{symbol: "BNBETH", price: "0.12810000"},
%Binance.Structs.SymbolPrice{symbol: "BTCUSDT", price: "30526.74000000"},
%Binance.Structs.SymbolPrice{symbol: "ETHUSDT", price: "1915.16000000"},
...
]}
```
### Buy 0.01 BNB for the current market price
```
iex> Binance.Trade.post_order "BNBUSDT", "BUY", "MARKET", quantity: 0.01
```
### Earn
#### Get all earn positions
```elixir
iex> Binance.Staking.get_staking_position "STAKING"
```
#### Get all earn products
```elixir
iex> Binance.Staking.get_staking_product_list "STAKING"
```
#### Redeem all flexible staked assets
```elixir
with {:ok, positions} <- Binance.Savings.get_lending_daily_token_position("") do
positions
|> Enum.map(
&Binance.Savings.post_lending_daily_redeem(&1.productId, &1.totalAmount, "FAST"
)
)
end
```
## License
MIT