Documentation
¶
Index ¶
- Variables
- func BigToFloat(b *big.Int, decimal int64) float64
- func GetTimepoint() uint64
- func TimeToTimepoint(t time.Time) uint64
- func TimepointToTime(t uint64) time.Time
- type ActivityID
- type ActivityRecord
- type AddressConfig
- type AllBalanceResponse
- type AllEBalanceResponse
- type AllOrderEntry
- type AllOrderResponse
- type AllPriceResponse
- type AllRateEntry
- type AllRateResponse
- type BalanceEntry
- type BalanceResponse
- type EBalanceEntry
- type Exchange
- type ExchangeID
- type ExchangePrice
- type OnePrice
- type OnePriceResponse
- type Order
- type OrderEntry
- type PriceEntry
- type RateEntry
- type RateResponse
- type RawBalance
- type Timestamp
- type Token
- type TokenPair
- type TokenPairID
- type Version
Constants ¶
This section is empty.
Variables ¶
View Source
var SupportedExchanges = map[ExchangeID]Exchange{}
View Source
var SupportedTokens map[string]Token
Functions ¶
func GetTimepoint ¶
func GetTimepoint() uint64
func TimeToTimepoint ¶
func TimepointToTime ¶
Types ¶
type ActivityID ¶
func NewActivityID ¶
func NewActivityID(t uint64, id string) ActivityID
func StringToActivityID ¶
func StringToActivityID(id string) (ActivityID, error)
func (ActivityID) MarshalText ¶
func (self ActivityID) MarshalText() ([]byte, error)
func (ActivityID) String ¶
func (self ActivityID) String() string
func (*ActivityID) UnmarshalText ¶
func (self *ActivityID) UnmarshalText(b []byte) error
type ActivityRecord ¶
type AddressConfig ¶
type AddressConfig struct {
Tokens map[string]token `json:"tokens"`
Exchanges map[string]exchange `json:"exchanges"`
Bank string `json:"bank"`
Reserve string `json:"reserve"`
Network string `json:"network"`
Wrapper string `json:"wrapper"`
}
func GetAddressConfigFromFile ¶
func GetAddressConfigFromFile(path string) (AddressConfig, error)
type AllBalanceResponse ¶
type AllBalanceResponse struct {
Version Version
Timestamp Timestamp
ReturnTime Timestamp
Data map[string]BalanceResponse
}
type AllEBalanceResponse ¶
type AllEBalanceResponse struct {
Version Version
Timestamp Timestamp
ReturnTime Timestamp
Data map[ExchangeID]EBalanceEntry
}
type AllOrderEntry ¶
type AllOrderEntry map[ExchangeID]OrderEntry
type AllOrderResponse ¶
type AllOrderResponse struct {
Version Version
Timestamp Timestamp
ReturnTime Timestamp
Data AllOrderEntry
}
type AllPriceResponse ¶
type AllPriceResponse struct {
Version Version
Timestamp Timestamp
ReturnTime Timestamp
Data map[TokenPairID]OnePrice
}
type AllRateEntry ¶
type AllRateResponse ¶
type AllRateResponse struct {
Version Version
Valid bool
Error string
Timestamp Timestamp
ReturnTime Timestamp
Data map[TokenPairID]RateResponse
}
type BalanceEntry ¶
type BalanceEntry struct {
Valid bool
Error string
Timestamp Timestamp
ReturnTime Timestamp
Balance RawBalance
}
func (BalanceEntry) ToBalanceResponse ¶
func (self BalanceEntry) ToBalanceResponse(decimal int64) BalanceResponse
type BalanceResponse ¶
type EBalanceEntry ¶
type Exchange ¶
type Exchange interface {
ID() ExchangeID
Address(token Token) (address ethereum.Address, supported bool)
Withdraw(token Token, amount *big.Int, address ethereum.Address, timepoint uint64) (string, error)
Trade(tradeType string, base Token, quote Token, rate float64, amount float64, timepoint uint64) (id string, done float64, remaining float64, finished bool, err error)
CancelOrder(id ActivityID) error
MarshalText() (text []byte, err error)
}
func GetExchange ¶
func MustGetExchange ¶
type ExchangeID ¶
type ExchangeID string
type ExchangePrice ¶
type ExchangePrice struct {
Valid bool
Error string
Timestamp Timestamp
Bids []PriceEntry
Asks []PriceEntry
ReturnTime Timestamp
}
type OnePrice ¶
type OnePrice map[ExchangeID]ExchangePrice
type OnePriceResponse ¶
type Order ¶
type Order struct {
ID string `standard id across multiple exchanges`
Base string
Quote string
OrderId string
Price float64
OrigQty float64 `original quantity`
ExecutedQty float64 `matched quantity`
TimeInForce string
Type string `market or limit`
Side string `buy or sell`
StopPrice string
IcebergQty string
Time uint64
}
type OrderEntry ¶
type PriceEntry ¶
type RateResponse ¶
type RawBalance ¶
func (RawBalance) MarshalJSON ¶
func (self RawBalance) MarshalJSON() ([]byte, error)
func (*RawBalance) ToFloat ¶
func (self *RawBalance) ToFloat(decimal int64) float64
func (*RawBalance) UnmarshalJSON ¶
func (self *RawBalance) UnmarshalJSON(text []byte) error
type TokenPair ¶
func MustCreateTokenPair ¶
func NewTokenPair ¶
func (*TokenPair) PairID ¶
func (self *TokenPair) PairID() TokenPairID
type TokenPairID ¶
type TokenPairID string
func NewTokenPairID ¶
func NewTokenPairID(base, quote string) TokenPairID
Click to show internal directories.
Click to hide internal directories.