Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add new liquidity stats to core #9750

Merged
merged 21 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@
- [9770](https://github.com/vegaprotocol/vega/issues/9770) - Fix `PnL` flickering bug.
- [9785](https://github.com/vegaprotocol/vega/issues/9785) - Support transfers to network treasury.
- [9743](https://github.com/vegaprotocol/system-tests/issues/9743) - Expose maker fees in fees stats API.
- [9750](https://github.com/vegaprotocol/vega/issues/9750) - Add paid liquidity fees statistics to API.

### 🐛 Fixes

Expand Down
1 change: 1 addition & 0 deletions cmd/data-node/commands/start/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ func (l *NodeCommand) createGRPCServer(config api.Config) *api.GRPCServer {
l.fundingPaymentService,
l.volumeDiscountStatsService,
l.volumeDiscountProgramService,
l.paidLiquidityFeesStatsService,
)
return grpcServer
}
191 changes: 99 additions & 92 deletions cmd/data-node/commands/start/sqlsubscribers.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,102 +76,105 @@ type SQLSubscribers struct {
fundingPaymentStore *sqlstore.FundingPayments
volumeDiscountStatsStore *sqlstore.VolumeDiscountStats
volumeDiscountProgramsStore *sqlstore.VolumeDiscountPrograms
paidLiquidityFeesStatsStore *sqlstore.PaidLiquidityFeesStats

// Services
candleService *candlesv2.Svc
marketDepthService *service.MarketDepth
riskService *service.Risk
marketDataService *service.MarketData
positionService *service.Position
tradeService *service.Trade
ledgerService *service.Ledger
rewardService *service.Reward
delegationService *service.Delegation
assetService *service.Asset
blockService *service.Block
partyService *service.Party
accountService *service.Account
orderService *service.Order
networkLimitsService *service.NetworkLimits
marketsService *service.Markets
epochService *service.Epoch
depositService *service.Deposit
withdrawalService *service.Withdrawal
governanceService *service.Governance
riskFactorService *service.RiskFactor
networkParameterService *service.NetworkParameter
checkpointService *service.Checkpoint
oracleSpecService *service.OracleSpec
oracleDataService *service.OracleData
liquidityProvisionService *service.LiquidityProvision
transferService *service.Transfer
stakeLinkingService *service.StakeLinking
notaryService *service.Notary
multiSigService *service.MultiSig
keyRotationsService *service.KeyRotations
ethereumKeyRotationsService *service.EthereumKeyRotation
nodeService *service.Node
chainService *service.Chain
protocolUpgradeService *service.ProtocolUpgrade
coreSnapshotService *service.SnapshotData
stopOrderService *service.StopOrders
fundingPeriodService *service.FundingPeriods
partyActivityStreakService *service.PartyActivityStreak
referralProgramService *service.ReferralPrograms
referralSetsService *service.ReferralSets
teamsService *service.Teams
vestingStatsService *service.VestingStats
feesStatsService *service.FeesStats
fundingPaymentService *service.FundingPayment
volumeDiscountStatsService *service.VolumeDiscountStats
volumeDiscountProgramService *service.VolumeDiscountPrograms
candleService *candlesv2.Svc
marketDepthService *service.MarketDepth
riskService *service.Risk
marketDataService *service.MarketData
positionService *service.Position
tradeService *service.Trade
ledgerService *service.Ledger
rewardService *service.Reward
delegationService *service.Delegation
assetService *service.Asset
blockService *service.Block
partyService *service.Party
accountService *service.Account
orderService *service.Order
networkLimitsService *service.NetworkLimits
marketsService *service.Markets
epochService *service.Epoch
depositService *service.Deposit
withdrawalService *service.Withdrawal
governanceService *service.Governance
riskFactorService *service.RiskFactor
networkParameterService *service.NetworkParameter
checkpointService *service.Checkpoint
oracleSpecService *service.OracleSpec
oracleDataService *service.OracleData
liquidityProvisionService *service.LiquidityProvision
transferService *service.Transfer
stakeLinkingService *service.StakeLinking
notaryService *service.Notary
multiSigService *service.MultiSig
keyRotationsService *service.KeyRotations
ethereumKeyRotationsService *service.EthereumKeyRotation
nodeService *service.Node
chainService *service.Chain
protocolUpgradeService *service.ProtocolUpgrade
coreSnapshotService *service.SnapshotData
stopOrderService *service.StopOrders
fundingPeriodService *service.FundingPeriods
partyActivityStreakService *service.PartyActivityStreak
referralProgramService *service.ReferralPrograms
referralSetsService *service.ReferralSets
teamsService *service.Teams
vestingStatsService *service.VestingStats
feesStatsService *service.FeesStats
fundingPaymentService *service.FundingPayment
volumeDiscountStatsService *service.VolumeDiscountStats
volumeDiscountProgramService *service.VolumeDiscountPrograms
paidLiquidityFeesStatsService *service.PaidLiquidityFeesStats

// Subscribers
accountSub *sqlsubscribers.Account
assetSub *sqlsubscribers.Asset
partySub *sqlsubscribers.Party
transferResponseSub *sqlsubscribers.TransferResponse
orderSub *sqlsubscribers.Order
networkLimitsSub *sqlsubscribers.NetworkLimits
marketDataSub *sqlsubscribers.MarketData
tradesSub *sqlsubscribers.TradeSubscriber
rewardsSub *sqlsubscribers.Reward
delegationsSub *sqlsubscribers.Delegation
marketCreatedSub *sqlsubscribers.MarketCreated
marketUpdatedSub *sqlsubscribers.MarketUpdated
epochSub *sqlsubscribers.Epoch
depositSub *sqlsubscribers.Deposit
withdrawalSub *sqlsubscribers.Withdrawal
proposalsSub *sqlsubscribers.Proposal
votesSub *sqlsubscribers.Vote
marginLevelsSub *sqlsubscribers.MarginLevels
riskFactorSub *sqlsubscribers.RiskFactor
netParamSub *sqlsubscribers.NetworkParameter
checkpointSub *sqlsubscribers.Checkpoint
oracleSpecSub *sqlsubscribers.OracleSpec
oracleDataSub *sqlsubscribers.OracleData
liquidityProvisionSub *sqlsubscribers.LiquidityProvision
positionsSub *sqlsubscribers.Position
transferSub *sqlsubscribers.Transfer
stakeLinkingSub *sqlsubscribers.StakeLinking
notarySub *sqlsubscribers.Notary
multiSigSignerEventSub *sqlsubscribers.ERC20MultiSigSignerEvent
keyRotationsSub *sqlsubscribers.KeyRotation
ethereumKeyRotationsSub *sqlsubscribers.EthereumKeyRotation
nodeSub *sqlsubscribers.Node
pupSub *sqlsubscribers.ProtocolUpgrade
snapSub *sqlsubscribers.SnapshotData
stopOrdersSub *sqlsubscribers.StopOrder
fundingPeriodSub *sqlsubscribers.FundingPeriod
partyActivityStreakSub *sqlsubscribers.PartyActivityStreak
referralProgramSub *sqlsubscribers.ReferralProgram
referralSetsSub *sqlsubscribers.ReferralSets
teamsSub *sqlsubscribers.Teams
vestingStatsSub *sqlsubscribers.VestingStatsUpdated
feesStatsSub *sqlsubscribers.FeesStats
fundingPaymentSub *sqlsubscribers.FundingPaymentSubscriber
volumeDiscountStatsSub *sqlsubscribers.VolumeDiscountStatsUpdated
volumeDiscountProgramSub *sqlsubscribers.VolumeDiscountProgram
accountSub *sqlsubscribers.Account
assetSub *sqlsubscribers.Asset
partySub *sqlsubscribers.Party
transferResponseSub *sqlsubscribers.TransferResponse
orderSub *sqlsubscribers.Order
networkLimitsSub *sqlsubscribers.NetworkLimits
marketDataSub *sqlsubscribers.MarketData
tradesSub *sqlsubscribers.TradeSubscriber
rewardsSub *sqlsubscribers.Reward
delegationsSub *sqlsubscribers.Delegation
marketCreatedSub *sqlsubscribers.MarketCreated
marketUpdatedSub *sqlsubscribers.MarketUpdated
epochSub *sqlsubscribers.Epoch
depositSub *sqlsubscribers.Deposit
withdrawalSub *sqlsubscribers.Withdrawal
proposalsSub *sqlsubscribers.Proposal
votesSub *sqlsubscribers.Vote
marginLevelsSub *sqlsubscribers.MarginLevels
riskFactorSub *sqlsubscribers.RiskFactor
netParamSub *sqlsubscribers.NetworkParameter
checkpointSub *sqlsubscribers.Checkpoint
oracleSpecSub *sqlsubscribers.OracleSpec
oracleDataSub *sqlsubscribers.OracleData
liquidityProvisionSub *sqlsubscribers.LiquidityProvision
positionsSub *sqlsubscribers.Position
transferSub *sqlsubscribers.Transfer
stakeLinkingSub *sqlsubscribers.StakeLinking
notarySub *sqlsubscribers.Notary
multiSigSignerEventSub *sqlsubscribers.ERC20MultiSigSignerEvent
keyRotationsSub *sqlsubscribers.KeyRotation
ethereumKeyRotationsSub *sqlsubscribers.EthereumKeyRotation
nodeSub *sqlsubscribers.Node
pupSub *sqlsubscribers.ProtocolUpgrade
snapSub *sqlsubscribers.SnapshotData
stopOrdersSub *sqlsubscribers.StopOrder
fundingPeriodSub *sqlsubscribers.FundingPeriod
partyActivityStreakSub *sqlsubscribers.PartyActivityStreak
referralProgramSub *sqlsubscribers.ReferralProgram
referralSetsSub *sqlsubscribers.ReferralSets
teamsSub *sqlsubscribers.Teams
vestingStatsSub *sqlsubscribers.VestingStatsUpdated
feesStatsSub *sqlsubscribers.FeesStats
fundingPaymentSub *sqlsubscribers.FundingPaymentSubscriber
volumeDiscountStatsSub *sqlsubscribers.VolumeDiscountStatsUpdated
volumeDiscountProgramSub *sqlsubscribers.VolumeDiscountProgram
paidLiquidityFeesStatsSub *sqlsubscribers.PaidLiquidityFeesStats
}

func (s *SQLSubscribers) GetSQLSubscribers() []broker.SQLBrokerSubscriber {
Expand Down Expand Up @@ -223,6 +226,7 @@ func (s *SQLSubscribers) GetSQLSubscribers() []broker.SQLBrokerSubscriber {
s.fundingPaymentSub,
s.volumeDiscountStatsSub,
s.volumeDiscountProgramSub,
s.paidLiquidityFeesStatsSub,
}
}

Expand Down Expand Up @@ -278,6 +282,7 @@ func (s *SQLSubscribers) CreateAllStores(ctx context.Context, Log *logging.Logge
s.fundingPaymentStore = sqlstore.NewFundingPayments(transactionalConnectionSource)
s.volumeDiscountStatsStore = sqlstore.NewVolumeDiscountStats(transactionalConnectionSource)
s.volumeDiscountProgramsStore = sqlstore.NewVolumeDiscountPrograms(transactionalConnectionSource)
s.paidLiquidityFeesStatsStore = sqlstore.NewPaidLiquidityFeesStats(transactionalConnectionSource)
}

func (s *SQLSubscribers) SetupServices(ctx context.Context, log *logging.Logger, candlesConfig candlesv2.Config) error {
Expand Down Expand Up @@ -328,6 +333,7 @@ func (s *SQLSubscribers) SetupServices(ctx context.Context, log *logging.Logger,
s.fundingPaymentService = service.NewFundingPayment(s.fundingPaymentStore)
s.volumeDiscountStatsService = service.NewVolumeDiscountStats(s.volumeDiscountStatsStore)
s.volumeDiscountProgramService = service.NewVolumeDiscountPrograms(s.volumeDiscountProgramsStore)
s.paidLiquidityFeesStatsService = service.NewPaidLiquidityFeesStats(s.paidLiquidityFeesStatsStore)

toInit := []interface{ Initialise(context.Context) error }{
s.marketDepthService,
Expand Down Expand Up @@ -390,4 +396,5 @@ func (s *SQLSubscribers) SetupSQLSubscribers() {
s.fundingPaymentSub = sqlsubscribers.NewFundingPaymentsSubscriber(s.fundingPaymentStore)
s.volumeDiscountStatsSub = sqlsubscribers.NewVolumeDiscountStatsUpdated(s.volumeDiscountStatsService)
s.volumeDiscountProgramSub = sqlsubscribers.NewVolumeDiscountProgram(s.volumeDiscountProgramService)
s.paidLiquidityFeesStatsSub = sqlsubscribers.NewPaidLiquidityFeesStats(s.paidLiquidityFeesStatsService)
}
Loading