Agent skill

Trading Futures

by alsk1992 in alsk1992/CloddsBot

Trade perpetual futures on Binance, Bybit, Hyperliquid, MEXC with up to 200x leverage

MITAuto-check passedBusiness, Finance & HR

Install Trading Futures

skills CLI
$ npx skills add alsk1992/CloddsBot --skill trading-futures -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install alsk1992/CloddsBot trading-futures --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/alsk1992/CloddsBot.git skills-src && mkdir -p .claude/skills && cp -r skills-src/src/skills/bundled/trading-futures .claude/skills/trading-futures && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
trading-futures
GitHub stars
3k
Token cost
~5.6k tokens
SKILL.md length
232 words
Files
2
Skills in repo
116
Repo updated
First seen
Licence
MIT

At a glance

Trade perpetual futures on Binance, Bybit, Hyperliquid, MEXC with up to 200x leverage

  • Tasks that involve Trading and backtesting
  • SKILL.md covers Supported Exchanges, Required Environment Variables, Chat Commands and TypeScript API Reference, plus 2 more sections
  • Runs TypeScript scripts from its folder; needs BINANCE_API_KEY and BINANCE_API_SECRET

What it does

Trading Futures is an agent skill from alsk1992/CloddsBot. Trade perpetual futures on Binance, Bybit, Hyperliquid, MEXC with up to 200x leverage

Its SKILL.md is about 5.6k tokens, which your agent loads only when the skill is triggered. The skill folder holds 1 other file (for example `index.ts`).

It sits in Business, Finance & HR, covering Trading and backtesting. It works with Binance and Hyperliquid. The repository describes itself as: Open Source AI trading agent that operates autonomously across 1000+ markets - Polymarket, Kalshi, Binance, Hyperliquid, Solana DEXs, 5 EVM chains. Scans for edge, executes… The licence is MIT.

When your agent uses it

  • Tasks that involve Trading and backtesting

Example prompts

  • “/trading-futures”

Requirements

  • Node.js
  • A credential in BINANCE_API_KEY
  • A credential in BYBIT_API_KEY

What it can do on your machine

Read from SKILL.md and the folder at commit c930628. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships script files (TypeScript), which the agent can run.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • BINANCE_API_KEY
    • BINANCE_API_SECRET
    • BYBIT_API_KEY
    • BYBIT_API_SECRET
    • MEXC_API_KEY
    • MEXC_API_SECRET
    • HYPERLIQUID_PRIVATE_KEY

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Trading Futures loads about 5.6k tokens when it runs. Until then it costs about 25 tokens; SKILL.md has 232 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~25
When it runs · the whole SKILL.md, loaded when a task matches
~5.6k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from alsk1992/CloddsBot at commit c930628, republished under its MIT licence (© alsk1992). 232 words, ~5,578 tokens.

Download SKILL.mdSave it as .claude/skills/trading-futures/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
trading-futures
description
Trade perpetual futures on Binance, Bybit, Hyperliquid, MEXC with up to 200x leverage
emoji
📈

Perpetual Futures Trading - Complete API Reference

Trade leveraged perpetual futures across 4 exchanges with database tracking, custom strategies, and A/B testing.

200+ methods across 4 exchanges. This is the complete reference.

Supported Exchanges

ExchangeTypeMax LeverageKYCAPI Methods
Binance FuturesCEX125xYes55+
BybitCEX100xYes50+
MEXCCEX200xNo (small)35+
HyperliquidDEX50xNo60+

Required Environment Variables

bash
# Binance Futures
BINANCE_API_KEY=your_api_key
BINANCE_API_SECRET=your_api_secret

# Bybit
BYBIT_API_KEY=your_api_key
BYBIT_API_SECRET=your_api_secret

# MEXC (No KYC for small amounts)
MEXC_API_KEY=your_api_key
MEXC_API_SECRET=your_api_secret

# Hyperliquid (Fully decentralized, No KYC)
HYPERLIQUID_PRIVATE_KEY=your_private_key
HYPERLIQUID_WALLET_ADDRESS=0x...

# Optional: Database for trade tracking
DATABASE_URL=postgres://user:pass@localhost:5432/clodds

Chat Commands

Account & Balance
/futures balance [exchange]        # Check margin balance (all or specific)
/futures positions                 # View all open positions
/futures positions <exchange>      # View positions on specific exchange
Opening Positions
/futures long <symbol> <size> [leverage]x    # Open long position
/futures short <symbol> <size> [leverage]x   # Open short position

