BINANCE API - Cryptocurrency Trading

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Internet and Network > MCP. - MCP (Model-Context Protocol) server operations >

BINANCE API - Cryptocurrency Trading

The BINANCE.* commands provide access to the Binance cryptocurrency exchange API, allowing you to:

Query real-time cryptocurrency pricesCheck account balancesPlace buy/sell orders (MARKET and LIMIT)Cancel open ordersView order history

Feature

Value

API Base URL

https://api.binance.com

(Testnet: https://testnet.binance.vision)

Authentication

HMAC-SHA256 Signature

Default Symbol

BTCUSDT



Available Commands

Command

Purpose

API Key Required

BINANCE.Init

Initialize the API (live or testnet)

No

BINANCE.SetKey

Set your API Key

N/A

BINANCE.SetSecret

Set your API Secret

N/A

BINANCE.GetPrice

Get current price for a symbol

No

BINANCE.GetBalance

Get account balance (JSON)

Yes

BINANCE.PlaceOrder

Place a buy/sell order

Yes

BINANCE.CancelOrder

Cancel an open order

Yes

BINANCE.GetOrders

Get list of open orders

Yes

Quick Start Example

; Initialize Binance API (use testnet for testing)

BINANCE.Init|1

 

; Set your API credentials

BINANCE.SetKey|your_api_key_here

BINANCE.SetSecret|your_api_secret_here

 

; Get current Bitcoin price

BINANCE.GetPrice|BTCUSDT|btcPrice

MSGBOX "BTC Price: $" & btcPrice

 

; Check account balance

BINANCE.GetBalance|balance

; Parse JSON response using PSJ commands...

Security Notes

Never commit API keys to version control. Use external configuration files.Use BINANCE.Init|1 for testnet (paper trading) during development.Enable IP restrictions on your Binance API keys.Use withdrawal whitelist features - never enable withdrawals for API keys used by scripts.

See Also

CloudTools Overview - Other cloud API integrationsPSJ.Parse - Parse JSON responses