# Status Codes for Financial Operations

1. [Order status codes](#order-status-codes)
2. [Transfer status codes](#transfer-status-codes)
3. [Transaction status codes](#transaction-status-codes)

## Order status codes

<table><thead><tr><th width="137.20025634765625">Order status code</th><th width="198.25006103515625">Description of status code</th><th width="215.46240234375">Possible previous status codes</th><th>Possible next status codes</th></tr></thead><tbody><tr><td>RECEIVED</td><td>The order request was passed through the API layer.</td><td>N/A</td><td>N/A</td></tr><tr><td>INVALID</td><td>The order request did not pass the validation.</td><td>N/A</td><td>N/A</td></tr><tr><td>PENDING</td><td>This status indicates that the order was received by the system and is now in the queue to be processed. At this stage, the order details are registered, but no trading actions have been taken yet.</td><td>N/A</td><td><ul><li>FILLED</li><li>CANCELED</li><li>REJECTED</li></ul></td></tr><tr><td>CANCELED</td><td>The order has been canceled either by the user or the system. This means that the order will no longer be processed or executed. Cancellation can occur at any point before the order is filled.</td><td><ul><li>PENDING</li><li>CORRECTED</li></ul></td><td>N/A</td></tr><tr><td>REJECTED</td><td>This status indicates that the order has been rejected by the system. Rejection can occur due to various reasons such as insufficient funds, invalid order parameters, or system errors. A rejected order will not be processed or executed.</td><td><ul><li>PENDING</li></ul></td><td>N/A</td></tr><tr><td>FILLED</td><td>The order has been successfully executed and the trade is complete. All the requested amount has been traded at the specified or better price. The order is now closed with this final status.</td><td><ul><li>PENDING</li></ul></td><td><ul><li>SETTLED</li></ul></td></tr><tr><td>CORRECTED</td><td>This status indicates that there has been a correction on the order. This can happen due to post-trade processes where discrepancies are found and corrected to ensure the accuracy of trade records.</td><td><ul><li>FILLED</li></ul></td><td><ul><li>CANCELED</li></ul></td></tr><tr><td>SETTLED</td><td>The order has been fully settled, meaning that all financial transactions related to the trade are complete. This status indicates that the trade has been finalized, and the funds or assets have been transferred accordingly. Now the funds can be withdrawn.</td><td><ul><li>FILLED</li></ul></td><td>N/A</td></tr></tbody></table>

Sequence diagram

{% @mermaid/diagram content="sequenceDiagram
participant Partner\
participant Platform

Partner->>Platform: POST Create MARKET order (10 BTC)
Platform -->> Partner: Order-id(Order status RECEIVED)

Platform->>Platform: Order processing

alt order executed
Platform->>Platform: Balance and position updated
Platform->>Partner: Order status FILLED
Platform->>Platform: Settlement completed
Platform->>Partner: Order status SETTLED
end
opt insufficient balance/position
Platform->>Partner: Order status REJECTED
end" %}

## Transfer status codes

<table><thead><tr><th width="250.203857421875">Transfer status code</th><th>Description of status code</th></tr></thead><tbody><tr><td>RECEIVED</td><td>The transfer request was passed through the API layer.</td></tr><tr><td>INVALID</td><td>The transfer order request did not pass the validation.</td></tr><tr><td>PENDING</td><td>The transfer is created but not processed as some operations or checks are being performed.</td></tr><tr><td>REJECTED</td><td>The transfer was rejected. Please check the error codes for further details</td></tr><tr><td>PROCESSED</td><td>The transfer was successfully processed.</td></tr></tbody></table>

Sequence diagram

{% @mermaid/diagram content="sequenceDiagram
participant Partner\
participant Platform
participant SEPA

Note over Partner,Platform: Incoming transfer
SEPA->>Platform: Transfer notification
Platform->>Platform: Balance updated
Platform->>Partner: Transfer notification (status PROCESSED)

Note over Partner,Platform: Outgoing transfer
Partner->>Platform: Create Transfer
Platform -->> Partner: Transfer created (transfer id, status RECEIVED)

alt transfer processed
Platform->>Platform: Balance updated
Platform->>SEPA: Create Transfer
SEPA-->>Platform:
Platform->>Partner: Transfer notification (status PENDING)
SEPA->>Platform: Transfer notification
Platform->>Partner: Transfer notification (status PROCESSED)
end
opt insufficient balance
Platform->>Partner: Transfer notification (status REJECTED)
end" %}

## Transaction status codes

The list of Transaction status codes

<table><thead><tr><th width="249.87713623046875">Transaction status code</th><th>Description of status codes</th></tr></thead><tbody><tr><td>COMPLETED</td><td>This status means that the transaction has been fully processed or (for orders) executed successfully. All steps required to finalize the transaction have been carried out.</td></tr><tr><td>MODIFIED</td><td>This status signifies that the transaction details have been altered or updated after its initial completion. It reflects any changes made to the transaction parameters.</td></tr></tbody></table>

### Mapping of Transaction status codes

#### Order and Transaction status codes

<table><thead><tr><th width="249.7066650390625">No.</th><th>Order status</th><th>Transaction status</th></tr></thead><tbody><tr><td>1</td><td>RECEIVED</td><td>N/A</td></tr><tr><td>2</td><td>INVALID</td><td>N/A</td></tr><tr><td>3</td><td>PENDING</td><td>N/A</td></tr><tr><td>4</td><td>CANCELED</td><td>N/A</td></tr><tr><td>5</td><td>REJECTED</td><td>N/A</td></tr><tr><td>6</td><td>FILLED</td><td>COMPLETED</td></tr><tr><td>7</td><td>CORRECTED</td><td>MODIFIED</td></tr><tr><td>8</td><td>SETTLED</td><td>COMPLETED</td></tr></tbody></table>

#### Transfer and Transaction status codes

| No. | Transfer status | Transaction status |
| --- | --------------- | ------------------ |
| 1   | RECEIVED        | N/A                |
| 2   | INVALID         | N/A                |
| 3   | PENDING         | N/A                |
| 4   | REJECTED        | N/A                |
| 5   | PROCESSED       | COMPLETED          |
