I'm probably just nerding out but I'm actually really excited about this.
Algorithmic traders used to rely on third-party libraries to interact with the Binance API. Well, Binance just rolled out a massive Library that covers pretty much everything from Spot trading to Loans as well as Staking and NFTs.
That means no more dealing with Github repositories that only work half the time and are not maintained or are simply abandoned. In the long run, this is going to significantly simplify and make algorithmic trading more accessible by making it easier for people to interact with the API in a direct and efficient manner.
Here's just how easy it is to programmatically place an order using the new Binance Connector Library:
Install the Binance connector library:
pip install binance-connector
Import the Binance Client:
from binance.client import Client
Authenticate and select the Spot client for spot trading
client = Spot(api_key='KEY', api_secret='SECRET')
Place a Market Buy Order
# Post a new order params = { 'symbol': 'BTCUSDT', 'side': 'BUY', 'type': 'MARKET', 'quantity': 0.002, } response = client.new_order(**params) print(response)
And that's all it takes to programmatically create a market buy order. Other functions are even easier to accomplish. For instance, you can fetch the last 500 1m candles for a symbol of your choice in fewer characters than it took me to explain it.
print(client.klines("BTCUSDT", "1m"))
These are just two of the methods made available with this library. Just to get a sense of how much infrastructure Binance wrote in this new library, I compiled a list of all available functions from this library according to the endpoints that they use:
MARKET: ping, time, exchange_info, depth, trades, historical_trades, agg_trades, klines, ui_klines, avg_price, ticker_24hr, ticker_price, book_ticker, rolling_window_ticker
ACCOUNT (including orders and trades): new_order_test, new_order, cancel_order, cancel_open_orders, get_order, cancel_and_replace, get_open_orders, get_orders, new_oco_order, cancel_oco_order, get_oco_order, get_oco_orders, get_oco_open_orders, account, my_trades, get_order_rate_limit
STREAMS: new_listen_key, renew_listen_key, close_listen_key, new_margin_listen_key, renew_margin_listen_key, close_margin_listen_key, new_isolated_margin_listen_key, renew_isolated_margin_listen_key, close_isolated_margin_listen_key
MARGIN: margin_transfer, margin_borrow, margin_repay, margin_asset, margin_pair, margin_all_assets, margin_all_pairs, margin_pair_index, new_margin_order, cancel_margin_order, margin_transfer_history, margin_load_record, margin_repay_record, margin_interest_history, margin_force_liquidation_record, margin_account, margin_order, margin_open_orders, margin_open_orders_cancellation, margin_all_orders, margin_my_trades, margin_max_borrowable, margin_max_transferable, isolated_margin_transfer, isolated_margin_transfer_history, isolated_margin_account, isolated_margin_pair, isolated_margin_all_pairs, toggle_bnbBurn, bnbBurn_status, margin_interest_rate_history, new_margin_oco_order, cancel_margin_oco_order, get_margin_oco_order, get_margin_oco_orders, get_margin_open_oco_orders, cancel_isolated_margin_account, enable_isolated_margin_account, isolated_margin_account_limit, margin_fee, isolated_margin_fee, isolated_margin_tier, margin_order_usage, margin_dust_log, summary_of_margin_account
SAVINGS: savings_flexible_products, savings_flexible_user_left_quota, savings_purchase_flexible_product, savings_flexible_user_redemption_quota, savings_flexible_redeem, savings_flexible_product_position, savings_project_list, savings_purchase_project, savings_project_position, savings_account, savings_purchase_record, savings_redemption_record, savings_interest_history, savings_change_position
Staking: staking_product_list, staking_purchase_product, staking_redeem_product, staking_product_position, staking_history, staking_set_auto_staking, staking_product_quota
WALLET: system_status, coin_info, account_snapshot, disable_fast_withdraw, enable_fast_withdraw, withdraw, deposit_history, withdraw_history, deposit_address, account_status, api_trading_status, dust_log, user_universal_transfer, user_universal_transfer_history, transfer_dust, asset_dividend_record, asset_detail, trade_fee, funding_wallet, user_asset, api_key_permissions, bnb_convertible_assets, convertible_coins, toggle_auto_convertion, cloud_mining_trans_history, convert_transfer, convert_history
MINING: mining_algo_list, mining_coin_list, mining_worker, mining_worker_list, mining_earnings_list, mining_bonus_list, mining_statistics_list, mining_account_list, mining_hashrate_resale_request, mining_hashrate_resale_cancellation, mining_hashrate_resale_list, mining_hashrate_resale_details, mining_account_earning
SUB-ACCOUNT: sub_account_create, sub_account_list, sub_account_assets, sub_account_deposit_address, sub_account_deposit_history, sub_account_status, sub_account_enable_margin, sub_account_margin_account, sub_account_margin_account_summary, sub_account_enable_futures, sub_account_futures_transfer, sub_account_margin_transfer, sub_account_transfer_to_sub, sub_account_transfer_to_master, sub_account_transfer_sub_account_history, sub_account_futures_asset_transfer_history, sub_account_futures_asset_transfer, sub_account_spot_summary, sub_account_universal_transfer, sub_account_universal_transfer_history, sub_account_futures_account, sub_account_futures_account_summary, sub_account_futures_position_risk, sub_account_spot_transfer_history, sub_account_enable_leverage_token, managed_sub_account_deposit, managed_sub_account_assets, managed_sub_account_withdraw, sub_account_update_ip_restriction, sub_account_api_get_ip_restriction, sub_account_api_delete_ip, managed_sub_account_get_snapshot, managed_sub_account_investor_trans_log, managed_sub_account_trading_trans_log, managed_sub_account_deposit_address
FUTURES: futures_transfer, futures_transfer_history, futures_loan_borrow_history, futures_loan_repay_history, futures_loan_wallet, futures_loan_adjust_collateral_history, futures_loan_liquidation_history, futures_loan_interest_history
BLVTs: blvt_info, subscribe_blvt, subscription_record, redeem_blvt, redemption_record, user_limit_info
BSwap: bswap_pools, bswap_liquidity, bswap_liquidity_add, bswap_liquidity_remove, bswap_liquidity_operation_record, bswap_request_quote, bswap_swap, bswap_swap_history, bswap_pool_configure, bswap_add_liquidity_preview, bswap_remove_liquidity_preview, bswap_unclaimed_rewards, bswap_claim_rewards, bswap_claimed_rewards
FIAT: fiat_order_history, fiat_payment_history
C2C: c2c_trade_history
LOANS: loan_history, loan_borrow, loan_borrow_history, loan_ongoing_orders, loan_repay, loan_repay_history, loan_adjust_ltv, loan_adjust_ltv_history, loan_vip_ongoing_orders, loan_vip_repay, loan_vip_repay_history, loan_vip_collateral_account, loan_loanable_data, loan_collateral_data, loan_collateral_rate, loan_customize_margin_call
PAY: pay_history
CONVERT: convert_trade_history
REBATE: rebate_spot_history
NFT: nft_transaction_history, nft_deposit_history, nft_withdraw_history, nft_asset
Gift Card (Binance Code in the API documentation): gift_card_create_code, gift_card_redeem_code, gift_card_verify_code, gift_card_rsa_public_key, gift_card_buy_code, gift_card_token_limit
Portfolio Margin: portfolio_margin_account, portfolio_margin_collateral_rate, portfolio_margin_bankruptcy_loan_amount, portfolio_margin_bankruptcy_loan_repay
It's nice to see a company like Binance actively investing in tech infrastructure and caring about a somewhat overlooked segment of the market and I'm hoping that other exchanges take note and develop their own SDKs and wrappers for developers to use.
[link] [comments]
You can get bonuses upto $100 FREE BONUS when you:
π° Install these recommended apps:
π² SocialGood - 100% Crypto Back on Everyday Shopping
π² xPortal - The DeFi For The Next Billion
π² CryptoTab Browser - Lightweight, fast, and ready to mine!
π° Register on these recommended exchanges:
π‘ Binanceπ‘ Bitfinexπ‘ Bitmartπ‘ Bittrexπ‘ Bitget
π‘ CoinExπ‘ Crypto.comπ‘ Gate.ioπ‘ Huobiπ‘ Kucoin.
Comments