# Rebalancing

Mosaiq moves its collateral between its pooled venue accounts as the margin
needs of orders and liquidations change. These transfers never debit your
balance, withdraw your funds, or change your positions or fills. Mosaiq pays
their costs.

The venue can still refuse an order when the Mosaiq account on it needs more
collateral. The write answer is `accepted`, and the refusal arrives on
`orderUpdates`: `failure.code` is `temporarily_unavailable` and
`failure.detail` is `broker_capacity`. It is not a margin error on your
account. When present, `failure.retryAfterMs` says how long to wait before you
retry.

Rebalancing does not prevent [liquidation](/concepts/liquidation) when your
account falls below maintenance margin.

## During US market hours

Mosaiq rests the Hyperliquid `Alo` orders of each market on one maker account.
A move of collateral out of that account pauses the orders of users who
connect with `cancelAllOnDisconnect=true`: see
[Account operations](/api/optimizing-latency#account-operations).

During the NYSE regular session, from 60 seconds before the 09:30 New York open
to the close, Mosaiq moves collateral out of a maker account only when the
move cannot wait:

| In the session, Mosaiq moves collateral from a maker account | Mosaiq waits for the close |
| --- | --- |
| To protect positions near their maintenance margin | To bring a venue account up to its forecast need |
| To fund an order that the venue account refused with `broker_capacity` | To keep a buffer above that need |
| To bring a venue account that holds less than half its forecast need back up to that need | To place idle collateral on the venues |

In the hour before the open, Mosaiq tops up the maker accounts of the HIP-3
dexes above their forecast need, so that they need no refill in the session.
Moves that do not debit a maker account do not change. NYSE holidays and early
closes follow the published NYSE calendar.

## Your token cash

:::note\[Not open in production yet]
Spot and outcome trading are not open in production yet, so no account holds
token cash.
:::

Spot and outcome buys spend token cash: the USDC that your account holds on its
own Hyperliquid sub-account. When a request needs USDC on the other side,
Mosaiq refuses the request and moves the amount below:

| Request | What Mosaiq moves |
| --- | --- |
| A token buy that your token cash cannot pay | The difference plus a buffer, from your withdrawable USDC to your token cash. |
| A perp order short of margin | The difference, from your token cash back to your USDC balance. |
| A withdrawal above your withdrawable USDC | The difference, from your token cash back to your USDC balance. |

Each refusal is `temporarily_unavailable` with the detail `broker_capacity`.
Its `retryAfterMs` says when to retry. Token cash without activity for 24
hours moves back on its own. A move changes where your USDC is, never whose it
is, and Mosaiq pays its costs. See [token cash](/api/exchange#token-cash).
