Documentation ¶
Index ¶
- Constants
- Variables
- func CheckCloseOnly(account *model.AccountStorage, order *model.Order) decimal.Decimal
- type MatchItem
- type OrderCancel
- type OrdersCollateral
- type OrdersEachPerp
- type OrdersPerpMap
- type Server
- func (s *Server) CancelOrder(poolAddress string, perpetualIndex int64, orderHash string) error
- func (s *Server) ClosePerpetual(poolAddress string, perpIndex int64) error
- func (s *Server) NewOrder(order *model.Order) string
- func (s *Server) RollbackOrdersStatus(txID string, status model.TransactionStatus, transactionHash, blockHash string, ...) error
- func (s *Server) SetPoolStorageDirty(txID string)
- func (s *Server) Start() error
- func (s *Server) UpdateOrdersStatus(txID string, status model.TransactionStatus, transactionHash, blockHash string, ...) error
Constants ¶
View Source
const POOL_STORAGE_USE_DURATION = 60
View Source
const PriceExceedsLimit = "price exceeds limit"
View Source
const TriggerPriceNotReach = "trigger price is not reached"
Variables ¶
View Source
var ChannelHWM = 64
View Source
var TradeAmountRelaxFactor = decimal.NewFromFloat(0.99)
Functions ¶
func CheckCloseOnly ¶
Types ¶
type MatchItem ¶
type MatchItem struct { Order *orderbook.MemoryOrder // NOTE: mutable! should only be modified where execute match OrderCancelAmounts []decimal.Decimal OrderCancelReasons []model.CancelReasonType OrderTotalCancel decimal.Decimal MatchedAmount decimal.Decimal }
type OrderCancel ¶
type OrderCancel struct { LiquidityPoolAddress string PerpetualIndex int64 OrderHash string Status model.OrderStatus ToCancel decimal.Decimal Reason model.CancelReasonType }
func ComputeOrderAvailable ¶
func ComputeOrderAvailable(poolStorage *model.LiquidityPoolStorage, perpetualIndex int64, account *model.AccountStorage, orders []*model.Order) ([]*OrderCancel, decimal.Decimal)
type OrdersCollateral ¶
type OrdersCollateral struct { WalletBalance decimal.Decimal OrderMap map[string]*OrdersPerpMap }
type OrdersEachPerp ¶
type OrdersPerpMap ¶
type OrdersPerpMap struct { LiquidityPoolAddress string PerpetualIndex int64 Account *model.AccountStorage PoolStorage *model.LiquidityPoolStorage Orders []*model.Order }
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func New ¶
func New(ctx context.Context, cli chain.ChainClient, dao dao.DAO, wsChan chan interface{}, gm *gasmonitor.GasMonitor) (*Server, error)
func (*Server) CancelOrder ¶
func (*Server) ClosePerpetual ¶
func (*Server) RollbackOrdersStatus ¶
func (s *Server) RollbackOrdersStatus(txID string, status model.TransactionStatus, transactionHash, blockHash string, blockNumber, blockTime uint64, successEvents []*model.TradeSuccessEvent, failedEvents []*model.TradeFailedEvent) error
func (*Server) SetPoolStorageDirty ¶
func (*Server) UpdateOrdersStatus ¶
func (s *Server) UpdateOrdersStatus(txID string, status model.TransactionStatus, transactionHash, blockHash string, blockNumber, blockTime uint64, successEvents []*model.TradeSuccessEvent, failedEvents []*model.TradeFailedEvent) error
Click to show internal directories.
Click to hide internal directories.