Documentation
¶
Index ¶
- func IsIntime(nonce string) bool
- type Authentication
- type Blockchain
- type KNAuthentication
- type Permission
- type Server
- func (s *Server) AllPrices(c *gin.Context)
- func (s *Server) AllPricesVersion(c *gin.Context)
- func (s *Server) AuthData(c *gin.Context)
- func (s *Server) AuthDataVersion(c *gin.Context)
- func (s *Server) Authenticated(c *gin.Context, requiredParams []string, perms []Permission) (url.Values, bool)
- func (s *Server) CancelOrder(c *gin.Context)
- func (s *Server) CancelTargetQtyV2(c *gin.Context)
- func (s *Server) CheckRebalanceQuadraticRequest(rq common.RebalanceQuadraticRequest) error
- func (s *Server) ConfirmPWIEquationV2(c *gin.Context)
- func (s *Server) ConfirmRebalanceQuadratic(c *gin.Context)
- func (s *Server) ConfirmStableTokenParams(c *gin.Context)
- func (s *Server) ConfirmTargetQtyV2(c *gin.Context)
- func (s *Server) ConfirmTokenUpdate(c *gin.Context)
- func (s *Server) Deposit(c *gin.Context)
- func (s *Server) EnableRebalance(c *gin.Context)
- func (s *Server) EnableSetrate(c *gin.Context)
- func (s *Server) ExchangeNotification(c *gin.Context)
- func (s *Server) GetActiveTokenByID(c *gin.Context)
- func (s *Server) GetActiveTokens(c *gin.Context)
- func (s *Server) GetActivities(c *gin.Context)
- func (s *Server) GetAddress(c *gin.Context)
- func (s *Server) GetAllFetcherConfiguration(c *gin.Context)
- func (s *Server) GetAllSetting(c *gin.Context)
- func (s *Server) GetBTCData(c *gin.Context)
- func (s *Server) GetExchangeInfo(c *gin.Context)
- func (s *Server) GetExchangesStatus(c *gin.Context)
- func (s *Server) GetFee(c *gin.Context)
- func (s *Server) GetFeedConfiguration(c *gin.Context)
- func (s *Server) GetGoldData(c *gin.Context)
- func (s *Server) GetInternalTokens(c *gin.Context)
- func (s *Server) GetMinDeposit(c *gin.Context)
- func (s *Server) GetNotifications(c *gin.Context)
- func (s *Server) GetPWIEquationV2(c *gin.Context)
- func (s *Server) GetPendingPWIEquationV2(c *gin.Context)
- func (s *Server) GetPendingRebalanceQuadratic(c *gin.Context)
- func (s *Server) GetPendingStableTokenParams(c *gin.Context)
- func (s *Server) GetPendingTargetQtyV2(c *gin.Context)
- func (s *Server) GetPendingTokenUpdates(c *gin.Context)
- func (s *Server) GetRate(c *gin.Context)
- func (s *Server) GetRates(c *gin.Context)
- func (s *Server) GetRebalanceQuadratic(c *gin.Context)
- func (s *Server) GetRebalanceStatus(c *gin.Context)
- func (s *Server) GetSetrateStatus(c *gin.Context)
- func (s *Server) GetStableTokenParams(c *gin.Context)
- func (s *Server) GetTargetQtyV2(c *gin.Context)
- func (s *Server) GetTimeServer(c *gin.Context)
- func (s *Server) GetTokenByAddress(c *gin.Context)
- func (s *Server) GetTradeHistory(c *gin.Context)
- func (s *Server) GetUSDData(c *gin.Context)
- func (s *Server) HoldRebalance(c *gin.Context)
- func (s *Server) HoldSetrate(c *gin.Context)
- func (s *Server) ImmediatePendingActivities(c *gin.Context)
- func (s *Server) Metrics(c *gin.Context)
- func (s *Server) Price(c *gin.Context)
- func (s *Server) ReadyToServe(c *gin.Context)
- func (s *Server) RejectPWIEquationV2(c *gin.Context)
- func (s *Server) RejectRebalanceQuadratic(c *gin.Context)
- func (s *Server) RejectStableTokenParams(c *gin.Context)
- func (s *Server) RejectTokenUpdate(c *gin.Context)
- func (s *Server) Run()
- func (s *Server) SetPWIEquationV2(c *gin.Context)
- func (s *Server) SetRate(c *gin.Context)
- func (s *Server) SetRebalanceQuadratic(c *gin.Context)
- func (s *Server) SetStableTokenParams(c *gin.Context)
- func (s *Server) SetTargetQtyV2(c *gin.Context)
- func (s *Server) SetTokenUpdate(c *gin.Context)
- func (s *Server) StopFetcher(c *gin.Context)
- func (s *Server) StoreMetrics(c *gin.Context)
- func (s *Server) TokenSettings(c *gin.Context)
- func (s *Server) Trade(c *gin.Context)
- func (s *Server) UpdateDepositAddress(c *gin.Context)
- func (s *Server) UpdateExchangeFee(c *gin.Context)
- func (s *Server) UpdateExchangeInfo(c *gin.Context)
- func (s *Server) UpdateExchangeMinDeposit(c *gin.Context)
- func (s *Server) UpdateExchangeStatus(c *gin.Context)
- func (s *Server) UpdateFeedConfiguration(c *gin.Context)
- func (s *Server) UpdateFetcherConfiguration(c *gin.Context)
- func (s *Server) ValidateTimeInput(c *gin.Context) (uint64, uint64, bool)
- func (s *Server) Withdraw(c *gin.Context)
- type Setting
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Authentication ¶ added in v0.1.1
type Authentication interface {
GetPermission(signed string, message string) []Permission
}
Authentication is the authentication layer of HTTP APIs.
type Blockchain ¶ added in v0.1.1
type Blockchain interface {
LoadAndSetTokenIndices([]ethereum.Address) error
CheckTokenIndices(ethereum.Address) error
GetPricingOPAddress() ethereum.Address
GetDepositOPAddress() ethereum.Address
GetIntermediatorOPAddress() ethereum.Address
}
Blockchain is used in http server as the caller to blockchain for information. Currently it is used for smart contract token's indice query.
type KNAuthentication ¶ added in v0.1.1
type KNAuthentication struct {
KNSecret string `json:"kn_secret"`
KNReadOnly string `json:"kn_readonly"`
KNConfiguration string `json:"kn_configuration"`
KNConfirmConf string `json:"kn_confirm_configuration"`
}
func NewKNAuthenticationFromFile ¶ added in v0.1.1
func NewKNAuthenticationFromFile(path string) KNAuthentication
func (KNAuthentication) GetPermission ¶ added in v0.1.1
func (auth KNAuthentication) GetPermission(signed string, message string) []Permission
func (KNAuthentication) KNSign ¶ added in v0.1.1
func (auth KNAuthentication) KNSign(msg string) string
type Permission ¶ added in v0.1.1
type Permission int
const ( ReadOnlyPermission Permission = iota // can only read data RebalancePermission // can do everything except configure setting ConfigurePermission // can read data and configure setting, cannot set rates, deposit, withdraw, trade, cancel activities ConfirmConfPermission // can read data and confirm configuration proposal )
type Server ¶ added in v0.1.1
type Server struct {
// contains filtered or unexported fields
}
func NewHTTPServer ¶
func (*Server) AllPricesVersion ¶ added in v0.1.1
func (*Server) AuthDataVersion ¶ added in v0.1.1
func (*Server) Authenticated ¶ added in v0.1.1
func (s *Server) Authenticated(c *gin.Context, requiredParams []string, perms []Permission) (url.Values, bool)
Authenticated signed message (message = url encoded both query params and post params, keys are sorted) in "signed" header using HMAC512 params must contain "nonce" which is the unixtime in millisecond. The nonce will be invalid if it differs from server time more than 10s
func (*Server) CancelOrder ¶ added in v0.1.1
func (*Server) CancelTargetQtyV2 ¶ added in v0.1.1
func (*Server) CheckRebalanceQuadraticRequest ¶ added in v0.1.1
func (s *Server) CheckRebalanceQuadraticRequest(rq common.RebalanceQuadraticRequest) error
CheckRebalanceQuadraticRequest check if request data is valid rq (requested data) follow format map["tokenID"]{"a": float64, "b": float64, "c": float64}
func (*Server) ConfirmPWIEquationV2 ¶ added in v0.1.1
ConfirmPWIEquationV2 accepts the pending PWI equations and remove it from pending bucket.
func (*Server) ConfirmRebalanceQuadratic ¶ added in v0.1.1
ConfirmRebalanceQuadratic confirm configuration for current pending config for rebalance quadratic equation
func (*Server) ConfirmStableTokenParams ¶ added in v0.1.1
func (*Server) ConfirmTargetQtyV2 ¶ added in v0.1.1
func (*Server) ConfirmTokenUpdate ¶ added in v0.1.1
func (*Server) EnableRebalance ¶ added in v0.1.1
func (*Server) EnableSetrate ¶ added in v0.1.1
func (*Server) ExchangeNotification ¶ added in v0.1.1
func (*Server) GetActiveTokenByID ¶ added in v0.1.1
func (*Server) GetActiveTokens ¶ added in v0.1.1
func (*Server) GetActivities ¶ added in v0.1.1
func (*Server) GetAddress ¶ added in v0.1.1
func (*Server) GetAllFetcherConfiguration ¶ added in v0.1.1
GetAllFetcherConfiguration returns all fetcher config
func (*Server) GetAllSetting ¶ added in v0.1.1
func (*Server) GetBTCData ¶ added in v0.1.1
func (*Server) GetExchangeInfo ¶ added in v0.1.1
GetExchangeInfo return exchange info of one exchange if it is given exchangeID otherwise return all exchanges info
func (*Server) GetExchangesStatus ¶ added in v0.1.1
func (*Server) GetFeedConfiguration ¶ added in v0.1.1
func (*Server) GetGoldData ¶ added in v0.1.1
func (*Server) GetInternalTokens ¶ added in v0.1.1
func (*Server) GetMinDeposit ¶ added in v0.1.1
func (*Server) GetNotifications ¶ added in v0.1.1
func (*Server) GetPWIEquationV2 ¶ added in v0.1.1
GetPWIEquationV2 returns the current PWI equations.
func (*Server) GetPendingPWIEquationV2 ¶ added in v0.1.1
GetPendingPWIEquationV2 returns the pending PWI equations.
func (*Server) GetPendingRebalanceQuadratic ¶ added in v0.1.1
GetPendingRebalanceQuadratic return currently pending config for rebalance quadratic equation if there is no pending equation return success false
func (*Server) GetPendingStableTokenParams ¶ added in v0.1.1
func (*Server) GetPendingTargetQtyV2 ¶ added in v0.1.1
func (*Server) GetPendingTokenUpdates ¶ added in v0.1.1
func (*Server) GetRebalanceQuadratic ¶ added in v0.1.1
GetRebalanceQuadratic return current confirmed rebalance quadratic equation
func (*Server) GetRebalanceStatus ¶ added in v0.1.1
func (*Server) GetSetrateStatus ¶ added in v0.1.1
func (*Server) GetStableTokenParams ¶ added in v0.1.1
func (*Server) GetTargetQtyV2 ¶ added in v0.1.1
func (*Server) GetTimeServer ¶ added in v0.1.1
func (*Server) GetTokenByAddress ¶ added in v0.1.1
func (*Server) GetTradeHistory ¶ added in v0.1.1
func (*Server) GetUSDData ¶ added in v0.1.1
func (*Server) HoldRebalance ¶ added in v0.1.1
func (*Server) HoldSetrate ¶ added in v0.1.1
func (*Server) ImmediatePendingActivities ¶ added in v0.1.1
func (*Server) ReadyToServe ¶ added in v0.1.1
func (*Server) RejectPWIEquationV2 ¶ added in v0.1.1
RejectPWIEquationV2 rejects the PWI equations request and removes it from pending storage.
func (*Server) RejectRebalanceQuadratic ¶ added in v0.1.1
RejectRebalanceQuadratic reject pending configuration for rebalance quadratic function
func (*Server) RejectStableTokenParams ¶ added in v0.1.1
func (*Server) RejectTokenUpdate ¶ added in v0.1.1
func (*Server) SetPWIEquationV2 ¶ added in v0.1.1
SetPWIEquationV2 stores the given PWI equations to pending for later evaluation.
func (*Server) SetRebalanceQuadratic ¶ added in v0.1.1
SetRebalanceQuadratic set pending rebalance quadratic equation input data follow json: {"data":{"KNC": {"a": 0.7, "b": 1.2, "c": 1.3}}}
func (*Server) SetStableTokenParams ¶ added in v0.1.1
func (*Server) SetTargetQtyV2 ¶ added in v0.1.1
SetTargetQtyV2 set token target quantity version 2
func (*Server) SetTokenUpdate ¶ added in v0.1.1
SetTokenUpdate will pre-process the token request and put into pending token request It will not apply any change to DB if the request is not as dictated in documentation. Newer request will append if the tokenID is not avail in pending, and overwrite otherwise
func (*Server) StopFetcher ¶ added in v0.1.1
func (*Server) StoreMetrics ¶ added in v0.1.1
func (*Server) TokenSettings ¶ added in v0.1.1
func (*Server) UpdateDepositAddress ¶ added in v0.1.1
func (*Server) UpdateExchangeFee ¶ added in v0.1.1
func (*Server) UpdateExchangeInfo ¶ added in v0.1.1
func (*Server) UpdateExchangeMinDeposit ¶ added in v0.1.1
func (*Server) UpdateExchangeStatus ¶ added in v0.1.1
func (*Server) UpdateFeedConfiguration ¶ added in v0.1.1
func (*Server) UpdateFetcherConfiguration ¶ added in v0.1.1
UpdateFetcherConfiguration update btc fetcher configuration and return new configuration
func (*Server) ValidateTimeInput ¶ added in v0.1.1
type Setting ¶ added in v0.1.1
type Setting interface {
GetInternalTokenByID(tokenID string) (common.Token, error)
GetActiveTokenByID(tokenID string) (common.Token, error)
GetTokenByID(tokenID string) (common.Token, error)
GetInternalTokens() ([]common.Token, error)
GetAllTokens() ([]common.Token, error)
NewTokenPairFromID(base, quote string) (common.TokenPair, error)
GetFee(ex settings.ExchangeName) (common.ExchangeFees, error)
UpdateFee(ex settings.ExchangeName, data common.ExchangeFees, timestamp uint64) error
GetMinDeposit(ex settings.ExchangeName) (common.ExchangesMinDeposit, error)
UpdateMinDeposit(ex settings.ExchangeName, minDeposit common.ExchangesMinDeposit, timestamp uint64) error
GetDepositAddresses(ex settings.ExchangeName) (common.ExchangeAddresses, error)
UpdateDepositAddress(ex 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
GetExchangeStatus() (common.ExchangesStatus, error)
UpdateExchangeStatus(data common.ExchangesStatus) error
UpdatePendingTokenUpdates(map[string]common.TokenUpdate) error
ApplyTokenWithExchangeSetting([]common.Token, map[settings.ExchangeName]*common.ExchangeSetting, uint64) error
GetPendingTokenUpdates() (map[string]common.TokenUpdate, error)
RemovePendingTokenUpdates() error
GetAllAddresses() (map[string]interface{}, error)
GetTokenVersion() (uint64, error)
GetExchangeVersion() (uint64, error)
GetActiveTokens() ([]common.Token, error)
GetTokenByAddress(ethereum.Address) (common.Token, error)
GetAddress(settings.AddressName) (ethereum.Address, error)
}