Skip to main content
Binance trading actions allow you to interact with the Binance exchange for cryptocurrency trading. These actions support retrieving market data, checking account balances, and placing both spot and futures orders.
Before using Binance actions, ensure you have a Binance integration configured with your API credentials. See Configuration Reference for setup details.

binance/getprice

Retrieves current or 24-hour price data for a trading pair.

Integration ID

The Binance integration to use.
YAML KeyintegrationID
Typestring
RequiredYes

Symbol

The trading pair symbol (e.g., BTCUSDT, ETHUSDT).
YAML Keysymbol
Typestring
RequiredYes

Price Type

The type of price data to retrieve.
YAML Keyprice_type
Typestring
RequiredYes
Allowed values:
  • current — Returns the current price
  • 24hr — Returns 24-hour price statistics

Example

actions:
  get_btc_price:
    type: binance/getprice
    config:
      integrationID: my_binance
      symbol: BTCUSDT
      price_type: current
    next: response.price

  get_24hr_stats:
    type: binance/getprice
    config:
      integrationID: my_binance
      symbol: ETHUSDT
      price_type: 24hr
    next: response.stats

Response

Current price response:
{
  "symbol": "BTCUSDT",
  "price": 45000.50,
  "type": "current"
}
24-hour stats response:
{
  "symbol": "BTCUSDT",
  "priceChange": "1250.00",
  "priceChangePercent": "2.85",
  "highPrice": "46000.00",
  "lowPrice": "44000.00",
  "volume": "15000.50"
}

binance/accountbalance

Retrieves account balance for one or more assets.

Integration ID

The Binance integration to use.
YAML KeyintegrationID
Typestring
RequiredYes

Symbol

The asset symbol(s) to query. Use comma-separated values for multiple assets.
YAML Keysymbol
Typestring
RequiredYes
Examples: BTC, ETH, BTC,ETH,USDT

Futures

Query the futures account instead of the spot account.
YAML Keyfutures
Typeboolean
RequiredNo
Defaultfalse

Example

actions:
  get_btc_balance:
    type: binance/accountbalance
    config:
      integrationID: my_binance
      symbol: BTC
    next: response.balance

  get_multiple_balances:
    type: binance/accountbalance
    config:
      integrationID: my_binance
      symbol: "BTC,ETH,USDT"
    next: response.balances

  get_futures_balance:
    type: binance/accountbalance
    config:
      integrationID: my_binance
      symbol: USDT
      futures: true
    next: response.futures_balance

Response

Single asset response:
{
  "symbol": "BTC",
  "balance": "1.25000000",
  "time": 1699900000
}
Multiple assets response:
[
  {"symbol": "BTC", "balance": "1.25000000", "time": 1699900000},
  {"symbol": "ETH", "balance": "10.50000000", "time": 1699900000},
  {"symbol": "USDT", "balance": "5000.00000000", "time": 1699900000}
]

binance/spotorder

Places spot trading orders for cryptocurrency pairs.

Integration ID

The Binance integration to use.
YAML KeyintegrationID
Typestring
RequiredYes

Symbol

The trading pair symbol (e.g., BTCUSDT).
YAML Keysymbol
Typestring
RequiredYes

Side

The order side.
YAML Keyside
Typestring
RequiredYes
Allowed values: BUY, SELL

Type

The order type.
YAML Keytype
Typestring
RequiredYes
Allowed values: MARKET, LIMIT, STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, TAKE_PROFIT_LIMIT

Quantity

The amount of the base asset to buy or sell.
YAML Keyquantity
Typestring
RequiredNo
Required for most order types. Use either quantity or quote_order_qty.

Quote Order Quantity

The amount in quote currency to spend (for market buy orders).
YAML Keyquote_order_qty
Typestring
RequiredNo
Use this to specify how much USDT to spend rather than how much BTC to buy.

Price

The price for limit orders.
YAML Keyprice
Typestring
RequiredNo
Required for LIMIT and limit-based order types.

Stop Price

The trigger price for stop orders.
YAML Keystop_price
Typestring
RequiredNo
Required for STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, and TAKE_PROFIT_LIMIT order types.

Time In Force

