mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 14:55:16 +00:00
xfunding: check duplicated funding fee txn
This commit is contained in:
parent
a6b47fda72
commit
ac33b5a878
|
@ -29,6 +29,10 @@ func (s *ProfitStats) AddFundingFee(fee FundingFee) error {
|
|||
return fmt.Errorf("unexpected error, funding fee currency is not matched, given: %s, wanted: %s", fee.Asset, s.FundingFeeCurrency)
|
||||
}
|
||||
|
||||
if s.LastFundingFeeTxn == fee.Txn {
|
||||
return errDuplicatedFundingFeeTxnId
|
||||
}
|
||||
|
||||
s.FundingFeeRecords = append(s.FundingFeeRecords, fee)
|
||||
s.TotalFundingFee = s.TotalFundingFee.Add(fee.Amount)
|
||||
s.LastFundingFeeTxn = fee.Txn
|
||||
|
|
|
@ -62,6 +62,8 @@ var log = logrus.WithField("strategy", ID)
|
|||
|
||||
var errNotBinanceExchange = errors.New("not binance exchange, currently only support binance exchange")
|
||||
|
||||
var errDuplicatedFundingFeeTxnId = errors.New("duplicated funding fee txn id")
|
||||
|
||||
func init() {
|
||||
// Register the pointer of the strategy struct,
|
||||
// so that bbgo knows what struct to be used to unmarshal the configs (YAML or JSON)
|
||||
|
|
Loading…
Reference in New Issue
Block a user