File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -101,6 +101,10 @@ type ManagerCfg struct {
101101 // determine whether a quote is accepted or rejected.
102102 PriceOracle PriceOracle
103103
104+ // PortfolioPilot is the portfolio pilot that will make financial
105+ // decisions based on RFQ requests.
106+ PortfolioPilot PortfolioPilot
107+
104108 // ChannelLister is the channel lister that the RFQ manager will use to
105109 // determine the available channels for routing.
106110 ChannelLister ChannelLister
@@ -267,6 +271,7 @@ func (m *Manager) startSubsystems(ctx context.Context) error {
267271 // Initialise and start the quote negotiator.
268272 m .negotiator , err = NewNegotiator (NegotiatorCfg {
269273 PriceOracle : m .cfg .PriceOracle ,
274+ PortfolioPilot : m .cfg .PortfolioPilot ,
270275 OutgoingMessages : m .outgoingMessages ,
271276 AcceptPriceDeviationPpm : m .cfg .AcceptPriceDeviationPpm ,
272277 SkipAcceptQuotePriceCheck : m .cfg .SkipAcceptQuotePriceCheck ,
Original file line number Diff line number Diff line change @@ -33,6 +33,9 @@ type NegotiatorCfg struct {
3333 // determine whether a quote is accepted or rejected.
3434 PriceOracle PriceOracle
3535
36+ // PortfolioPilot makes financial decisions when evaluating quotes.
37+ PortfolioPilot PortfolioPilot
38+
3639 // OutgoingMessages is a channel which is populated with outgoing peer
3740 // messages. These are messages which are destined to be sent to peers.
3841 OutgoingMessages chan <- rfqmsg.OutgoingMsg
@@ -93,6 +96,18 @@ type Negotiator struct {
9396
9497// NewNegotiator creates a new quote negotiator.
9598func NewNegotiator (cfg NegotiatorCfg ) (* Negotiator , error ) {
99+ // If the portfolio pilot is not specified, then we will use the
100+ // internal portfolio pilot.
101+ if cfg .PortfolioPilot == nil {
102+ cfgPortfolioPilot := InternalPortfolioPilotConfig {
103+ PriceOracle : cfg .PriceOracle ,
104+ ForwardPeerIDToOracle : cfg .SendPeerId ,
105+ }
106+ cfg .PortfolioPilot = NewInternalPortfolioPilot (
107+ cfgPortfolioPilot ,
108+ )
109+ }
110+
96111 return & Negotiator {
97112 cfg : cfg ,
98113
You can’t perform that action at this time.
0 commit comments