mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
assign fee rate to position
This commit is contained in:
parent
187a9c795b
commit
e7c718ee15
|
@ -117,9 +117,9 @@ type ExchangeSession struct {
|
|||
SubAccount string `json:"subAccount,omitempty" yaml:"subAccount,omitempty"`
|
||||
|
||||
// Withdrawal is used for enabling withdrawal functions
|
||||
Withdrawal bool `json:"withdrawal,omitempty" yaml:"withdrawal,omitempty"`
|
||||
MakerFee fixedpoint.Value `json:"makerFee,omitempty" yaml:"makerFee,omitempty"`
|
||||
TakerFee fixedpoint.Value `json:"takerFee,omitempty" yaml:"takerFee,omitempty"`
|
||||
Withdrawal bool `json:"withdrawal,omitempty" yaml:"withdrawal,omitempty"`
|
||||
MakerFeeRate fixedpoint.Value `json:"makerFeeRate,omitempty" yaml:"makerFeeRate,omitempty"`
|
||||
TakerFeeRate fixedpoint.Value `json:"takerFeeRate,omitempty" yaml:"takerFeeRate,omitempty"`
|
||||
|
||||
PublicOnly bool `json:"publicOnly,omitempty" yaml:"publicOnly"`
|
||||
Margin bool `json:"margin,omitempty" yaml:"margin"`
|
||||
|
|
|
@ -613,6 +613,20 @@ func (s *Strategy) CrossRun(ctx context.Context, orderExecutionRouter bbgo.Order
|
|||
}
|
||||
}
|
||||
|
||||
if s.makerSession.MakerFeeRate > 0 || s.makerSession.TakerFeeRate > 0 {
|
||||
s.state.Position.SetExchangeFeeRate(types.ExchangeName(s.MakerExchange), bbgo.ExchangeFee{
|
||||
MakerFeeRate: s.makerSession.MakerFeeRate,
|
||||
TakerFeeRate: s.makerSession.TakerFeeRate,
|
||||
})
|
||||
}
|
||||
|
||||
if s.sourceSession.MakerFeeRate > 0 || s.sourceSession.TakerFeeRate > 0 {
|
||||
s.state.Position.SetExchangeFeeRate(types.ExchangeName(s.SourceExchange), bbgo.ExchangeFee{
|
||||
MakerFeeRate: s.sourceSession.MakerFeeRate,
|
||||
TakerFeeRate: s.sourceSession.TakerFeeRate,
|
||||
})
|
||||
}
|
||||
|
||||
if s.state.AccumulatedSince == 0 {
|
||||
s.state.AccumulatedSince = time.Now().Unix()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user