Add credit
CreditIn¶
Description: Grants broker credit to a user account. Credit is separate from balance, participates in equity and margin calculations, and is not withdrawable. Only strictly positive values are accepted.
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 to assign credit |
| amount | double | Yes | Credit amount to add (must be greater than 0) |
| comment | string | Yes | Description or reason for the credit |
| 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": 300.00,
"comment": "Credit for promotion"
}
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": 1242281,
"state": 10,
"login": 123456,
"cmd": 7,
"amount": 300.0
}
⚠️ If zero or a negative amount is provided, the operation is rejected:
{ "error": "INVALID_DATA", "message": "Invalid finance amount" }
Accounting Rules¶
OP_CREDIT_INhas command value7.- The signed amount is persisted in the completed finance transaction
profitfield. - The operation increases
credit,equity, andmargin_free; it does not increasebalance. - Trading profit and loss continue to settle to
balance, not tocredit. - See Credit and Withdrawal Policy for the complete model.