Documentation ¶
Index ¶
- Constants
- type AccountBalances
- type ContractsData
- type Deribit
- func (e *Deribit) ApiKeyGet(strRequestPath string, mapParams map[string]string) string
- func (e *Deribit) ApiKeyRequest(strMethod, strRequestPath string, mapParams map[string]string) string
- func (e *Deribit) CanDeposit(coin *coin.Coin) bool
- func (e *Deribit) CanWithdraw(coin *coin.Coin) bool
- func (e *Deribit) CancelAllOrder() error
- func (e *Deribit) CancelOrder(order *exchange.Order) error
- func (e *Deribit) DeleteCoin(coin *coin.Coin)
- func (e *Deribit) DeletePair(pair *pair.Pair)
- func (e *Deribit) DoAccountOperation(operation *exchange.AccountOperation) error
- func (e *Deribit) GetBalance(coin *coin.Coin) float64
- func (e *Deribit) GetCoinBySymbol(symbol string) *coin.Coin
- func (e *Deribit) GetCoinConstraint(coin *coin.Coin) *exchange.CoinConstraint
- func (e *Deribit) GetCoins() []*coin.Coin
- func (e *Deribit) GetCoinsData() error
- func (e *Deribit) GetConfirmation(coin *coin.Coin) int
- func (e *Deribit) GetConstraintFetchMethod(pair *pair.Pair) *exchange.ConstrainFetchMethod
- func (e *Deribit) GetFee(pair *pair.Pair) float64
- func (e *Deribit) GetID() int
- func (e *Deribit) GetLotSize(pair *pair.Pair) float64
- func (e *Deribit) GetName() exchange.ExchangeName
- func (e *Deribit) GetPairBySymbol(symbol string) *pair.Pair
- func (e *Deribit) GetPairConstraint(pair *pair.Pair) *exchange.PairConstraint
- func (e *Deribit) GetPairs() []*pair.Pair
- func (e *Deribit) GetPairsData() error
- func (e *Deribit) GetPriceFilter(pair *pair.Pair) float64
- func (e *Deribit) GetSymbolByCoin(coin *coin.Coin) string
- func (e *Deribit) GetSymbolByPair(pair *pair.Pair) string
- func (e *Deribit) GetTradingWebURL(pair *pair.Pair) string
- func (e *Deribit) GetTxFee(coin *coin.Coin) float64
- func (e *Deribit) HasPair(pair *pair.Pair) bool
- func (e *Deribit) InitData() error
- func (e *Deribit) LimitBuy(pair *pair.Pair, quantity, rate float64) (*exchange.Order, error)
- func (e *Deribit) LimitSell(pair *pair.Pair, quantity, rate float64) (*exchange.Order, error)
- func (e *Deribit) ListOrders() ([]*exchange.Order, error)
- func (e *Deribit) LoadPublicData(operation *exchange.PublicOperation) error
- func (e *Deribit) OrderBook(p *pair.Pair) (*exchange.Maker, error)
- func (e *Deribit) OrderStatus(order *exchange.Order) error
- func (e *Deribit) SetCoinConstraint(coinConstraint *exchange.CoinConstraint)
- func (e *Deribit) SetPairConstraint(pairConstraint *exchange.PairConstraint)
- func (e *Deribit) UpdateAllBalances()
- func (e *Deribit) UpdateConstraint()
- func (e *Deribit) Withdraw(coin *coin.Coin, quantity float64, addr, tag string) bool
- type JsonResponse
- type OrderBook
- type PlaceOrder
- type WithdrawResponse
Constants ¶
const ( DEFAULT_ID = 44 DEFAULT_TAKER_FEE = 0.00075 DEFAULT_MAKER_FEE = -0.00025 DEFAULT_LOT_SIZE = 0.00000001 DEFAULT_PRICE_FILTER = 0.00000001 //PRICE FILTER DEFAULT_TXFEE = 0.005 DEFAULT_WITHDRAW = false DEFAULT_DEPOSIT = false DEFAULT_CONFIRMATION = 2 )
const (
API_URL = "https://test.deribit.com/api/v2"
)
The Base Endpoint URL
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountBalances ¶
type AccountBalances []struct { Asset string `json:"asset"` Total float64 `json:"total"` Available float64 `json:"available"` Locked float64 `json:"locked"` }
********* Private API Structure*********
type ContractsData ¶
type ContractsData []struct { TickSize float64 `json:"tick_size"` Strike float64 `json:"strike,omitempty"` SettlementPeriod string `json:"settlement_period"` QuoteCurrency string `json:"quote_currency"` OptionType string `json:"option_type,omitempty"` MinTradeAmount float64 `json:"min_trade_amount"` Kind string `json:"kind"` IsActive bool `json:"is_active"` InstrumentName string `json:"instrument_name"` ExpirationTimestamp int64 `json:"expiration_timestamp"` CreationTimestamp int64 `json:"creation_timestamp"` ContractSize float64 `json:"contract_size"` BaseCurrency string `json:"base_currency"` }
********* Public API Structure*********
type Deribit ¶
type Deribit 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 CreateDeribit ¶
*************************************************
func (*Deribit) ApiKeyGet ¶
************** Signature Http Request ************** Method: API Get 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 (*Deribit) ApiKeyRequest ¶
func (e *Deribit) ApiKeyRequest(strMethod, strRequestPath string, mapParams map[string]string) string
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
func (*Deribit) CancelAllOrder ¶
func (*Deribit) DeleteCoin ¶
func (*Deribit) DeletePair ¶
func (*Deribit) DoAccountOperation ¶
func (e *Deribit) DoAccountOperation(operation *exchange.AccountOperation) error
************** Private API **************
func (*Deribit) GetCoinConstraint ¶
func (e *Deribit) GetCoinConstraint(coin *coin.Coin) *exchange.CoinConstraint
************** Coins on the Exchanges **************
func (*Deribit) GetCoinsData ¶
************** 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(strRequestPath)
func (*Deribit) GetConstraintFetchMethod ¶
func (e *Deribit) GetConstraintFetchMethod(pair *pair.Pair) *exchange.ConstrainFetchMethod
*************** Exchange Constraint ***************
func (*Deribit) GetName ¶
func (e *Deribit) GetName() exchange.ExchangeName
func (*Deribit) GetPairConstraint ¶
func (e *Deribit) GetPairConstraint(pair *pair.Pair) *exchange.PairConstraint
************** Pairs on the Exchanges **************
func (*Deribit) GetPairsData ¶
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 (*Deribit) LoadPublicData ¶
func (e *Deribit) LoadPublicData(operation *exchange.PublicOperation) error
func (*Deribit) OrderBook ¶
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.GetSymbolByPair(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 (*Deribit) SetCoinConstraint ¶
func (e *Deribit) SetCoinConstraint(coinConstraint *exchange.CoinConstraint)
func (*Deribit) SetPairConstraint ¶
func (e *Deribit) SetPairConstraint(pairConstraint *exchange.PairConstraint)
func (*Deribit) UpdateAllBalances ¶
func (e *Deribit) UpdateAllBalances()
func (*Deribit) UpdateConstraint ¶
func (e *Deribit) UpdateConstraint()
type JsonResponse ¶
type OrderBook ¶
type OrderBook struct { Timestamp int64 `json:"timestamp"` Stats struct { Volume float64 `json:"volume"` Low float64 `json:"low"` High float64 `json:"high"` } `json:"stats"` State string `json:"state"` SettlementPrice float64 `json:"settlement_price"` OpenInterest int `json:"open_interest"` MinPrice float64 `json:"min_price"` MaxPrice float64 `json:"max_price"` MarkPrice float64 `json:"mark_price"` LastPrice float64 `json:"last_price"` InstrumentName string `json:"instrument_name"` IndexPrice float64 `json:"index_price"` Funding8H float64 `json:"funding_8h"` CurrentFunding float64 `json:"current_funding"` ChangeID int64 `json:"change_id"` Bids [][]float64 `json:"bids"` BestBidPrice float64 `json:"best_bid_price"` BestBidAmount float64 `json:"best_bid_amount"` BestAskPrice float64 `json:"best_ask_price"` BestAskAmount float64 `json:"best_ask_amount"` Asks [][]float64 `json:"asks"` }
type PlaceOrder ¶
type PlaceOrder struct { Symbol string `json:"symbol"` OrderID string `json:"orderId"` Side string `json:"side"` Type string `json:"type"` Price string `json:"price"` AveragePrice string `json:"executedQty"` OrigQty string `json:"origQty"` ExecutedQty string `json:"executedQty"` Status string `json:"status"` TimeInForce string `json:"timeInForce"` }