symbol

package
v0.0.0-...-c46be8d Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package symbol provides middleware utilities around symbol.

Symbol is a function whereby you have two different currencies that can be traded between one another. When buying and selling a cryptocurrency, it is often swapped with local currency. For example, If you're looking to buy or sell Bitcoin with U.S. Dollar, the trading pair would be BTC to USD

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound              = errors.New("symbol not found")
	ErrAuthenticationFailure = errors.New("authentication failed")
	ErrInvalidID             = errors.New("ID is not in its proper form")
	ErrInvalidSymbol         = errors.New("symbol is not valid")
)

Set of error variables for CRUD operations.

Functions

This section is empty.

Types

type Core

type Core struct {
	// contains filtered or unexported fields
}

Core manages the set of API's for candle access.

func NewCore

func NewCore(log *zap.SugaredLogger, sqlxDB *sqlx.DB, broker broker.Broker) Core

NewCore constructs a core for user api access.

func (Core) Create

func (c Core) Create(ctx context.Context, nSbl NewSymbol) (Symbol, error)

Create fetch a symbol from the binance api and inserts it into the database.

func (Core) Query

func (c Core) Query(ctx context.Context, pageNumber int, rowsPerPage int) ([]Symbol, error)

Query retrieves a list of existing symbols from the database.

func (Core) QueryByID

func (c Core) QueryByID(ctx context.Context, sblID string) (Symbol, error)

QueryByID gets the specified symbol from the database.

func (Core) QueryBySymbol

func (c Core) QueryBySymbol(ctx context.Context, sSbl string) (Symbol, error)

QueryBySymbol gets the specified symbol from the database.

type NewSymbol

type NewSymbol struct {
	Symbol string `json:"symbol" validate:"required"`
}

type Symbol

type Symbol struct {
	ID                         string `json:"symbol_id"`
	Symbol                     string `json:"symbol"`
	Status                     string `json:"status"`
	BaseAsset                  string `json:"base_asset"`
	BaseAssetPrecision         int    `json:"base_asset_precision"`
	QuoteAsset                 string `json:"quote_asset"`
	QuotePrecision             int    `json:"quote_precision"`
	BaseCommissionPrecision    int    `json:"base_commission_precision"`
	QuoteCommissionPrecision   int    `json:"quote_commission_precision"`
	IcebergAllowed             bool   `json:"iceberg_allowed"`
	OcoAllowed                 bool   `json:"oco_allowed"`
	QuoteOrderQtyMarketAllowed bool   `json:"quote_order_qty_market_allowed"`
	IsSpotTradingAllowed       bool   `json:"is_spot_trading_allowed"`
	IsMarginTradingAllowed     bool   `json:"is_margin_trading_allowed"`
}

Directories

Path Synopsis
Package binance manages symbol using the binance api
Package binance manages symbol using the binance api
Package db contains symbol related CRUD functionality.
Package db contains symbol related CRUD functionality.

Jump to

Keyboard shortcuts

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