entities

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// currency will be added to exchange at unknown date
	AddUnkown = 0
	// currency will be added to exchange at known date (AddToMarketDate)
	AddKnown = 1
	// currency has been added and trading is enabled
	AddDone = 1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ActiveElement

type ActiveElement struct {
	CurrencyInfo
	Votes int `json:"votes" description:"Number of votes so far"`
}

type AllBalanceResp

type AllBalanceResp struct {
	Base
	Balances `json:"balances" description:"Balances"`
}

type AskOrder

type AskOrder Quotation // also ascending

func (AskOrder) Len

func (v AskOrder) Len() int

func (AskOrder) Less

func (a AskOrder) Less(i, j int) bool

func (AskOrder) Swap

func (v AskOrder) Swap(i, j int)

type Balance

type Balance struct {
	Total     json.Number `json:"total,string" description:"Total amount."`
	Available json.Number `json:"available,string" description:"Available amount."`
}

type BalanceResp

type BalanceResp struct {
	Base
	Currency string `json:"currency" description:"Currency"`
	Balance
}

func (BalanceResp) String

func (me BalanceResp) String() string

type Balances

type Balances map[string]*Balance

type Base

type Base struct {
	Status    string    `json:"status" description:"Status"`
	Timestamp Timestamp `json:"timestamp" description:"Timestamp"`
}

func (Base) GetStatus

func (me Base) GetStatus() string

func (Base) SetStatus

func (me Base) SetStatus(status string)

type CandleItem added in v0.0.2

type CandleItem struct {
	Time   Timestamp
	Open   json.Number
	High   json.Number
	Low    json.Number
	Close  json.Number
	Volume json.Number
}

func (*CandleItem) UnmarshalJSON added in v0.0.2

func (n *CandleItem) UnmarshalJSON(buf []byte) error

type CandlesResp added in v0.0.2

type CandlesResp struct {
	Base
	MoreAvailable bool         `json:"more_available" description:"Is more data available?"`
	Data          []CandleItem `json:"data" description:"Actual data"`
}

type ColumnQuotation

type ColumnQuotation int
const (
	Volume ColumnQuotation = 0
	Price  ColumnQuotation = 1
)

type Currency added in v0.0.2

type Currency struct {
	Name          string      `json:"name" description:"Name of the currency."`
	NamePlural    string      `json:"namePlural" description:"Plural name of the currency."`
	Decimals      int         `json:"decimals,int" description:"Number of decimals."`
	WithdrawalFee json.Number `json:"withdrawalFee,string" description:"Fee in this currency to whitdraw."`
	MinimalOrder  json.Number `json:"minimalOrder,string" description:"Minimal order."`
	CanWithdraw   bool        `json:"canWithDraw" description:"Can the currency currently be withdrawn?"`
	UsdtValue     json.Number `json:"usdtValue,string" description:"Value of this currency in USDT."`
	BtcValue      json.Number `json:"btcValue,string" description:"Value of this currency in BTC."`
	EthValue      json.Number `json:"ethValue,string" description:"Value of this currency in ETH."`
}

type CurrencyInfo

type CurrencyInfo struct {
	Currency     string `json:"currency" description:"Currency code like XLM"`
	CurrencyName string `json:"currencyName" description:"Currency name like Stellar"`
}

type CurrencyResp added in v0.0.2

type CurrencyResp struct {
	Base
	Currencies map[string]Currency `json:"currencies" description:"The actual currencies."`
}

type DepositAddrResp added in v0.0.2

type DepositAddrResp struct {
	Base
	Address string `json:"address" description:"Deposit address."`
}

type ErrorResp

type ErrorResp struct {
	Base
	Reason    string `json:"reason" description:"Reason for the failure."`
	ErrorCode int    `json:"errorCode" description:"Code for the error"`
}

type ExtendedTrade

type ExtendedTrade struct {
	Trade
	Value json.Number `` /* 138-byte string literal not displayed */
}

type OpenOrder

type OpenOrder struct {
	Id              uuid.UUID   `json:"id" description:"ID"`
	Created         Timestamp   `json:"created" description:"Timestamp of order"`
	Type            OrderType   `json:"type" description:"Either buy or sell"`
	Price           json.Number `json:"price,string" description:"Price of order."`
	TakeProfitPrice json.Number `json:"takeeprofit,string" description:"Price to take profit."`
	Amount          json.Number `json:"amount,string" description:"Amount of order."`
	RemainingAmount json.Number `json:"remainingAmount,string" description:"Remaining amount of order."`
	CurrencyPair    string      `json:"currencyPair" description:"Currency pair of order."`
}

type OrderBook

type OrderBook struct {
	Bids Quotation `json:"bids" description:"Bids (buy requests)"`
	Asks Quotation `json:"asks" description:"Asks (sell requests)"`
}

type OrderBookResp

type OrderBookResp struct {
	Base
	Bids Quotation `json:"bids" description:"Bids (buy requests)"`
	Asks Quotation `json:"asks" description:"Asks (sell requests)"`
}

type OrderDetails

type OrderDetails string
const (
	Open     OrderDetails = "open"
	Filled   OrderDetails = "filled"
	Canceled OrderDetails = "canceled" // sic
	Expired  OrderDetails = "expired"
)