# Examples:
/futures long BTCUSDT 0.1 10x      # Open 0.1 BTC long at 10x
/futures short ETHUSDT 1 20x       # Open 1 ETH short at 20x
/futures long BTCUSDT 0.01         # Use default leverage
Take-Profit & Stop-Loss
/futures tp <symbol> <price>       # Set take-profit
/futures sl <symbol> <price>       # Set stop-loss
/futures tpsl <symbol> <tp> <sl>   # Set both at once

# Examples:
/futures tp BTCUSDT 105000         # Take profit at $105k
/futures sl BTCUSDT 95000          # Stop loss at $95k
/futures tpsl BTCUSDT 105000 95000 # Both
Closing Positions
/futures close <symbol>            # Close specific position
/futures close-all                 # Close ALL positions (all exchanges)
/futures close-all <exchange>      # Close all on specific exchange
Market Data
/futures markets [exchange]        # List available markets
/futures price <symbol>            # Get current price
/futures funding <symbol>          # Check funding rate
/futures orderbook <symbol>        # View orderbook depth
Account Info
/futures stats                     # Trade statistics from database
/futures history [symbol]          # Trade history
/futures pnl [period]              # P&L summary (day/week/month)
Leverage & Margin
/futures leverage <symbol> <value> # Set leverage
/futures margin <symbol> <mode>    # Set margin mode (cross/isolated)

TypeScript API Reference

Quick Setup
typescript
import { setupFromEnv } from 'clodds/trading/futures';

// Auto-configure from environment variables
const { clients, database, strategyEngine } = await setupFromEnv();

// Access individual clients
const binance = clients.binance;
const bybit = clients.bybit;
const mexc = clients.mexc;
const hyperliquid = clients.hyperliquid;
Manual Client Setup
typescript
import {
  BinanceFuturesClient,
  BybitFuturesClient,
  MexcFuturesClient,
  HyperliquidClient,
  FuturesDatabase,
  StrategyEngine,
} from 'clodds/trading/futures';

// Binance
const binance = new BinanceFuturesClient({
  apiKey: process.env.BINANCE_API_KEY!,
  apiSecret: process.env.BINANCE_API_SECRET!,
  testnet: false,  // true for testnet
});

// Bybit
const bybit = new BybitFuturesClient({
  apiKey: process.env.BYBIT_API_KEY!,
  apiSecret: process.env.BYBIT_API_SECRET!,
  testnet: false,
});

// MEXC (No KYC)
const mexc = new MexcFuturesClient({
  apiKey: process.env.MEXC_API_KEY!,
  apiSecret: process.env.MEXC_API_SECRET!,
});

// Hyperliquid (Decentralized, No KYC)
const hyperliquid = new HyperliquidClient({
  privateKey: process.env.HYPERLIQUID_PRIVATE_KEY!,
  walletAddress: process.env.HYPERLIQUID_WALLET_ADDRESS!,
  testnet: false,
});

Binance Futures API (55+ Methods)

Market Data
typescript
// Prices & Tickers
await binance.getMarkPrice('BTCUSDT');
await binance.getTicker24h('BTCUSDT');
await binance.getAllTickers();
await binance.getBookTicker('BTCUSDT');

// Orderbook & Trades
await binance.getOrderBook('BTCUSDT', 100);
await binance.getRecentTrades('BTCUSDT', 500);
await binance.getHistoricalTrades('BTCUSDT', 500);
await binance.getAggTrades('BTCUSDT');

// Klines (Candlesticks)
await binance.getKlines('BTCUSDT', '1h', 100);
await binance.getContinuousKlines('BTCUSDT', '1h', 'PERPETUAL');
await binance.getIndexPriceKlines('BTCUSDT', '1h');
await binance.getMarkPriceKlines('BTCUSDT', '1h');
await binance.getPremiumIndexKlines('BTCUSDT', '1h');

// Funding Rates
await binance.getFundingRate('BTCUSDT');
await binance.getFundingRateHistory('BTCUSDT', 100);

// Market Info
await binance.getExchangeInfo();
await binance.getOpenInterest('BTCUSDT');
await binance.getOpenInterestHistory('BTCUSDT', '1h');
Trading
typescript
// Place Orders
await binance.placeOrder({
  symbol: 'BTCUSDT',
  side: 'BUY',
  type: 'MARKET',
  quantity: 0.01,
});

