binance

package module
v0.0.0-...-a05b099 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2023 License: MIT Imports: 11 Imported by: 0

README

Binance Connector

Binance

Binance Exchange is the largest crypto exchange by trade volume and one of the fastest in the world.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(baseURL string, params url.Values) ([]uint8, error)

http get and read body as bytes

func GetJSON

func GetJSON(baseURL string, params url.Values) (*gjson.Result, error)

http get and read body as json

func TimedFetch

func TimedFetch(baseURL string, params url.Values, options TimedFetchOptions, callback func(*gjson.Result, error))

timedFetch makes requests to API endpoint that updates every expected `interval`, resistant to clock drift by 1 `margin` ahead and n `delay` behind. Algo: 1m 1m 1m 1m. If lastVal != val, 4m. 15s 15s 15s 15s. If lastVal != val, 4m.59s. 1s 1s 1s 1s. If lastVal != val, 4m.59.5s

Types

type BinanceConnector

type BinanceConnector struct {
	*connector.Connector
}

func (*BinanceConnector) Start

func (c *BinanceConnector) Start()

type TimedFetchOptions

type TimedFetchOptions struct {
	Interval,
	Margin,
	Delay,
	Decay int // decay factor for each round. Affects how fast it syncs to remote emission at the cost of more requests.
}

Interval, Margin, Delay are in ms `decay` is the muliple at which the delay decreases.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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