Independent discussion of crypto, wallets, cards and markets
Forum Home > Exchanges & Trading > Centralized Exchanges > API trading without blowing up: permissions, limits and rotation
API trading without blowing up: permissions, limits and rotation98 replies · 6,228 views
Thread ToolsShow Printable Version · Subscribe to this Thread · Search Thread
Where to open an account: Open a Trustee account.

API trading without blowing up: permissions, limits and rotation

API trading fails in a known pattern: a key with withdrawal rights leaks, a bot runs away with size, or a stale key sits forgotten until someone finds it. Every rule below exists because of an incident like one of those. This thread covers the permission model, the limits that contain mistakes, and the rotation habit that keeps keys boring.

The incident that motivates each rule

  • The leaked withdrawal key. A trading script committed with withdrawal-enabled credentials; the attacker traded the float and withdrew the rest. Rule: withdrawal-disabled keys, always.
  • The runaway bot. A logic error turned a grid bot into a market-order machine; it burned the account's fees and slippage in an hour. Rule: rate limits and size caps at the key level.
  • The forgotten key. A key from a two-year-old experiment sat enabled through a platform breach; it was never used, and it was never revoked. Rule: inventory and rotation.
  • The shared key. Two tools used one key; one tool got compromised and took both strategies' floats with it. Rule: one key per tool, per sub-account.

Withdraw-disabled keys

  • Create trading keys with withdrawal permission off at creation - not disabled later, never enabled.
  • Some platforms let you set per-key withdrawal rights; set them to zero and leave them there.
  • The master account - the one with withdrawal rights - should have no trading keys bound to it at all.
  • Test the scope once: confirm the key can place and cancel orders but cannot move funds out.

Rate limits and size caps

  • Key-level rate limits. Cap requests per second at the tool's actual need; runaway loops hit the cap instead of the account.
  • Order size caps. Where supported, cap per-order size so a logic error cannot deploy the whole float in one fill.
  • Funded sub-accounts. The key's worst case is the sub-account's balance, not the master's. Size the sub-account to what a total loss would be survivable.
  • Market restrictions. Keys that only need one pair get that pair only; scope follows the tool's actual mandate.

Rotation and monitoring

  • Rotate on schedule. Quarterly rotation of every trading key: create new, migrate the tool, revoke old. The rotation is cheap; the leaked stale key is not.
  • Rotate on change. Tool updates, staff changes, partner changes and any suspected exposure trigger immediate rotation.
  • Monitor usage. Log every key's last-used timestamp and request pattern; anomalies - a key active at 3am that never sleeps - deserve review before they deserve panic.
  • Inventory monthly. One document lists every key: owner, tool, sub-account, permissions, last used, next rotation. Keys not on the list get revoked.

The takeaway

API safety is a permission model, not a hope: withdrawal-disabled keys, rate and size caps at the key level, funded sub-accounts that contain the worst case, and quarterly rotation with a monthly inventory. Every rule above is scar tissue from an incident that did not have to repeat on your account.

Thread Statistics98 replies · 6,228 views