subaccount_id you put on every order, deposit and withdrawal.
One subaccount trades both cNGN-USDC spot and the cNGN futures. Margin covers the
whole subaccount, across every series and the cNGN it holds.
Open a subaccount
Post a deposit toPOST /deposits with subaccount_id 0.
The venue opens the subaccount, funds it and pays the gas. The response’s subaccount_id is your
new subaccount.
To top up a subaccount you already have, send its id instead of 0.
Ownership
Matching holds every subaccount and records its owner: theowner of the deposit that opened it.
Only the owner can deposit to it or withdraw from it, and withdrawals are paid to the owner.
A withdrawal lends the subaccount to the WithdrawalModule for the call. The subaccount stays in
Matching, so trading from it is not interrupted.
Trade from a session key
For orders, you can sign with a session key instead of the owner key. Register it on chain withregisterSessionKey(address toAllow, uint expiry). Matching then accepts that signer for all the
owner’s subaccounts until expiry. See Session keys.
Deposits, withdrawals and cancels must be signed by the owner. Session keys
are not supported for them.
Use a subaccount on an order
Setsubaccount_id in the request body and subaccountId in the signed Action to the same id.
A mismatch is refused. See Order errors and validation.
Read a subaccount
GET /positions?subaccount_id=N returns the subaccount’s
futures positions and its margin surplus, read from chain. No signature is needed, because
positions are public on chain.
Accounts under the first MarginEngine
A subaccount stays under the MarginEngine it was opened under, and there is no way to move it. Accounts opened under the first engine,0xA19E296021c9DF25b90D96C2A0793CC3D0800758, cannot hold the current
futures. To move, open a new subaccount with a deposit, and withdraw
from the old one. Read an account’s engine as futures_account.manager on
GET /positions.

