Skip to content

Decrease credit

CreditOut

Description: Revokes broker credit from a user account. Only strictly negative values are accepted. The server rejects an operation that would produce negative credit or an unsafe projected margin state.

Access Control

Requires set_accounts_balance for manager/dealer sessions. The target account must also match the manager groups and brand scope loaded from the cached manager record. Token payload is used only for manager id and session type.

Request Parameters

Name Type Required Description
login int Yes User login ID whose credit should be decreased
amount double Yes Negative credit amount
comment string Yes Description or reason for the credit decrease
order int No Optional order ID for this credit operation. If set, the operation updates an existing finance transaction
open_time int No Optional open timestamp
close_time int No Optional close timestamp

Request Example

{
  "login": 123456,
  "amount": -100.0,
  "comment": "Credit correction"
}

Response Parameters

Successful finance commands return the same accepted-command structure as trade commands. In the raw TCP response envelope, the fields below are returned inside data.

Name Type Description
accepted bool true when the command was accepted for processing
order int Server-assigned finance transaction order ID
state int Finance request state. New transactions return TS_FINANCE_OPEN_REQUEST (10); updates return TS_FINANCE_UPDATE_REQUEST (11)
login int Account login
cmd int Finance command type
amount double Operation amount

Response Example

{
  "accepted": true,
  "order": 1242282,
  "state": 10,
  "login": 123456,
  "cmd": 9,
  "amount": -100.0
}

Errors

Code Description
400 Invalid request payload
401 Credit operation was rejected

Validation Rules

  • OP_CREDIT_OUT has command value 9.
  • abs(amount) cannot exceed current account credit.
  • Resulting credit cannot be negative.
  • Resulting equity cannot be negative.
  • With open exposure, projected equity must remain positive and the account must remain outside Margin Call and Stop Out.
  • Projected free margin must remain at or above the group's withdrawal_margin_reserve.

Credit revocation never changes balance. A negative balance is not automatically compensated from credit.

See Credit and Withdrawal Policy for formulas and examples.