> ## Documentation Index
> Fetch the complete documentation index at: https://docs.defiloops.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Cards on Binance

> Write a card that reads any venue's data and trades on Binance, with real card examples, how arming works, and how to stop a card

**In short:** a card names Binance as the place it trades. It can watch any data feed, including another venue's, and place the order on Binance. A saved Binance card is a draft. It does nothing until you arm it. **Cards on Binance run on the demo exchange today.**

You write cards in words. See [writing a card](https://docs.defiloops.com/cards/writing.md) for the language. This page covers what is specific to Binance.

## What a Binance card can say

A Binance card has one rule and one action. These are the forms it takes:

```
swap 100 USDT for BTC, at most 1% below market
open a 2x long BTC perp with 100 USDT, at most 1% below market
swap 10 USDT for BTC at $60,000, post only
close my BTC perp
```

* A spot card can only buy. A futures card opens or closes a perpetual.
* The perpetual's margin times its leverage is the order's size.
* A price written in the card (`at $60,000`) places a limit order at exactly that price. With `post only`, it places a spot post-only order.
* BTC and ETH only. SOL, BNB, XRP, DOGE and options are in the lock's table, and have no card form yet.
* Take-profit and stop-loss are not card words. You set them on the card page. Setting them is [paused for now](https://docs.defiloops.com/venues/binance/trading.md#take-profit-and-stop-loss-on-futures).
* A card reads markets and data feeds. It never reads your wallet.

## When a card fires

| you write | what fires it |
| - | - |
| nothing | it fires once, when you arm it |
| `IMMEDIATELY WHEN the BTC price reaches $90,000` | the enclave checks the price crossing itself |
| `EVERY 6 hours` | a schedule, in hours, days or weeks. A time of day is refused |
| any other `WHEN` | our system checks the condition on each closed bar, then fires your grant |

`LIMITS stop after 3 runs · expires after 30 days` become the grant's run count and its life, at most 90 days. `BUDGET 1,000 USDT` becomes its total. A limit the grant could not keep is refused, never dropped.

## Real card examples

A price level, checked by the enclave:

```
PLAN      Binance
ON        Binance
IMMEDIATELY WHEN the BTC price reaches $90,000
DO        swap 100 USDT for BTC, at most 1% below market
LIMITS    stop after 3 runs · expires after 30 days
```

A condition on closed bars, once a day at most:

```
PLAN      Binance
ON        Binance
WHEN      the BTC price is below $60,000
DO        swap 100 USDT for BTC, at most 1% below market
LIMITS    at most once a day
```

## Watch one venue, trade on another

The venue a card trades on is separate from the data it reads. This card trades on Binance and reads Hyperliquid's funding rate for BTC through a measure. `{asset}` becomes the asset the card calls the measure for, here BTC. The feed is Hyperliquid's hourly funding rate. The measure multiplies it by 1,000, so an hourly rate of 0.015% (0.00015) reads as 15%. That hourly rate is about 131% a year.

```
//@version=6
indicator("fund", timeframe = "1H")
//@dl.unit probability
x = dl.feed("hl.{asset}.funding")
plot(x * 1000, "p")
```

```
PLAN      Funding
ON        Binance
CHECK     every 1 hour
BUDGET    1000 USDT
WHEN      p(BTC) is above 15%
DO        swap 100 USDT for BTC, at most 1% below market
LIMITS    at most once a day · stop after 3 runs · expires after 30 days
```

This shows the shape of a card. It is not advice. If no feed serves the key, the card is refused when you save it and when you arm it. A value older than the feed's limit makes our system skip that bar.

## From card to grant

1. **Save the card.** It is a draft. It is not backtested, and you cannot approve or start it. Nothing runs.
2. **Arm it** from the card page, or from a link the chat gives you. The grant form opens with the card's numbers filled in. You type every limit the card left empty.
3. **Sign with your wallet.** The chat never signs or arms for you.

A card's grant stores a copy of the card when you sign. Editing the saved card later changes nothing about a grant you already signed.

## Updating a card

**Arming a newer version revokes your older ones.** The older versions' opening orders are cancelled first. Their take-profit and stop-loss orders stay until the position closes. The arming screen names the versions it revokes before you sign.

After a restart, only the version that holds the live grant goes on.

## Stop a card

Stopping is on the card page. There are two modes.

* **Close mode.** No new entries. Orders that open a position are cancelled. Take-profit and stop-loss orders stay until the position closes.
* **Cancel all.** No new entries. Every open order of the card is cancelled, take-profit and stop-loss included. Our kill switch uses this mode.

A stopped card stays stopped. To run it again, arm it again.

A card also stops placing orders when our system halts it. Its resting orders are cancelled when you stop it, when you revoke or replace its grant, when the grant expires, and when our system halts it. A sweep checks every 15 seconds for take-profit and stop-loss orders of a card stopped in cancel-all mode or halted by our kill switch, and cancels them. Close mode keeps them. If it cannot read a card's state, it cancels nothing that round.

See also [stops and protective orders](https://docs.defiloops.com/venues/overview.md#stops-and-protective-orders).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.