Skip to main content

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)

ValueStateDescription
0NoneSentinel
1CreatedDraft, awaiting activation
2ActivatedActive, funds locked, yield accumulating
4ReceivedEarlyCloseRequestEarly-close request submitted by the user
8ProfitCalculatedFinal profit value has been computed
128ClosedFinalized — funds and yield released

Flags (investments_flags_enum)

ValueFlagDescription
0NoneNone
1EarlyCloseAllowedUser is allowed to request early close

Types (investments_type_enum)

ValueType
0None
1interest_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"
}
  • amount is in lowest-denomination units of currencyId (long).
  • ratePct is 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. External set_profits_for_investments calls 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:

  1. Locked funds are released back to free_balance.
  2. A CloseInvest transaction is recorded.
  3. 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:

  1. May apply a penalty (reduced or zero yield, depending on product configuration).
  2. Creates an EarlyCloseInvest transaction.
  3. 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/Calculations page is for operator reconciliation with external payment/exchange rails, not for configuring investment yield.

Transaction Types Produced

TransactTypeEnumWhen
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