bybit

package
v0.0.0-...-db5ea55 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_ID           = 52
	DEFAULT_TAKER_FEE    = 0.0075
	DEFAULT_MAKER_FEE    = 0.0025
	DEFAULT_TXFEE        = 0.005
	DEFAULT_WITHDRAW     = true
	DEFAULT_DEPOSIT      = true
	DEFAULT_CONFIRMATION = 2
	DEFAULT_LISTED       = true
)
View Source
const (
	API_URL string = "https://api.bybit.com"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Bybit

type Bybit struct {
	ID      int
	Name    string `bson:"name"`
	Website string `bson:"website"`

	API_KEY    string
	API_SECRET string

	Source    exchange.DataSource // / exchange API / microservicve api 1 / PSQL
	SourceURI string
}

func CreateBybit

func CreateBybit(config *exchange.Config) *Bybit

*************************************************

func (*Bybit) ApiKeyGET

func (e *Bybit) ApiKeyGET(strRequestPath string, mapParams map[string]string) string

************** Signature Http Request ************** Method: API Request and Signature is required Step 1: Change Instance Name (e *<exchange Instance Name>) Step 2: Create mapParams Depend on API Signature request Step 3: Add HttpGetRequest below strUrl if API has different requests

func (*Bybit) CanDeposit

func (e *Bybit) CanDeposit(coin *coin.Coin) bool

func (*Bybit) CanWithdraw

func (e *Bybit) CanWithdraw(coin *coin.Coin) bool

func (*Bybit) CancelAllOrder

func (e *Bybit) CancelAllOrder() error

func (*Bybit) CancelOrder

func (e *Bybit) CancelOrder(order *exchange.Order) error

func (*Bybit) DeleteCoin

func (e *Bybit) DeleteCoin(coin *coin.Coin)

func (*Bybit) DeletePair

func (e *Bybit) DeletePair(pair *pair.Pair)

func (*Bybit) DoAccountOperation

func (e *Bybit) DoAccountOperation(operation *exchange.AccountOperation) error

************** Private API **************

func (*Bybit) GetBalance

func (e *Bybit) GetBalance(coin *coin.Coin) float64

func (*Bybit) GetCoinBySymbol

func (e *Bybit) GetCoinBySymbol(symbol string) *coin.Coin

func (*Bybit) GetCoinConstraint

func (e *Bybit) GetCoinConstraint(coin *coin.Coin) *exchange.CoinConstraint

************** Coins on the Exchanges **************

func (*Bybit) GetCoins

func (e *Bybit) GetCoins() []*coin.Coin

func (*Bybit) GetCoinsData

func (e *Bybit) GetCoinsData() error

************** Public API ************** Get Coins Information (If API provide) Step 1: Change Instance Name (e *<exchange Instance Name>) Step 2: Add Model of API Response Step 3: Modify API Path(strRequestUrl)

func (*Bybit) GetConfirmation

func (e *Bybit) GetConfirmation(coin *coin.Coin) int

func (*Bybit) GetConstraintFetchMethod

func (e *Bybit) GetConstraintFetchMethod(pair *pair.Pair) *exchange.ConstrainFetchMethod

*************** Exchange Constraint ***************

func (*Bybit) GetFee

func (e *Bybit) GetFee(pair *pair.Pair) float64

*************** Pair Constraint ***************

func (*Bybit) GetID

func (e *Bybit) GetID() int

*************** Exchange Information ***************

func (*Bybit) GetLotSize

func (e *Bybit) GetLotSize(pair *pair.Pair) float64

func (*Bybit) GetName

func (e *Bybit) GetName() exchange.ExchangeName

func (*Bybit) GetPairBySymbol

func (e *Bybit) GetPairBySymbol(symbol string) *pair.Pair

func (*Bybit) GetPairConstraint

func (e *Bybit) GetPairConstraint(pair *pair.Pair) *exchange.PairConstraint

************** Pairs on the Exchanges **************

func (*Bybit) GetPairs

func (e *Bybit) GetPairs() []*pair.Pair

func (*Bybit) GetPairsData

func (e *Bybit) GetPairsData() error
GetPairsData - Get Pairs Information (If API provide)

Step 1: Change Instance Name (e *<exchange Instance Name>) Step 2: Add Model of API Response Step 3: Modify API Path(strRequestUrl)

func (*Bybit) GetPriceFilter

func (e *Bybit) GetPriceFilter(pair *pair.Pair) float64

func (*Bybit) GetSymbolByCoin

func (e *Bybit) GetSymbolByCoin(coin *coin.Coin) string

func (*Bybit) GetSymbolByPair

func (e *Bybit) GetSymbolByPair(pair *pair.Pair) string

func (*Bybit) GetTradingWebURL

func (e *Bybit) GetTradingWebURL(pair *pair.Pair) string

func (*Bybit) GetTxFee

func (e *Bybit) GetTxFee(coin *coin.Coin) float64

*************** Coin Constraint ***************

func (*Bybit) HasPair

func (e *Bybit) HasPair(pair *pair.Pair) bool

func (*Bybit) InitData

func (e *Bybit) InitData() error

func (*Bybit) LimitBuy

func (e *Bybit) LimitBuy(pair *pair.Pair, quantity, rate float64) (*exchange.Order, error)

func (*Bybit) LimitSell

func (e *Bybit) LimitSell(pair *pair.Pair, quantity, rate float64) (*exchange.Order, error)

func (*Bybit) ListOrders

func (e *Bybit) ListOrders() ([]*exchange.Order, error)

func (*Bybit) LoadPublicData

func (e *Bybit) LoadPublicData(operation *exchange.PublicOperation) error

func (*Bybit) OrderBook

func (e *Bybit) OrderBook(pair *pair.Pair) (*exchange.Maker, error)

Get Pair Market Depth Step 1: Change Instance Name (e *<exchange Instance Name>) Step 2: Add Model of API Response Step 3: Get Exchange Pair Code ex. symbol := e.GetPairCode(p) Step 4: Modify API Path(strRequestUrl) Step 5: Add Params - Depend on API request Step 6: Convert the response to Standard Maker struct

func (*Bybit) OrderStatus

func (e *Bybit) OrderStatus(order *exchange.Order) error

func (*Bybit) SetCoinConstraint

func (e *Bybit) SetCoinConstraint(coinConstraint *exchange.CoinConstraint)

func (*Bybit) SetPairConstraint

func (e *Bybit) SetPairConstraint(pairConstraint *exchange.PairConstraint)

func (*Bybit) UpdateAllBalances

func (e *Bybit) UpdateAllBalances()

func (*Bybit) UpdateConstraint

func (e *Bybit) UpdateConstraint()

func (*Bybit) Withdraw

func (e *Bybit) Withdraw(coin *coin.Coin, quantity float64, addr, tag string) bool

type JsonResponse

type JsonResponse struct {
	RetCode int             `json:"ret_code"`
	RetMsg  string          `json:"ret_msg"`
	ExtCode string          `json:"ext_code"`
	ExtInfo string          `json:"ext_info"`
	TimeNow string          `json:"time_now"`
	Result  json.RawMessage `json:"result"`
}

type PairsData

type PairsData []struct {
	Name          string `json:"name"`
	BaseCurrency  string `json:"base_currency"`
	QuoteCurrency string `json:"quote_currency"`
	PriceScale    int    `json:"price_scale"`
	PriceFilter   struct {
		MinPrice string `json:"min_price"`
		MaxPrice string `json:"max_price"`
		TickSize string `json:"tick_size"`
	} `json:"price_filter"`
	LotSizeFilter struct {
		MaxTradingQty int     `json:"max_trading_qty"`
		MinTradingQty int     `json:"min_trading_qty"`
		QtyStep       float64 `json:"qty_step"`
	} `json:"lot_size_filter"`
}

Jump to

Keyboard shortcuts

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