feat: migrate RealUnit price to Aktionariat API#3188
Merged
TaprootFreak merged 6 commits intodevelopfrom Feb 13, 2026
Merged
Conversation
Replace direct smart contract reads (getPrice, getBuyPrice, getShares, settings) with the Aktionariat REST API endpoint for price and share data. Add 30s AsyncCache with fallback for resilience. Expose availableShares in all broker DTOs and remove raw wei fields (pricePerShareRaw, totalPriceRaw).
The API returns priceInEUR directly, so use it for the /realunit/price endpoint instead of deriving EUR from CHF via exchange rate conversion.
Add getDirectEurPrice() to PricingRealUnitService that returns the EUR price from the Aktionariat API for REALU<->EUR pairs. PricingService checks for this direct price before falling back to the rule chain, ensuring buy/sell and display endpoints use the same EUR rate.
When a REALU buy quote is confirmed, call the Aktionariat requestPaymentInstructions endpoint to register the order and store the response in a new aktionariatResponse column on transaction_request.
xlamn
requested changes
Feb 13, 2026
src/subdomains/supporting/pricing/services/integration/pricing-realunit.service.ts
Show resolved
Hide resolved
src/integration/blockchain/realunit/realunit-blockchain.service.ts
Outdated
Show resolved
Hide resolved
src/subdomains/supporting/payment/services/transaction-request.service.ts
Outdated
Show resolved
Hide resolved
- Add PaymentInstructionsResponse DTO to replace Promise<any> - Move Aktionariat order submission from TransactionRequestService into RealUnitService.confirmBuy() - Add PUT /realunit/buy/:id/confirm endpoint - Remove RealUnitBlockchainService dependency from TransactionRequestService - Make confirmTransactionRequest accept optional aktionariatResponse param
xlamn
approved these changes
Feb 13, 2026
xlamn
added a commit
to DFXswiss/realunit-app
that referenced
this pull request
Feb 13, 2026
with DFXswiss/api#3188 (review) another endpoint is used to confirm the pay payment - update confirm payment path - added available shares to dtos
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
getPrice,getBuyPrice,getShares,settings) with the Aktionariat REST API (POST /realunit/directinvestment/getPrice)AsyncCache(30s TTL, fallback to cache on API failure) so all methods share a single cached API callavailableSharesin all broker DTOs (BrokerbotPriceDto,BrokerbotBuyPriceDto,BrokerbotSharesDto,BrokerbotInfoDto)pricePerShareRaw,totalPriceRaw) — breaking change, as intendedpriceInEURfrom the API directly for REALU↔EUR pricing across the entire system (display, buy, sell) instead of deriving EUR from CHF via market exchange ratesaktionariat.cominHttpServicefor local developmentChanged files
realunit-blockchain.service.tsfetchPrice()with AsyncCacherealunit-broker.dto.tsavailableShares, removepricePerShareRaw/totalPriceRawpricing-realunit.service.tsgetDirectEurPrice()for direct REALU↔EUR pricing from APIpricing.service.tsgetDirectEurPrice()before rule chain ingetAssetPrice()http.service.tsaktionariat.commock responseEUR pricing consistency
Previously, the EUR price for REALU was derived via CHF → EUR market exchange rates (Fixer/Kraken). Now the Aktionariat API provides
priceInEURdirectly, which is used consistently:GET /realunit/price— viaPricingService→getDirectEurPrice()TransactionHelper→PricingService→getDirectEurPrice()TransactionHelper→PricingService→getDirectEurPrice()Test plan
npm run buildcompiles without new errorsGET /realunit/pricereturns CHF (from API), EUR (from API), USD (from rule chain)GET /realunit/brokerbot/infoshowsavailableSharesandbuyingEnabledderived from share countGET /realunit/brokerbot/buyPrice?shares=10returnstotalPrice = pricePerShare * 10GET /realunit/brokerbot/shares?amount=100returnsshares = floor(100 / pricePerShare)/realunit/price/realunit/price