oksim

package
v0.0.0-...-5439e55 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2022 License: MIT Imports: 15 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DEFAULT_ID           = 74
	DEFAULT_TAKER_FEE    = 0.0015
	DEFAULT_MAKER_FEE    = 0.001
	DEFAULT_LOT_SIZE     = 0.00000001
	DEFAULT_PRICE_FILTER = 0.00000001
	DEFAULT_CONFIRMATION = 2
	DEFAULT_LISTED       = true
)
View Source
const (
	API_URL string = "https://www.okex.com"
)

Variables

This section is empty.

Functions

func IsoTime

func IsoTime() string

Types

type AccountBalances

type AccountBalances struct {
	AvailBal  string `json:"availBal"`
	Bal       string `json:"bal"`
	Ccy       string `json:"ccy"`
	FrozenBal string `json:"frozenBal"`
}

type CoinData

type CoinData struct {
	CanDep bool   `json:"canDep"`
	CanWd  bool   `json:"canWd"`
	Ccy    string `json:"ccy"`
	Chain  string `json:"chain"`
	MinWd  int    `json:"minWd"`
	Name   string `json:"name"`
}

type JsonResponse

type JsonResponse struct {
	Code         string          `json:"code"`
	DetailMsg    string          `json:"detailMsg"`
	ErrorCode    string          `json:"error_code"`
	ErrorMessage string          `json:"error_message"`
	Msg          string          `json:"msg"`
	Data         json.RawMessage `json:"data"`
}

type Oksim

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

	API_KEY       string
	API_SECRET    string
	Passphrase    string
	TradePassword string

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

func CreateOksim

func CreateOksim(config *exchange.Config) *Oksim

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

func (*Oksim) ApiKeyRequest

func (e *Oksim) ApiKeyRequest(method string, mapParams map[string]interface{}, strRequestPath 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 (*Oksim) CanDeposit

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

func (*Oksim) CanWithdraw

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

func (*Oksim) CancelAllOrder

func (e *Oksim) CancelAllOrder() error

func (*Oksim) CancelOrder

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

func (*Oksim) DeleteCoin

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

func (*Oksim) DeletePair

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

func (*Oksim) DoAccountOperation

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

func (*Oksim) GetBalance

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

func (*Oksim) GetCoinBySymbol

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

func (*Oksim) GetCoinConstraint

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

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

func (*Oksim) GetCoins

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

func (*Oksim) GetCoinsData

func (e *Oksim) 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 (*Oksim) GetConfirmation

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

func (*Oksim) GetConstraintFetchMethod

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

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

func (*Oksim) GetFee

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

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

func (*Oksim) GetID

func (e *Oksim) GetID() int

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

func (*Oksim) GetLotSize

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

func (*Oksim) GetName

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

func (*Oksim) GetPairBySymbol

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

func (*Oksim) GetPairConstraint

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

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

func (*Oksim) GetPairs

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

func (*Oksim) GetPairsData

func (e *Oksim) 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 (*Oksim) GetPriceFilter

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

func (*Oksim) GetSymbolByCoin

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

func (*Oksim) GetSymbolByPair

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

func (*Oksim) GetTradingWebURL

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

func (*Oksim) GetTxFee

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

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

func (*Oksim) HasPair

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

func (*Oksim) InitData

func (e *Oksim) InitData() error

func (*Oksim) LimitBuy

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

func (*Oksim) LimitSell

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

func (*Oksim) ListOrders

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

func (*Oksim) LoadPublicData

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

func (*Oksim) OrderBook

func (e *Oksim) 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 (*Oksim) OrderStatus

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

func (*Oksim) SetCoinConstraint

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

func (*Oksim) SetPairConstraint

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

func (*Oksim) Transfer

func (e *Oksim) Transfer(coin *coin.Coin, quantity float64, from, to int) bool

func (*Oksim) UpdateAllBalances

func (e *Oksim) UpdateAllBalances()

func (*Oksim) UpdateConstraint

func (e *Oksim) UpdateConstraint()

func (*Oksim) Withdraw

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

type OrderBook

type OrderBook struct {
	Asks [][]string `json:"asks"`
	Bids [][]string `json:"bids"`
	Ts   string     `json:"ts"`
}

type OrderStatus

type OrderStatus struct {
	InstType    string `json:"instType"`
	InstID      string `json:"instId"`
	Ccy         string `json:"ccy"`
	OrdID       string `json:"ordId"`
	ClOrdID     string `json:"clOrdId"`
	Tag         string `json:"tag"`
	Px          string `json:"px"`
	Sz          string `json:"sz"`
	Pnl         string `json:"pnl"`
	OrdType     string `json:"ordType"`
	Side        string `json:"side"`
	PosSide     string `json:"posSide"`
	TdMode      string `json:"tdMode"`
	AccFillSz   string `json:"accFillSz"`
	FillPx      string `json:"fillPx"`
	TradeID     string `json:"tradeId"`
	FillSz      string `json:"fillSz"`
	FillTime    string `json:"fillTime"`
	State       string `json:"state"`
	AvgPx       string `json:"avgPx"`
	Lever       string `json:"lever"`
	TpTriggerPx string `json:"tpTriggerPx"`
	TpOrdPx     string `json:"tpOrdPx"`
	SlTriggerPx string `json:"slTriggerPx"`
	SlOrdPx     string `json:"slOrdPx"`
	FeeCcy      string `json:"feeCcy"`
	Fee         string `json:"fee"`
	RebateCcy   string `json:"rebateCcy"`
	Rebate      string `json:"rebate"`
	Category    string `json:"category"`
	UTime       string `json:"uTime"`
	CTime       string `json:"cTime"`
}

type PairData

type PairData struct {
	Alias     string `json:"alias"`
	BaseCcy   string `json:"baseCcy"`
	Category  string `json:"category"`
	CtMult    string `json:"ctMult"`
	CtType    string `json:"ctType"`
	CtVal     string `json:"ctVal"`
	CtValCcy  string `json:"ctValCcy"`
	ExpTime   string `json:"expTime"`
	InstID    string `json:"instId"`
	InstType  string `json:"instType"`
	Lever     string `json:"lever"`
	ListTime  string `json:"listTime"`
	LotSz     string `json:"lotSz"`
	MinSz     string `json:"minSz"`
	OptType   string `json:"optType"`
	QuoteCcy  string `json:"quoteCcy"`
	SettleCcy string `json:"settleCcy"`
	State     string `json:"state"`
	Stk       string `json:"stk"`
	TickSz    string `json:"tickSz"`
	Uly       string `json:"uly"`
}

type PlaceOrder

type PlaceOrder struct {
	ClOrdID string `json:"clOrdId"`
	OrdID   string `json:"ordId"`
	Tag     string `json:"tag"`
	SCode   string `json:"sCode"`
	SMsg    string `json:"sMsg"`
}

type Transfer

type Transfer struct {
	TransID string `json:"transId"`
	Ccy     string `json:"ccy"`
	From    string `json:"from"`
	Amt     string `json:"amt"`
	To      string `json:"to"`
}

Jump to

Keyboard shortcuts

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