Skip to content

[feature]: PortfolioPilot - Outsourcing All Market and Portfolio-Related Decision-Making During RFQ #1362

@ffranr

Description

@ffranr

Currently, the RFQ PriceOracle provides asset-to-BTC exchange rates, serving both wallet nodes and edge nodes. A key benefit of this setup is that tapd does not need to manage pricing decisions directly—these can be offloaded to an external service.

I propose extending this approach to limit orders as well. By limit order, I mean configurable rate and volume thresholds that an edge node can set to further restrict asset channel usage. While channel capacity already imposes constraints, limit orders add an additional layer of control. In our current implementation, these are referred to as "offers."

To enhance flexibility, all market, portfolio, and financial decision-making—not just price queries—should be handled by an external service. This is particularly important for edge nodes, as they require more nuanced control over pricing, limits, and execution policies.

Introducing PortfolioPilot

To support this, I think we should introduce a more generalized service, which I will call PortfolioPilot.

Proposed PortfolioPilot RPC Endpoints

  • QueryAssetRates – Returns exchange rates (migrated from or integrated with the price oracle).
  • IsQuoteAcceptable – Evaluates whether a peer's proposed quote meets acceptable conditions. If PortfolioPilot handles quote validation, it could also maintain an internal record of accepted/rejected quotes.
  • QueryAssetChannelLimits – Returns the maximum allowable volume for a given asset and channel.
  • PaymentUpdate – Updates PortfolioPilot on whether a quote was used, ensuring it remains synchronized with executed transactions.

By consolidating these responsibilities into PortfolioPilot, we can create a dedicated service for market intelligence, portfolio management, and financial decision-making, keeping tapd focused on its core role.


Notes

And then, if we go down this route, we can just remove RPC endpoints AddAssetSellOffer and AddAssetBuyOffer.

This sort of change should also allow us to get rid of price tolerance checks:

acceptablePrice := msg.AssetRate.Rate.WithinTolerance(
assetRate.Rate, tolerance,
)

It basically shrinks tapd and moves market/portfolio related decisions to a new service.

Metadata

Metadata

Assignees

No one assigned

    Labels

    RFQWork relating to TAP channel Request For Quote (RFQ).enhancementNew feature or requestoracle

    Projects

    Status

    🆕 New

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions