# Coinpred widget: BTC / ETH long/short account ratio (BTC / ETH 合约多空账户比)

> The share of OKX accounts with net long vs net short futures positions, with 24h change and history. The needle and numbers animate on load.

Widget id: `longshort` · Live preview and configurator: https://coinpred.com/widgets/#longshort · All widgets: https://coinpred.com/widgets/llms.txt

## Embed code (default settings)

```html
<div class="coinpred-widget" data-widget="longshort" data-style="dial" data-coins="BTC,ETH" data-lang="en" data-theme="light">
  <a href="https://coinpred.com/signal-lab/" target="_blank" rel="noopener">Coinpred BTC / ETH long/short account ratio</a>
</div>
<script async src="https://coinpred.com/widgets/v1.js"></script>
```

## Options

Change the data-* attributes on the div. Only these values are supported:

| Attribute | Values | Default | Notes |
|---|---|---|---|
| `data-style` | `dial` \| `meter` \| `ring` | `dial` | dial (Dial), meter (Meter), ring (Ring) |
| `data-coins` | `BTC,ETH` \| `BTC` \| `ETH` | `BTC,ETH` |  |
| `data-theme` | `light` \| `dark` | `light` |  |
| `data-lang` | `en` \| `zh` | `en` | en (English) or zh (Simplified Chinese) |

## Rules

1. Load the script from coinpred.com, which also provides the data: `<script async src="https://coinpred.com/widgets/v1.js"></script>`.
2. Use the official snippet unchanged: the `<div class="coinpred-widget">` with its `<a>` link to coinpred.com. Do not rebuild the widget with another library.
3. Keep the `<a>` link inside the div visible (no `display:none`, no `rel="nofollow"`); it is the only condition of free use.
4. Load the script once per page. In single-page apps (React, Vue, Next.js…) call `window.CoinpredWidgets.scan()` after rendering new widget divs.
5. Use `data-lang="zh"` for Simplified Chinese sites and `data-theme="dark"` on dark backgrounds. Coin symbols are plain tickers (BTC, not BTCUSDT).

## Where to paste it

### Plain HTML

Paste the snippet inside <body> where the widget should appear, save and reload. With several widgets on one page keep the <script> line once.

### WordPress

Edit the page or post → “+” → Custom HTML block → paste → Update. In the Classic editor switch to the Text tab first; for a sidebar use Appearance → Widgets → Custom HTML.

### Webflow / Wix / Shopify etc.

Add an Embed / Code Block / Custom code / Custom Liquid section, paste the snippet and publish. In Wix, resize the HTML iframe element to the widget height.

### React / Next.js

Render the div with its data attributes and load the script once on the client; after client-side navigation call window.CoinpredWidgets.scan() to mount new widgets. The Next.js App Router needs 'use client'.

```jsx
'use client';
import { useEffect } from 'react';

const SRC = 'https://coinpred.com/widgets/v1.js';
export default function CoinpredWidget() {
  useEffect(() => {
    if (window.CoinpredWidgets) return void window.CoinpredWidgets.scan();
    if (!document.querySelector('script[src="' + SRC + '"]')) {
      const s = document.createElement('script'); s.src = SRC; s.async = true; document.body.appendChild(s);
    }
  }, []);
  return (
    <div className="coinpred-widget" data-widget="longshort" data-style="dial" data-coins="BTC,ETH" data-lang="en" data-theme="light">
      <a href="https://coinpred.com/signal-lab/" target="_blank" rel="noopener">Coinpred BTC / ETH long/short account ratio</a>
    </div>
  );
}
```

### Vue / Nuxt

Put the div in the template and load the script once in onMounted; if it is already loaded call window.CoinpredWidgets.scan().

```vue
<template>
  <div class="coinpred-widget" data-widget="longshort" data-style="dial" data-coins="BTC,ETH" data-lang="en" data-theme="light">
    <a href="https://coinpred.com/signal-lab/" target="_blank" rel="noopener">Coinpred BTC / ETH long/short account ratio</a>
  </div>
</template>

<script setup>
import { onMounted } from 'vue';
const SRC = 'https://coinpred.com/widgets/v1.js';
onMounted(() => {
  if (window.CoinpredWidgets) return window.CoinpredWidgets.scan();
  const s = document.createElement('script'); s.src = SRC; s.async = true; document.body.appendChild(s);
});
</script>
```

## Add it with AI

Copy this prompt into ChatGPT, Claude, Cursor, Copilot or any AI assistant:

```text
Add the “BTC / ETH long/short account ratio” widget from coinpred.com to my site. Docs: https://coinpred.com/widgets/docs/longshort.md
My settings: style=dial, coins=BTC,ETH, lang=en, theme=light
```

## Data source and method

From the OKX public Rubik statistics (long-short-account-ratio), one point per hour: among OKX accounts holding futures and perpetual positions in the coin, net-long accounts ÷ net-short accounts; long share = ratio ÷ (1 + ratio). It describes positioning by head count, not a model forecast, so there is no confidence score; accounts count equally regardless of size and only OKX is covered. Extremes are often read as a contrarian hint, never as a signal on their own.

Data is for information only and is not investment advice.
