utils

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2023 License: MPL-2.0 Imports: 8 Imported by: 0

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