type OrderDetailsResp

type OrderDetailsResp struct {
	Base
	// This order might have a different status than "Open", check OrderStatus
	OpenOrder
	Trades []ExtendedTrade `json:"trades" description:"Trades."`

	OrderStatus OrderDetails `json:"orderStatus" description:"Details about the order"`
}

type OrderType

type OrderType string
const (
	Buy  OrderType = "buy"
	Sell OrderType = "sell"
)

type OrdersResp

type OrdersResp struct {
	Base
	// All orders here are Open
	OpenOrders []OpenOrder `json:"openOrders" description:"Open orders."`
}

type Page

type Page struct {
	Base
	CurrentPage int `json:"page" description:"Current page"`
	TotalPages  int `json:"pages" description:"Total pages"`
}

type PlaceOrderResp

type PlaceOrderResp struct {
	Base
	OrderId uuid.UUID `json:"orderId" description:"ID"`
}

type PublishStatus

type PublishStatus int

type Quotation

type Quotation [][2]json.Number

volume, price

func (*Quotation) Copy

func (me *Quotation) Copy() *Quotation

func (*Quotation) GetLiquidity

func (me *Quotation) GetLiquidity() decimal.Decimal

* * Get liquidity in counter currency (e.g., USDT).

type Statuser

type Statuser interface {
	GetStatus() string
	SetStatus(string)
}

type TickerResp

type TickerResp struct {
	Base
	Bid        json.Number `json:"bid,string" description:"Current best bid."`
	Ask        json.Number `json:"ask,string" description:"Current best bid."`
	Low        json.Number `json:"low,string" description:"Lowest value of requested interval."`
	High       json.Number `json:"high,string" description:"Highest value of requested interval."`
	Vwap       json.Number `json:"vwap,string" description:"Volume weighted average."`
	Volume     json.Number `json:"volume,string" description:"Volume in the requested interval"`
	VolumeUsdt json.Number `json:"volume_usdt,string" description:"Volume in the requested interval (in USDT)"`
}

type Timestamp

type Timestamp struct {
	time.Time
}

func (Timestamp) MarshalJSON

func (t Timestamp) MarshalJSON() ([]byte, error)

func (*Timestamp) UnmarshalJSON

func (t *Timestamp) UnmarshalJSON(data []byte) error

type Trade

type Trade struct {
	Id       int64       `json:"id" description:"ID"`
	Datetime Timestamp   `json:"datetime" description:"Timestamp of trade"`
	Price    json.Number `json:"price,string" description:"Price of trade."`
	Amount   json.Number `json:"amount,string" description:"Amount of trade."`
	Type     OrderType   `json:"type" description:"Either buy or sell"`
}

type TradesResp

type TradesResp struct {
	Base
	Trades []Trade `json:"trades" description:"Timestamp"`
}

type TradingPair

type TradingPair struct {
	PriceDecimals   int         `json:"priceDecimals" description:"Decimals for price"`
	AmountDecimals  int         `json:"amountDecimals" description:"Decimals for amount"`
	MinAmount       json.Number `json:"minAmount" description:"Minimum amount of base currency."`
	BaseCurrency    string      `json:"baseCurrency" description:"Base currency."`
	CounterCurrency string      `json:"counterCurrency" description:"Counter currency."`
	Title           string      `json:"title" description:"Title."`
}

func (TradingPair) String

func (me TradingPair) String() string

type TradingPairResp

type TradingPairResp map[string]TradingPair

type Transaction

type Transaction struct {
	Id       int64           `json:"id" description:"ID"`
	Datetime Timestamp       `json:"datetime" description:"Timestamp of transaction"`
	Amount   json.Number     `json:"amount,string" description:"Amount of transaction."`
	Type     TransactionType `json:"type" description:"Type of transaction"`
	Currency string          `json:"currency" description:"Currency of transaction"`
}

type TransactionResp

type TransactionResp struct {
	Page
	Transactions []Transaction `json:"transactions" description:"Transactions"`
}

type TransactionType

type TransactionType string
const (
	Deposit         TransactionType = "Deposit"
	Whitdrawal      TransactionType = "Whitdrawal"
	WithdrawalFee   TransactionType = "Whitdrawal fee"
	Trading         TransactionType = "Trade" // cannot reuse Trade
	TradingFee      TransactionType = "Trading fee"
	AccountTransfer TransactionType = "Account transfer"
	Vote            TransactionType = "Vote"
)

type VotesResp

type VotesResp struct {
	Base
	VotingEndDate Timestamp       `json:"votingEndDate" description:"When voting ends"`
	WinnerList    []WinnerElement `json:"winnerList" description:"Winner list"`
	ActiveList    []ActiveElement `json:"activeList" description:"Active voting list"`
}

type WinnerElement

type WinnerElement struct {
	CurrencyInfo
	TotalVotes      int           `json:"totalVotes" description:"Number of votes"`
	WinDate         Timestamp     `json:"winDate" description:"When the currency has won"`
	AddToMarketDate Timestamp     `json:"addToMarketDate" description:"When the currency will be added to market"`
	PublishStatus   PublishStatus `json:"publishStatus" description:"Is adding currency to market date known?"`
}

Jump to

Keyboard shortcuts

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