How long the order remains active.
YAML Keytime_in_force
Typestring
RequiredNo
Allowed values:
  • GTC — Good ‘til canceled
  • IOC — Immediate or cancel
  • FOK — Fill or kill

Example

actions:
  market_buy:
    type: binance/spotorder
    config:
      integrationID: my_binance
      symbol: BTCUSDT
      side: BUY
      type: MARKET
      quote_order_qty: "100"
    next: response.order_placed
    fail: response.order_failed

  limit_sell:
    type: binance/spotorder
    config:
      integrationID: my_binance
      symbol: BTCUSDT
      side: SELL
      type: LIMIT
      quantity: "0.001"
      price: "50000"
      time_in_force: GTC
    next: response.order_placed

  stop_loss:
    type: binance/spotorder
    config:
      integrationID: my_binance
      symbol: BTCUSDT
      side: SELL
      type: STOP_LOSS
      quantity: "0.001"
      stop_price: "40000"
    next: response.stop_set

Response

{
  "orderId": 123456789,
  "symbol": "BTCUSDT",
  "side": "BUY",
  "type": "MARKET",
  "status": "FILLED"
}

binance/futuresorder

Places futures trading orders with leverage and position management.

Integration ID

The Binance integration to use.
YAML KeyintegrationID
Typestring
RequiredYes

Symbol

The futures trading pair symbol (e.g., BTCUSDT).
YAML Keysymbol
Typestring
RequiredYes

Side

The order side.
YAML Keyside
Typestring
RequiredYes
Allowed values: BUY, SELL

Type

The order type.
YAML Keytype
Typestring
RequiredYes
Allowed values: MARKET, LIMIT, STOP, STOP_MARKET, TAKE_PROFIT, TAKE_PROFIT_MARKET

Quantity

The contract quantity.
YAML Keyquantity
Typestring
RequiredYes

Leverage

The leverage multiplier for the position.
YAML Keyleverage
Typeinteger
RequiredNo

Position Side

The position direction for hedge mode.
YAML Keyposition_side
Typestring
RequiredNo
Allowed values: LONG, SHORT, BOTH

Reduce Only

Only reduce an existing position, don’t open a new one.
YAML Keyreduce_only
Typeboolean
RequiredNo
Defaultfalse

Price

The price for limit orders.
YAML Keyprice
Typestring
RequiredNo

Example

actions:
  open_long:
    type: binance/futuresorder
    config:
      integrationID: my_binance
      symbol: BTCUSDT
      side: BUY
      type: MARKET
      quantity: "0.01"
      leverage: 10
      position_side: LONG
    next: response.position_opened
    fail: response.order_failed

  close_position:
    type: binance/futuresorder
    config:
      integrationID: my_binance
      symbol: BTCUSDT
      side: SELL
      type: MARKET
      quantity: "0.01"
      position_side: LONG
      reduce_only: true
    next: response.position_closed

  limit_short:
    type: binance/futuresorder
    config:
      integrationID: my_binance
      symbol: ETHUSDT
      side: SELL
      type: LIMIT
      quantity: "0.1"
      price: "3000"
      leverage: 5
      position_side: SHORT
    next: response.order_placed

Response

{
  "orderId": 987654321,
  "symbol": "BTCUSDT",
  "side": "BUY",
  "type": "MARKET",
  "executedQty": "0.01",
  "status": "FILLED",
  "positionSide": "LONG",
  "reduceOnly": false
}

binance/pricedifference

Calculates price differences and percentage changes over specified time periods.

Integration ID

The Binance integration to use.
YAML KeyintegrationID
Typestring
RequiredYes

Symbol

The trading pair symbol or comma-separated symbols.
YAML Keysymbol
Typestring
RequiredYes

Interval

The candlestick interval for historical data.
YAML Keyinterval
Typestring
RequiredYes
Allowed values: 1m, 5m, 15m, 30m, 1h, 4h, 1d, 1w

Period

The number of intervals to look back.
YAML Keyperiod
Typeinteger
RequiredYes

Example

actions:
  check_btc_change:
    type: binance/pricedifference
    config:
      integrationID: my_binance
      symbol: BTCUSDT
      interval: "1h"
      period: 24
    next: conditional.significant_change

  check_multiple:
    type: binance/pricedifference
    config:
      integrationID: my_binance
      symbol: "BTCUSDT,ETHUSDT,BNBUSDT"
      interval: "1d"
      period: 7
    next: response.price_changes

conditionals:
  significant_change:
    expression: "{{ gt .check_btc_change.differencePercent 5 }}"
    onTrue: action.send_alert
    onFalse: response.no_alert

Response

{
  "symbol": "BTCUSDT",
  "currentPrice": 45000.50,
  "previousPrice": 44000.00,
  "difference": 1000.50,
  "differencePercent": 2.27,
  "interval": "1h",
  "priceHistory": [
    {
      "openTime": 1699900000000,
      "open": "44000.00",
      "high": "45500.00",
      "low": "43800.00",
      "close": "45000.50",
      "volume": "1234.56",
      "closeTime": 1699903600000
    }
  ]
}

binance/tradeinfo

Retrieves detailed trading information including open orders and positions.

Integration ID

The Binance integration to use.
YAML KeyintegrationID
Typestring
RequiredYes

Symbol

The trading pair symbol.
YAML Keysymbol
Typestring
RequiredNo

Info Type

The type of information to retrieve.
YAML KeyinfoType
Typestring
RequiredNo
Allowed values: orders, positions

Order ID

A specific order ID to query.
YAML KeyorderID
Typestring
RequiredNo

Futures

Query futures trading information instead of spot.
YAML Keyfutures
Typeboolean
RequiredNo
Defaultfalse

Example

actions:
  get_open_orders:
    type: binance/tradeinfo
    config:
      integrationID: my_binance
      symbol: BTCUSDT
      infoType: orders
    next: response.orders

  get_specific_order:
    type: binance/tradeinfo
    config:
      integrationID: my_binance
      symbol: BTCUSDT
      orderID: "{{ param \"order_id\" }}"
    next: response.order_details

  get_futures_positions:
    type: binance/tradeinfo
    config:
      integrationID: my_binance
      symbol: BTCUSDT
      futures: true
      infoType: positions
    next: response.positions

  get_all_futures_orders:
    type: binance/tradeinfo
    config:
      integrationID: my_binance
      futures: true
      infoType: orders
    next: response.all_orders

Common Patterns

Price Alert Bot

Monitor price changes and send alerts:
actions:
  check_price:
    type: binance/pricedifference
    config:
      integrationID: my_binance
      symbol: BTCUSDT
      interval: "1h"
      period: 1
    next: conditional.price_dropped

conditionals:
  price_dropped:
    expression: "{{ lt .check_price.differencePercent -3 }}"
    onTrue: action.send_alert
    onFalse: response.no_alert

actions:
  send_alert:
    type: email
    config:
      senderEmail: "alerts@example.com"
      recipientEmail: "{{ secret \"ALERT_EMAIL\" }}"
      name: "Price Alert"
      subject: "BTC Price Alert"
      content: |
        BTC has dropped {{ .check_price.differencePercent }}% in the last hour.
        Current price: ${{ .check_price.currentPrice }}
      auth:
        serverHostname: smtp.example.com
        serverPort: "587"
        username: "{{ secret \"SMTP_USER\" }}"
        password: "{{ secret \"SMTP_PASS\" }}"
    next: response.alert_sent

Dollar-Cost Averaging Bot

Automatically buy a fixed amount on schedule:
actions:
  check_balance:
    type: binance/accountbalance
    config:
      integrationID: my_binance
      symbol: USDT
    next: conditional.has_funds

conditionals:
  has_funds:
    expression: "{{ gt .check_balance.balance 100 }}"
    onTrue: action.place_buy
    onFalse: response.insufficient_funds

actions:
  place_buy:
    type: binance/spotorder
    config:
      integrationID: my_binance
      symbol: BTCUSDT
      side: BUY
      type: MARKET
      quote_order_qty: "100"
    next: response.order_placed
    fail: response.order_failed

Next Steps

Actions Overview

Learn the fundamentals of ServFlow actions.

Flow Control

Run multiple trading checks in parallel.

Memory

Cache price data for faster lookups.

Communication

Send trading alerts via email.