Documentation ¶
Index ¶
- Constants
- func DeleteDB(dbPath string)
- type DealDataSource
- type IKline1MDataSource
- type MergeResultDataSource
- type ORM
- func (orm *ORM) AddClaimInfo(claimInfos []*types.ClaimInfo) (addedCnt int, err error)
- func (orm *ORM) AddDeals(deals []*types.Deal) (addedCnt int, err error)
- func (orm *ORM) AddFeeDetails(feeDetails []*token.FeeDetail) (addedCnt int, err error)
- func (orm *ORM) AddMatchResults(results []*types.MatchResult) (addedCnt int, err error)
- func (orm *ORM) AddOrders(orders []*types.Order) (addedCnt int, err error)
- func (orm *ORM) AddSwapInfo(swapInfos []*types.SwapInfo) (addedCnt int, err error)
- func (orm *ORM) AddSwapWhitelist(swapWhitelists []*types.SwapWhitelist) (addedCnt int, err error)
- func (orm *ORM) AddTransactions(transactions []*types.Transaction) (addedCnt int, err error)
- func (orm *ORM) BatchInsertOrUpdate(newOrders []*types.Order, updatedOrders []*types.Order, deals []*types.Deal, ...) (resultMap map[string]int, err error)
- func (orm *ORM) Close() error
- func (orm *ORM) CommitKlines(klines ...[]interface{})
- func (orm *ORM) CreateKline1M(startTS, endTS int64, dataSource IKline1MDataSource) (anchorEndTS int64, newProductCnt int, newKlineInfo map[string][]types.KlineM1, ...)
- func (orm *ORM) Debug(msg string)
- func (orm *ORM) DeleteKlineBefore(unixTS int64, kline interface{}) error
- func (orm *ORM) Error(msg string)
- func (orm *ORM) GetAccountClaimInfos(address string) []types.ClaimInfo
- func (orm *ORM) GetAccountClaimedByPool(address string, poolName string) []types.ClaimInfo
- func (orm *ORM) GetAccountOrders(address string, startTS, endTS int64, offset, limit int) ([]types.Order, int)
- func (orm *ORM) GetDeals(address, product, side string, startTime, endTime int64, offset, limit int) ([]types.Deal, int)
- func (orm *ORM) GetDealsV2(address, product, side string, after string, before string, limit int) []types.Deal
- func (orm *ORM) GetDexFees(dexHandlingAddr, product string, offset, limit int) ([]types.DexFees, int)
- func (orm *ORM) GetFeeDetails(address string, offset, limit int) ([]token.FeeDetail, int)
- func (orm *ORM) GetFeeDetailsV2(address string, after string, before string, limit int) []token.FeeDetail
- func (orm *ORM) GetLatestKlinesByProduct(product string, limit int, anchorTS int64, klines interface{}) error
- func (orm *ORM) GetMatchResults(product string, startTime, endTime int64, offset, limit int) ([]types.MatchResult, int)
- func (orm *ORM) GetMatchResultsV2(instrumentID string, after string, before string, limit int) []types.MatchResult
- func (o *ORM) GetMaxBlockTimestamp() int64
- func (orm *ORM) GetOrderByID(orderID string) *types.Order
- func (orm *ORM) GetOrderList(address, product, side string, open bool, offset, limit int, ...) ([]types.Order, int)
- func (orm *ORM) GetOrderListV2(instrumentID string, address string, side string, open bool, after string, ...) []types.Order
- func (orm *ORM) GetSwapInfo(startTime int64) []types.SwapInfo
- func (orm *ORM) GetSwapWhitelist() []types.SwapWhitelist
- func (orm *ORM) GetTransactionList(address string, txType, startTime, endTime int64, offset, limit int) ([]types.Transaction, int)
- func (orm *ORM) GetTransactionListV2(address string, txType int, after string, before string, limit int) []types.Transaction
- func (orm *ORM) MergeKlineM1(startTS, endTS int64, destKline types.IKline) (anchorEndTS int64, newKlineTypeCnt int, newKlines map[string][]interface{}, ...)
- func (orm *ORM) RefreshTickers(startTS, endTS int64, productList []string) (m map[string]*types.Ticker, err error)
- func (o *ORM) SetMaxBlockTimestamp(maxBlockTimestamp int64)
- func (orm *ORM) UpdateOrders(orders []*types.Order) (addedCnt int, err error)
- type OrmEngineInfo
Constants ¶
const ( EngineTypeSqlite = blockchaincfg.BackendOrmEngineTypeSqlite EngineTypeMysql = blockchaincfg.BackendOrmEngineTypeMysql )
nolint
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DealDataSource ¶
type DealDataSource struct {
// contains filtered or unexported fields
}
nolint
type IKline1MDataSource ¶
type IKline1MDataSource interface {
// contains filtered or unexported methods
}
nolint
type ORM ¶
type ORM struct {
// contains filtered or unexported fields
}
ORM is designed for deal with database by orm http://gorm.io/docs/query.html
func MockSqlite3ORM ¶
MockSqlite3ORM create sqlite db for test, return orm
func NewSqlite3ORM ¶
func NewSqlite3ORM(enableLog bool, baseDir string, dbName string, logger *log.Logger) (orm *ORM, e error)
NewSqlite3ORM create sqlite db, return orm
func (*ORM) AddClaimInfo ¶
AddClaimInfo insert farm claimed coins into db
func (*ORM) AddFeeDetails ¶
AddFeeDetails insert into fees
func (*ORM) AddMatchResults ¶
func (orm *ORM) AddMatchResults(results []*types.MatchResult) (addedCnt int, err error)
nolint
func (*ORM) AddSwapInfo ¶
AddSwapInfo insert into swap token pairs details
func (*ORM) AddSwapWhitelist ¶
func (orm *ORM) AddSwapWhitelist(swapWhitelists []*types.SwapWhitelist) (addedCnt int, err error)
AddSwapWhitelist insert swap whitelist to db
func (*ORM) AddTransactions ¶
func (orm *ORM) AddTransactions(transactions []*types.Transaction) (addedCnt int, err error)
AddTransactions insert into transactions, return count
func (*ORM) BatchInsertOrUpdate ¶
func (orm *ORM) BatchInsertOrUpdate(newOrders []*types.Order, updatedOrders []*types.Order, deals []*types.Deal, mrs []*types.MatchResult, feeDetails []*token.FeeDetail, trxs []*types.Transaction, swapInfos []*types.SwapInfo, claimInfos []*types.ClaimInfo) (resultMap map[string]int, err error)
BatchInsertOrUpdate return map mean success or fail
func (*ORM) CommitKlines ¶
func (orm *ORM) CommitKlines(klines ...[]interface{})
CommitKlines insert into klines for test
func (*ORM) CreateKline1M ¶
func (orm *ORM) CreateKline1M(startTS, endTS int64, dataSource IKline1MDataSource) ( anchorEndTS int64, newProductCnt int, newKlineInfo map[string][]types.KlineM1, err error)
CreateKline1M batch insert into Kline1M
func (*ORM) DeleteKlineBefore ¶
DeleteKlineBefore delete from kline
func (*ORM) GetAccountClaimInfos ¶
nolint
func (*ORM) GetAccountClaimedByPool ¶
func (*ORM) GetAccountOrders ¶
func (*ORM) GetDeals ¶
func (orm *ORM) GetDeals(address, product, side string, startTime, endTime int64, offset, limit int) ([]types.Deal, int)
nolint
func (*ORM) GetDealsV2 ¶
func (orm *ORM) GetDealsV2(address, product, side string, after string, before string, limit int) []types.Deal
nolint
func (*ORM) GetDexFees ¶
func (orm *ORM) GetDexFees(dexHandlingAddr, product string, offset, limit int) ([]types.DexFees, int)
nolint
func (*ORM) GetFeeDetails ¶
nolint
func (*ORM) GetFeeDetailsV2 ¶
func (orm *ORM) GetFeeDetailsV2(address string, after string, before string, limit int) []token.FeeDetail
nolint
func (*ORM) GetLatestKlinesByProduct ¶
func (orm *ORM) GetLatestKlinesByProduct(product string, limit int, anchorTS int64, klines interface{}) error
nolint
func (*ORM) GetMatchResults ¶
func (orm *ORM) GetMatchResults(product string, startTime, endTime int64, offset, limit int) ([]types.MatchResult, int)
nolint
func (*ORM) GetMatchResultsV2 ¶
func (orm *ORM) GetMatchResultsV2(instrumentID string, after string, before string, limit int) []types.MatchResult
nolint
func (*ORM) GetMaxBlockTimestamp ¶
func (*ORM) GetOrderList ¶
func (orm *ORM) GetOrderList(address, product, side string, open bool, offset, limit int, startTS, endTS int64, hideNoFill bool) ([]types.Order, int)
nolint
func (*ORM) GetOrderListV2 ¶
func (orm *ORM) GetOrderListV2(instrumentID string, address string, side string, open bool, after string, before string, limit int) []types.Order
nolint
func (*ORM) GetTransactionList ¶
func (orm *ORM) GetTransactionList(address string, txType, startTime, endTime int64, offset, limit int) ([]types.Transaction, int)
nolint
func (*ORM) GetTransactionListV2 ¶
func (orm *ORM) GetTransactionListV2(address string, txType int, after string, before string, limit int) []types.Transaction
nolint
func (*ORM) MergeKlineM1 ¶
func (orm *ORM) MergeKlineM1(startTS, endTS int64, destKline types.IKline) ( anchorEndTS int64, newKlineTypeCnt int, newKlines map[string][]interface{}, err error)
MergeKlineM1 merge KlineM1 data to KlineM*
func (*ORM) RefreshTickers ¶
func (orm *ORM) RefreshTickers(startTS, endTS int64, productList []string) (m map[string]*types.Ticker, err error)
RefreshTickers Latest 24H KlineM1 to Ticker