await binance.placeOrder({
  symbol: 'BTCUSDT',
  side: 'BUY',
  type: 'LIMIT',
  quantity: 0.01,
  price: 95000,
  timeInForce: 'GTC',
});

// With TP/SL
await binance.placeOrder({
  symbol: 'BTCUSDT',
  side: 'BUY',
  type: 'MARKET',
  quantity: 0.01,
  takeProfit: 105000,
  stopLoss: 95000,
});

// Batch Orders
await binance.placeBatchOrders([
  { symbol: 'BTCUSDT', side: 'BUY', type: 'LIMIT', quantity: 0.01, price: 94000 },
  { symbol: 'BTCUSDT', side: 'BUY', type: 'LIMIT', quantity: 0.01, price: 93000 },
]);

// Modify & Cancel
await binance.modifyOrder('BTCUSDT', orderId, { quantity: 0.02 });
await binance.cancelOrder('BTCUSDT', orderId);
await binance.cancelAllOrders('BTCUSDT');
await binance.cancelBatchOrders('BTCUSDT', [orderId1, orderId2]);

// Auto-cancel
await binance.setAutoCancel(60000);  // Cancel all after 60s
await binance.cancelAutoCancel();
Account & Positions
typescript
// Account Info
await binance.getAccountInfo();
await binance.getBalance();
await binance.getPositions();
await binance.getPositionRisk();

// Orders & History
await binance.getOpenOrders();
await binance.getOpenOrders('BTCUSDT');
await binance.getAllOrders('BTCUSDT');
await binance.getOrder('BTCUSDT', orderId);
await binance.getTradeHistory('BTCUSDT');
await binance.getIncomeHistory();
await binance.getIncomeHistory('BTCUSDT', 'REALIZED_PNL');

// Commission
await binance.getCommissionRate('BTCUSDT');
Risk Management
typescript
// Leverage
await binance.setLeverage('BTCUSDT', 10);
await binance.getLeverageBrackets();
await binance.getLeverageBrackets('BTCUSDT');

// Margin Mode
await binance.setMarginType('BTCUSDT', 'ISOLATED');
await binance.modifyIsolatedMargin('BTCUSDT', 100, 'ADD');
await binance.modifyIsolatedMargin('BTCUSDT', 50, 'REDUCE');

// Position Mode
await binance.getPositionMode();
await binance.setPositionMode(true);  // Hedge mode
await binance.setPositionMode(false); // One-way mode

// Multi-Asset Mode
await binance.getMultiAssetMode();
await binance.setMultiAssetMode(true);
Analytics
typescript
// Market Analytics
await binance.getLongShortRatio('BTCUSDT', '1h');
await binance.getTopTraderLongShortRatio('BTCUSDT', '1h');
await binance.getTopTraderPositions('BTCUSDT', '1h');
await binance.getGlobalLongShortRatio('BTCUSDT', '1h');
await binance.getTakerBuySellVolume('BTCUSDT', '1h');
Staking & Earn
typescript
// Staking
await binance.getStakingProducts();
await binance.stake('BNB', 10);
await binance.unstake('BNB', 5);
await binance.getStakingHistory();
await binance.getStakingPositions();
Convert
typescript
// Convert between assets
await binance.getConvertPairs('USDT', 'BTC');
await binance.sendQuote('USDT', 'BTC', 100);
await binance.acceptQuote(quoteId);
await binance.getConvertHistory();
Portfolio Margin
typescript
await binance.getPortfolioMarginAccount();
await binance.getPortfolioMarginBankruptcyLoan();
await binance.repayPortfolioMarginLoan();

Bybit API (50+ Methods)

Market Data
typescript
await bybit.getTickers('linear');
await bybit.getTickers('linear', 'BTCUSDT');
await bybit.getOrderbook('BTCUSDT', 'linear');
await bybit.getKline('BTCUSDT', '1h', 'linear');
await bybit.getMarkPriceKline('BTCUSDT', '1h', 'linear');
await bybit.getIndexPriceKline('BTCUSDT', '1h', 'linear');
await bybit.getPremiumIndexPriceKline('BTCUSDT', '1h', 'linear');
await bybit.getInstrumentsInfo('linear');
await bybit.getFundingHistory('BTCUSDT', 'linear');
await bybit.getPublicTradingHistory('BTCUSDT', 'linear');
await bybit.getOpenInterest('BTCUSDT', 'linear', '1h');
await bybit.getHistoricalVolatility();
await bybit.getInsurance();
await bybit.getRiskLimit('linear');
Trading
typescript
// Place Order
await bybit.placeOrder({
  category: 'linear',
  symbol: 'BTCUSDT',
  side: 'Buy',
  orderType: 'Market',
  qty: '0.01',
});

await bybit.placeOrder({
  category: 'linear',
  symbol: 'BTCUSDT',
  side: 'Buy',
  orderType: 'Limit',
  qty: '0.01',
  price: '95000',
  timeInForce: 'GTC',
});

// Batch Orders
await bybit.placeBatchOrders('linear', [
  { symbol: 'BTCUSDT', side: 'Buy', orderType: 'Limit', qty: '0.01', price: '94000' },
  { symbol: 'BTCUSDT', side: 'Buy', orderType: 'Limit', qty: '0.01', price: '93000' },
]);

// Modify & Cancel
await bybit.amendOrder({ category: 'linear', symbol: 'BTCUSDT', orderId, qty: '0.02' });
await bybit.cancelOrder({ category: 'linear', symbol: 'BTCUSDT', orderId });
await bybit.cancelAllOrders({ category: 'linear', symbol: 'BTCUSDT' });
await bybit.cancelBatchOrders('linear', [{ symbol: 'BTCUSDT', orderId }]);
Account & Positions
typescript
await bybit.getWalletBalance('UNIFIED');
await bybit.getPositionInfo('linear');
await bybit.getPositionInfo('linear', 'BTCUSDT');
await bybit.getOpenOrders('linear');
await bybit.getOrderHistory('linear');
await bybit.getExecutionList('linear');
await bybit.getClosedPnl('linear');
await bybit.getBorrowHistory();
await bybit.getCollateralInfo();
await bybit.getCoinGreeks();
await bybit.getFeeRate('linear', 'BTCUSDT');
await bybit.getAccountInfo();
await bybit.getTransactionLog();
await bybit.getMMPState('linear');
await bybit.setMMP({ baseCoin: 'BTC', window: '5000', frozenPeriod: '100', qtyLimit: '10', deltaLimit: '100' });
await bybit.resetMMP('BTC');
Risk Management
typescript
await bybit.setLeverage({ category: 'linear', symbol: 'BTCUSDT', buyLeverage: '10', sellLeverage: '10' });
await bybit.setMarginMode('ISOLATED_MARGIN');
await bybit.setPositionMode({ category: 'linear', mode: 0 });  // 0=one-way, 3=hedge
await bybit.setRiskLimit({ category: 'linear', symbol: 'BTCUSDT', riskId: 1 });
await bybit.setTradingStop({ category: 'linear', symbol: 'BTCUSDT', takeProfit: '105000', stopLoss: '95000' });
await bybit.setTpSlMode({ category: 'linear', symbol: 'BTCUSDT', tpSlMode: 'Full' });
await bybit.addOrReduceMargin({ category: 'linear', symbol: 'BTCUSDT', margin: '100' });
await bybit.switchCrossIsolatedMargin({ category: 'linear', symbol: 'BTCUSDT', tradeMode: 1, buyLeverage: '10', sellLeverage: '10' });
Copy Trading
typescript
await bybit.getCopyTradingLeaders();
await bybit.followLeader(leaderId);
await bybit.unfollowLeader(leaderId);
await bybit.getCopyPositions();
await bybit.closeCopyPosition(symbol);
Lending & Earn
typescript
await bybit.getLendingProducts();
await bybit.depositToLending(productId, amount);
await bybit.redeemFromLending(productId, amount);
await bybit.getLendingOrders();
await bybit.getEarnProducts();
await bybit.getEarnOrders();

Hyperliquid API (60+ Methods)

Market Data
typescript
await hyperliquid.getMeta();
await hyperliquid.getMetaAndAssetCtxs();
await hyperliquid.getAssetCtxs();
await hyperliquid.getAllMids();
await hyperliquid.getCandleSnapshot('BTC', '1h', startTime, endTime);
await hyperliquid.getL2Snapshot('BTC');
await hyperliquid.getFundingHistory('BTC', startTime, endTime);
await hyperliquid.getRecentTrades('BTC');
await hyperliquid.getPredictedFunding();
Trading
typescript
// Place Order
await hyperliquid.placeOrder({
  asset: 'BTC',
  isBuy: true,
  sz: 0.01,
  limitPx: 95000,
  orderType: { limit: { tif: 'Gtc' } },
  reduceOnly: false,
});

