Skip to content
NyriaDocs

Crypto perpetuals

Build a long/short crypto perpetuals strategy on Nyria Paper, the only venue that accepts one today: how the budget sizes a position, and funding-rate drift.

No connectable broker carries perpetuals today. Until Binance or Coinbase is live, test your strategy for free on paper.

Perpetual positions can be liquidated. On an exchange, leverage sets the margin held against a position, not the position's size. At 10x, a 10% move against you wipes out the margin, and fees and funding make that move smaller. Nyria places only the orders your alerts ask for. It doesn't add a stop or top up your margin. Liquidation is done by the exchange.

Prerequisites

  • A Nyria Paper account, which is free on every plan. If you're new to Nyria, do the quick start first.
  • An alert source that sends entry and exit alerts for longs and shorts. This guide uses TradingView, and any source in alert sources works the same way.

Long and short on a perpetual

A perpetual future follows the coin's spot price and never expires. You can hold a long or a short as long as you want. The cost of holding it is the funding rate, covered below.

LongShort
Funding paid whenFunding rate is positive (longs pay shorts)Funding rate is negative (shorts pay longs)
Liquidation triggerPrice drops to your liquidation pricePrice rises to your liquidation price
Nyria action keybuy / longsell / short

You configure long and short separately on the strategy. The common setups are:

  • Long and short entries both on, for a two-way strategy.
  • One direction only, for example a long-only BTC momentum strategy.
  • One direction's entry alert closing the other direction, using the Exit long position or Exit short position entry behavior. Use this when your alert source sends one flip alert instead of a separate close alert.

Exits arrive from your alert source as their own alerts. If you want a stop, your alert source has to send it.

Funding rate: the cost of holding

Funding is a payment between longs and shorts that keeps the perpetual's price close to spot. Binance settles it every 8 hours on most perpetuals. Other exchanges, Coinbase included, set their own schedule, so check the contract page.

  • When the rate is positive, longs pay shorts. This is the usual case in a rising market.
  • When the rate is negative, shorts pay longs. This happens most often in sharp sell-offs.
  • Each payment is position_notional * funding_rate. For example, $100 notional at 0.01% funding costs $0.01 every 8 hours; three $100 entries held for a month cost about $2.70.

Funding is charged on the position size and taken from your margin. Nyria doesn't set aside a buffer for it. If funding pushes your margin below the maintenance level, the exchange liquidates the position.

Position sizing for perpetuals

A perpetual position has two sizes:

  1. Notional exposure, the market value of the position (quantity * mark_price). It moves with the price.
  2. Margin, the collateral the exchange holds against the position (notional / leverage). This is what you lose in a liquidation.

The bot's budget sets the notional. Each entry buys budget ÷ price of the coin. The strategy's leverage does not change the quantity. On an exchange it only sets how much margin is held. Nyria Paper holds no margin and never liquidates. The strategy's record is the exception: it states each return at the strategy's leverage, capped at -100% of the entry.

Worked example (BTC at $64,000, 5x leverage, $100 budget per entry):

  • Quantity: $100 / $64,000 ≈ 0.00156 BTC.
  • Notional exposure: $100.
  • Margin an exchange would hold at 5x: $20.
  • Approximate distance to liquidation: a 20% move against you, minus fees and the exchange's maintenance margin. The exchange shows the exact liquidation price after the order fills.

Raising leverage buys the same quantity with less margin behind it, so the liquidation price moves closer. On a $100 position, going from 5x to 10x cuts the margin from $20 to $10 and the buffer from about 20% to about 10%. Funding is charged on the notional, so it costs the same in dollars, but it eats twice the share of your margin.

A bot's Budget per entry is the notional, not the margin. With a $100 budget on a 10x perpetual, every entry opens about $100 of the coin, and an exchange would hold $10 of margin against it. Three $100 entries are $300 notional at any leverage.

Margin warnings

