sfp

package module
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2025 License: GPL-3.0 Imports: 5 Imported by: 0

README

SimpleFinancePackage

An Package to interact with an mock stock exchange

Structure

Field Length
Key 8 Bytes
Operation Byte
Asset 2 Bytes
Price Float64
Volume Float64
Expire (Unix) uint64
CRC 2 Bytes

TODOS

  • Test it
  • Make it configureable
  • Implement expire date
  • Change Key to uuid
  • Document it

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeSimpleFinanacePackage

func EncodeSimpleFinanacePackage(packet SimpleFinancePackage) ([]byte, error)

Types

type SimpleFinancePackage

type SimpleFinancePackage struct {
	Key       [8]byte // 8 bytes for the key
	Operation byte    // 1 byte for operation
	Asset     uint16  // 2 bytes for asset
	Price     float64 // 8 bytes for price (float64 for precision)
	Volume    float64 // 8 bytes for volume
	Expire    uint64  // 8 bytes for expiration date
	CRC       uint16  // 2 bytes for CRC
}

func ParseSimpleFinanacePackage

func ParseSimpleFinanacePackage(data []byte) (*SimpleFinancePackage, error)

Jump to

Keyboard shortcuts

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