// Market Order
await hyperliquid.placeOrder({
  asset: 'BTC',
  isBuy: true,
  sz: 0.01,
  limitPx: null,
  orderType: { market: {} },
});

// TWAP Order
await hyperliquid.placeTwapOrder({
  asset: 'BTC',
  isBuy: true,
  sz: 1.0,
  duration: 3600,  // 1 hour
  randomize: true,
});

// Modify & Cancel
await hyperliquid.modifyOrder(orderId, { sz: 0.02 });
await hyperliquid.cancelOrder('BTC', orderId);
await hyperliquid.cancelAllOrders();
await hyperliquid.cancelOrdersByCloid(['cloid1', 'cloid2']);

// Batch Operations
await hyperliquid.batchModifyOrders([{ oid: orderId1, sz: 0.02 }, { oid: orderId2, sz: 0.03 }]);
Account & Positions
typescript
await hyperliquid.getUserState(walletAddress);
await hyperliquid.getClearinghouseState(walletAddress);
await hyperliquid.getOpenOrders(walletAddress);
await hyperliquid.getFrontendOpenOrders(walletAddress);
await hyperliquid.getUserFills(walletAddress);
await hyperliquid.getUserFillsByTime(walletAddress, startTime, endTime);
await hyperliquid.getUserFunding(walletAddress);
await hyperliquid.getUserFundingHistory(walletAddress, startTime, endTime);
await hyperliquid.getHistoricalOrders(walletAddress);
await hyperliquid.getOrderStatus(walletAddress, orderId);
await hyperliquid.getTwapHistory(walletAddress);
await hyperliquid.getSubaccounts(walletAddress);
Leverage & Margin
typescript
await hyperliquid.updateLeverage('BTC', 10, false);  // false = cross
await hyperliquid.updateLeverage('BTC', 10, true);   // true = isolated
await hyperliquid.updateIsolatedMargin('BTC', 100);
Transfers
typescript
await hyperliquid.usdTransfer(toAddress, amount);
await hyperliquid.spotTransfer(toAddress, token, amount);
await hyperliquid.withdraw(amount);
await hyperliquid.classTransfer(amount, toPerp);
Spot Trading
typescript
await hyperliquid.getSpotMeta();
await hyperliquid.getSpotMetaAndAssetCtxs();
await hyperliquid.getSpotClearinghouseState(walletAddress);
await hyperliquid.placeSpotOrder({
  asset: 'HYPE',
  isBuy: true,
  sz: 10,
  limitPx: 25,
});
Vaults
typescript
await hyperliquid.getVaultDetails(vaultAddress);
await hyperliquid.getUserVaultEquities(walletAddress);
await hyperliquid.depositToVault(vaultAddress, amount);
await hyperliquid.withdrawFromVault(vaultAddress, amount);
await hyperliquid.getAllVaults();
Staking
typescript
await hyperliquid.getValidatorSummaries();
await hyperliquid.getUserStakingSummary(walletAddress);
await hyperliquid.stakeHype(amount, validatorAddress);
await hyperliquid.unstakeHype(amount, validatorAddress);
await hyperliquid.claimStakingRewards();
Delegations
typescript
await hyperliquid.getDelegatorSummary(walletAddress);
await hyperliquid.getDelegatorHistory(walletAddress);
await hyperliquid.delegate(amount, agentAddress);
await hyperliquid.undelegate(amount, agentAddress);
Referrals & Analytics
typescript
await hyperliquid.getReferralState(walletAddress);
await hyperliquid.createReferralCode(code);
await hyperliquid.getReferredUsers(walletAddress);
await hyperliquid.getUserAnalytics(walletAddress);
await hyperliquid.getLeaderboard();
await hyperliquid.getMaxBuilderFee();

MEXC API (35+ Methods)

Market Data
typescript
await mexc.getContractDetail('BTC_USDT');
await mexc.getAllContractDetails();
await mexc.getOrderbook('BTC_USDT');
await mexc.getKlines('BTC_USDT', '1h');
await mexc.getTicker('BTC_USDT');
await mexc.getAllTickers();
await mexc.getFundingRate('BTC_USDT');
await mexc.getFundingRateHistory('BTC_USDT');
await mexc.getOpenInterest('BTC_USDT');
await mexc.getRecentTrades('BTC_USDT');
await mexc.getIndexPrice('BTC_USDT');
await mexc.getFairPrice('BTC_USDT');
Trading
typescript
// Place Order
await mexc.placeOrder({
  symbol: 'BTC_USDT',
  side: 1,  // 1=Open Long, 2=Close Short, 3=Open Short, 4=Close Long
  type: 5,  // 1=Limit, 2=Post Only, 3=IOC, 4=FOK, 5=Market
  vol: 1,   // Contracts
  leverage: 10,
});

