Documentation ¶
Overview ¶
nolint
nolint
nolint
Index ¶
- Constants
- func ErrAddressIsRequired() sdk.EnvelopedErr
- func ErrBackendModuleUnknownQueryType() sdk.EnvelopedErr
- func ErrBackendPluginNotEnabled() sdk.EnvelopedErr
- func ErrGetInvalidTickerByProducts(key string) sdk.EnvelopedErr
- func ErrGetInvalidateGranularity(msg string, key string, field string) sdk.EnvelopedErr
- func ErrMarketkeeperNotInitialized() sdk.EnvelopedErr
- func ErrNoKlinesFunctionFound() sdk.EnvelopedErr
- func ErrOrderIdIsRequired() sdk.EnvelopedErr
- func ErrOrderSideParamMustBuyOrSell(side string) sdk.EnvelopedErr
- func ErrParamNotCorrect(size int, granularity int) sdk.EnvelopedErr
- func ErrProductDoesNotExist(product string) sdk.EnvelopedErr
- func ErrProductIsRequired() sdk.EnvelopedErr
- func GetAllKlineMap() map[int]string
- func GetChannelByKlineType(klineType string) string
- func GetFreqByKlineType(klineType string) int
- func GetKlineTableNameByFreq(freq int) string
- func MustNewKlineFactory(name string, baseK *BaseKline) (r interface{})
- func NewErrorsMerged(args ...error) error
- func NewKlineFactory(name string, baseK *BaseKline) (r interface{}, err error)
- func NewKlinesFactory(name string) (r interface{}, err error)
- func PrintStackIfPanic()
- func TimeString(ts int64) string
- func ToRestfulData(klines *[]IKline, limit int) [][]string
- type BaseKline
- func (b *BaseKline) FormatResult() interface{}
- func (b *BaseKline) GetAnchorTimeTS(ts int64) int64
- func (b *BaseKline) GetBriefInfo() []string
- func (b *BaseKline) GetChannelInfo() (channel, filter string, err error)
- func (b *BaseKline) GetClose() float64
- func (b *BaseKline) GetFreqInSecond() int
- func (b *BaseKline) GetFullChannel() string
- func (b *BaseKline) GetHigh() float64
- func (b *BaseKline) GetLow() float64
- func (b *BaseKline) GetOpen() float64
- func (b *BaseKline) GetProduct() string
- func (b *BaseKline) GetTableName() string
- func (b *BaseKline) GetTimestamp() int64
- func (b *BaseKline) GetVolume() float64
- func (b *BaseKline) PrettyTimeString() string
- type ClaimInfo
- type Deal
- type DexFees
- type DexKeeper
- type ErrorsMerged
- type FakeWSEvent
- type FarmFirstPool
- type FarmInfo
- type FarmKeeper
- type FarmPoolResponse
- type FarmPoolStatus
- type FarmResponseList
- type FarmResponseListSorter
- type FarmStakedInfo
- type IKline
- type IKlines
- type IKlinesDsc
- type IWebsocket
- type InstrumentV2
- type KlineM1
- type KlineM10080
- type KlineM120
- type KlineM1440
- type KlineM15
- type KlineM240
- type KlineM3
- type KlineM30
- type KlineM360
- type KlineM4320
- type KlineM44640
- type KlineM5
- type KlineM525600
- type KlineM60
- type KlineM720
- type MarketKeeper
- type MatchResult
- type MergedTickersEvent
- type MintKeeper
- type Order
- type OrderKeeper
- type OrderV2
- type QueryAccountOrdersParams
- type QueryDealsParams
- type QueryDealsParamsV2
- type QueryDexFeesParams
- type QueryFarmDashboardParams
- type QueryFarmFirstPoolParams
- type QueryFarmPoolsParams
- type QueryFarmStakedInfoParams
- type QueryFeeDetailsParams
- type QueryFeeDetailsParamsV2
- type QueryKlinesParams
- type QueryMatchParams
- type QueryMatchParamsV2
- type QueryOrderListParams
- type QueryOrderParamsV2
- type QuerySwapLiquidityInfoParams
- type QuerySwapTokensParams
- type QuerySwapWatchlistParams
- type QueryTickerParams
- type QueryTxListParams
- type QueryTxListParamsV2
- type SwapInfo
- type SwapKeeper
- type SwapLiquidityInfo
- type SwapToken
- type SwapTokens
- type SwapTokensResponse
- type SwapVolumePriceInfo
- type SwapWatchlist
- type SwapWatchlistSorter
- type SwapWhitelist
- type Ticker
- type TickerV2
- type Tickers
- type TokenKeeper
- type Transaction
Constants ¶
const ( DefaultCodespace = ModuleName CodeProductIsRequired uint32 = 62000 CodeAddressIsRequired uint32 = 62001 CodeOrderStatusMustBeOpenOrClosed uint32 = 62002 CodeAddressAndProductRequired uint32 = 62003 CodeGetChainHeightFailed uint32 = 62004 CodeGetBlockTxHashesFailed uint32 = 62005 CodeOrderSideMustBuyOrSell uint32 = 62006 CodeProductDoesNotExist uint32 = 62007 CodeBackendPluginNotEnabled uint32 = 62008 CodeGoroutinePanic uint32 = 62009 CodeBackendModuleUnknownQueryType uint32 = 62010 CodeGetCandlesFailed uint32 = 62011 CodeGetCandlesByMarketFailed uint32 = 62012 CodeGetTickerByProductsFailed uint32 = 62013 CodeParamNotCorrect uint32 = 62014 CodeNoKlinesFunctionFound uint32 = 62015 CodeMarketkeeperNotInitialized uint32 = 62016 CodeGetInvalidateGranularity uint32 = 62017 CodeGetInvalidTickerByProducts uint32 = 62018 CodeOrderIdIsRequired uint32 = 62019 )
const uint32
const ( WhitelistFarmPool = "whitelist" NormalFarmPool = "normal" SecondsInDay = 24 * 60 * 60 DaysInYear = 365 BlockInterval = 3 BlocksPerDay = SecondsInADay / BlockInterval // farm pool status FarmPoolCreated FarmPoolStatus = 1 FarmPoolProvided FarmPoolStatus = 2 FarmPoolYielded FarmPoolStatus = 3 FarmPoolFinished FarmPoolStatus = 4 // query key QueryFarmPools = "farmPools" QueryFarmDashboard = "farmDashboard" QueryFarmMaxApy = "farmMaxApy" QueryFarmStakedInfo = "farmStakedInfo" QueryFarmFirstPool = "farmFirstPool" // farm sort column FarmPoolTotalStaked = "total_staked" FarmPoolApy = "farm_apy" FarmPoolStartAt = "start_at" FarmPoolFinishAt = "finish_at" // sort direction FarmSortAsc = "asc" )
const ( // ModuleName is the name of the backend module ModuleName = "backend" // QuerierRoute is the querier route for the backend module QuerierRoute = ModuleName // RouterKey is the msg router key for the backend module RouterKey = "" // query endpoints supported by the backend querier QueryMatchResults = "matches" QueryDealList = "deals" QueryFeeDetails = "fees" QueryOrderList = "orders" QueryOrderByID = "orderByID" QueryAccountOrders = "accountOrders" QueryTxList = "txs" QueryCandleList = "candles" QueryTickerList = "tickers" QueryDexFeesList = "dexFees" // v2 QueryTickerListV2 = "tickerListV2" QueryTickerV2 = "tickerV2" QueryInstrumentsV2 = "instrumentsV2" QueryOrderListV2 = "orderListV2" QueryOrderV2 = "orderV2" QueryCandleListV2 = "candlesV2" QueryMatchResultsV2 = "matchesV2" QueryFeeDetailsV2 = "feesV2" QueryDealListV2 = "dealsV2" QueryTxListV2 = "txsV2" Kline1GoRoutineWaitInSecond = 5 KlinexGoRoutineWaitInSecond = 10 SecondsInADay = 24 * 60 * 60 )
const ( KlineTypeM1 = "kline_m1" KlineTypeM3 = "kline_m3" KlineTypeM5 = "kline_m5" KlineTypeM15 = "kline_m15" KlineTypeM30 = "kline_m30" KlineTypeM60 = "kline_m60" KlineTypeM120 = "kline_m120" KlineTypeM240 = "kline_m240" KlineTypeM360 = "kline_m360" KlineTypeM720 = "kline_m720" KlineTypeM1440 = "kline_m1440" KlineTypeM4320 = "kline_m4320" KlineTypeM10080 = "kline_m10080" KlineTypeM44640 = "kline_m44640" KlineTypeM525600 = "kline_m525600" )
const ( DefaultPage = 1 DefaultPerPage = 50 )
nolint
const ( // watchlist sort column SwapWatchlistLiquidity = "liquidity" SwapWatchlistVolume24h = "volume24h" SwapWatchlistFeeApy = "fee_apy" SwapWatchlistLastPrice = "last_price" SwapWatchlistChange24h = "change24h" // sort direction SwapWatchlistSortAsc = "asc" // query key QuerySwapWatchlist = "swapWatchlist" QuerySwapTokens = "swapTokens" QuerySwapTokenPairs = "swapTokenPairs" QuerySwapLiquidityHistories = "swapLiquidityHistories" // swap business type SwapBusinessTypeCreate = "create" SwapBusinessTypeAdd = "add" SwapBusinessTypeSwap = "swap" )
const ( TxTypeTransfer = 1 TxTypeOrderNew = 2 TxTypeOrderCancel = 3 TxSideBuy = 1 TxSideSell = 2 TxSideFrom = 3 TxSideTo = 4 BuyOrder = orderTypes.BuyOrder SellOrder = orderTypes.SellOrder TestTokenPair = orderTypes.TestTokenPair FeeTypeOrderNew = orderTypes.FeeTypeOrderNew FeeTypeOrderCancel = orderTypes.FeeTypeOrderCancel FeeTypeOrderExpire = orderTypes.FeeTypeOrderExpire FeeTypeOrderDeal = orderTypes.FeeTypeOrderDeal FeeTypeOrderReceive = orderTypes.FeeTypeOrderReceive )
const WebsocketChanCapacity = 2048
Variables ¶
This section is empty.
Functions ¶
func ErrBackendModuleUnknownQueryType ¶
func ErrBackendModuleUnknownQueryType() sdk.EnvelopedErr
func ErrBackendPluginNotEnabled ¶
func ErrBackendPluginNotEnabled() sdk.EnvelopedErr
func ErrGetInvalidTickerByProducts ¶
func ErrGetInvalidTickerByProducts(key string) sdk.EnvelopedErr
func ErrGetInvalidateGranularity ¶
func ErrGetInvalidateGranularity(msg string, key string, field string) sdk.EnvelopedErr
func ErrMarketkeeperNotInitialized ¶
func ErrMarketkeeperNotInitialized() sdk.EnvelopedErr
func ErrNoKlinesFunctionFound ¶
func ErrNoKlinesFunctionFound() sdk.EnvelopedErr
func ErrOrderSideParamMustBuyOrSell ¶
func ErrOrderSideParamMustBuyOrSell(side string) sdk.EnvelopedErr
invalid param side, must be buy or sell
func ErrParamNotCorrect ¶
func ErrParamNotCorrect(size int, granularity int) sdk.EnvelopedErr
func ErrProductDoesNotExist ¶
func ErrProductDoesNotExist(product string) sdk.EnvelopedErr
product does not exist
func GetAllKlineMap ¶
GetAllKlineMap return map about kline table names
func GetChannelByKlineType ¶
func GetFreqByKlineType ¶
func GetKlineTableNameByFreq ¶
GetKlineTableNameByFreq return table name
func MustNewKlineFactory ¶
MustNewKlineFactory will panic when err occurred during NewKlineFactory
func NewErrorsMerged ¶
NewErrorsMerged plenty of errors into a single error.
func NewKlineFactory ¶
NewKlineFactory generate kline type by factory pattern
func NewKlinesFactory ¶
NewKlinesFactory generate kline type by type of kline
Types ¶
type BaseKline ¶
type BaseKline struct { Product string `gorm:"PRIMARY_KEY;type:varchar(20)" json:"product"` Timestamp int64 `gorm:"PRIMARY_KEY;type:bigint;" json:"timestamp"` Open float64 `gorm:"type:DOUBLE" json:"open"` Close float64 `gorm:"type:DOUBLE" json:"close"` High float64 `gorm:"type:DOUBLE" json:"high"` Low float64 `gorm:"type:DOUBLE" json:"low"` Volume float64 `gorm:"type:DOUBLE" json:"volume"` // contains filtered or unexported fields }
BaseKline define the basic data of Kine
func (*BaseKline) FormatResult ¶
func (b *BaseKline) FormatResult() interface{}
func (*BaseKline) GetAnchorTimeTS ¶
GetAnchorTimeTS return time interval
func (*BaseKline) GetBriefInfo ¶
GetBriefInfo return array of kline data
func (*BaseKline) GetChannelInfo ¶
func (*BaseKline) GetFreqInSecond ¶
GetFreqInSecond return interval time
func (*BaseKline) GetFullChannel ¶
func (*BaseKline) GetTableName ¶
GetTableName rerurn database table name
func (*BaseKline) GetTimestamp ¶
GetTimestamp return timestamp
func (*BaseKline) PrettyTimeString ¶
PrettyTimeString convert kline data to string
type Deal ¶
type Deal struct { Timestamp int64 `gorm:"index;" json:"timestamp" v2:"timestamp"` BlockHeight int64 `gorm:"PRIMARY_KEY;type:bigint" json:"block_height" v2:"block_height"` OrderID string `gorm:"PRIMARY_KEY;type:varchar(30)" json:"order_id" v2:"order_id"` Sender string `gorm:"index;type:varchar(80)" json:"sender" v2:"sender"` Product string `gorm:"index;type:varchar(20)" json:"product" v2:"product"` Side string `gorm:"type:varchar(10)" json:"side" v2:"side"` Price float64 `gorm:"type:DOUBLE" json:"price" v2:"price"` Quantity float64 `gorm:"type:DOUBLE" json:"volume" v2:"volume"` Fee string `gorm:"type:varchar(40)" json:"fee" v2:"fee"` FeeReceiver string `gorm:"index;type:varchar(80)" json:"fee_receiver" v2:"fee_receiver"` }
type DexKeeper ¶
type DexKeeper interface { GetTokenPairs(ctx sdk.Context) []*dextypes.TokenPair GetTokenPair(ctx sdk.Context, product string) *dextypes.TokenPair SetObserverKeeper(keeper dex.StreamKeeper) }
DexKeeper expected dex keeper
type FakeWSEvent ¶
type FakeWSEvent struct {
// contains filtered or unexported fields
}
FakeWSEvent won't result in sending out tendermint event
func NewFakeWSEvent ¶
func NewFakeWSEvent(channel, filter string, ts int64) *FakeWSEvent
func (*FakeWSEvent) FormatResult ¶
func (f *FakeWSEvent) FormatResult() interface{}
func (*FakeWSEvent) GetChannelInfo ¶
func (f *FakeWSEvent) GetChannelInfo() (channel, filter string, err error)
func (*FakeWSEvent) GetFullChannel ¶
func (f *FakeWSEvent) GetFullChannel() string
func (*FakeWSEvent) GetTimestamp ¶
func (f *FakeWSEvent) GetTimestamp() int64
type FarmFirstPool ¶
type FarmFirstPool struct { FarmApy sdk.Dec `json:"farm_apy"` FarmAmount sdk.Dec `json:"farm_amount"` TotalStaked sdk.Dec `json:"total_staked"` ClaimAt int64 `json:"claim_at"` AccountStaked sdk.Dec `json:"account_staked"` EstimatedFarm sdk.Dec `json:"estimated_farm"` Balance sdk.Dec `json:"balance"` }
type FarmKeeper ¶
type FarmKeeper interface { SetObserverKeeper(k farmtypes.BackendKeeper) GetFarmPools(ctx sdk.Context) (pools farmtypes.FarmPools) GetWhitelist(ctx sdk.Context) (whitelist farmtypes.PoolNameList) GetParams(ctx sdk.Context) (params farmtypes.Params) GetPoolLockedValue(ctx sdk.Context, pool farmtypes.FarmPool) sdk.Dec CalculateAmountYieldedBetween(ctx sdk.Context, pool farmtypes.FarmPool) (farmtypes.FarmPool, sdk.SysCoins) SupplyKeeper() supply.Keeper GetFarmPoolNamesForAccount(ctx sdk.Context, accAddr sdk.AccAddress) (poolNames farmtypes.PoolNameList) GetFarmPool(ctx sdk.Context, poolName string) (pool farmtypes.FarmPool, found bool) GetLockInfo(ctx sdk.Context, addr sdk.AccAddress, poolName string) (info farmtypes.LockInfo, found bool) GetEarnings(ctx sdk.Context, poolName string, accAddr sdk.AccAddress) (farmtypes.Earnings, sdk.Error) }
FarmKeeper expected farm keeper
type FarmPoolResponse ¶
type FarmPoolResponse struct { PoolName string `json:"pool_name"` LockSymbol string `json:"lock_symbol"` YieldSymbol string `json:"yield_symbol"` TotalStaked sdk.Dec `json:"total_staked"` UserStaked sdk.Dec `json:"user_staked"` StartAt int64 `json:"start_at"` FinishAt int64 `json:"finish_at"` PoolRate sdk.SysCoins `json:"pool_rate"` FarmApy sdk.SysCoins `json:"farm_apy"` PoolRatio sdk.Dec `json:"pool_ratio"` InWhitelist bool `json:"in_whitelist"` TotalFarmed sdk.Dec `json:"total_farmed"` FarmedDetails []FarmInfo `json:"farmed_details"` Status FarmPoolStatus `json:"status"` }
func (FarmPoolResponse) TotalApy ¶
func (farmPool FarmPoolResponse) TotalApy() sdk.Dec
type FarmPoolStatus ¶
type FarmPoolStatus int
type FarmResponseList ¶
type FarmResponseList []FarmPoolResponse
func (FarmResponseList) Len ¶
func (list FarmResponseList) Len() int
func (FarmResponseList) Less ¶
func (list FarmResponseList) Less(i, j int) bool
func (FarmResponseList) Swap ¶
func (list FarmResponseList) Swap(i, j int)
type FarmResponseListSorter ¶
type FarmResponseListSorter struct { FarmPoolList FarmResponseList SortField string SortDirectory string }
func (*FarmResponseListSorter) Len ¶
func (s *FarmResponseListSorter) Len() int
func (*FarmResponseListSorter) Less ¶
func (s *FarmResponseListSorter) Less(i, j int) bool
func (*FarmResponseListSorter) Swap ¶
func (s *FarmResponseListSorter) Swap(i, j int)
type FarmStakedInfo ¶
type IKline ¶
type IKline interface { GetFreqInSecond() int GetAnchorTimeTS(ts int64) int64 GetTableName() string GetProduct() string GetTimestamp() int64 GetOpen() float64 GetClose() float64 GetHigh() float64 GetLow() float64 GetVolume() float64 PrettyTimeString() string GetBriefInfo() []string }
nolint
func ToIKlinesArray ¶
ToIKlinesArray Convert kline data to array for restful interface
type IWebsocket ¶
type InstrumentV2 ¶
type InstrumentV2 struct { InstrumentID string `json:"instrument_id"` // name of token pair BaseCurrency string `json:"base_currency"` QuoteCurrency string `json:"quote_currency"` MinSize string `json:"min_size"` SizeIncrement string `json:"size_increment"` TickSize string `json:"tick_size"` }
func ConvertTokenPairToInstrumentV2 ¶
func ConvertTokenPairToInstrumentV2(tokenPair *dex.TokenPair) *InstrumentV2
ConvertTokenPairToInstrumentV2 convert TokenPair to InstrumentV2
type KlineM10080 ¶
type KlineM10080 struct {
*BaseKline
}
KlineM10080 define kline data in 1 week
func NewKlineM10080 ¶
func NewKlineM10080(b *BaseKline) *KlineM10080
NewKlineM10080 create a instance of NewKlineM10080
func (*KlineM10080) GetFreqInSecond ¶
func (k *KlineM10080) GetFreqInSecond() int
GetFreqInSecond return 604800
func (*KlineM10080) GetTableName ¶
func (k *KlineM10080) GetTableName() string
GetTableName return kline_m10080
type KlineM120 ¶
type KlineM120 struct {
*BaseKline
}
KlineM120 define kline data in 2 hours
func NewKlineM120 ¶
NewKlineM120 create a instance of KlineM120
func (*KlineM120) GetFreqInSecond ¶
GetFreqInSecond return 7200
func (*KlineM120) GetTableName ¶
GetTableName return kline_m120
type KlineM1440 ¶
type KlineM1440 struct {
*BaseKline
}
KlineM1440 define kline data in 1 day
func NewKlineM1440 ¶
func NewKlineM1440(b *BaseKline) *KlineM1440
NewKlineM1440 create a instance of NewKlineM1440
func (*KlineM1440) GetFreqInSecond ¶
func (k *KlineM1440) GetFreqInSecond() int
GetFreqInSecond return 86400
func (*KlineM1440) GetTableName ¶
func (k *KlineM1440) GetTableName() string
GetTableName return kline_m1440
type KlineM15 ¶
type KlineM15 struct {
*BaseKline
}
KlineM15 define kline data in 15 minutes
func NewKlineM15 ¶
NewKlineM15 create a instance of KlineM15
func (*KlineM15) GetFreqInSecond ¶
GetFreqInSecond return 900
func (*KlineM15) GetTableName ¶
GetTableName return kline_m15
type KlineM240 ¶
type KlineM240 struct {
*BaseKline
}
KlineM240 define kline data in 4 hours
func NewKlineM240 ¶
NewKlineM240 create a instance of KlineM240
func (*KlineM240) GetFreqInSecond ¶
GetFreqInSecond return 14400
func (*KlineM240) GetTableName ¶
GetTableName return kline_m240
type KlineM3 ¶
type KlineM3 struct {
*BaseKline
}
KlineM3 define kline data in 3 minutes
func (*KlineM3) GetFreqInSecond ¶
GetFreqInSecond return 180
type KlineM30 ¶
type KlineM30 struct {
*BaseKline
}
KlineM30 define kline data in 30 minutes
func NewKlineM30 ¶
NewKlineM30 create a instance of KlineM30
func (*KlineM30) GetFreqInSecond ¶
GetFreqInSecond return 1800
func (*KlineM30) GetTableName ¶
GetTableName return kline_m30
type KlineM360 ¶
type KlineM360 struct {
*BaseKline
}
KlineM360 define kline data in 6 hours
func NewKlineM360 ¶
NewKlineM360 create a instance of KlineM360
func (*KlineM360) GetFreqInSecond ¶
GetFreqInSecond return 21600
func (*KlineM360) GetTableName ¶
GetTableName return kline_m360
type KlineM4320 ¶
type KlineM4320 struct {
*BaseKline
}
KlineM4320 define kline data in 1 day
func NewKlineM4320 ¶
func NewKlineM4320(b *BaseKline) *KlineM4320
NewKlineM4320 create a instance of KlineM4320
func (*KlineM4320) GetFreqInSecond ¶
func (k *KlineM4320) GetFreqInSecond() int
GetFreqInSecond return 259200
func (*KlineM4320) GetTableName ¶
func (k *KlineM4320) GetTableName() string
GetTableName return kline_m4320
type KlineM44640 ¶
type KlineM44640 struct {
*BaseKline
}
KlineM44640 define kline data in 1 day
func NewKlineM44640 ¶
func NewKlineM44640(b *BaseKline) *KlineM44640
NewKlineM44640 create a instance of KlineM44640
func (*KlineM44640) GetFreqInSecond ¶
func (k *KlineM44640) GetFreqInSecond() int
GetFreqInSecond return 2678400
func (*KlineM44640) GetTableName ¶
func (k *KlineM44640) GetTableName() string
GetTableName return kline_m44640
type KlineM5 ¶
type KlineM5 struct {
*BaseKline
}
KlineM5 define kline data in 5 minutes
func (*KlineM5) GetFreqInSecond ¶
GetFreqInSecond return 300
type KlineM525600 ¶
type KlineM525600 struct {
*BaseKline
}
KlineM525600 define kline data in 1 day
func NewKlineM525600 ¶
func NewKlineM525600(b *BaseKline) *KlineM525600
NewKlineM525600 create a instance of KlineM525600
func (*KlineM525600) GetFreqInSecond ¶
func (k *KlineM525600) GetFreqInSecond() int
GetFreqInSecond return 31536000
func (*KlineM525600) GetTableName ¶
func (k *KlineM525600) GetTableName() string
GetTableName return kline_m525600
type KlineM60 ¶
type KlineM60 struct {
*BaseKline
}
KlineM60 define kline data in 1 hour
func NewKlineM60 ¶
NewKlineM60 create a instance of KlineM60
func (*KlineM60) GetFreqInSecond ¶
GetFreqInSecond return 3600
func (*KlineM60) GetTableName ¶
GetTableName return kline_m60
type KlineM720 ¶
type KlineM720 struct {
*BaseKline
}
KlineM720 define kline data in 12 hours
func NewKlineM720 ¶
NewKlineM720 create a instance of KlineM720
func (*KlineM720) GetFreqInSecond ¶
GetFreqInSecond return 43200
func (*KlineM720) GetTableName ¶
GetTableName return kline_m720
type MarketKeeper ¶
type MarketKeeper interface { GetTickerByProducts(products []string) ([]map[string]string, error) GetKlineByProductID(productID uint64, granularity, size int) ([][]string, error) }
MarketKeeper expected market keeper which would get data from pulsar & redis
type MatchResult ¶
type MatchResult struct { Timestamp int64 `gorm:"index;" json:"timestamp" v2:"timestamp"` BlockHeight int64 `gorm:"PRIMARY_KEY;type:bigint" json:"block_height" v2:"block_height"` Product string `gorm:"PRIMARY_KEY;type:varchar(20)" json:"product" v2:"product"` Price float64 `gorm:"type:DOUBLE" json:"price" v2:"price"` Quantity float64 `gorm:"type:DOUBLE" json:"volume" v2:"volume"` }
type MergedTickersEvent ¶
type MergedTickersEvent struct {
// contains filtered or unexported fields
}
func NewMergedTickersEvent ¶
func NewMergedTickersEvent(ts int64, freq int, tickers []interface{}) *MergedTickersEvent
func (*MergedTickersEvent) FormatResult ¶
func (m *MergedTickersEvent) FormatResult() interface{}
func (*MergedTickersEvent) GetChannelInfo ¶
func (m *MergedTickersEvent) GetChannelInfo() (channel, filter string, err error)
func (*MergedTickersEvent) GetFullChannel ¶
func (m *MergedTickersEvent) GetFullChannel() string
func (*MergedTickersEvent) GetTimestamp ¶
func (m *MergedTickersEvent) GetTimestamp() int64
type MintKeeper ¶
MintKeeper expected mint keeper
type Order ¶
type Order struct { TxHash string `gorm:"type:varchar(80)" json:"txhash" v2:"txhash"` OrderID string `gorm:"PRIMARY_KEY;type:varchar(30)" json:"order_id" v2:"order_id"` Sender string `gorm:"index;type:varchar(80)" json:"sender" v2:"sender"` Product string `gorm:"index;type:varchar(20)" json:"product" v2:"product"` Side string `gorm:"type:varchar(10)" json:"side" v2:"side"` Price string `gorm:"type:varchar(40)" json:"price" v2:"price"` Quantity string `gorm:"type:varchar(40)" json:"quantity" v2:"quantity"` Status int64 `gorm:"index;" json:"status" v2:"status"` FilledAvgPrice string `gorm:"type:varchar(40)" json:"filled_avg_price" v2:"filled_avg_price"` RemainQuantity string `gorm:"type:varchar(40)" json:"remain_quantity" v2:"remain_quantity"` Timestamp int64 `gorm:"index;" json:"timestamp" v2:"timestamp"` }
type OrderKeeper ¶
type OrderKeeper interface { GetOrder(ctx sdk.Context, orderID string) *order.Order GetUpdatedOrderIDs() []string GetTxHandlerMsgResult() []bitset.BitSet GetBlockOrderNum(ctx sdk.Context, blockHeight int64) int64 GetBlockMatchResult() *ordertypes.BlockMatchResult GetLastPrice(ctx sdk.Context, product string) sdk.Dec GetBestBidAndAsk(ctx sdk.Context, product string) (sdk.Dec, sdk.Dec) }
OrderKeeper expected order keeper
type OrderV2 ¶
type OrderV2 struct { OrderID string `json:"order_id"` Price string `json:"price"` Size string `json:"size"` OrderType string `json:"order_type"` Notional string `json:"notional"` InstrumentID string `json:"instrument_id"` Side string `json:"side"` Type string `json:"type"` Timestamp string `json:"timestamp"` FilledSize string `json:"filled_size"` FilledNotional string `json:"filled_notional"` State string `json:"state"` }
func ConvertOrderToOrderV2 ¶
type QueryAccountOrdersParams ¶
nolint
func NewQueryAccountOrdersParams ¶
func NewQueryAccountOrdersParams(address string, start int64, end int64, page, perPage int) QueryAccountOrdersParams
NewQueryAccountOrdersParams creates a new instance of QueryAccountOrdersParams
type QueryDealsParams ¶
type QueryDealsParams struct { Address string Product string Start int64 End int64 Page int PerPage int Side string }
nolint
func NewQueryDealsParams ¶
func NewQueryDealsParams(addr, product string, start, end int64, page, perPage int, side string) QueryDealsParams
NewQueryDealsParams creates a new instance of QueryDealsParams
type QueryDealsParamsV2 ¶
type QueryDexFeesParams ¶
type QueryDexFeesParams struct { DexHandlingAddr string BaseAsset string QuoteAsset string Page int PerPage int }
nolint
func NewQueryDexFeesParams ¶
func NewQueryDexFeesParams(dexHandlingAddr, baseAsset, quoteAsset string, page, perPage int) QueryDexFeesParams
NewQueryDexFeesParams creates a new instance of QueryDexFeesParams
type QueryFarmDashboardParams ¶
type QueryFarmDashboardParams struct { Address string `json:"address"` Page int `json:"page"` PerPage int `json:"per_page"` }
nolint
func NewQueryFarmDashboardParams ¶
func NewQueryFarmDashboardParams(address string, page int, perPage int) QueryFarmDashboardParams
NewQueryFarmDashboardParams creates a new instance of QueryFarmDashboardParams
type QueryFarmFirstPoolParams ¶
type QueryFarmFirstPoolParams struct { PoolName string `json:"pool_name"` Address string `json:"address"` StakeAt int64 `json:"stake_at"` ClaimHeight int64 `json:"claim_height"` }
nolint
func NewQueryFarmFirstPoolParams ¶
func NewQueryFarmFirstPoolParams(poolName string, address string, stakeAt int64, claimHeight int64) QueryFarmFirstPoolParams
NewQueryFarmFirstPoolParams creates a new instance of QueryFarmFirstPoolParams
type QueryFarmPoolsParams ¶
type QueryFarmPoolsParams struct { PoolType string `json:"pool_type"` SortColumn string `json:"sort_column"` SortDirection string `json:"sort_direction"` Page int `json:"page"` PerPage int `json:"per_page"` }
nolint
func NewQueryFarmPoolsParams ¶
func NewQueryFarmPoolsParams(poolType string, sortColumn string, sortDirection string, page int, perPage int) QueryFarmPoolsParams
NewQueryFarmPoolsParams creates a new instance of QueryFarmPoolsParams
type QueryFarmStakedInfoParams ¶
type QueryFarmStakedInfoParams struct { PoolName string `json:"pool_name"` Address string `json:"address"` }
nolint
func NewQueryFarmStakedInfoParams ¶
func NewQueryFarmStakedInfoParams(poolName string, address string) QueryFarmStakedInfoParams
NewQueryFarmStakedInfoParams creates a new instance of QueryFarmStakedInfoParams
type QueryFeeDetailsParams ¶
nolint
func NewQueryFeeDetailsParams ¶
func NewQueryFeeDetailsParams(addr string, page, perPage int) QueryFeeDetailsParams
NewQueryFeeDetailsParams creates a new instance of QueryFeeDetailsParams
type QueryFeeDetailsParamsV2 ¶
type QueryKlinesParams ¶
nolint
func NewQueryKlinesParams ¶
func NewQueryKlinesParams(product string, granularity, size int) QueryKlinesParams
NewQueryKlinesParams creates a new instance of QueryKlinesParams
type QueryMatchParams ¶
nolint
func NewQueryMatchParams ¶
func NewQueryMatchParams(product string, start, end int64, page, perPage int) QueryMatchParams
NewQueryMatchParams creates a new instance of QueryMatchParams
type QueryMatchParamsV2 ¶
type QueryOrderListParams ¶
type QueryOrderListParams struct { Address string Product string Page int PerPage int Start int64 End int64 Side string HideNoFill bool }
nolint
func NewQueryOrderListParams ¶
func NewQueryOrderListParams(addr, product, side string, page, perPage int, start, end int64, hideNoFill bool) QueryOrderListParams
NewQueryOrderListParams creates a new instance of QueryOrderListParams
type QueryOrderParamsV2 ¶
type QuerySwapLiquidityInfoParams ¶
type QuerySwapLiquidityInfoParams struct { Address string `json:"address"` TokenPairName string `json:"token_pair_name"` }
nolint
func NewQuerySwapLiquidityInfoParams ¶
func NewQuerySwapLiquidityInfoParams(address string, tokenPairName string) QuerySwapLiquidityInfoParams
NewQuerySwapBuyInfoParams creates a new instance of QuerySwapLiquidityInfoParams
type QuerySwapTokensParams ¶
type QuerySwapTokensParams struct { BusinessType string `json:"business_type"` Address string `json:"address"` BaseTokenName string `json:"base_token_name"` }
nolint
func NewQuerySwapTokensParams ¶
func NewQuerySwapTokensParams(businessType string, address string, baseTokenName string) QuerySwapTokensParams
NewQuerySwapTokensParams creates a new instance of QueryDexFeesParams
type QuerySwapWatchlistParams ¶
type QuerySwapWatchlistParams struct { SortColumn string `json:"sort_column"` SortDirection string `json:"sort_direction"` Page int `json:"page"` PerPage int `json:"per_page"` }
nolint
func NewQuerySwapWatchlistParams ¶
func NewQuerySwapWatchlistParams(sortColumn string, sortDirection string, page int, perPage int) QuerySwapWatchlistParams
NewQuerySwapWatchlistParams creates a new instance of QuerySwapWatchlistParams
type QueryTickerParams ¶
type QueryTickerParams struct { Product string `json:"product"` Count int `json:"count"` Sort bool `json:"sort"` }
nolint
type QueryTxListParams ¶
type QueryTxListParams struct { Address string TxType int64 StartTime int64 EndTime int64 Page int PerPage int }
nolint
func NewQueryTxListParams ¶
func NewQueryTxListParams(addr string, txType, startTime, endTime int64, page, perPage int) QueryTxListParams
NewQueryTxListParams creates a new instance of QueryTxListParams
type QueryTxListParamsV2 ¶
type SwapInfo ¶
type SwapInfo struct { Address string `grom:"index;"` TokenPairName string `gorm:"index;"` BaseTokenAmount string `gorm:"type:varchar(40)"` QuoteTokenAmount string `gorm:"type:varchar(40)"` SellAmount string `gorm:"type:varchar(40)"` BuysAmount string `gorm:"type:varchar(40)"` Price string `gorm:"type:varchar(40)"` Timestamp int64 `gorm:"index;"` }
type SwapKeeper ¶
type SwapKeeper interface { GetSwapTokenPairs(ctx sdk.Context) []ammswap.SwapTokenPair GetSwapTokenPair(ctx sdk.Context, tokenPairName string) (ammswap.SwapTokenPair, error) GetParams(ctx sdk.Context) (params ammswap.Params) GetPoolTokenAmount(ctx sdk.Context, poolTokenName string) sdk.Dec SetObserverKeeper(k ammswaptypes.BackendKeeper) }
SwapKeeper expected swap keeper
type SwapLiquidityInfo ¶
type SwapTokens ¶
type SwapTokens []SwapToken
func (SwapTokens) Len ¶
func (swapTokens SwapTokens) Len() int
func (SwapTokens) Less ¶
func (swapTokens SwapTokens) Less(i, j int) bool
func (SwapTokens) Swap ¶
func (swapTokens SwapTokens) Swap(i, j int)
type SwapTokensResponse ¶
type SwapTokensResponse struct { NativeToken string `json:"native_token"` Tokens SwapTokens `json:"tokens"` }
type SwapVolumePriceInfo ¶
type SwapWatchlist ¶
type SwapWatchlistSorter ¶
type SwapWatchlistSorter struct { Watchlist []SwapWatchlist SortField string SortDirectory string }
func (*SwapWatchlistSorter) Len ¶
func (s *SwapWatchlistSorter) Len() int
func (*SwapWatchlistSorter) Less ¶
func (s *SwapWatchlistSorter) Less(i, j int) bool
func (*SwapWatchlistSorter) Swap ¶
func (s *SwapWatchlistSorter) Swap(i, j int)
type SwapWhitelist ¶
type Ticker ¶
type Ticker struct { Symbol string `json:"symbol"` Product string `json:"product"` Timestamp int64 `json:"timestamp"` Open float64 `json:"open"` // Open In 24h Close float64 `json:"close"` // Close in 24h High float64 `json:"high"` // High in 24h Low float64 `json:"low"` // Low in 24h Price float64 `json:"price"` Volume float64 `json:"volume"` // Volume in 24h Change float64 `json:"change"` // (Close - Open) ChangePercentage string `json:"change_percentage"` // Change / Open * 100% }
func (*Ticker) FormatResult ¶
func (t *Ticker) FormatResult() interface{}
func (*Ticker) GetChannelInfo ¶
func (*Ticker) GetFullChannel ¶
func (*Ticker) GetTimestamp ¶
func (*Ticker) PrettyString ¶
PrettyString return string of ticker data
type TickerV2 ¶
type TickerV2 struct { InstrumentID string `json:"instrument_id"` // name of token pair Last string `json:"last"` BestBid string `json:"best_bid"` BestAsk string `json:"best_ask"` Open24H string `json:"open_24h"` High24H string `json:"high_24h"` Low24H string `json:"low_24h"` BaseVolume24H string `json:"base_volume_24h"` QuoteVolume24H string `json:"quote_volume_24h"` Timestamp string `json:"timestamp"` }
func DefaultTickerV2 ¶
type TokenKeeper ¶
type TokenKeeper interface { GetFeeDetailList() []*token.FeeDetail GetParams(ctx sdk.Context) (params token.Params) GetCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.SysCoins GetTokensInfo(ctx sdk.Context) (tokens []token.Token) }
TokenKeeper expected token keeper
type Transaction ¶
type Transaction struct { TxHash string `gorm:"type:varchar(80)" json:"txhash" v2:"txhash"` Type int64 `gorm:"index;" json:"type" v2:"type"` // 1:Transfer, 2:NewOrder, 3:CancelOrder Address string `gorm:"index;type:varchar(80)" json:"address" v2:"address"` Symbol string `gorm:"type:varchar(20)" json:"symbol" v2:"symbol"` Side int64 `gorm:"" json:"side"` // 1:buy, 2:sell, 3:from, 4:to Quantity string `gorm:"type:varchar(40)" json:"quantity" v2:"quantity"` Fee string `gorm:"type:varchar(40)" json:"fee" v2:"fee"` Timestamp int64 `gorm:"index" json:"timestamp" v2:"timestamp"` }
func GenerateTx ¶
func GenerateTx(tx *auth.StdTx, txHash string, ctx sdk.Context, orderKeeper OrderKeeper, timestamp int64) []*Transaction
GenerateTx return transaction, called at DeliverTx