AGENT SKILL

cdcx-advanced

Advanced contingency orders — OCO, OTO, OTOCO. Triggered orders with linked cancellation logic.

License 许可
AGPL-3.0
最近更新
2026-11-15
Stars
★ 81
Forks
17

01 前言 Front Matter

name
cdcx-advanced
description
Advanced contingency orders — OCO, OTO, OTOCO. Triggered orders with linked cancellation logic.

02 资源文件 2

03 SKILL.md 正文

Advanced Orders

When to Use

  • Place a stop-loss and take-profit that cancel each other (OCO)
  • Place an entry order that spawns a protection order when filled (OTO)
  • Place an entry with both a stop-loss and take-profit (OTOCO — "bracket order")
  • Manage or cancel an advanced order by its contingency ID

Requires authentication. All placement commands are tier mutate.

Order Types

Type Meaning Shape
OCO One-Cancels-the-Other 2 protection legs; one fill cancels the other
OTO One-Triggers-the-Other 1 entry leg + 1 protection leg (fires only after entry fills)
OTOCO Bracket 1 entry leg + 2 protection legs (stop-loss + take-profit)

Tools Used

Tool Purpose Tier
cdcx_advanced_oco Create OCO pair mutate
cdcx_advanced_create_oto Create OTO pair mutate
cdcx_advanced_create_otoco Create OTOCO bracket mutate
cdcx_advanced_cancel_oco Cancel an OCO by list ID mutate
cdcx_advanced_cancel_oto Cancel an OTO by list ID mutate
cdcx_advanced_cancel_otoco Cancel an OTOCO by list ID mutate
cdcx_advanced_cancel Cancel a single child order mutate
cdcx_advanced_cancel_all Cancel all advanced orders dangerous
cdcx_advanced_open_orders List open advanced orders sensitive_read
cdcx_advanced_order_detail Lookup by order_id / client_oid sensitive_read
cdcx_advanced_order_history Historical advanced orders sensitive_read
cdcx_advanced_order_list_detail Lookup by list IDs sensitive_read

Workflow

Each create-* command takes a single positional <order_list> — a JSON array of order objects. The order list captures the entire contingency in one request.

OTOCO Bracket (most common)

cdcx advanced create-otoco '[
    {"instrument_name":"BTC_USDT","side":"BUY","type":"LIMIT","price":"50000","quantity":"0.01"},
    {"instrument_name":"BTC_USDT","side":"SELL","type":"STOP_LOSS","trigger_price":"48000","quantity":"0.01","ref_price_type":"MARK_PRICE"},
    {"instrument_name":"BTC_USDT","side":"SELL","type":"TAKE_PROFIT","trigger_price":"55000","quantity":"0.01","ref_price_type":"MARK_PRICE"}
]' --dry-run -o json

Exactly 3 orders: one entry (LIMIT or MARKET), one stop leg (STOP_LOSS or STOP_LIMIT), one take-profit leg (TAKE_PROFIT or TAKE_PROFIT_LIMIT). ref_price_type supports MARK_PRICE (default), INDEX_PRICE, LAST_PRICE.

OTO (entry + protection)

cdcx advanced create-oto '[
    {"instrument_name":"BTC_USDT","side":"BUY","type":"LIMIT","price":"50000","quantity":"0.01"},
    {"instrument_name":"BTC_USDT","side":"SELL","type":"STOP_LOSS","trigger_price":"48000","quantity":"0.01","ref_price_type":"MARK_PRICE"}
]' -o json

Exactly 2 orders: one entry, one protection leg.

OCO (bare pair, already in position)

cdcx advanced oco '[
    {"instrument_name":"BTC_USDT","side":"SELL","type":"LIMIT","price":"55000","quantity":"0.01"},
    {"instrument_name":"BTC_USDT","side":"SELL","type":"STOP_LOSS","trigger_price":"48000","quantity":"0.01","ref_price_type":"MARK_PRICE"}
]' -o json

Use after you already hold a position — exits at either the take-profit limit or stop-loss trigger.

Single Trigger Order

cdcx advanced order BTCUSD-PERP \
    --side SELL --type STOP_LOSS \
    --quantity 0.01 \
    --trigger-price 48000 \
    --ref-price-type MARK_PRICE \
    -o json

Use when you want an unattached stop or take-profit with no linked leg.

Cancel by List ID

cdcx advanced cancel-otoco --list-id <list_id> -o json
cdcx advanced cancel-oco --list-id <list_id> -o json
cdcx advanced cancel-oto --list-id <list_id> -o json

List IDs are returned in the response body of the create-* call — capture and store them.

List and Inspect

cdcx advanced open-orders BTC_USDT -o json
cdcx advanced order-detail --order-id <id> -o json
cdcx advanced order-list-detail --list-id <list_id>,<list_id2> -o json
cdcx advanced order-history --instrument-name BTC_USDT --limit 50 -o json

Cancel Every Advanced Order (dangerous)

cdcx advanced cancel-all BTC_USDT -o json     # Per-instrument
cdcx advanced cancel-all -o json               # Account-wide — very rare

Notes

  • Advanced orders live in their own namespace — they do not appear in cdcx trade open-orders
  • ref_price_type defaults to MARK_PRICE. For perpetuals stick to MARK_PRICE to avoid liquidation-edge scenarios
  • OTO/OTOCO child orders are only created after the entry fills — until then they are virtual
  • Always --dry-run before a live OTOCO — the JSON payload is easy to get wrong

04 同仓库更多 Skills

jiayaoqijia
jiayaoqijia/cryptoskill

troves

Deposit and withdraw from Troves DeFi yield vault strategies on Starknet. View available strategies, check positions, and manage vault deposits. Use this skill when the user mentions Troves, vault, yield vault, DeFi vault, strategy, yield farming, vault deposit, vault withdraw, earning yield through vaults, passive yield strategies, or wants to deposit into or withdraw from a yield strategy — even if they don't say "Troves" explicitly.

★ 81
jiayaoqijia
jiayaoqijia/cryptoskill

trade

Swap tokens on Starknet via Fibrous DEX aggregator. Supports per-provider selection (avnu, ekubo, or auto to race all). Use this skill when the user wants to swap, exchange, trade, convert, buy, or sell one token for another on Starknet. Also use when the user asks about token prices, exchange rates, DEX routing, best swap route, or wants to check how much they would receive for a given amount — even if they don't explicitly say "swap".

★ 81
jiayaoqijia
jiayaoqijia/cryptoskill

staking

Stake, unstake, claim, and compound rewards for STRK, WBTC, tBTC, SolvBTC, and LBTC on Starknet. View validators, pools, and staking positions. Use this skill when the user mentions staking, delegating, validators, staking pools, rewards, compounding, unstaking, earning yield, passive income on crypto, or wants to earn on their STRK or BTC tokens — even if they don't say "stake" explicitly.

★ 81
jiayaoqijia
jiayaoqijia/cryptoskill

send

Send STRK, ETH, or any ERC-20 token to a Starknet address. Supports simulation (dry-run) before execution. Use this skill when the user wants to send, transfer, pay, tip, or move tokens to another wallet address on Starknet. Also trigger when the user mentions sending funds to someone, making a payment, transferring assets, or moving crypto to a specific address — even if they just say "pay 10 STRK to 0x...".

★ 81
jiayaoqijia
jiayaoqijia/cryptoskill

portfolio

View a comprehensive DeFi portfolio dashboard and optimize portfolio allocation via automated rebalancing. Use this skill when the user wants an overview, summary, dashboard, total value, net worth, portfolio rebalancing, target allocation, or wants to see all their DeFi positions across Starknet at once. Also trigger when the user asks "what do I have", "show me everything", "how much am I worth", "my positions", "my investments", "rebalance my portfolio", "I want 50% ETH", "optimize my holdings", or any request for a holistic view of their Starknet holdings — even if they don't explicitly say "portfolio".

★ 81
jiayaoqijia
jiayaoqijia/cryptoskill

multi-swap

Execute multiple token swaps in a single Starknet transaction via Fibrous (default). Supports per-provider selection (avnu, ekubo, or auto to race all). Supports 2-3 swap pairs bundled into one multicall. Use this skill when the user wants to swap multiple token pairs at once, do batch swaps, execute several trades simultaneously, perform parallel swaps, or do bulk trading in one transaction. Also trigger when the user mentions "two swaps", "three swaps", "swap X and Y at the same time", or wants to convert multiple tokens in a single call.

★ 81