// With TP/SL
await mexc.placeOrder({
  symbol: 'BTC_USDT',
  side: 1,
  type: 5,
  vol: 1,
  leverage: 10,
  takeProfit: 105000,
  stopLoss: 95000,
});

// Batch Orders
await mexc.placeBatchOrders([
  { symbol: 'BTC_USDT', side: 1, type: 1, vol: 1, price: 94000, leverage: 10 },
  { symbol: 'BTC_USDT', side: 1, type: 1, vol: 1, price: 93000, leverage: 10 },
]);

// Trigger Order
await mexc.placeTriggerOrder({
  symbol: 'BTC_USDT',
  side: 1,
  type: 1,
  vol: 1,
  triggerPrice: 96000,
  triggerType: 1,  // 1=Last Price, 2=Fair Price, 3=Index Price
  executionPrice: 96100,
  leverage: 10,
});

// Cancel
await mexc.cancelOrder('BTC_USDT', orderId);
await mexc.cancelAllOrders('BTC_USDT');
await mexc.cancelBatchOrders([orderId1, orderId2]);
Account & Positions
typescript
await mexc.getAccountInfo();
await mexc.getPositions();
await mexc.getPositions('BTC_USDT');
await mexc.getOpenOrders();
await mexc.getOpenOrders('BTC_USDT');
await mexc.getOrderHistory('BTC_USDT');
await mexc.getTradeHistory('BTC_USDT');
await mexc.getTriggerOrders();
await mexc.getStopOrders();
await mexc.getRiskLimit('BTC_USDT');
await mexc.getAssets();
await mexc.getAssetRecords();
Risk Management
typescript
await mexc.setLeverage('BTC_USDT', 10);
await mexc.changeMarginMode('BTC_USDT', 1);  // 1=Isolated, 2=Cross
await mexc.changePositionMode(1);  // 1=Hedge, 2=One-way
await mexc.autoAddMargin('BTC_USDT', true);

Database Tracking

Initialize Database
typescript
import { FuturesDatabase } from 'clodds/trading/futures';

const db = new FuturesDatabase(process.env.DATABASE_URL!);
await db.initialize();  // Creates tables if not exist
Log Trades
typescript
await db.logTrade({
  exchange: 'binance',
  symbol: 'BTCUSDT',
  orderId: '12345',
  side: 'BUY',
  price: 95000,
  quantity: 0.01,
  realizedPnl: 50.25,
  commission: 0.95,
  commissionAsset: 'USDT',
  timestamp: Date.now(),
  isMaker: false,
  strategy: 'momentum',
  variant: 'aggressive',
});
Query Trades
typescript
// Get trades
const trades = await db.getTrades({ exchange: 'binance' });
const btcTrades = await db.getTrades({ exchange: 'binance', symbol: 'BTCUSDT' });
const recentTrades = await db.getTrades({ limit: 100 });

// Get statistics
const stats = await db.getTradeStats('binance');
// { totalTrades, winRate, totalPnl, avgPnl, bestTrade, worstTrade }

// Get variant performance
const results = await db.getVariantPerformance('momentum');
// { aggressive: { trades, pnl, winRate }, conservative: { ... } }

Custom Strategies

Strategy Interface
typescript
import { FuturesStrategy, StrategySignal } from 'clodds/trading/futures';

interface FuturesStrategy {
  name: string;
  analyze(data: MarketData): Promise<StrategySignal | null>;
}

interface StrategySignal {
  action: 'BUY' | 'SELL' | 'CLOSE';
  symbol: string;
  confidence: number;  // 0-1
  reason: string;
  metadata?: Record<string, unknown>;
}
Example Strategy
typescript
class RSIStrategy implements FuturesStrategy {
  name = 'rsi-strategy';

  constructor(private config: { period: number; oversold: number; overbought: number }) {}

