Documentation ¶
Index ¶
- Constants
- type BinaAccountTradeHistory
- type BinaServerTime
- type Binacancel
- type Binadeposit
- type Binadepositaddress
- type Binadeposits
- type Binainfo
- type Binance
- func (bn *Binance) Address(token common.Token) (ethereum.Address, bool)
- func (bn *Binance) CancelOrder(id string, base, quote string) error
- func (bn *Binance) DepositStatus(id common.ActivityID, txHash, currency string, amount float64, ...) (string, error)
- func (bn *Binance) FetchEBalanceData(timepoint uint64) (common.EBalanceEntry, error)
- func (bn *Binance) FetchOnePairData(wg *sync.WaitGroup, baseID, quoteID string, data *sync.Map, timepoint uint64)
- func (bn *Binance) FetchOnePairTradeHistory(wait *sync.WaitGroup, data *sync.Map, pair common.TokenPair)
- func (bn *Binance) FetchPriceData(timepoint uint64, fetchBTCPrice bool) (map[common.TokenPairID]common.ExchangePrice, error)
- func (bn *Binance) FetchTradeHistory()
- func (bn *Binance) GetExchangeInfo(pair common.TokenPairID) (common.ExchangePrecisionLimit, error)
- func (bn *Binance) GetFee() (common.ExchangeFees, error)
- func (bn *Binance) GetInfo() (common.ExchangeInfo, error)
- func (bn *Binance) GetLiveExchangeInfos(tokenPairIDs []common.TokenPairID) (common.ExchangeInfo, error)
- func (bn *Binance) GetMinDeposit() (common.ExchangesMinDeposit, error)
- func (bn *Binance) GetTradeHistory(fromTime, toTime uint64) (common.ExchangeTradeHistory, error)
- func (bn *Binance) ID() common.ExchangeID
- func (bn *Binance) MarshalText() (text []byte, err error)
- func (bn *Binance) Name() string
- func (bn *Binance) OpenOrdersForOnePair(wg *sync.WaitGroup, pair common.TokenPair, data *sync.Map, timepoint uint64)
- func (bn *Binance) OrderStatus(id string, base, quote string) (string, error)
- func (bn *Binance) QueryOrder(symbol string, id uint64) (done float64, remaining float64, finished bool, err error)
- func (bn *Binance) TokenAddresses() (map[string]ethereum.Address, error)
- func (bn *Binance) TokenPairs() ([]common.TokenPair, error)
- func (bn *Binance) Trade(tradeType string, base common.Token, quote common.Token, rate float64, ...) (id string, done float64, remaining float64, finished bool, err error)
- func (bn *Binance) UpdateDepositAddress(token common.Token, address string) error
- func (bn *Binance) UpdatePairsPrecision() error
- func (bn *Binance) Withdraw(token common.Token, amount *big.Int, address ethereum.Address, ...) (string, error)
- func (bn *Binance) WithdrawStatus(id, currency string, amount float64, timepoint uint64) (string, string, error)
- type BinanceExchangeInfo
- type BinanceInterface
- type BinanceStorage
- type BinanceSymbol
- type BinanceTradeHistory
- type Binaorder
- type Binaorders
- type Binaprice
- type Binaresp
- type Binatrade
- type Binawithdraw
- type Binawithdrawal
- type Binawithdrawals
- type FilterLimit
- type Huobi
- func (h *Huobi) Address(token common.Token) (ethereum.Address, bool)
- func (h *Huobi) CancelOrder(id, base, quote string) error
- func (h *Huobi) DepositStatus(id common.ActivityID, tx1Hash, currency string, sentAmount float64, ...) (string, error)
- func (h *Huobi) FetchEBalanceData(timepoint uint64) (common.EBalanceEntry, error)
- func (h *Huobi) FetchOnePairData(wg *sync.WaitGroup, baseID, quoteID string, data *sync.Map, timepoint uint64)
- func (h *Huobi) FetchOnePairTradeHistory(wait *sync.WaitGroup, data *sync.Map, pair common.TokenPair)
- func (h *Huobi) FetchOrderData(timepoint uint64) (common.OrderEntry, error)
- func (h *Huobi) FetchPriceData(timepoint uint64, fetchPriceData bool) (map[common.TokenPairID]common.ExchangePrice, error)
- func (h *Huobi) FetchTradeHistory()
- func (h *Huobi) FindTx2(id common.ActivityID) (tx2 common.TXEntry, found bool)
- func (h *Huobi) FindTx2InPending(id common.ActivityID) (common.TXEntry, bool)
- func (h *Huobi) GetExchangeInfo(pair common.TokenPairID) (common.ExchangePrecisionLimit, error)
- func (h *Huobi) GetFee() (common.ExchangeFees, error)
- func (h *Huobi) GetInfo() (common.ExchangeInfo, error)
- func (h *Huobi) GetLiveExchangeInfos(tokenPairIDs []common.TokenPairID) (common.ExchangeInfo, error)
- func (h *Huobi) GetMinDeposit() (common.ExchangesMinDeposit, error)
- func (h *Huobi) GetTradeHistory(fromTime, toTime uint64) (common.ExchangeTradeHistory, error)
- func (h *Huobi) ID() common.ExchangeID
- func (h *Huobi) MarshalText() (text []byte, err error)
- func (h *Huobi) Name() string
- func (h *Huobi) OpenOrdersForOnePair(wg *sync.WaitGroup, pair common.TokenPair, data *sync.Map, timepoint uint64)
- func (h *Huobi) OrderStatus(id string, base, quote string) (string, error)
- func (h *Huobi) PendingIntermediateTxs() (map[common.ActivityID]common.TXEntry, error)
- func (h *Huobi) QueryOrder(symbol string, id uint64) (done float64, remaining float64, finished bool, err error)
- func (h *Huobi) RealDepositAddress(tokenID string) (ethereum.Address, error)
- func (h *Huobi) Send2ndTransaction(amount float64, token common.Token, exchangeAddress ethereum.Address) (*types.Transaction, error)
- func (h *Huobi) TokenAddresses() (map[string]ethereum.Address, error)
- func (h *Huobi) TokenPairs() ([]common.TokenPair, error)
- func (h *Huobi) Trade(tradeType string, base common.Token, quote common.Token, rate float64, ...) (id string, done float64, remaining float64, finished bool, err error)
- func (h *Huobi) UpdateDepositAddress(token common.Token, address string) error
- func (h *Huobi) UpdatePairsPrecision() error
- func (h *Huobi) Withdraw(token common.Token, amount *big.Int, address ethereum.Address, ...) (string, error)
- func (h *Huobi) WithdrawStatus(id, currency string, amount float64, timepoint uint64) (string, string, error)
- type HuobiAccounts
- type HuobiBlockchain
- type HuobiCancel
- type HuobiDeposit
- type HuobiDepositAddress
- type HuobiDeposits
- type HuobiDepth
- type HuobiExchangeInfo
- type HuobiInfo
- type HuobiInterface
- type HuobiOrder
- type HuobiStorage
- type HuobiTrade
- type HuobiTradeHistory
- type HuobiWithdraw
- type HuobiWithdrawHistory
- type HuobiWithdraws
- type Setting
- type StableEx
- func (se *StableEx) Address(token common.Token) (ethereum.Address, bool)
- func (se *StableEx) CancelOrder(id, base, quote string) error
- func (se *StableEx) DepositStatus(id common.ActivityID, txHash, currency string, amount float64, ...) (string, error)
- func (se *StableEx) FetchEBalanceData(timepoint uint64) (common.EBalanceEntry, error)
- func (se *StableEx) FetchPriceData(timepoint uint64, fetchBTCPrice bool) (map[common.TokenPairID]common.ExchangePrice, error)
- func (se *StableEx) FetchTradeHistory(timepoint uint64) (map[common.TokenPairID][]common.TradeHistory, error)
- func (se *StableEx) GetExchangeInfo(pair common.TokenPairID) (common.ExchangePrecisionLimit, error)
- func (se *StableEx) GetFee() (common.ExchangeFees, error)
- func (se *StableEx) GetInfo() (common.ExchangeInfo, error)
- func (se *StableEx) GetLiveExchangeInfos(tokenPairIDs []common.TokenPairID) (common.ExchangeInfo, error)
- func (se *StableEx) GetMinDeposit() (common.ExchangesMinDeposit, error)
- func (se *StableEx) GetTradeHistory(fromTime, toTime uint64) (common.ExchangeTradeHistory, error)
- func (se *StableEx) ID() common.ExchangeID
- func (se *StableEx) MarshalText() (text []byte, err error)
- func (se *StableEx) Name() string
- func (se *StableEx) OrderStatus(id string, base, quote string) (string, error)
- func (se *StableEx) QueryOrder(symbol string, id uint64) (done float64, remaining float64, finished bool, err error)
- func (se *StableEx) TokenAddresses() (map[string]ethereum.Address, error)
- func (se *StableEx) TokenPairs() ([]common.TokenPair, error)
- func (se *StableEx) Trade(tradeType string, base common.Token, quote common.Token, rate float64, ...) (id string, done float64, remaining float64, finished bool, err error)
- func (se *StableEx) UpdateDepositAddress(token common.Token, address string) error
- func (se *StableEx) Withdraw(token common.Token, amount *big.Int, address ethereum.Address, ...) (string, error)
- func (se *StableEx) WithdrawStatus(id, currency string, amount float64, timepoint uint64) (string, string, error)
Constants ¶
const (
//BtcID is the string ID used for bitcoin
BtcID = "BTC"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BinaAccountTradeHistory ¶ added in v0.1.1
type BinaAccountTradeHistory []struct { Symbol string `json:"symbol"` ID uint64 `json:"id"` OrderID uint64 `json:"orderId"` Price string `json:"price"` Qty string `json:"qty"` QuoteQty string `json:"quoteQty"` Commission string `json:"commission"` CommissionAsset string `json:"commissionAsset"` Time uint64 `json:"time"` IsBuyer bool `json:"isBuyer"` IsMaker bool `json:"isMaker"` IsBestMatch bool `json:"isBestMatch"` }
BinaAccountTradeHistory object for a trade
type BinaServerTime ¶ added in v0.1.1
type BinaServerTime struct {
ServerTime uint64 `json:"serverTime"`
}
type Binacancel ¶
type Binadeposit ¶
type Binadepositaddress ¶
type Binadeposits ¶
type Binadeposits struct { Success bool `json:"success"` Msg string `json:"msg"` Deposits []Binadeposit `json:"depositList"` }
{ "depositList": [ { "insertTime": 1508198532000, "amount": 0.04670582, "asset": "ETH", "address": "0x6915f16f8791d0a1cc2bf47c13a6b2a92000504b", "txId": "0xdf33b22bdb2b28b1f75ccd201a4a4m6e7g83jy5fc5d5a9d1340961598cfcb0a1", "status": 1 }, { "insertTime": 1508298532000, "amount": 1000, "asset": "XMR", "address": "463tWEBn5XZJSxLU34r6g7h8jtxuNcDbjLSjkn3XAXHCbLrTTErJrBWYgHJQyrCwkNgYvyV3z8zctJLPCZy24jvb3NiTcTJ", "addressTag": "342341222", "txId": "b3c6219639c8ae3f9cf010cdc24fw7f7yt8j1e063f9b4bd1a05cb44c4b6e2509", "status": 1 } ], "success": true }
type Binainfo ¶
type Binainfo struct { Code int `json:"code"` Msg string `json:"msg"` MakerCommission int64 `json:"makerCommission"` TakerCommission int64 `json:"takerCommission"` BuyerCommission int64 `json:"buyerCommission"` SellerCommission int64 `json:"sellerCommission"` CanTrade bool `json:"canTrade"` CanWithdraw bool `json:"canWithdraw"` CanDeposit bool `json:"canDeposit"` Balances []struct { Asset string `json:"asset"` Free string `json:"free"` Locked string `json:"locked"` } `json:"balances"` }
type Binance ¶
type Binance struct {
// contains filtered or unexported fields
}
func NewBinance ¶
func NewBinance( interf BinanceInterface, storage BinanceStorage, setting Setting) (*Binance, error)
func (*Binance) Address ¶
Address returns the deposit address of a token on Binance. It will prioritize the live adress from Binance over the current address in storage
func (*Binance) DepositStatus ¶
func (*Binance) FetchEBalanceData ¶
func (bn *Binance) FetchEBalanceData(timepoint uint64) (common.EBalanceEntry, error)
func (*Binance) FetchOnePairData ¶ added in v0.1.1
func (*Binance) FetchOnePairTradeHistory ¶ added in v0.1.1
func (bn *Binance) FetchOnePairTradeHistory( wait *sync.WaitGroup, data *sync.Map, pair common.TokenPair)
FetchOnePairTradeHistory fetch trade history for one pair from exchange
func (*Binance) FetchPriceData ¶
func (bn *Binance) FetchPriceData(timepoint uint64, fetchBTCPrice bool) (map[common.TokenPairID]common.ExchangePrice, error)
func (*Binance) FetchTradeHistory ¶ added in v0.1.1
func (bn *Binance) FetchTradeHistory()
FetchTradeHistory get all trade history for all tokens in the exchange
func (*Binance) GetExchangeInfo ¶ added in v0.1.1
func (bn *Binance) GetExchangeInfo(pair common.TokenPairID) (common.ExchangePrecisionLimit, error)
func (*Binance) GetLiveExchangeInfos ¶ added in v0.1.1
func (bn *Binance) GetLiveExchangeInfos(tokenPairIDs []common.TokenPairID) (common.ExchangeInfo, error)
GetLiveExchangeInfo queries the Exchange Endpoint for exchange precision and limit of a certain pair ID It return error if occurs.
func (*Binance) GetMinDeposit ¶ added in v0.1.1
func (bn *Binance) GetMinDeposit() (common.ExchangesMinDeposit, error)
func (*Binance) GetTradeHistory ¶ added in v0.1.1
func (bn *Binance) GetTradeHistory(fromTime, toTime uint64) (common.ExchangeTradeHistory, error)
func (*Binance) ID ¶
func (bn *Binance) ID() common.ExchangeID
ID must return the exact string or else simulation will fail
func (*Binance) MarshalText ¶
func (*Binance) OpenOrdersForOnePair ¶ added in v0.1.1
func (*Binance) OrderStatus ¶
func (*Binance) QueryOrder ¶ added in v0.1.1
func (*Binance) TokenAddresses ¶ added in v0.1.1
func (*Binance) UpdateDepositAddress ¶
UpdateDepositAddress update deposit address from binance api
func (*Binance) UpdatePairsPrecision ¶ added in v0.1.1
type BinanceExchangeInfo ¶ added in v0.1.1
type BinanceExchangeInfo struct {
Symbols []BinanceSymbol
}
type BinanceInterface ¶
type BinanceInterface interface { GetDepthOnePair(baseID, quoteID string) (Binaresp, error) OpenOrdersForOnePair(pair common.TokenPair) (Binaorders, error) GetInfo() (Binainfo, error) GetExchangeInfo() (BinanceExchangeInfo, error) GetDepositAddress(tokenID string) (Binadepositaddress, error) GetAccountTradeHistory(base, quote common.Token, fromID string) (BinaAccountTradeHistory, error) Withdraw( token common.Token, amount *big.Int, address ethereum.Address) (string, error) Trade( tradeType string, base, quote common.Token, rate, amount float64) (Binatrade, error) CancelOrder(symbol string, id uint64) (Binacancel, error) DepositHistory(startTime, endTime uint64) (Binadeposits, error) WithdrawHistory(startTime, endTime uint64) (Binawithdrawals, error) OrderStatus(symbol string, id uint64) (Binaorder, error) }
BinanceInterface contains the methods to interact with Binance centralized exchange.
type BinanceStorage ¶ added in v0.1.1
type BinanceStorage interface { StoreTradeHistory(data common.ExchangeTradeHistory) error GetTradeHistory(fromTime, toTime uint64) (common.ExchangeTradeHistory, error) GetLastIDTradeHistory(pair string) (string, error) }
BinanceStorage is the interface that wraps all database operation of Binance exchange.
type BinanceSymbol ¶ added in v0.1.1
type BinanceSymbol struct { Symbol string `json:"symbol"` BaseAssetPrecision int `json:"baseAssetPrecision"` QuotePrecision int `json:"quotePrecision"` Filters []FilterLimit `json:"filters"` }
type BinanceTradeHistory ¶ added in v0.1.1
type BinanceTradeHistory []struct { ID uint64 `json:"id"` Price string `json:"price"` Qty string `json:"qty"` Time uint64 `json:"time"` IsBuyerMaker bool `json:"isBuyerMaker"` IsBestMatch bool `json:"isBestMatch"` }
BinanceTradeHistory recent trade history
type Binaorder ¶
type Binaorder struct { Code int `json:"code"` Msg string `json:"msg"` Symbol string `json:"symbol"` OrderID uint64 `json:"orderId"` ClientOrderID string `json:"clientOrderId"` Price string `json:"price"` OrigQty string `json:"origQty"` ExecutedQty string `json:"executedQty"` Status string `json:"status"` TimeInForce string `json:"timeInForce"` Type string `json:"type"` Side string `json:"side"` StopPrice string `json:"stopPrice"` IcebergQty string `json:"icebergQty"` Time uint64 `json:"time"` }
type Binaorders ¶
type Binaorders []Binaorder
type Binaprice ¶ added in v0.1.1
func (*Binaprice) UnmarshalJSON ¶ added in v0.1.1
type Binawithdraw ¶
type Binawithdrawal ¶
type Binawithdrawals ¶
type Binawithdrawals struct { Success bool `json:"success"` Msg string `json:"msg"` Withdrawals []Binawithdrawal `json:"withdrawList"` }
{ "withdrawList": [ { "id":"7213fea8e94b4a5593d507237e5a555b" "amount": 1, "address": "0x6915f16f8791d0a1cc2bf47c13a6b2a92000504b", "asset": "ETH", "txId": "0xdf33b22bdb2b28b1f75ccd201a4a4m6e7g83jy5fc5d5a9d1340961598cfcb0a1", "applyTime": 1508198532000 "status": 4 }, { "id":"7213fea8e94b4a5534ggsd237e5a555b" "amount": 1000, "address": "463tWEBn5XZJSxLU34r6g7h8jtxuNcDbjLSjkn3XAXHCbLrTTErJrBWYgHJQyrCwkNgYvyV3z8zctJLPCZy24jvb3NiTcTJ", "addressTag": "342341222", "txId": "b3c6219639c8ae3f9cf010cdc24fw7f7yt8j1e063f9b4bd1a05cb44c4b6e2509", "asset": "XMR", "applyTime": 1508198532000, "status": 4 } ], "success": true }
type FilterLimit ¶ added in v0.1.1
type FilterLimit struct { FilterType string `json:"filterType"` MinPrice string `json:"minPrice"` MaxPrice string `json:"maxPrice"` MinQuantity string `json:"minQty"` MaxQuantity string `json:"maxQty"` StepSize string `json:"stepSize"` TickSize string `json:"tickSize"` MinNotional string `json:"minNotional"` }
type Huobi ¶ added in v0.1.1
type Huobi struct {
// contains filtered or unexported fields
}
func NewHuobi ¶ added in v0.1.1
func NewHuobi( interf HuobiInterface, blockchain *blockchain.BaseBlockchain, signer blockchain.Signer, nonce blockchain.NonceCorpus, storage HuobiStorage, setting Setting) (*Huobi, error)
NewHuobi creates new Huobi exchange instance
func (*Huobi) Address ¶ added in v0.1.1
Address return the deposit address of a token in Huobi exchange. Due to the logic of Huobi exchange, every token if supported will be deposited to an Intermediator address instead.
func (*Huobi) CancelOrder ¶ added in v0.1.1
func (*Huobi) DepositStatus ¶ added in v0.1.1
func (*Huobi) FetchEBalanceData ¶ added in v0.1.1
func (h *Huobi) FetchEBalanceData(timepoint uint64) (common.EBalanceEntry, error)
func (*Huobi) FetchOnePairData ¶ added in v0.1.1
func (*Huobi) FetchOnePairTradeHistory ¶ added in v0.1.1
func (*Huobi) FetchOrderData ¶ added in v0.1.1
func (h *Huobi) FetchOrderData(timepoint uint64) (common.OrderEntry, error)
func (*Huobi) FetchPriceData ¶ added in v0.1.1
func (h *Huobi) FetchPriceData(timepoint uint64, fetchPriceData bool) (map[common.TokenPairID]common.ExchangePrice, error)
func (*Huobi) FetchTradeHistory ¶ added in v0.1.1
func (h *Huobi) FetchTradeHistory()
FetchTradeHistory get all trade history for all pairs from huobi exchange
func (*Huobi) FindTx2 ¶ added in v0.1.1
FindTx2 : find Tx2 Record associates with activity ID, return
func (*Huobi) FindTx2InPending ¶ added in v0.1.1
func (*Huobi) GetExchangeInfo ¶ added in v0.1.1
func (h *Huobi) GetExchangeInfo(pair common.TokenPairID) (common.ExchangePrecisionLimit, error)
func (*Huobi) GetLiveExchangeInfos ¶ added in v0.1.1
func (h *Huobi) GetLiveExchangeInfos(tokenPairIDs []common.TokenPairID) (common.ExchangeInfo, error)
GetLiveExchangeInfos querry the Exchange Endpoint for exchange precision and limit of a list of tokenPairIDs It return error if occurs.
func (*Huobi) GetMinDeposit ¶ added in v0.1.1
func (h *Huobi) GetMinDeposit() (common.ExchangesMinDeposit, error)
func (*Huobi) GetTradeHistory ¶ added in v0.1.1
func (h *Huobi) GetTradeHistory(fromTime, toTime uint64) (common.ExchangeTradeHistory, error)
func (*Huobi) ID ¶ added in v0.1.1
func (h *Huobi) ID() common.ExchangeID
ID must return the exact string or else simulation will fail
func (*Huobi) MarshalText ¶ added in v0.1.1
func (*Huobi) OpenOrdersForOnePair ¶ added in v0.1.1
func (*Huobi) OrderStatus ¶ added in v0.1.1
func (*Huobi) PendingIntermediateTxs ¶ added in v0.1.1
func (*Huobi) QueryOrder ¶ added in v0.1.1
func (*Huobi) RealDepositAddress ¶ added in v0.1.1
RealDepositAddress return the actual Huobi deposit address of a token It should only be used to send 2nd transaction.
func (*Huobi) Send2ndTransaction ¶ added in v0.1.1
func (*Huobi) TokenAddresses ¶ added in v0.1.1
func (*Huobi) UpdateDepositAddress ¶ added in v0.1.1
UpdateDepositAddress update the deposit address of a token in Huobi It will prioritize the live address over the input address
func (*Huobi) UpdatePairsPrecision ¶ added in v0.1.1
type HuobiAccounts ¶ added in v0.1.1
type HuobiAccounts struct { Status string `json:"status"` Data []struct { ID uint64 `json:"id"` Type string `json:"type"` State string `json:"state"` UserID uint64 `json:"user-id"` } `json:"data"` Reason string `json:"err-msg"` }
HuobiAccounts get huobi account info
type HuobiBlockchain ¶ added in v0.1.1
type HuobiBlockchain interface { SendETHFromAccountToExchange(amount *big.Int, exchangeAddress ethereum.Address) (*types.Transaction, error) SendTokenFromAccountToExchange(amount *big.Int, exchangeAddress ethereum.Address, tokenAddress ethereum.Address) (*types.Transaction, error) TxStatus(hash ethereum.Hash) (string, uint64, error) GetIntermediatorAddr() ethereum.Address }
HuobiBlockchain contains methods to interact with blockchain from Huobi address.
type HuobiCancel ¶ added in v0.1.1
type HuobiCancel struct { Status string `json:"status"` OrderID string `json:"data"` Reason string `json:"err-msg"` }
HuobiCancel cancel order on huobi
type HuobiDeposit ¶ added in v0.1.1
type HuobiDeposit struct { ID uint64 `json:"id"` TxID uint64 `json:"transaction-id"` Currency string `json:"currency"` Amount float64 `json:"amount"` State string `json:"state"` TxHash string `json:"tx-hash"` Address string `json:"address"` }
HuobiDeposit deposit record on huobi
type HuobiDepositAddress ¶ added in v0.1.1
type HuobiDepositAddress struct { Code int `json:"code"` Message string `json:"message"` Data []struct { Currency string `json:"currency"` Address string `json:"address"` AddressTag string `json:"addressTag"` Chain string `json:"chain"` } `json:"data"` }
HuobiDepositAddress response from huobi
type HuobiDeposits ¶ added in v0.1.1
type HuobiDeposits struct { Status string `json:"status"` Data []HuobiDeposit `json:"data"` Reason string `json:"err-msg"` }
HuobiDeposits deposit on huobi
type HuobiDepth ¶ added in v0.1.1
type HuobiDepth struct { Status string `json:"status"` Timestamp uint64 `json:"ts"` Tick struct { Bids [][]float64 `json:"bids"` Asks [][]float64 `json:"asks"` } `json:"tick"` Reason string `json:"err-msg"` }
HuobiDepth get its orderbook
type HuobiExchangeInfo ¶ added in v0.1.1
type HuobiExchangeInfo struct { Status string `json:"status"` Data []struct { Base string `json:"base-currency"` Quote string `json:"quote-currency"` PricePrecision int `json:"price-precision"` AmountPrecision int `json:"amount-precision"` } `json:"data"` Reason string `json:"err-msg"` }
HuobiExchangeInfo exchange info on huobi
type HuobiInfo ¶ added in v0.1.1
type HuobiInfo struct { Status string `json:"status"` Data struct { ID uint64 `json:"id"` Type string `json:"type"` State string `json:"state"` List []struct { Currency string `json:"currency"` Type string `json:"type"` Balance string `json:"balance"` } `json:"list"` } `json:"data"` Reason string `json:"err-msg"` }
HuobiInfo exchange info
type HuobiInterface ¶ added in v0.1.1
type HuobiInterface interface { GetDepthOnePair(baseID, quoteID string) (HuobiDepth, error) GetInfo() (HuobiInfo, error) GetExchangeInfo() (HuobiExchangeInfo, error) GetDepositAddress(token string) (HuobiDepositAddress, error) GetAccountTradeHistory(base, quote common.Token) (HuobiTradeHistory, error) Withdraw( token common.Token, amount *big.Int, address ethereum.Address) (string, error) Trade( tradeType string, base, quote common.Token, rate, amount float64, timepoint uint64) (HuobiTrade, error) CancelOrder(symbol string, id uint64) (HuobiCancel, error) DepositHistory(tokens []common.Token) (HuobiDeposits, error) WithdrawHistory(token []common.Token) (HuobiWithdraws, error) OrderStatus(symbol string, id uint64) (HuobiOrder, error) }
HuobiInterface contains the methods to interact with Huobi centralized exchange.
type HuobiOrder ¶ added in v0.1.1
type HuobiOrder struct { Status string `json:"status"` Data struct { OrderID uint64 `json:"id"` Symbol string `json:"symbol"` AccountID uint64 `json:"account-id"` OrigQty string `json:"amount"` Price string `json:"price"` Type string `json:"type"` State string `json:"state"` ExecutedQty string `json:"field-amount"` } `json:"data"` Reason string `json:"err-msg"` }
HuobiOrder orderon huobi
type HuobiStorage ¶ added in v0.1.1
type HuobiStorage interface { StoreIntermediateTx(id common.ActivityID, data common.TXEntry) error StorePendingIntermediateTx(id common.ActivityID, data common.TXEntry) error // get intermediate tx corresponding to the id. It can be done, failed or pending GetIntermedatorTx(id common.ActivityID) (common.TXEntry, error) GetPendingIntermediateTXs() (map[common.ActivityID]common.TXEntry, error) StoreTradeHistory(data common.ExchangeTradeHistory) error GetTradeHistory(fromTime, toTime uint64) (common.ExchangeTradeHistory, error) }
HuobiStorage is the interface that wraps all database operation of Huobi exchange.
type HuobiTrade ¶ added in v0.1.1
type HuobiTrade struct { Status string `json:"status"` OrderID string `json:"data"` Reason string `json:"err-msg"` }
HuobiTrade trade on huobi
type HuobiTradeHistory ¶ added in v0.1.1
type HuobiTradeHistory struct { Status string `json:"status"` Data []struct { ID uint64 `json:"id"` Symbol string `json:"symbol"` Amount string `json:"amount"` Price string `json:"price"` Timestamp uint64 `json:"created-at"` Type string `json:"type"` FinishedAt uint64 `json:"finished-at"` } `json:"data"` }
HuobiTradeHistory trade history record on huobi
type HuobiWithdraw ¶ added in v0.1.1
type HuobiWithdraw struct { Status string `json:"status"` ErrCode string `json:"err-code"` Reason string `json:"err-msg"` ID uint64 `json:"data"` }
HuobiWithdraw withdraw result from huobi
type HuobiWithdrawHistory ¶ added in v0.1.1
type HuobiWithdrawHistory struct { ID uint64 `json:"id"` TxID uint64 `json:"transaction-id"` Currency string `json:"currency"` Amount float64 `json:"amount"` State string `json:"state"` TxHash string `json:"tx-hash"` Address string `json:"address"` }
HuobiWithdrawHistory from huobi
type HuobiWithdraws ¶ added in v0.1.1
type HuobiWithdraws struct { Status string `json:"status"` Data []HuobiWithdrawHistory `json:"data"` Reason string `json:"err-msg"` }
HuobiWithdraws record
type Setting ¶ added in v0.1.1
type Setting interface { GetInternalTokenByID(tokenID string) (common.Token, error) GetAllTokens() ([]common.Token, error) GetTokenByID(tokenID string) (common.Token, error) GetFee(ex settings.ExchangeName) (common.ExchangeFees, error) GetMinDeposit(ex settings.ExchangeName) (common.ExchangesMinDeposit, error) GetDepositAddresses(ex settings.ExchangeName) (common.ExchangeAddresses, error) UpdateDepositAddress(name settings.ExchangeName, addrs common.ExchangeAddresses, timestamp uint64) error GetExchangeInfo(ex settings.ExchangeName) (common.ExchangeInfo, error) UpdateExchangeInfo(ex settings.ExchangeName, exInfo common.ExchangeInfo, timestamp uint64) error ETHToken() common.Token }
type StableEx ¶ added in v0.1.1
type StableEx struct {
// contains filtered or unexported fields
}
func NewStableEx ¶ added in v0.1.1
func (*StableEx) CancelOrder ¶ added in v0.1.1
func (*StableEx) DepositStatus ¶ added in v0.1.1
func (*StableEx) FetchEBalanceData ¶ added in v0.1.1
func (se *StableEx) FetchEBalanceData(timepoint uint64) (common.EBalanceEntry, error)
func (*StableEx) FetchPriceData ¶ added in v0.1.1
func (se *StableEx) FetchPriceData(timepoint uint64, fetchBTCPrice bool) (map[common.TokenPairID]common.ExchangePrice, error)
func (*StableEx) FetchTradeHistory ¶ added in v0.1.1
func (se *StableEx) FetchTradeHistory(timepoint uint64) (map[common.TokenPairID][]common.TradeHistory, error)
func (*StableEx) GetExchangeInfo ¶ added in v0.1.1
func (se *StableEx) GetExchangeInfo(pair common.TokenPairID) (common.ExchangePrecisionLimit, error)
func (*StableEx) GetInfo ¶ added in v0.1.1
func (se *StableEx) GetInfo() (common.ExchangeInfo, error)
func (*StableEx) GetLiveExchangeInfos ¶ added in v0.1.1
func (se *StableEx) GetLiveExchangeInfos(tokenPairIDs []common.TokenPairID) (common.ExchangeInfo, error)
func (*StableEx) GetMinDeposit ¶ added in v0.1.1
func (se *StableEx) GetMinDeposit() (common.ExchangesMinDeposit, error)
func (*StableEx) GetTradeHistory ¶ added in v0.1.1
func (se *StableEx) GetTradeHistory(fromTime, toTime uint64) (common.ExchangeTradeHistory, error)
func (*StableEx) ID ¶ added in v0.1.1
func (se *StableEx) ID() common.ExchangeID
ID must return the exact string or else simulation will fail