btc-trading-since-2020
```markdown
What this skill does
```markdown
---
name: btc-trading-since-2020
description: Work with the BTC-Trading-Since-2020 open dataset of real Bitcoin trading history (43k+ orders, 173k+ executions, 2020–2026) from a BitMEX account.
triggers:
- analyze BTC trading dataset
- load bitmex execution history
- parse trading ledger CSV
- reconstruct equity curve from wallet history
- work with btc trading since 2020
- analyze bitcoin trade executions
- process bitmex wallet history
- calculate trading performance from ledger
---
# BTC-Trading-Since-2020 Dataset Skill
> Skill by [ara.so](https://ara.so) — Daily 2026 Skills collection.
## What This Project Is
A public, continuously updated mirror of a real BitMEX BTC trading account spanning **2020-05-01 → 2026-04-17**. It contains:
- **43,214** orders (`api-v1-order.csv`)
- **173,058** execution rows (`api-v1-execution-tradeHistory.csv`)
- **17,099** wallet events (`api-v1-user-walletHistory.csv`)
- Derived equity curve, terminal snapshots, instrument dictionaries
Primary use: discretionary manual trading analysis — regime detection, position sizing, drawdown study, long-term compounding. **Not** an HFT/microstructure dataset.
---
## Getting the Data
### Clone the repo
```bash
git clone https://github.com/bwjoke/BTC-Trading-Since-2020.git
cd BTC-Trading-Since-2020
```
### Or download a tagged release
```bash
# Latest tagged build (replace date as needed)
gh release download data-2026-04-17 --repo bwjoke/BTC-Trading-Since-2020
```
### File inventory
```
api-v1-execution-tradeHistory.csv # primary execution ledger (balance-affecting)
api-v1-order.csv # order intent + lifecycle
api-v1-user-walletHistory.csv # deposits, withdrawals, funding, realised PnL
api-v1-position.snapshot.csv # terminal position anchor
api-v1-user-wallet.snapshot-all.csv # terminal wallet anchor
api-v1-user-margin.snapshot-all.csv # terminal margin/equity anchor
api-v1-user-walletSummary.all.csv # BitMEX summary cross-check
api-v1-instrument.all.csv # instrument dictionary + contract specs
api-v1-wallet-assets.csv # asset scale + wallet metadata
derived-equity-curve.csv # XBT-equivalent wealth curve
manifest.json # checksums, row counts, time ranges
```
---
## Loading the Data (Python)
### Basic setup
```python
import pandas as pd
import numpy as np
DATA_DIR = "./BTC-Trading-Since-2020" # adjust to your clone path
def load_executions():
df = pd.read_csv(f"{DATA_DIR}/api-v1-execution-tradeHistory.csv", low_memory=False)
df["timestamp"] = pd.to_datetime(df["timestamp"], utc=True)
return df
def load_orders():
df = pd.read_csv(f"{DATA_DIR}/api-v1-order.csv", low_memory=False)
df["timestamp"] = pd.to_datetime(df["timestamp"], utc=True)
df["transactTime"] = pd.to_datetime(df["transactTime"], utc=True)
return df
def load_wallet_history():
df = pd.read_csv(f"{DATA_DIR}/api-v1-user-walletHistory.csv", low_memory=False)
df["timestamp"] = pd.to_datetime(df["timestamp"], utc=True)
df["transactTime"] = pd.to_datetime(df["transactTime"], utc=True)
return df
def load_equity_curve():
df = pd.read_csv(f"{DATA_DIR}/derived-equity-curve.csv", low_memory=False)
df["timestamp"] = pd.to_datetime(df["timestamp"], utc=True)
return df
def load_instruments():
return pd.read_csv(f"{DATA_DIR}/api-v1-instrument.all.csv", low_memory=False)
```
### Scale note — XBT amounts are in satoshis (1e-8 XBT)
```python
SATOSHI = 1e8 # BitMEX stores XBT amounts as integer satoshis
def to_xbt(satoshi_series):
"""Convert BitMEX integer satoshi column to XBT float."""
return satoshi_series / SATOSHI
```
---
## Key Data Structures
### Execution ledger columns (tradeHistory)
```python
executions = load_executions()
print(executions.columns.tolist())
# Relevant fields:
# timestamp, symbol, side, lastQty, lastPx, execType,
# execCost, execComm, realizedPnl, homeNotional,
# foreignNotional, settlCurrency, text
```
### Order ledger columns
```python
orders = load_orders()
# Relevant fields:
# timestamp, transactTime, symbol, side, orderQty, price,
# stopPx, ordType, ordStatus, cumQty, avgPx, leavesQty,
# triggered, workingIndicator, currency, settlCurrency
```
### Wallet history transactTypes
```python
wallet = load_wallet_history()
print(wallet["transactType"].value_counts())
# Common types:
# RealisedPNL — closed position profit/loss
# Funding — perpetual swap funding payments
# Deposit — external inbound
# Withdrawal — external outbound
# Transfer — internal wallet move (neutralize in PnL)
# Conversion — XBT <-> USDt swap (treat as internal)
# SpotTrade — spot pair trade (treat as internal)
```
---
## Common Analysis Patterns
### 1. Filter to BTC-only executions
```python
def btc_executions(df):
"""Return rows where symbol contains XBTUSD, XBTUSDT, or BTC."""
mask = df["symbol"].str.contains("XBT|BTC", case=False, na=False)
return df[mask].copy()
execs = load_executions()
btc = btc_executions(execs)
print(f"BTC executions: {len(btc):,} / {len(execs):,} total")
```
### 2. Compute realized PnL by year
```python
def annual_realised_pnl(wallet_df):
"""Aggregate RealisedPNL wallet events by year in XBT."""
pnl = wallet_df[wallet_df["transactType"] == "RealisedPNL"].copy()
pnl["xbt"] = to_xbt(pnl["amount"])
pnl["year"] = pnl["timestamp"].dt.year
return pnl.groupby("year")["xbt"].sum()
wallet = load_wallet_history()
print(annual_realised_pnl(wallet))
```
### 3. Reconstruct the adjusted equity curve (matches repo methodology)
```python
def build_equity_curve(wallet_df, baseline_xbt=1.83953943):
"""
Replicate the repo's adjusted-wealth methodology:
- Start from baseline (first funded XBT balance after final deposit)
- Add back completed Withdrawals
- Subtract completed Deposits after baseline
- Neutralize Transfer, Conversion, SpotTrade rows
Returns a DataFrame with timestamp and adjusted_xbt columns.
"""
relevant_types = {"RealisedPNL", "Funding", "Deposit", "Withdrawal"}
df = wallet_df[
(wallet_df["transactType"].isin(relevant_types)) &
(wallet_df["currency"] == "XBt") # XBt = satoshi-denominated XBT
].copy().sort_values("timestamp")
baseline_time = pd.Timestamp("2020-05-01T14:39:40.387Z", tz="UTC")
df = df[df["timestamp"] >= baseline_time]
df["xbt_delta"] = to_xbt(df["amount"])
# Flip sign: withdrawals increase adjusted wealth, deposits after baseline decrease it
df.loc[df["transactType"] == "Withdrawal", "xbt_delta"] *= 1 # add back
df.loc[df["transactType"] == "Deposit", "xbt_delta"] *= -1 # subtract
df["cumulative_xbt"] = baseline_xbt + df["xbt_delta"].cumsum()
return df[["timestamp", "transactType", "xbt_delta", "cumulative_xbt"]]
wallet = load_wallet_history()
curve = build_equity_curve(wallet)
print(curve.tail())
```
### 4. Load the pre-built equity curve (simplest approach)
```python
equity = load_equity_curve()
print(equity.tail(3))
# columns include timestamp, wallet_xbt (or similar), adjusted_xbt
# Always check actual column names:
print(equity.columns.tolist())
```
### 5. Plot cumulative performance
```python
import matplotlib.pyplot as plt
equity = load_equity_curve()
# Adapt column names to what's actually in the file
time_col = equity.columns[0]
val_col = equity.columns[1]
fig, ax = plt.subplots(figsize=(14, 5))
ax.plot(equity[time_col], equity[val_col], linewidth=1.2)
ax.set_title("BTC-Trading-Since-2020 — Adjusted XBT Wealth")
ax.set_ylabel("XBT")
ax.set_xlabel("Date")
plt.tight_layout()
plt.savefig("my_equity_curve.png", dpi=150)
plt.show()
```
### 6. Funding payment analysis
```python
def funding_summary(wallet_df):
funding = wallet_df[wallet_df["transactType"] == "Funding"].copy()
funding["xbt"] = to_xbt(funding["amount"])
funding["year_month"] = funding["timestamp"].dt.to_period("M")
monthly = fundRelated in Writing & Docs
jax-development
IncludedUse this skill when the user is writing, debugging, profiling, refactoring, reviewing, benchmarking, parallelising, exporting, or explaining JAX code, or when they mention JAX, jax.numpy, jit, grad, value_and_grad, vmap, scan, lax, random keys, pytrees, jax.Array, sharding, Mesh, PartitionSpec, NamedSharding, pmap, shard_map, Pallas, XLA, StableHLO, checkify, profiler, or the JAX repo. It helps turn NumPy or PyTorch-style code into pure functional JAX, fix tracer/control-flow/shape/PRNG bugs, remove recompiles and host-device syncs, choose transforms and sharding strategies, inspect jaxpr/lowering/IR, and benchmark compiled code correctly.
nature-article-writer
IncludedDrafts, rewrites, diagnostically critiques, and style-calibrates primary research manuscripts for Nature and Nature Portfolio journals. Use when the user wants a Nature-style title, summary paragraph or abstract, introduction, results, discussion, methods, figure legends, presubmission enquiry, cover letter, reviewer response, or when a scientific draft sounds generic, jargon-heavy, structurally weak, or AI-ish and needs precise, broad-reader-friendly prose without inventing data, analyses, or references. Best for primary research articles and letters rather than reviews or press releases unless explicitly adapting one.
deckrd
IncludedDocument-driven framework that derives requirements, specifications, implementation plans, and executable tasks from goals through structured AI dialogue. Use when user says "write requirements", "create spec", "plan implementation", "derive tasks", "structure this feature", "break down into tasks", or "document this module". Also use for reverse engineering existing code into docs (/deckrd rev). Do NOT use for direct code writing — use /deckrd-coder after tasks are generated. Do NOT use when the user only wants to run or fix existing code without planning.
clinical-decision-support
IncludedGenerate professional clinical decision support (CDS) documents for pharmaceutical and clinical research settings, including patient cohort analyses (biomarker-stratified with outcomes) and treatment recommendation reports (evidence-based guidelines with decision algorithms). Supports GRADE evidence grading, statistical analysis (hazard ratios, survival curves, waterfall plots), biomarker integration, and regulatory compliance. Outputs publication-ready LaTeX/PDF format optimized for drug development, clinical research, and evidence synthesis.
handling-sf-data
IncludedSalesforce data operations with 130-point scoring. Use this skill to create, update, delete, bulk import/export, generate test data, and clean up org records using sf CLI and anonymous Apex. TRIGGER when: user creates test data, performs bulk import/export, uses sf data CLI commands, needs data factory patterns for Apex tests, or needs to seed/clean records in a Salesforce org. DO NOT TRIGGER when: SOQL query writing only (use querying-soql), Apex test execution (use running-apex-tests), or metadata deployment (use deploying-metadata).
accelint-ac-to-playwright
IncludedConvert and validate acceptance criteria for Playwright test automation. Use when user asks to (1) review/evaluate/check if AC are ready for automation, (2) assess if AC can be converted as-is, (3) validate AC quality for Playwright, (4) turn AC into tests, (5) generate tests from acceptance criteria, (6) convert .md bullets or .feature Gherkin files to Playwright specs, (7) create test automation from requirements. Handles both bullet-style markdown and Gherkin syntax with JSON test plan generation and validation.