client

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2023 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SecTypeNone SecType = iota
	SecTypeSigned
)
View Source
const (
	TestnetEndpoint   ccxtbeyang.EndpointType = "https://api-testnet.bybit.com"
	MainnetEndpoint_1 ccxtbeyang.EndpointType = "https://api.bybit.com"
	MainnetEndpoint_2 ccxtbeyang.EndpointType = "https://api.bytick.com"
)
View Source
const (

	// Unified Account
	CategorySpot CategoryType = "spot"
	// Unified|Normal Account
	CategoryLinear CategoryType = "linear" // Linear contract, including USDT perp, USDC perp
	// Unified|Normal Account
	CategoryInverse CategoryType = "inverse" // Inverse contract, including Inverse perp, Inverse futures
	// Unified Account
	CategoryOption CategoryType = "option"

	// https://bybit-exchange.github.io/docs/v5/enum#orderstatus
	OrderStatusCreated                 OrderStatusType = "Created" // order has been accepted by the system but not yet put through the matching engine
	OrderStatusNew                     OrderStatusType = "New"     // order has been placed successfully
	OrderStatusRejected                OrderStatusType = "Rejected"
	OrderStatusPartiallyFilled         OrderStatusType = "PartiallyFilled"
	OrderStatusPartiallyFilledCanceled OrderStatusType = "PartiallyFilledCanceled" // spot has this order status only
	OrderStatusFilled                  OrderStatusType = "Filled"
	OrderStatusCancelled               OrderStatusType = "Cancelled"
	OrderStatusUntriggered             OrderStatusType = "Untriggered"
	OrderStatusTriggered               OrderStatusType = "Triggered"
	OrderStatusDeactivated             OrderStatusType = "Deactivated"
	OrderStatusActive                  OrderStatusType = "Active"

	// https://bybit-exchange.github.io/docs/v5/enum#timeinforce
	TimeInForceGTC      TimeInForceType = "GTC"      // GoodTillCancel
	TimeInForceIOC      TimeInForceType = "IOC"      // ImmediateOrCancel
	TimeInForceFOK      TimeInForceType = "FOK"      // FillOrKill
	TimeInForcePostOnly TimeInForceType = "PostOnly" // https://www.bybit.com/en-US/help-center/bybitHC_Article?language=en_US&id=000001051

	// https://bybit-exchange.github.io/docs/v5/enum#exectype
	ExecTypeTrade     ExecType = "Trade"
	ExecTypeAdlTrade  ExecType = "AdlTrade" //Auto-Deleveraging 	https://www.bybit.com/en-US/help-center/bybitHC_Article/?language=en_US&id=000001124
	ExecTypeFunding   ExecType = "Funding"  //Funding fee 			https://www.bybit.com/en-US/help-center/HelpCenterKnowledge/bybitHC_Article/?id=000001123&language=en_US
	ExecTypeBustTrade ExecType = "BustTrade"
	ExecTypeSettle    ExecType = "Settle"

	// https://bybit-exchange.github.io/docs/v5/enum#stopordertype
	StopOrderTypeTakeProfit        StopOrderType = "TakeProfit"
	StopOrderTypeStopLoss          StopOrderType = "StopLoss"
	StopOrderTypeTrailingStop      StopOrderType = "TrailingStop"
	StopOrderTypeStop              StopOrderType = "Stop"
	StopOrderTypePartialTakeProfit StopOrderType = "PartialTakeProfit"
	StopOrderTypePartialStopLoss   StopOrderType = "PartialStopLoss"
	StopOrderTypeTpslOrder         StopOrderType = "tpslOrder" // spot TP/SL order

	// https://bybit-exchange.github.io/docs/v5/enum#tickdirection
	TickDirectionPlusTick      TickDirectionType = "PlusTick"      // price rise
	TickDirectionZeroPlusTick  TickDirectionType = "ZeroPlusTick"  // trade occurs at the same price as the previous trade, which occurred at a price higher than that for the trade preceding it
	TickDirectionMinusTick     TickDirectionType = "MinusTick"     // price drop
	TickDirectionZeroMinusTick TickDirectionType = "ZeroMinusTick" // trade occurs at the same price as the previous trade, which occurred at a price lower than that for the trade preceding it

	// https://bybit-exchange.github.io/docs/v5/enum#interval
	Interval_1Minute   IntervalType = "1"
	Interval_3Minute   IntervalType = "3"
	Interval_5Minute   IntervalType = "5"
	Interval_15Minute  IntervalType = "15"
	Interval_30Minute  IntervalType = "30"
	Interval_60Minute  IntervalType = "60"
	Interval_120Minute IntervalType = "120"
	Interval_240Minute IntervalType = "240"
	Interval_360Minute IntervalType = "360"
	Interval_720Minute IntervalType = "720"
	Interval_Day       IntervalType = "D"
	Interval_Week      IntervalType = "W"
	Interval_Month     IntervalType = "Month"

	// https://bybit-exchange.github.io/docs/v5/enum#positionidx
	PositionIdx0 PositionIdxType = 0 // one-way mode position
	PositionIdx1 PositionIdxType = 1 // Buy side of hedge-mode position
	PositionIdx2 PositionIdxType = 2 // Sell side of hedge-mode position

	// https://bybit-exchange.github.io/docs/v5/enum#positionstatus
	PositionStatusNormal PositionStatusType = "Normal"
	PositionStatusLiq    PositionStatusType = "Liq" // in the liquidation progress
	PositionStatusAdl    PositionStatusType = "Adl" // in the auto-deleverage progress

	// https://bybit-exchange.github.io/docs/v5/enum#rejectreason
	RejectReason_NoError                      RejectReasonType = "EC_NoError"
	RejectReason_Others                       RejectReasonType = "EC_Others"
	RejectReason_UnknownMessageType           RejectReasonType = "EC_UnknownMessageType"
	RejectReason_MissingClOrdID               RejectReasonType = "EC_MissingClOrdID"
	RejectReason_MissingOrigClOrdID           RejectReasonType = "EC_MissingOrigClOrdID"
	RejectReason_ClOrdIDOrigClOrdIDAreTheSame RejectReasonType = "EC_ClOrdIDOrigClOrdIDAreTheSame"
	RejectReason_DuplicatedClOrdID            RejectReasonType = "EC_DuplicatedClOrdID"
	RejectReason_OrigClOrdIDDoesNotExist      RejectReasonType = "EC_OrigClOrdIDDoesNotExist"
	RejectReason_TooLateToCancel              RejectReasonType = "EC_TooLateToCancel"
	RejectReason_UnknownOrderType             RejectReasonType = "EC_UnknownOrderType"
	RejectReason_UnknownSide                  RejectReasonType = "EC_UnknownSide"
	RejectReason_UnknownTimeInForce           RejectReasonType = "EC_UnknownTimeInForce"
	RejectReason_WronglyRouted                RejectReasonType = "EC_WronglyRouted"
	RejectReason_MarketOrderPriceIsNotZero    RejectReasonType = "EC_MarketOrderPriceIsNotZero"
	RejectReason_LimitOrderInvalidPrice       RejectReasonType = "EC_LimitOrderInvalidPrice"
	RejectReason_NoEnoughQtyToFill            RejectReasonType = "EC_NoEnoughQtyToFill"
	RejectReason_NoImmediateQtyToFill         RejectReasonType = "EC_NoImmediateQtyToFill"
	RejectReason_PerCancelRequest             RejectReasonType = "EC_PerCancelRequest"
	RejectReason_MarketOrderCannotBePostOnly  RejectReasonType = "EC_MarketOrderCannotBePostOnly"
	RejectReason_PostOnlyWillTakeLiquidity    RejectReasonType = "EC_PostOnlyWillTakeLiquidity"
	RejectReason_CancelReplaceOrder           RejectReasonType = "EC_CancelReplaceOrder"
	RejectReason_InvalidSymbolStatus          RejectReasonType = "EC_InvalidSymbolStatus"

	// https://bybit-exchange.github.io/docs/v5/enum#accounttype
	AccountTypeContract   AccountType = "CONTRACT"   // Derivatives Account
	AccountTypeSpot       AccountType = "SPOT"       // Spot Account
	AccountTypeInvestment AccountType = "INVESTMENT" // ByFi Account
	AccountTypeOption     AccountType = "OPTION"     // USDC Account
	AccountTypeUnified    AccountType = "UNIFIED"    // UMA or UTA
	AccountTypeFind       AccountType = "FUND"       // Funding Account (Sub account is not supported temporarily)

	TransferStatusSuccess TransferStatusType = "SUCCESS"
	TransferStatusPending TransferStatusType = "PENDING"
	TransferStatusFailed  TransferStatusType = "FAILED"

	// https://bybit-exchange.github.io/docs/v5/enum#depositstatus
	DepositStatus0 DepositStatusType = 0 // unknown
	DepositStatus1 DepositStatusType = 1 // toBeConfirmed
	DepositStatus2 DepositStatusType = 2 // processing
	DepositStatus3 DepositStatusType = 3 // success
	DepositStatus4 DepositStatusType = 4 // deposit failed

	// https://bybit-exchange.github.io/docs/v5/enum#withdrawstatus
	WithdrawStatusSecurityCheck       WithdrawStatusType = "SecurityCheck"
	WithdrawStatusPending             WithdrawStatusType = "Pending"
	WithdrawStatusSuccess             WithdrawStatusType = "success"
	WithdrawStatusCancelByUser        WithdrawStatusType = "CancelByUser"
	WithdrawStatusReject              WithdrawStatusType = "Reject"
	WithdrawStatusFail                WithdrawStatusType = "Fail"
	WithdrawStatusBlockchainConfirmed WithdrawStatusType = "BlockchainConfirmed"

	// https://bybit-exchange.github.io/docs/v5/enum#triggerby
	TriggerByLastPrice  TriggerByType = "LastPrice"
	TriggerByIndexPrice TriggerByType = "IndexPrice"
	TriggerByMarkPrice  TriggerByType = "MarkPrice"

	CancelType_ByUser        CancelType = "CancelByUser"
	CancelType_ByReduceOnly  CancelType = "CancelByReduceOnly"
	CancelType_ByPrepareLiq  CancelType = "CancelByPrepareLiq" // Cancelled due to liquidation
	CancelType_AllBeforeLiq  CancelType = "CancelAllBeforeLiq" // Cancelled due to liquidation
	CancelType_ByPrepareAdl  CancelType = "CancelByPrepareAdl" // Cancelled due to ADL
	CancelType_AllBeforeAdl  CancelType = "CancelAllBeforeAdl" // Cancelled due to ADL
	CancelType_ByAdmin       CancelType = "CancelByAdmin"
	CancelType_ByTpSlTsClear CancelType = "CancelByTpSlTsClear"
	CancelType_ByPzSideCh    CancelType = "CancelByPzSideCh"
	CancelType_BySmp         CancelType = "CancelBySmp"

	//	Options:
	CancelType_BySettle                CancelType = "CancelBySettle"
	CancelType_ByCannotAffordOrderCost CancelType = "CancelByCannotAffordOrderCost"
	CancelType_ByPmTrialMmOverEquity   CancelType = "CancelByPmTrialMmOverEquity"
	CancelType_ByAccountBlocking       CancelType = "CancelByAccountBlocking"
	CancelType_ByDelivery              CancelType = "CancelByDelivery"
	CancelType_ByMmpTriggered          CancelType = "CancelByMmpTriggered"
	CancelType_ByCrossSelfMuch         CancelType = "CancelByCrossSelfMuch"
	CancelType_ByCrossReachMaxTradeNum CancelType = "CancelByCrossReachMaxTradeNum"
	CancelType_ByDCP                   CancelType = "CancelByDCP"

	// https://bybit-exchange.github.io/docs/v5/enum#contracttype
	ContractType_InversePerpetual ContractType = "InversePerpetual"
	ContractType_LinearPerpetual  ContractType = "LinearPerpetual"
	ContractType_LinearFutures    ContractType = "LinearFutures" // USDC Futures
	ContractType_InverseFutures   ContractType = "InverseFutures"

	// https://bybit-exchange.github.io/docs/v5/enum#status
	Status_Pending    StatusType = "PreLaunch"
	Status_Trading    StatusType = "Trading"
	Status_Settling   StatusType = "Settling"
	Status_Delivering StatusType = "Delivering"
	Status_Closed     StatusType = "Closed"

	// https://bybit-exchange.github.io/docs/v5/enum#type
	TypeTransfer_In   Type = "TRANSFER_IN"
	TypeTransfer_Out  Type = "TRANSFER_OUT"
	TypeTrade         Type = "TRADE"
	TypeSettlement    Type = "SETTLEMENT"
	TypeDelivery      Type = "DELIVERY"
	TypeLiquidation   Type = "LIQUIDATION"
	TypeBonus         Type = "BONUS"
	TypeFee_Refund    Type = "FEE_REFUND"
	TypeInterest      Type = "INTEREST"
	TypeCurrency_buy  Type = "CURRENCY_BUY"
	TypeCurrency_sell Type = "CURRENCY_SELL"

	// https://bybit-exchange.github.io/docs/v5/enum#unifiedmarginstatus
	UnifiedMarginStatus1 UnifiedMarginStatusType = 1 // Regular account
	UnifiedMarginStatus2 UnifiedMarginStatusType = 2 // Unified margin account, it only trades linear perpetual and options
	UnifiedMarginStatus3 UnifiedMarginStatusType = 3 //Unified trade account, it can trade linear perpetual, options and spot

	// https://bybit-exchange.github.io/docs/v5/enum#ltstatus
	LtStatus1 LtStatusType = 1 // LT can be purchased and redeemed
	LtStatus2 LtStatusType = 2 // LT can be purchased, but not redeemed
	LtStatus3 LtStatusType = 3 // LT can be redeemed, but not purchased
	LtStatus4 LtStatusType = 4 // LT cannot be purchased nor redeemed
	LtStatus5 LtStatusType = 5 // Adjusting position

	// https://bybit-exchange.github.io/docs/v5/enum#smptype
	SmpType_None        SmpType = "None"
	SmpType_CancelMaker SmpType = "CancelMaker"
	SmpType_CancelTaker SmpType = "CancelTaker"
	SmpType_CancelBoth  SmpType = "CancelBoth"
)
View Source
const (
	SideBuy  SideType = "Buy"
	SideSell SideType = "Sell"

	OrderTypeLimit  OrderType = "Limit"
	OrderTypeMarket OrderType = "Market"
)

