Investments
TrexWallet supports investment products — users lock funds for a period and receive yield. Investments are managed through a small dedicated API and a /TrexAdmin/Investments admin page.
Investment Lifecycle
Created → Activated → ProfitCalculated → Closed
↘ ReceivedEarlyCloseRequest → Closed
States (investments_state_enum)
| Value | State | Description |
|---|---|---|
| 0 | None | Sentinel |
| 1 | Created | Draft, awaiting activation |
| 2 | Activated | Active, funds locked, yield accumulating |
| 4 | ReceivedEarlyCloseRequest | Early-close request submitted by the user |
| 8 | ProfitCalculated | Final profit value has been computed |
| 128 | Closed | Finalized — funds and yield released |
Flags (investments_flags_enum)
| Value | Flag | Description |
|---|---|---|
| 0 | None | None |
| 1 | EarlyCloseAllowed | User is allowed to request early close |
Types (investments_type_enum)
| Value | Type |
|---|---|
| 0 | None |
| 1 | interest_on_balance |
Creating an Investment
Investments are created by a trusted service through the private API:
POST private/v1/create_investment
{
"walletId": 123456789,
"currencyId": "USDT",
"investmentType": 1,
"state": 1,
"flags": 1,
"amount": 1000000000,
"profit": 0,
"ratePct": 12.5,
"dateEnd": "2026-06-15T00:00:00Z",
"tag": "30d term deposit"
}
amountis in lowest-denomination units ofcurrencyId(long).ratePctis the annual rate as a decimal percent.- The endpoint returns the freshly allocated investment
timetick(long).
On the platform side, creation moves funds out of free_balance into the order-locked partition (lock_orders) and records a CreateInvest transaction.
Yield Payments
Profit can be distributed two ways depending on InvestmentProfitMode:
- Managed mode (
= 1) — TrexWallet computes and applies profit periodically. Externalset_profits_for_investmentscalls are rejected. - External mode — a trusted integration pushes pre-computed profits via the private endpoint:
POST private/v1/set_profits_for_investments
[
{ "timetick": 123, "profit": 50000000 },
{ "timetick": 456, "profit": 30000000 }
]
Each accepted entry produces a PaymentInvest transaction crediting the user's wallet.
Closing an Investment
Normal close (maturity)
When the investment reaches dateEnd:
- Locked funds are released back to
free_balance. - A
CloseInvesttransaction is recorded. - State changes to
Closed (128).
Early close (user request)
User-initiated, only when flags contains EarlyCloseAllowed:
POST /trex/v1/invest/return_investment?investment=<investmentTimetick>
Early close:
- May apply a penalty (reduced or zero yield, depending on product configuration).
- Creates an
EarlyCloseInvesttransaction. - Releases the remaining funds to
free_balance.
Viewing Investments
User-facing API
# List investments in a date range, optionally filtered by type
GET /trex/v1/invest/get_investments
?start=2026-01-01
&end=2026-02-01
&investment_types=interest_on_balance
# Single investment details
GET /trex/v1/invest/get_investment_info?investment_id=<timetick>
Investment transaction details
POST /trex/v1/invest_tx_info
["123456789", "987654321"]
The body is a JSON array of transaction timetick strings; ids are returned as strings everywhere to keep int64 precision intact on the wire.
Authentication
Investment APIs use standard wallet authentication. Private endpoints require deployment-issued service credentials and the documented tenant/owner context headers. End-user endpoints use the active session.
Admin Panel
Manage investments at /TrexAdmin/Investments:
- View all investments with filters (wallet, currency, state, type).
- Create investments through the admin form (backed by the same private API).
- Track investment transaction history.
The
/TrexAdmin/Calculationspage is for operator reconciliation with external payment/exchange rails, not for configuring investment yield.
Transaction Types Produced
TransactTypeEnum | When |
|---|---|
CreateInvest (7) | Funds locked for the new investment |
CloseInvest (8) | Investment matured, funds released |
EarlyCloseInvest (9) | User-requested early closure |
PaymentInvest (10) | Yield payment credited |
Related
- Sub-balances — how funds are locked
- Transaction States
- Investments Admin Page