  async analyze(data: MarketData): Promise<StrategySignal | null> {
    const rsi = calculateRSI(data.closes, this.config.period);

    if (rsi < this.config.oversold) {
      return {
        action: 'BUY',
        symbol: data.symbol,
        confidence: (this.config.oversold - rsi) / this.config.oversold,
        reason: `RSI oversold at ${rsi.toFixed(1)}`,
        metadata: { rsi },
      };
    }

    if (rsi > this.config.overbought) {
      return {
        action: 'SELL',
        symbol: data.symbol,
        confidence: (rsi - this.config.overbought) / (100 - this.config.overbought),
        reason: `RSI overbought at ${rsi.toFixed(1)}`,
        metadata: { rsi },
      };
    }

    return null;
  }
}
Register & Run
typescript
const engine = new StrategyEngine(db);
engine.registerStrategy(new RSIStrategy({ period: 14, oversold: 30, overbought: 70 }));

// A/B Test Variants
engine.registerVariant('rsi-strategy', 'aggressive', { oversold: 25, overbought: 75 });
engine.registerVariant('rsi-strategy', 'conservative', { oversold: 35, overbought: 65 });

Built-in Strategies

StrategyLogicConfig
MomentumStrategyFollow price trendslookbackPeriod, threshold
MeanReversionStrategyBuy dips, sell ralliesmaPeriod, deviationMultiplier
GridStrategyPlace orders at intervalsgridSize, levels, spacing

Error Handling

All clients throw typed errors:

typescript
import { FuturesError, InsufficientBalanceError, InvalidOrderError } from 'clodds/trading/futures';

try {
  await binance.placeOrder({ ... });
} catch (error) {
  if (error instanceof InsufficientBalanceError) {
    console.log('Not enough margin');
  } else if (error instanceof InvalidOrderError) {
    console.log('Invalid order params:', error.message);
  } else if (error instanceof FuturesError) {
    console.log('Exchange error:', error.code, error.message);
  }
}

Rate Limits

ExchangeLimitNotes
Binance2400/minPer IP, weight-based
Bybit120/minPer endpoint
Hyperliquid1200/minPer wallet
MEXC20/secPer IP

All clients automatically handle rate limiting with exponential backoff.

© alsk1992, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file in src/skills/bundled/trading-futures of alsk1992/CloddsBot.

  • SKILL.md
  • index.ts

Open the folder on GitHubat commit c930628

Compare with similar skills

Trading Futures next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Trading Futures compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Trading Futures this skillalsk1992/CloddsBot3k—~5.6kAutomated safety check: PassMIT
Fintoolsecond-state/fintool316—~5.9kAutomated safety check: PassNone
Heytraders APILeoYeAI/openclaw-master-skills2.2k—~4.2kAutomated safety check: PassMIT
Moss Trade Bot Factorymoss-site/moss-trade-bot-skills390—~2.2kAutomated safety check: PassMIT-0
Academy Skillbinance/binance-skills-hub1.1k—~3.5kAutomated safety check: NotesNone
Opportunity RadarNunchi-trade/agent-cli521—~1.2kAutomated safety check: PassMIT

Similar skills

  • Fintool

    second-state/fintool

    Financial trading CLIs — spot and perp trading on Hyperliquid, Binance, Coinbase, OKX.

    316 GitHub stars~5.9k tokensUpdated 4 mo ago
    Business, Finance & HRAuto-check passed
  • Heytraders API

    LeoYeAI/openclaw-master-skills

    Trade crypto (Binance, Upbit, Hyperliquid, Lighter) and prediction markets (Polymarket).

    2.2k GitHub stars~4.2k tokensUpdated 2 mo ago
    Business, Finance & HRAuto-check passed
  • Moss Trade Bot Factory

    moss-site/moss-trade-bot-skills

    用户用自然语言描述币种、回测时间区间和策略风格时,自动创建加密货币交易 Bot,读取内置 Hyperliquid CSV 覆盖并运行本地回测/进化;若币种、时间区间或策略风格缺失,则主动询问缺失项并展示 CSV 解析出的可用回测区间。也可在回测后上传平台 verify 或创建模拟实盘 Bot。适用于创建bot、交易策略、回测、backtest、evolve、upload verify、live…

    390 GitHub stars~2.2k tokensUpdated 1 mo ago
    Business, Finance & HRAuto-check passed
  • Academy Skill

    binance/binance-skills-hub

    Retrieve Binance Academy's official educational content (Glossary, Courses, Learn & Earn, Articles) for AI chat.

    1.1k GitHub stars~3.5k tokensUpdated 1 mo ago
    Business, Finance & HRAuto-check: notes
  • Opportunity Radar

    Nunchi-trade/agent-cli

    Screens all Hyperliquid perps and surfaces top trading setups

    521 GitHub stars~1.2k tokensUpdated 3 mo ago
    Business, Finance & HRAuto-check passed
  • Binance Sports AI Analyzer

    binance/binance-skills-hub

    A skill your agent uses when users ask for World Cup or 世界杯 AI match predictions, WC assistant probabilities, World Cup news insights, master analysis, recomputing football match win rates with…

    1.1k GitHub stars~2k tokensUpdated 1 mo ago
    Business, Finance & HRAuto-check passed