Variables

This section is empty.

Functions

func New

func New(conf config.Configuration, logFileName string) ConnectorRest

Types

type AccountType

type AccountType string

type ByBitRest

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

func (*ByBitRest) GetClient

func (connRest *ByBitRest) GetClient() *http.Client

func (*ByBitRest) GetConfiguration

func (connRest *ByBitRest) GetConfiguration() config.Configuration

func (*ByBitRest) GetExchangeName

func (connRest *ByBitRest) GetExchangeName() string

func (*ByBitRest) GetLogger

func (connRest *ByBitRest) GetLogger() *zap.Logger

func (*ByBitRest) GetPair

func (connRest *ByBitRest) GetPair(args ...string) (string, error)

правильное создание какой-то валютной пары

func (*ByBitRest) GetSign

func (connRest *ByBitRest) GetSign(parms ...string) string

получение точной сигнатуры

func (*ByBitRest) ParseRequest

func (connRest *ByBitRest) ParseRequest(req *Request)

подготовка url и headers под каждую задачу

type CancelType

type CancelType string

type CategoryType

type CategoryType string

type ContractType

type ContractType string

type DepositStatusType

type DepositStatusType int

type ExecType

type ExecType string

type IntervalType

type IntervalType string

type LtStatusType

type LtStatusType int

type OrderStatusType

type OrderStatusType string

type OrderType

type OrderType string

type PositionIdxType

type PositionIdxType int

type PositionStatusType

type PositionStatusType string

type RejectReasonType

type RejectReasonType string

type SideType

type SideType string

Решил сам от себя добавить (добавляется по мере появления методов)

type SmpType

type SmpType string

type StatusType

type StatusType string

type StopOrderType

type StopOrderType string

type TickDirectionType

type TickDirectionType string

type TimeInForceType

type TimeInForceType string

type TransferStatusType

type TransferStatusType string

type TriggerByType

type TriggerByType string

type Type

type Type string

type UnifiedMarginStatusType

type UnifiedMarginStatusType int

type WithdrawStatusType

type WithdrawStatusType string

Jump to

Keyboard shortcuts

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