Documentation ¶
Index ¶
- Constants
- Variables
- func BigToFloat(b *big.Int, decimal int64) float64
- func CmdDirLocation0() string
- func CombineActivityStorageErrs(err, sErr error) error
- func CurrentDir() string
- func ErrorToString(err error) string
- func EthToWei(n float64) *big.Int
- func FloatToBigInt(amount float64, decimal int64) *big.Int
- func GetCallerFunctionName() string
- func GetTimepoint() uint64
- func GetTokenAddressesList(tokens []Token) []ethereum.Address
- func GweiToWei(n float64) *big.Int
- func RunningMode() string
- func TimeToTimepoint(t time.Time) uint64
- func TimepointToTime(t uint64) time.Time
- func TruncStr(src []byte) []byte
- type ActivityID
- type ActivityRecord
- type ActivityStatus
- type AddressConfig
- type AddressesResponse
- type AllBalanceResponse
- type AllEBalanceResponse
- type AllOrderEntry
- type AllOrderResponse
- type AllPriceEntry
- type AllPriceResponse
- type AllRateEntry
- type AllRateResponse
- type AllSettings
- type AllTradeHistory
- type AuthDataRecord
- type AuthDataResponse
- type AuthDataSnapshot
- type BTCData
- type BalanceEntry
- type BalanceResponse
- type BinanceData
- type BitFinexData
- type CoinbaseData
- type DGXGoldData
- type EBalanceEntry
- type EthClient
- type ExStatus
- type Exchange
- type ExchangeActionNoti
- type ExchangeAddresses
- type ExchangeFees
- type ExchangeID
- type ExchangeInfo
- type ExchangeNotiContent
- type ExchangeNotifications
- type ExchangePrecisionLimit
- type ExchangePrice
- type ExchangeResponse
- type ExchangeSetting
- type ExchangeTokenNoti
- type ExchangeTradeHistory
- type ExchangesMinDeposit
- type ExchangesStatus
- type FeeSetRate
- type FeedConfiguration
- type FeedSetting
- type FetcherConfiguration
- type FundingFee
- type GDAXGoldData
- type GeminiETHBTCData
- type GeminiGoldData
- type GeminiVolumeETHBTC
- type GoldData
- type GoldRate
- type HitData
- type ImbalanceStepFunction
- type KrakenGoldData
- type MapFeedSetting
- type MetricEntry
- type MetricList
- type MetricResponse
- type OneForgeGoldData
- type OnePrice
- type OnePriceResponse
- type Order
- type OrderEntry
- type PWIEquation
- type PWIEquationRequestV2
- type PWIEquationTokenV2
- type PWIEquationV2
- type PriceEntry
- type QuantityStepFunction
- type RateEntry
- type RateResponse
- type RawBalance
- type RebalanceControl
- type RebalanceQuadraticEquation
- type RebalanceQuadraticRequest
- type RunnerConfig
- type SetRateTxInfo
- type SetrateControl
- type StepFunctionResponse
- type StoreSetRateTx
- type TXEntry
- type TargetQtySet
- type TargetQtyV2
- type TestExchange
- func (te TestExchange) Address(token Token) (address ethereum.Address, supported bool)
- func (te TestExchange) CancelOrder(id, base, quote string) error
- func (te TestExchange) GetExchangeInfo(pair TokenPairID) (ExchangePrecisionLimit, error)
- func (te TestExchange) GetFee() (ExchangeFees, error)
- func (te TestExchange) GetInfo() (ExchangeInfo, error)
- func (te TestExchange) GetLiveExchangeInfos(tokenPairIDs []TokenPairID) (ExchangeInfo, error)
- func (te TestExchange) GetMinDeposit() (ExchangesMinDeposit, error)
- func (te TestExchange) GetTradeHistory(fromTime, toTime uint64) (ExchangeTradeHistory, error)
- func (te TestExchange) ID() ExchangeID
- func (te TestExchange) MarshalText() (text []byte, err error)
- func (te TestExchange) Trade(tradeType string, base Token, quote Token, rate float64, amount float64, ...) (id string, done float64, remaining float64, finished bool, err error)
- func (te TestExchange) UpdateDepositAddress(token Token, address string) error
- func (te TestExchange) Withdraw(token Token, amount *big.Int, address ethereum.Address, timepoint uint64) (string, error)
- type Timestamp
- type Token
- type TokenExchangeSetting
- type TokenFee
- type TokenMetric
- type TokenMetricResponse
- type TokenPair
- type TokenPairAmountLimit
- type TokenPairID
- type TokenPairPrecision
- type TokenPairPriceLimit
- type TokenResponse
- type TokenTargetQty
- type TokenTargetQtyV2
- type TokenUpdate
- type TradeHistory
- type TradingFee
- type TransactionInfo
- type USDData
- type Version
Constants ¶
const ( ProductionMode = "production" SimulationMode = "simulation" )
const ( MiningStatusMined = "mined" MiningStatusFailed = "failed" MiningStatusSubmitted = "submitted" MiningStatusLost = "lost" MiningStatusPending = "pending" ExchangeStatusDone = "done" ExchangeStatusPending = "pending" ExchangeStatusFailed = "failed" ExchangeStatusSubmitted = "submitted" ExchangeStatusLost = "lost" ActionDeposit = "deposit" ActionTrade = "trade" ActionWithdraw = "withdraw" ActionSetRate = "set_rates" )
Variables ¶
var AppVersion string
AppVersion store build version, which set on build
var SupportedExchanges = map[ExchangeID]Exchange{}
Functions ¶
func BigToFloat ¶
BigToFloat converts a big int to float according to its number of decimal digits Example: - BigToFloat(1100, 3) = 1.1 - BigToFloat(1100, 2) = 11 - BigToFloat(1100, 5) = 0.11
func CmdDirLocation0 ¶ added in v0.1.2
func CmdDirLocation0() string
CmdDirLocation returns the absolute location of cmd directory where public settings will be read.
func CombineActivityStorageErrs ¶ added in v0.1.1
CombineActivityStorageErrs return a combination of error between action error and storage error
func CurrentDir ¶ added in v0.1.1
func CurrentDir() string
CurrentDir returns current directory of the caller.
func ErrorToString ¶ added in v0.1.1
ErrorToString returns error as string and an empty string if the error is nil
func FloatToBigInt ¶ added in v0.1.1
FloatToBigInt converts a float to a big int with specific decimal Example: - FloatToBigInt(1, 4) = 10000 - FloatToBigInt(1.234, 4) = 12340
func GetCallerFunctionName ¶ added in v0.1.2
func GetCallerFunctionName() string
GetCallerFunctionName return caller function name
func GetTimepoint ¶
func GetTimepoint() uint64
func GetTokenAddressesList ¶ added in v0.1.1
func RunningMode ¶ added in v0.1.1
func RunningMode() string
RunningMode returns the current running mode of application.
func TimeToTimepoint ¶
func TimepointToTime ¶
Types ¶
type ActivityID ¶
func NewActivityID ¶
func NewActivityID(timepoint uint64, eid string) ActivityID
NewActivityStatus creates new Activity ID.
func StringToActivityID ¶
func StringToActivityID(id string) (ActivityID, error)
func (ActivityID) MarshalText ¶
func (ai ActivityID) MarshalText() ([]byte, error)
func (ActivityID) String ¶
func (ai ActivityID) String() string
func (ActivityID) ToBytes ¶ added in v0.1.1
func (ai ActivityID) ToBytes() [64]byte
func (*ActivityID) UnmarshalText ¶
func (ai *ActivityID) UnmarshalText(b []byte) error
type ActivityRecord ¶
type ActivityRecord struct { Action string ID ActivityID Destination string Params map[string]interface{} Result map[string]interface{} ExchangeStatus string MiningStatus string Timestamp Timestamp }
func NewActivityRecord ¶ added in v0.1.1
func NewActivityRecord(action string, id ActivityID, destination string, params, result map[string]interface{}, exStatus, miStatus string, timestamp Timestamp) ActivityRecord
New ActivityRecord return an activity record with params["token"] only as token.ID
func (ActivityRecord) IsBlockchainPending ¶ added in v0.1.1
func (ar ActivityRecord) IsBlockchainPending() bool
func (ActivityRecord) IsExchangePending ¶ added in v0.1.1
func (ar ActivityRecord) IsExchangePending() bool
func (ActivityRecord) IsPending ¶ added in v0.1.1
func (ar ActivityRecord) IsPending() bool
type ActivityStatus ¶ added in v0.1.1
type ActivityStatus struct { ExchangeStatus string Tx string BlockNumber uint64 MiningStatus string Error error }
func NewActivityStatus ¶ added in v0.1.1
func NewActivityStatus(exchangeStatus, tx string, blockNumber uint64, miningStatus string, err error) ActivityStatus
NewActivityStatus creates a new ActivityStatus instance.
type AddressConfig ¶
type AddressConfig struct { Reserve string `json:"reserve"` // not officially shown but you can find it here: https://github.com/KyberNetwork/smart-contracts/blob/master/contracts/mock/Wrapper.sol Wrapper string `json:"wrapper"` // Pricing is ConversionRates contract Pricing string `json:"pricing"` // as we used to miscalling this contract as network // we still keep its json name as network // then other component won't be affect Proxy string `json:"network"` }
AddressConfig type defines a list of address attribute available in core.
type AddressesResponse ¶ added in v0.1.1
type AddressesResponse struct {
Addresses map[string]interface{} `json:"addresses"`
}
func NewAddressResponse ¶ added in v0.1.1
func NewAddressResponse(addrs map[string]interface{}) *AddressesResponse
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 AllPriceEntry ¶ added in v0.1.1
type AllPriceEntry struct { Block uint64 Data map[TokenPairID]OnePrice }
type AllPriceResponse ¶
type AllRateEntry ¶
type AllRateEntry struct { Timestamp Timestamp ReturnTime Timestamp Data map[string]RateEntry BlockNumber uint64 }
AllRateEntry contains rates data of all tokens.
type AllRateResponse ¶
type AllRateResponse struct { Version Version Timestamp Timestamp ReturnTime Timestamp Data map[string]RateResponse BlockNumber uint64 ToBlockNumber uint64 }
AllRateResponse is the response to query all rates.
type AllSettings ¶ added in v0.1.1
type AllSettings struct { Addresses *AddressesResponse `json:"addresses"` Tokens *TokenResponse `json:"tokens"` Exchanges *ExchangeResponse `json:"exchanges"` }
func NewAllSettings ¶ added in v0.1.1
func NewAllSettings(addrs *AddressesResponse, toks *TokenResponse, exs *ExchangeResponse) *AllSettings
type AllTradeHistory ¶ added in v0.1.1
type AllTradeHistory struct { Timestamp Timestamp Data map[ExchangeID]ExchangeTradeHistory }
type AuthDataRecord ¶ added in v0.1.1
type AuthDataRecord struct { Timestamp Timestamp Data AuthDataSnapshot }
func NewAuthDataRecord ¶ added in v0.1.1
func NewAuthDataRecord(timestamp Timestamp, data AuthDataSnapshot) AuthDataRecord
NewAuthDataRecord creates a new AuthDataRecord instance.
type AuthDataResponse ¶ added in v0.1.1
type AuthDataResponse struct { Version Version Timestamp Timestamp ReturnTime Timestamp Data struct { Valid bool Error string Timestamp Timestamp ReturnTime Timestamp ExchangeBalances map[ExchangeID]EBalanceEntry ReserveBalances map[string]BalanceResponse PendingActivities []ActivityRecord Block uint64 } }
type AuthDataSnapshot ¶ added in v0.1.1
type AuthDataSnapshot struct { Valid bool Error string Timestamp Timestamp ReturnTime Timestamp ExchangeBalances map[ExchangeID]EBalanceEntry ReserveBalances map[string]BalanceEntry PendingActivities []ActivityRecord Block uint64 }
type BTCData ¶ added in v0.1.1
type BTCData struct { Timestamp uint64 Coinbase CoinbaseData `json:"CoinbaseBTC"` Gemini GeminiETHBTCData `json:"GeminiBTC"` }
BTCData is the data returned by /btc-feed API.
type BalanceEntry ¶
type BalanceEntry struct { Valid bool Error string Timestamp Timestamp ReturnTime Timestamp Balance RawBalance }
func (BalanceEntry) ToBalanceResponse ¶
func (be BalanceEntry) ToBalanceResponse(decimal int64) BalanceResponse
type BalanceResponse ¶
type BinanceData ¶ added in v0.1.1
type BinanceData struct { Valid bool Error string Symbol string `json:"symbol"` BidPrice string `json:"bidPrice"` BidQty string `json:"bidQty"` AskPrice string `json:"askPrice"` AskQty string `json:"askQty"` }
BinanceData data return by https://api.binance.com/api/v3/ticker/bookTicker?symbol=ETHUSDC
type BitFinexData ¶ added in v0.1.2
type BitFinexData struct { Valid bool Error string Bid float64 `json:"bid"` BidSize float64 `json:"bid_size"` Ask float64 `json:"ask"` AskSize float64 `json:"ask_size"` DailyChange float64 `json:"daily_change"` DailyChangePerc float64 `json:"daily_change_perc"` LastPrice float64 `json:"last_price"` Volume float64 `json:"volume"` High float64 `json:"high"` Low float64 `json:"low"` }
type CoinbaseData ¶ added in v0.1.1
type CoinbaseData struct { Valid bool Error string TradeID uint64 `json:"trade_id"` Price string `json:"price"` Size string `json:"size"` Time string `json:"time"` Bid string `json:"bid"` Ask string `json:"ask"` Volume string `json:"volume"` }
CoinBaseData is the response of Coinbase ETH/BTC ticker request. Example: https://api.pro.coinbase.com/products/eth-btc/ticker Response
{ "trade_id": 7188449, "price": "0.02707000", "size": "3.43340266", "time": "2019-05-13T04:56:14.777Z", "bid": "0.02707", "ask": "0.02708", "volume": "31528.93120442" }
type DGXGoldData ¶ added in v0.1.1
type EBalanceEntry ¶
type EthClient ¶ added in v0.1.2
EthClient just a wrap for ethclient.Client with url connect to
func NewEthClient ¶ added in v0.1.2
NewEthClient create a new ethclient
type Exchange ¶
type Exchange interface { ID() ExchangeID // Address return the deposit address of a token and return true if token is supported in the exchange. // Otherwise return false. This function will prioritize live address from exchange above the current stored address. Address(token Token) (address ethereum.Address, supported bool) UpdateDepositAddress(token Token, addr string) error Withdraw(token Token, amount *big.Int, address ethereum.Address, timepoint uint64) (string, error) Trade(tradeType string, base, quote Token, rate, amount float64, timepoint uint64) (id string, done, remaining float64, finished bool, err error) CancelOrder(id, base, quote string) error MarshalText() (text []byte, err error) GetInfo() (ExchangeInfo, error) GetExchangeInfo(TokenPairID) (ExchangePrecisionLimit, error) // GetLiveExchangeInfo querry the Exchange Endpoint for exchange precision and limit of a list of tokenPairIDs // It return error if occurs. GetLiveExchangeInfos([]TokenPairID) (ExchangeInfo, error) GetFee() (ExchangeFees, error) GetMinDeposit() (ExchangesMinDeposit, error) GetTradeHistory(fromTime, toTime uint64) (ExchangeTradeHistory, error) }
Exchange represents a centralized exchange like Binance, Huobi...
func GetExchange ¶
type ExchangeActionNoti ¶ added in v0.1.1
type ExchangeActionNoti map[string]ExchangeTokenNoti
type ExchangeAddresses ¶ added in v0.1.1
ExchangeAddresses type store a map[tokenID]exchangeDepositAddress
func NewExchangeAddresses ¶ added in v0.1.1
func NewExchangeAddresses() *ExchangeAddresses
func (ExchangeAddresses) Get ¶ added in v0.1.1
func (ea ExchangeAddresses) Get(tokenID string) (ethereum.Address, bool)
func (ExchangeAddresses) GetData ¶ added in v0.1.1
func (ea ExchangeAddresses) GetData() map[string]ethereum.Address
func (ExchangeAddresses) Remove ¶ added in v0.1.1
func (ea ExchangeAddresses) Remove(tokenID string)
type ExchangeFees ¶ added in v0.1.1
type ExchangeFees struct { Trading TradingFee Funding FundingFee }
ExchangeFees contains the fee for an exchanges It follow the struct of {trading: map[tokenID]float64, funding: {Withdraw: map[tokenID]float64, Deposit: map[tokenID]float64}}
func NewExchangeFee ¶ added in v0.1.1
func NewExchangeFee(tradingFee TradingFee, fundingFee FundingFee) ExchangeFees
type ExchangeID ¶
type ExchangeID string
type ExchangeInfo ¶ added in v0.1.1
type ExchangeInfo map[TokenPairID]ExchangePrecisionLimit
ExchangeInfo is written and read concurrently
func NewExchangeInfo ¶ added in v0.1.1
func NewExchangeInfo() ExchangeInfo
func (ExchangeInfo) Get ¶ added in v0.1.1
func (ei ExchangeInfo) Get(pair TokenPairID) (ExchangePrecisionLimit, error)
func (ExchangeInfo) GetData ¶ added in v0.1.1
func (ei ExchangeInfo) GetData() map[TokenPairID]ExchangePrecisionLimit
type ExchangeNotiContent ¶ added in v0.1.1
type ExchangeNotifications ¶ added in v0.1.1
type ExchangeNotifications map[string]ExchangeActionNoti
type ExchangePrecisionLimit ¶ added in v0.1.1
type ExchangePrecisionLimit struct { Precision TokenPairPrecision `json:"precision"` AmountLimit TokenPairAmountLimit `json:"amount_limit"` PriceLimit TokenPairPriceLimit `json:"price_limit"` MinNotional float64 `json:"min_notional"` }
ExchangePrecisionLimit store the precision and limit of a certain token pair on an exchange it is int the struct of [[int int], [float64 float64], [float64 float64], float64]
type ExchangePrice ¶
type ExchangePrice struct { Valid bool Error string Timestamp Timestamp Bids []PriceEntry Asks []PriceEntry ReturnTime Timestamp }
type ExchangeResponse ¶ added in v0.1.1
type ExchangeResponse struct { Exchanges map[string]*ExchangeSetting `json:"exchanges"` Version uint64 `json:"version"` }
func NewExchangeResponse ¶ added in v0.1.1
func NewExchangeResponse(exs map[string]*ExchangeSetting, version uint64) *ExchangeResponse
type ExchangeSetting ¶ added in v0.1.1
type ExchangeSetting struct { DepositAddress ExchangeAddresses `json:"deposit_address"` MinDeposit ExchangesMinDeposit `json:"min_deposit"` Fee ExchangeFees `json:"fee"` Info ExchangeInfo `json:"info"` }
ExchangeSetting contain the composition of settings necessary for an exchange It is use mainly to group all the setting for DB operations
func NewExchangeSetting ¶ added in v0.1.1
func NewExchangeSetting(depoAddr ExchangeAddresses, minDep ExchangesMinDeposit, fee ExchangeFees, info ExchangeInfo) *ExchangeSetting
NewExchangeSetting returns a pointer to A newly created ExchangeSetting instance
type ExchangeTokenNoti ¶ added in v0.1.1
type ExchangeTokenNoti map[string]ExchangeNotiContent
type ExchangeTradeHistory ¶ added in v0.1.1
type ExchangeTradeHistory map[TokenPairID][]TradeHistory
type ExchangesMinDeposit ¶ added in v0.1.1
type ExchangesStatus ¶ added in v0.1.1
type FeeSetRate ¶ added in v0.1.1
type FeedConfiguration ¶ added in v0.1.1
type FeedSetting ¶ added in v0.1.2
type FeedSetting struct { BaseVolatilitySpread float64 `json:"base_volatility_spread"` NormalSpread float64 `json:"normal_spread"` }
FeedSetting setting for feed configuration
type FetcherConfiguration ¶ added in v0.1.1
type FetcherConfiguration struct {
BTC bool `json:"btc" binding:"exists"`
}
FetcherConfiguration is configuration of fetcher
type FundingFee ¶ added in v0.1.1
func NewFundingFee ¶ added in v0.1.1
func NewFundingFee(widthraw, deposit map[string]float64) FundingFee
NewFundingFee creates a new instance of FundingFee instance.
func (FundingFee) GetTokenFee ¶ added in v0.1.1
func (ff FundingFee) GetTokenFee(token string) float64
type GDAXGoldData ¶ added in v0.1.1
type GeminiETHBTCData ¶ added in v0.1.2
type GeminiETHBTCData struct { Valid bool Error string Bid string `json:"bid"` Ask string `json:"ask"` Volume GeminiVolumeETHBTC `json:"volume"` Last string `json:"last"` }
GeminiETHBTCData is the data returns by Gemini ETH/BTC ticker. Example: https://api.gemini.com/v1/pubticker/ethbtc Response
{ "bid": "0.02686", "ask": "0.02694", "volume": { "ETH": "5595.131076", "BTC": "149.60020830467", "timestamp": 1557728700000 }, "last": "0.02694" }
type GeminiGoldData ¶ added in v0.1.1
type GeminiVolumeETHBTC ¶ added in v0.1.2
type GoldData ¶ added in v0.1.1
type GoldData struct { Timestamp uint64 DGX DGXGoldData OneForgeETH OneForgeGoldData OneForgeUSD OneForgeGoldData GDAX GDAXGoldData Kraken KrakenGoldData Gemini GeminiGoldData }
type HitData ¶ added in v0.1.2
type HitData struct { Valid bool Error string Ask string `json:"ask"` Bid string `json:"bid"` Last string `json:"last"` Open string `json:"open"` Low string `json:"low"` High string `json:"high"` Volume string `json:"volume"` VolumeQuote string `json:"volumeQuote"` Timestamp string `json:"timestamp"` Symbol string `json:"symbol"` }
HitData ...
type ImbalanceStepFunction ¶ added in v0.1.1
type ImbalanceStepFunction struct { XBuy []*big.Int `json:"x_buy"` YBuy []*big.Int `json:"y_buy"` XSell []*big.Int `json:"x_sell"` YSell []*big.Int `json:"y_sell"` }
ImbalanceStepFunction represent an imbalance step function for a token
type KrakenGoldData ¶ added in v0.1.1
type KrakenGoldData struct { Valid bool Error string `json:"network_error"` ErrorFromKraken []interface{} `json:"error"` Result map[string]struct { A []string `json:"a"` B []string `json:"b"` C []string `json:"c"` V []string `json:"v"` P []string `json:"p"` T []uint64 `json:"t"` L []string `json:"l"` H []string `json:"h"` O string `json:"o"` } `json:"result"` }
type MapFeedSetting ¶ added in v0.1.2
type MapFeedSetting map[string]FeedSetting
MapFeedSetting map feed name with feed setting
type MetricEntry ¶ added in v0.1.1
type MetricEntry struct { Timestamp uint64 // data contain all token metric for all tokens Data map[string]TokenMetric }
type MetricList ¶ added in v0.1.1
type MetricList []TokenMetricResponse
MetricList list for one token
type MetricResponse ¶ added in v0.1.1
type MetricResponse struct { Timestamp uint64 ReturnTime uint64 Data map[string]MetricList }
type OneForgeGoldData ¶ added in v0.1.1
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 PWIEquation ¶ added in v0.1.1
type PWIEquationRequestV2 ¶ added in v0.1.1
type PWIEquationRequestV2 map[string]PWIEquationTokenV2
PWIEquationRequestV2 is the input SetPWIEquationV2 api.
func (PWIEquationRequestV2) Validate ¶ added in v0.1.1
func (input PWIEquationRequestV2) Validate() error
Validate returns nil if the input is valid, otherwise it will return an error with detail which field is invalid. Example input: [{"token_id": {equation_token}}, ...]
type PWIEquationTokenV2 ¶ added in v0.1.1
type PWIEquationTokenV2 map[string]PWIEquationV2
PWIEquationTokenV2 is a mapping between a token id and a PWI equation.
type PWIEquationV2 ¶ added in v0.1.1
type PWIEquationV2 struct { A float64 `json:"a"` B float64 `json:"b"` C float64 `json:"c"` MinMinSpread float64 `json:"min_min_spread"` PriceMultiplyFactor float64 `json:"price_multiply_factor"` }
PWIEquationV2 contains the information of a PWI equation.
type PriceEntry ¶
func NewPriceEntry ¶ added in v0.1.1
func NewPriceEntry(quantity, rate float64) PriceEntry
NewPriceEntry creates new instance of PriceEntry.
type QuantityStepFunction ¶ added in v0.1.1
type QuantityStepFunction struct { XBuy []*big.Int `json:"x_buy"` YBuy []*big.Int `json:"y_buy"` XSell []*big.Int `json:"x_sell"` YSell []*big.Int `json:"y_sell"` }
QuantityStepFunction represent a quatity step function for a token
type RateEntry ¶
type RateEntry struct { BaseBuy *big.Int CompactBuy int8 BaseSell *big.Int CompactSell int8 Block uint64 }
RateEntry contains the buy/sell rates of a token and their compact forms.
type RateResponse ¶
type RateResponse struct { Timestamp Timestamp ReturnTime Timestamp BaseBuy float64 CompactBuy int8 BaseSell float64 CompactSell int8 Rate float64 Block uint64 }
RateResponse is the human friendly format of a rate entry to returns in HTTP APIs.
type RawBalance ¶
func (RawBalance) MarshalJSON ¶
func (rb RawBalance) MarshalJSON() ([]byte, error)
func (*RawBalance) ToFloat ¶
func (rb *RawBalance) ToFloat(decimal int64) float64
func (*RawBalance) UnmarshalJSON ¶
func (rb *RawBalance) UnmarshalJSON(text []byte) error
type RebalanceControl ¶ added in v0.1.1
type RebalanceControl struct {
Status bool `json:"status"`
}
RebalanceControl represent status of rebalance, true is enable and false is disable
type RebalanceQuadraticEquation ¶ added in v0.1.1
type RebalanceQuadraticEquation struct { RebalanceQuadratic struct { A float64 `json:"a"` B float64 `json:"b"` C float64 `json:"c"` } `json:"rebalance_quadratic"` }
RebalanceQuadraticEquation represent an equation
type RebalanceQuadraticRequest ¶ added in v0.1.1
type RebalanceQuadraticRequest map[string]RebalanceQuadraticEquation
RebalanceQuadraticRequest represent data request to set rebalance quadratic map[token]equation
type RunnerConfig ¶ added in v0.1.2
type RunnerConfig struct { OrderBookFetchingInterval time.Duration AuthDataFetchingInterval time.Duration RateFetchingInterval time.Duration BlockFetchingInterval time.Duration GlobalDataFetchingInterval time.Duration }
RunnerConfig list configs for runner
type SetRateTxInfo ¶ added in v0.1.1
type SetrateControl ¶ added in v0.1.1
type SetrateControl struct {
Status bool `json:"status"`
}
SetrateControl represent status of set rate ability, true is enable and false is disable
type StepFunctionResponse ¶ added in v0.1.1
type StepFunctionResponse struct { QuantityStepResponse QuantityStepFunction `json:"quantity_step_function"` ImbalanceStepResponse ImbalanceStepFunction `json:"imbalance_step_function"` }
StepFunctionResponse api response about a token step function
type StoreSetRateTx ¶ added in v0.1.1
type TXEntry ¶ added in v0.1.1
type TargetQtySet ¶ added in v0.1.1
type TargetQtySet struct { TotalTarget float64 `json:"total_target"` ReserveTarget float64 `json:"reserve_target"` RebalanceThreshold float64 `json:"rebalance_threshold"` TransferThreshold float64 `json:"transfer_threshold"` }
TargetQtySet represent a set of target quantity
type TargetQtyV2 ¶ added in v0.1.1
type TargetQtyV2 struct { SetTarget TargetQtySet `json:"set_target"` RecommendBalance map[string]float64 `json:"recomend_balance,omitempty"` ExchangeRatio map[string]float64 `json:"exchange_ratio,omitempty"` }
TargetQtyV2 object for save target qty
type TestExchange ¶ added in v0.1.1
type TestExchange struct { }
func (TestExchange) Address ¶ added in v0.1.1
func (te TestExchange) Address(token Token) (address ethereum.Address, supported bool)
func (TestExchange) CancelOrder ¶ added in v0.1.1
func (te TestExchange) CancelOrder(id, base, quote string) error
func (TestExchange) GetExchangeInfo ¶ added in v0.1.1
func (te TestExchange) GetExchangeInfo(pair TokenPairID) (ExchangePrecisionLimit, error)
func (TestExchange) GetFee ¶ added in v0.1.1
func (te TestExchange) GetFee() (ExchangeFees, error)
func (TestExchange) GetInfo ¶ added in v0.1.1
func (te TestExchange) GetInfo() (ExchangeInfo, error)
func (TestExchange) GetLiveExchangeInfos ¶ added in v0.1.1
func (te TestExchange) GetLiveExchangeInfos(tokenPairIDs []TokenPairID) (ExchangeInfo, error)
func (TestExchange) GetMinDeposit ¶ added in v0.1.1
func (te TestExchange) GetMinDeposit() (ExchangesMinDeposit, error)
func (TestExchange) GetTradeHistory ¶ added in v0.1.1
func (te TestExchange) GetTradeHistory(fromTime, toTime uint64) (ExchangeTradeHistory, error)
func (TestExchange) ID ¶ added in v0.1.1
func (te TestExchange) ID() ExchangeID
func (TestExchange) MarshalText ¶ added in v0.1.1
func (te TestExchange) MarshalText() (text []byte, err error)
func (TestExchange) UpdateDepositAddress ¶ added in v0.1.1
func (te TestExchange) UpdateDepositAddress(token Token, address string) error
type Timestamp ¶
type Timestamp string
func GetTimestamp ¶
func GetTimestamp() Timestamp
func (Timestamp) MustToUint64 ¶ added in v0.1.1
type Token ¶
type Token struct { ID string `json:"id"` Name string `json:"name"` Address string `json:"address"` Decimals int64 `json:"decimals"` Active bool `json:"active"` Internal bool `json:"internal"` LastActivationChange uint64 `json:"last_activation_change"` CreationTime uint64 `json:"creation_time"` }
type TokenExchangeSetting ¶ added in v0.1.1
type TokenExchangeSetting struct { DepositAddress string `json:"deposit_address"` Info ExchangeInfo `json:"exchange_info"` Fee TokenFee `json:"fee"` MinDeposit float64 `json:"min_deposit"` }
TokenExchangeSetting contains necessary information on exchange to List a token on the fly
type TokenMetric ¶ added in v0.1.1
type TokenMetricResponse ¶ added in v0.1.1
type TokenPair ¶
func NewTokenPair ¶
func (*TokenPair) GetBaseQuoteID ¶ added in v0.1.1
GetBaseQuoteID return base and quoteID as strings
func (*TokenPair) PairID ¶
func (tp *TokenPair) PairID() TokenPairID
type TokenPairAmountLimit ¶ added in v0.1.1
TokenPairAmountLimit represent amount min and max when trade a token pair
type TokenPairID ¶
type TokenPairID string
func NewTokenPairID ¶
func NewTokenPairID(base, quote string) TokenPairID
type TokenPairPrecision ¶ added in v0.1.1
TokenPairPrecision represent precision when trading a token pair
type TokenPairPriceLimit ¶ added in v0.1.1
type TokenResponse ¶ added in v0.1.1
func NewTokenResponse ¶ added in v0.1.1
func NewTokenResponse(tokens []Token, version uint64) *TokenResponse
type TokenTargetQty ¶ added in v0.1.1
type TokenTargetQtyV2 ¶ added in v0.1.1
type TokenTargetQtyV2 map[string]TargetQtyV2
TokenTargetQtyV2 represent a map of token and its target quantity struct
type TokenUpdate ¶ added in v0.1.1
type TokenUpdate struct { Token Token `json:"token"` Exchanges map[string]TokenExchangeSetting `json:"exchanges"` PWIEq PWIEquationTokenV2 `json:"pwis_equation"` TargetQty TargetQtyV2 `json:"target_qty"` QuadraticEq RebalanceQuadraticEquation `json:"rebalance_quadratic"` }
type TradeHistory ¶ added in v0.1.1
type TradeHistory struct { ID string Price float64 Qty float64 Type string // buy or sell Timestamp uint64 }
func NewTradeHistory ¶ added in v0.1.1
func NewTradeHistory(id string, price, qty float64, typ string, timestamp uint64) TradeHistory
NewTradeHistory creates a new TradeHistory instance. typ: "buy" or "sell"
type TradingFee ¶ added in v0.1.1
type TransactionInfo ¶ added in v0.1.1
type USDData ¶ added in v0.1.1
type USDData struct { Timestamp uint64 CoinbaseUSD CoinbaseData `json:"CoinbaseUSD"` GeminiUSD GeminiGoldData `json:"GeminiUSD"` // gold and usd use the same url CoinbaseUSDC CoinbaseData `json:"CoinbaseUSDC"` BinanceUSDC BinanceData `json:"BinanceUSDC"` CoinbaseDAI CoinbaseData `json:"CoinbaseDAI"` HitDAI HitData `json:"HitDAI"` BitFinex BitFinexData `json:"BitFinexUSD"` BinanceUSDT BinanceData `json:"BinanceUSDT"` BinancePAX BinanceData `json:"BinancePAX"` BinanceTUSD BinanceData `json:"BinanceTUSD"` }
USDData ...