mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-25 16:25:16 +00:00
Merge pull request #26 from c9s/fix/pnl-check
fix: early return if len of trades == 0
This commit is contained in:
commit
5a6ca491aa
|
@ -23,6 +23,17 @@ func (c *AverageCostCalculator) Calculate(symbol string, trades []types.Trade, c
|
||||||
var bidFeeUSD = 0.0
|
var bidFeeUSD = 0.0
|
||||||
var feeRate = 0.0015
|
var feeRate = 0.0015
|
||||||
|
|
||||||
|
if len(trades) == 0 {
|
||||||
|
return &AverageCostPnlReport{
|
||||||
|
Symbol: symbol,
|
||||||
|
CurrentPrice: currentPrice,
|
||||||
|
NumTrades: 0,
|
||||||
|
BidVolume: bidVolume,
|
||||||
|
AskVolume: askVolume,
|
||||||
|
FeeUSD: feeUSD,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var currencyFees = map[string]float64{}
|
var currencyFees = map[string]float64{}
|
||||||
|
|
||||||
for _, trade := range trades {
|
for _, trade := range trades {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user