Skip to content

Commit 055f1f4

Browse files
committed
fix glicker sales/volume stats
1 parent 7f877e9 commit 055f1f4

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

cmd/common.go

+3
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ var (
4949
queueListings = make(chan *models.ItemListedEvent, 1024)
5050
queueOutput = make(chan string, 1024)
5151

52+
stats *glicker.Stats
53+
5254
logQueues = make(map[int]*chan types.Log, 0)
5355
newNodes = make(map[int]*gbnode.ChainNode, 0)
5456
)
@@ -460,6 +462,7 @@ func formatEvent(ctx context.Context, g *gocui.Gui, event *collections.Event, no
460462
for i := 0; i < int(event.TxItemCount); i++ {
461463
// go event.Collection.AddSale(event.PriceWei, uint64(event.TxItemCount))
462464
go event.Collection.AddSale(event.PriceWei, 1)
465+
stats.AddSale(pricePerItem)
463466
// event.Collection.SaLiRa.Add((float64(event.Collection.Counters.Sales) / float64(event.Collection.Counters.Listings)))
464467
}
465468
} else if event.EventType == collections.Mint {

cmd/live.go

+2-5
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,9 @@ func live(_ *cobra.Command, _ []string) {
116116

117117
gbl.GetSugaredLogger()
118118

119-
var (
120-
// wallets *models.Wallets
121-
stats *glicker.Stats
119+
// wallets *models.Wallets
122120

123-
ownCollections = collections.New()
124-
)
121+
ownCollections := collections.New()
125122

126123
//
127124
// config

internal/glicker/glicker.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@ func (s *Stats) salesPerMinute() float64 {
125125
// }
126126

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

130-
return float64((ethVolume * 60) / uint64(s.interval.Seconds()))
130+
return float64((ethVolume * 60) / s.interval.Seconds())
131131
}
132132

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

@@ -291,7 +291,7 @@ func (s *Stats) getPrimaryStatsLists() []string {
291291
}...)
292292
}
293293

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

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

0 commit comments

Comments
 (0)