You choose cross or isolated margin on the exchange, not in Nyria. Binance and Coinbase usually default to cross margin, where every open perpetual draws on one shared pool, so a loss on one symbol can liquidate the others. To keep them separate, switch the contracts to isolated margin on the exchange before you connect the account to Nyria.

  • Insufficient margin. The order needs more margin than the account has free after its open positions. The rejection appears in your bot logs with the exchange's reason. Nyria drops the order and doesn't retry the alert.
  • Auto-deleveraging (ADL). If the exchange's insurance fund can't cover a liquidation, the exchange closes profitable positions on the other side at the bankruptcy price. It is rare, but it has happened on Binance perpetuals in extreme markets.
  • Maintenance margin tiers. Both exchanges raise the maintenance margin as the notional grows. If repeated entries push a position into a higher tier, its liquidation price gets worse than the first entry suggested. Check the exchange's tier table before you scale in.

Step 1: Decide the contract before you create the strategy

Start with one pair. A strategy can trade several, but one pair is easier to debug.

Write down these values before you start:

DecisionYour value
Pair (BTCUSDT)
Direction(s): long, short, or both
Long leverage (1x–125x)
Short leverage (same range)
Budget per entry (position size in USD)
Multiple entries: on or off?
Exit rule: from alerts, or timed around funding?

An alert can say BTCUSDT, BTC-USD, BTC or BTCUSD. When the strategy has both a USDT and a USDC pair for the coin, name the exact pair.

Which tickers on a perpetual futures strategy: the USDT and USDC perpetual pairs, a pairing filter, and BTCUSDT picked.

Step 2: Create the strategy in Nyria

In Nyria, go to My strategies and select Create strategy.

Fill in these fields:

  • Strategy name: for example, BTC Perp Long/Short.
  • Strategy link: for example, btc-perp-long-short.
  • Alert source: Custom webhook. TradingView also works, but it checks alerts in its own wizard instead of the steps below.

On the What it trades step, set Asset type to Crypto and Market type to Futures. Futures here means crypto perpetuals, which run on Nyria Paper only. The leverage fields appear only for Futures and stay hidden for Spot.

Set Leverage for each direction, from 1x to 125x. A Nyria Paper bot doesn't apply it. Each position is the size set on the bot. The strategy's record is stated at this leverage.

On the same step, set Long behavior and Short behavior. For a two-way strategy, use:

  • Long: Enter position on entry, Close on exit alerts on, order type Market order.
  • Short: Enter position on entry, Close on exit alerts on, order type Market order.

For a long-only strategy where a short alert closes the long, use:

  • Long: Enter position on entry, Close on exit alerts on.
  • Short: Exit long position on entry, so a short alert closes any open long and never opens a short.

On the Who can copy it step, select Private until it has run on paper.

On Which tickers, select your pair. To stay in one quote currency, filter the list by pairing, USDT or USDC.

On Review, select Create draft. The strategy is saved as a Draft.

Step 3: Check the alert format

Give Nyria a sample alert for each direction you turned on, so you can confirm it reads the symbol and direction the way you intend.

Open the strategy's Integration tab and copy the webhook URL. It looks like https://trades.nyria.io/webhooks/{strategy_token}. Keep it private. Anyone who has it can send alerts to your strategy.

On the Alert format card, paste one sample alert per enabled direction. The minimum payload is two fields, ticker and action.

Select Check format. On a TradingView strategy, select Check and save in the TradingView alert wizard instead. Nyria reads each sample exactly as it would a live alert, without placing an order. Every sample must pass. If one fails, the reason appears next to it.

Sample long entry (JSON payload):

{
  "ticker": "BTCUSDT",
  "action": "buy",
  "direction": "long"
}

Sample short entry (JSON payload):

{
  "ticker": "BTCUSDT",
  "action": "sell",
  "direction": "short"
}

Sample long exit (JSON payload):

{
  "ticker": "BTCUSDT",
  "action": "exit",
  "direction": "long"
}

Sample short exit (JSON payload):

{
  "ticker": "BTCUSDT",
  "action": "exit",
  "direction": "short"
}

For every payload field, see the webhook reference.

Step 4: Connect the alert source

Start from this Pine Script template. Each order it places sends its comment, which holds one of the JSON payloads above, as the alert message. Replace the longCondition and shortCondition lines with your own entry logic. Keep the strategy.entry and strategy.close lines, since they carry the JSON.

//@version=5
strategy("Nyria Perp Long/Short Template", overlay=true)

// --- your entry logic goes here ---
longCondition = ta.crossover(ta.sma(close, 9), ta.sma(close, 21))
shortCondition = ta.crossunder(ta.sma(close, 9), ta.sma(close, 21))

if longCondition
    strategy.close("short", comment='{"ticker":"BTCUSDT","action":"exit","direction":"short"}')
    strategy.entry("long",  strategy.long,  comment='{"ticker":"BTCUSDT","action":"buy","direction":"long"}')

if shortCondition
    strategy.close("long",  comment='{"ticker":"BTCUSDT","action":"exit","direction":"long"}')
    strategy.entry("short", strategy.short, comment='{"ticker":"BTCUSDT","action":"sell","direction":"short"}')

// In your TradingView alert: set "Message" to {{strategy.order.comment}}
// and tick "Webhook URL" in Notifications, with your strategy's https://trades.nyria.io/webhooks/... URL.

To set it up:

  1. Paste it into the Pine editor and select Add to chart.
  2. Select Alert on the top toolbar and set Condition to your strategy. In the second dropdown under it, choose Order fills only. Open Message, set it to {{strategy.order.comment}} and select Apply. Open Notifications, tick Webhook URL, paste your Nyria webhook URL and select Apply.
  3. Select Create. From then on, TradingView posts the JSON from comment each time the script calls strategy.entry or strategy.close.

To send the same alert without TradingView, use curl:

curl -X POST https://trades.nyria.io/webhooks/REPLACE_WITH_YOUR_STRATEGY_TOKEN \
  -H "Content-Type: application/json" \
  -d '{"ticker":"BTCUSDT","action":"buy","direction":"long"}'

Replace REPLACE_WITH_YOUR_STRATEGY_TOKEN with the token from your strategy's Integration tab.

Step 5: Deploy a bot on Nyria Paper

Open the strategy and select Deploy bot.

On the Size step, enter the Budget per entry you chose in step 1. It sets the size of each position, not the margin.

On the Account step, choose your Nyria Paper account. The strategy's leverage is shown under Leverage. A Nyria Paper bot doesn't apply it to its size.

Keep Allow multiple entries off on the strategy until single entries work. Each extra entry adds another full budget to the position.

Select Deploy on Nyria Paper. The bot trades on the next alert that reaches the strategy's webhook.

Step 6: Watch the first round trip

When your first alert reaches the webhook, two logs update. The strategy log, visible only to the strategy's owner, shows how Nyria read the alert. The bot log shows how your bot sized the order and what the broker did with it.

Keep both open for the first entry. These are the usual problems on a first run:

SymptomCauseFix
Strategy log shows the alert but no bot log appearsBot is paused, or its broker is DisconnectedStart the bot, or reconnect the broker
Bot log says The order size came to 0 units for $<amount> at $<price> eachThe budget per entry buys less than one unit at the venue's order size stepRaise the budget per entry
Order fills, then reverses at onceTradingView repainted the alert candleSee TradingView repainting

Common pitfalls

  • Treating the budget as margin. The budget is the position's notional. A $1,000 budget opens about $1,000 of the coin at any leverage, and at 10x the exchange holds $100 of margin against it. If you want $1,000 of margin at 10x, that's $10,000 of notional, so set the budget to $10,000.
  • Forgetting that each entry adds a full budget. Three $100 entries are $300 of notional at any leverage. On an exchange each entry also needs its own margin, and when the free collateral runs out the exchange rejects the next one.
  • Ignoring funding on long holds. At 0.01% per 8-hour window, which is Binance's baseline rate, a long pays about 0.03% of notional a day, or about 0.9% a month. At 10x the margin is a tenth of the notional, so that is about 9% of the margin lost to funding alone, before any price move. Nyria Paper charges no funding.
  • Expecting an exit alert to close a single entry. Nyria closes by direction. After three long entries, one long exit alert closes all three. A quantity on a CLOSE alert doesn't trim the position, because the webhook has no partial-close field. See the webhook reference.
  • Changing leverage on an open position. A new leverage value on the strategy doesn't affect positions that are already open. On Nyria Paper, leverage never changes a bot's position size.

Next steps

Your edge, on autopilot.

Trading carries risk. Read the risk disclosure.

© 2026 Nyria LLC. All rights reserved.