utils

package
v0.10.22 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 26, 2024 License: MPL-2.0 Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

nolint

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MessageGenerator

type MessageGenerator struct {
	NumOfTradesPerBlock   int
	NumOfTransferPerBlock int
	NumOfBlocks           int
	OrderChangeMap        orderPkg.OrderInfoForPublish

	TimeStart time.Time
	// contains filtered or unexported fields
}

func (*MessageGenerator) ExpireMessages

func (mg *MessageGenerator) ExpireMessages(height int, timeNow time.Time) (tradesToPublish []*pub.Trade, orderChanges orderPkg.OrderChanges, accounts map[string]pub.Account)

simulate 1 million expire orders to publish at breathe block

func (*MessageGenerator) OneOnOneMessages

func (mg *MessageGenerator) OneOnOneMessages(height int, timeNow time.Time) (tradesToPublish []*pub.Trade, orderChanges orderPkg.OrderChanges, accounts map[string]pub.Account, transfers *pub.Transfers)

each trade has two equal quantity order the price is a sin function of time, 4 full sin curve (0 - 2 * pi) within an hour :P

func (MessageGenerator) Publish

func (mg MessageGenerator) Publish(height, timePub int64, tradesToPublish []*pub.Trade, orderChanges orderPkg.OrderChanges, orderChangesMap orderPkg.OrderInfoForPublish, accounts map[string]pub.Account, transfers *pub.Transfers, block *pub.Block)

func (*MessageGenerator) Setup

func (mg *MessageGenerator) Setup()

func (*MessageGenerator) TwoOnOneMessages

func (mg *MessageGenerator) TwoOnOneMessages(height int, timeNow time.Time) (tradesToPublish []*pub.Trade, orderChanges orderPkg.OrderChanges, accounts map[string]pub.Account, transfers *pub.Transfers)

each big order eat two small orders

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL