refactor order executor accessors

This commit is contained in:
c9s 2023-08-05 01:59:52 +08:00
parent c605761c4f
commit eaaab914e0
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -33,6 +33,14 @@ type BaseOrderExecutor struct {
orderStore *core.OrderStore
}
func (e *BaseOrderExecutor) OrderStore() *core.OrderStore {
return e.orderStore
}
func (e *BaseOrderExecutor) ActiveMakerOrders() *ActiveOrderBook {
return e.activeMakerOrders
}
// GeneralOrderExecutor implements the general order executor for strategy
type GeneralOrderExecutor struct {
BaseOrderExecutor
@ -131,14 +139,6 @@ func (e *GeneralOrderExecutor) marginAssetMaxBorrowableUpdater(ctx context.Conte
}
}
func (e *GeneralOrderExecutor) OrderStore() *core.OrderStore {
return e.orderStore
}
func (e *GeneralOrderExecutor) ActiveMakerOrders() *ActiveOrderBook {
return e.activeMakerOrders
}
func (e *GeneralOrderExecutor) BindEnvironment(environ *Environment) {
e.tradeCollector.OnProfit(func(trade types.Trade, profit *types.Profit) {
environ.RecordPosition(e.position, trade, profit)