More from alsk1992/CloddsBot

All 116 skills in this repo
  • Qmd

    alsk1992/CloddsBot

    Local hybrid search for markdown notes and docs. An agent skill from alsk1992/CloddsBot.

    3k GitHub starsUsed in 3 repos~1.2k tokens
    Auto-check passed
  • AI Strategy

    alsk1992/CloddsBot

    AI Strategy - natural language to trades. An agent skill from alsk1992/CloddsBot.

    3k GitHub stars~670 tokensUpdated 8 days ago
    Auto-check passed
  • Alerts

    alsk1992/CloddsBot

    Create and manage price alerts for prediction markets. An agent skill from alsk1992/CloddsBot.

    3k GitHub stars~460 tokensUpdated 8 days ago
    Auto-check passed
  • Analytics

    alsk1992/CloddsBot

    Performance attribution, trade analytics, and strategy optimization

    3k GitHub stars~1.6k tokensUpdated 8 days ago
    Auto-check passed
  • Arbitrage

    alsk1992/CloddsBot

    Automated cross-platform arbitrage detection and monitoring. An agent skill from alsk1992/CloddsBot.

    3k GitHub stars~1.7k tokensUpdated 8 days ago
    Auto-check passed
  • Auto Reply

    alsk1992/CloddsBot

    Automatic response rules, patterns, and scheduled messages. An agent skill from alsk1992/CloddsBot.

    3k GitHub stars~1.5k tokensUpdated 8 days ago
    Auto-check passed

Questions about Trading Futures

What does Trading Futures do?

Trade perpetual futures on Binance, Bybit, Hyperliquid, MEXC with up to 200x leverage. Trading Futures is an agent skill from alsk1992/CloddsBot.

When should I use Trading Futures?

Trading Futures fits situations like: tasks that involve Trading and backtesting.

How do I install Trading Futures in Claude Code?

Run `npx skills add alsk1992/CloddsBot --skill trading-futures -a claude-code`. Or copy the skill folder (src/skills/bundled/trading-futures in alsk1992/CloddsBot) into .claude/skills/trading-futures in your project. Claude Code loads it when a task matches its description.

How do I install Trading Futures in Codex?

Run `npx skills add alsk1992/CloddsBot --skill trading-futures -a codex`. Or copy the skill folder (src/skills/bundled/trading-futures in alsk1992/CloddsBot) into .agents/skills/trading-futures in your project. Codex loads it when a task matches its description.

Can I use Trading Futures in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add alsk1992/CloddsBot --skill trading-futures -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/trading-futures, .gemini/skills/trading-futures, .github/skills/trading-futures and .opencode/skills/trading-futures in your project.

What does Trading Futures need to run?

Going by SKILL.md and its folder, Trading Futures needs TypeScript for the scripts in its folder and credentials named BINANCE_API_KEY, BINANCE_API_SECRET, BYBIT_API_KEY and BYBIT_API_SECRET. Our summary lists: Node.js; A credential in BINANCE_API_KEY; A credential in BYBIT_API_KEY.

Does Trading Futures access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Trading Futures safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Trading Futures use?

Trading Futures is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Trading Futures use?

About 5.6k tokens (SKILL.md is roughly 22k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Trading Futures?

Skills that share tags, products or a category with Trading Futures: Fintool (second-state/fintool, 316 stars), Heytraders API (LeoYeAI/openclaw-master-skills, 2.2k stars), Moss Trade Bot Factory (moss-site/moss-trade-bot-skills, 390 stars) and Academy Skill (binance/binance-skills-hub, 1.1k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Trading Futures?

alsk1992 (a GitHub user) maintains it in alsk1992/CloddsBot, which has 2,951 GitHub stars. The repository holds 116 skills in this directory. The repository was last updated on October 2, 2026.

Source: alsk1992/CloddsBot on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.