Skip to content

Commit

Permalink
fix glicker sales/volume stats
Browse files Browse the repository at this point in the history
  • Loading branch information
benleb committed Aug 23, 2022
1 parent 7f877e9 commit 055f1f4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
3 changes: 3 additions & 0 deletions cmd/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ var (
queueListings = make(chan *models.ItemListedEvent, 1024)
queueOutput = make(chan string, 1024)

stats *glicker.Stats

logQueues = make(map[int]*chan types.Log, 0)
newNodes = make(map[int]*gbnode.ChainNode, 0)
)
Expand Down Expand Up @@ -460,6 +462,7 @@ func formatEvent(ctx context.Context, g *gocui.Gui, event *collections.Event, no
for i := 0; i < int(event.TxItemCount); i++ {
// go event.Collection.AddSale(event.PriceWei, uint64(event.TxItemCount))
go event.Collection.AddSale(event.PriceWei, 1)
stats.AddSale(pricePerItem)
// event.Collection.SaLiRa.Add((float64(event.Collection.Counters.Sales) / float64(event.Collection.Counters.Listings)))
}
} else if event.EventType == collections.Mint {
Expand Down
7 changes: 2 additions & 5 deletions cmd/live.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,9 @@ func live(_ *cobra.Command, _ []string) {

gbl.GetSugaredLogger()

var (
// wallets *models.Wallets
stats *glicker.Stats
// wallets *models.Wallets

ownCollections = collections.New()
)
ownCollections := collections.New()

//
// config
Expand Down
8 changes: 4 additions & 4 deletions internal/glicker/glicker.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ func (s *Stats) salesPerMinute() float64 {
// }

func (s *Stats) salesVolumePerMinute() float64 {
ethVolume, _ := subscriptions.WeiToEther(s.salesVolume).Uint64()
ethVolume, _ := subscriptions.WeiToEther(s.salesVolume).Float64()

return float64((ethVolume * 60) / uint64(s.interval.Seconds()))
return float64((ethVolume * 60) / s.interval.Seconds())
}

func (s *Stats) processedLogs() uint64 {
Expand Down Expand Up @@ -263,7 +263,7 @@ func (s *Stats) getPrimaryStatsLists() []string {
firstColumn = append(firstColumn, []string{
// listItem(FormatCounter(lipgloss.NewStyle().Align(lipgloss.Right).Render(fmt.Sprintf("%4d", GetEstimatedGasPrice())), "𛱟 gas")),
listItem(formatCounter(fmt.Sprintf("%.1f", s.salesVolumePerMinute()), "Ξ vol/min")),
listItem(formatCounter(fmt.Sprintf("%4d", uint(s.salesPerMinute())), " sales/min")),
listItem(formatCounter(fmt.Sprintf("%4d", uint(s.salesPerMinute())), " sales/min")),
// listItem(formatCounter(fmt.Sprintf("%4d", uint(s.mintsPerMinute())), " mints/min")),
}...)

Expand Down Expand Up @@ -291,7 +291,7 @@ func (s *Stats) getPrimaryStatsLists() []string {
}...)
}

statsOutput := []string{listStyle.Copy().Width(18).Render(lipgloss.JoinVertical(lipgloss.Left, firstColumn...))}
statsOutput := []string{listStyle.Copy().Width(17).Render(lipgloss.JoinVertical(lipgloss.Left, firstColumn...))}

if len(secondcolumn) > 0 {
statsOutput = append(statsOutput, listStyle.Copy().Width(20).Render(lipgloss.JoinVertical(lipgloss.Left, secondcolumn...)))
Expand Down

0 comments on commit 055f1f4

Please sign in to comment.