@@ -205,17 +205,17 @@ type ProfitStats struct {
205
205
BaseCurrency string `json:"baseCurrency"`
206
206
207
207
AccumulatedPnL fixedpoint.Value `json:"accumulatedPnL,omitempty"`
208
- AccumulatedNetProfit fixedpoint.Value `json:"accumulatedNetProfit,omitempty"`
209
- AccumulatedProfit fixedpoint.Value `json:"accumulatedProfit,omitempty"`
210
- AccumulatedLoss fixedpoint.Value `json:"accumulatedLoss,omitempty"`
211
- AccumulatedVolume fixedpoint.Value `json:"accumulatedVolume,omitempty"`
208
+ AccumulatedNetProfit fixedpoint.Value `json:"accumulatedNetProfit,omitempty"`
209
+ AccumulatedGrossProfit fixedpoint.Value `json:"accumulatedProfit,omitempty"`
210
+ AccumulatedGrossLoss fixedpoint.Value `json:"accumulatedLoss,omitempty"`
211
+ AccumulatedVolume fixedpoint.Value `json:"accumulatedVolume,omitempty"`
212
212
AccumulatedSince int64 `json:"accumulatedSince,omitempty"`
213
213
214
214
TodayPnL fixedpoint.Value `json:"todayPnL,omitempty"`
215
- TodayNetProfit fixedpoint.Value `json:"todayNetProfit,omitempty"`
216
- TodayProfit fixedpoint.Value `json:"todayProfit,omitempty"`
217
- TodayLoss fixedpoint.Value `json:"todayLoss,omitempty"`
218
- TodaySince int64 `json:"todaySince,omitempty"`
215
+ TodayNetProfit fixedpoint.Value `json:"todayNetProfit,omitempty"`
216
+ TodayGrossProfit fixedpoint.Value `json:"todayProfit,omitempty"`
217
+ TodayGrossLoss fixedpoint.Value `json:"todayLoss,omitempty"`
218
+ TodaySince int64 `json:"todaySince,omitempty"`
219
219
}
220
220
221
221
func NewProfitStats (market Market ) * ProfitStats {
@@ -244,11 +244,11 @@ func (s *ProfitStats) AddProfit(profit Profit) {
244
244
s .TodayNetProfit = s .TodayNetProfit .Add (profit .NetProfit )
245
245
246
246
if profit .Profit .Sign () < 0 {
247
- s .AccumulatedLoss = s .AccumulatedLoss .Add (profit .Profit )
248
- s .TodayLoss = s .TodayLoss .Add (profit .Profit )
247
+ s .AccumulatedGrossLoss = s .AccumulatedGrossLoss .Add (profit .Profit )
248
+ s .TodayGrossLoss = s .TodayGrossLoss .Add (profit .Profit )
249
249
} else if profit .Profit .Sign () > 0 {
250
- s .AccumulatedProfit = s .AccumulatedLoss .Add (profit .Profit )
251
- s .TodayProfit = s .TodayProfit .Add (profit .Profit )
250
+ s .AccumulatedGrossProfit = s .AccumulatedGrossLoss .Add (profit .Profit )
251
+ s .TodayGrossProfit = s .TodayGrossProfit .Add (profit .Profit )
252
252
}
253
253
}
254
254
@@ -267,8 +267,8 @@ func (s *ProfitStats) IsOver24Hours() bool {
267
267
func (s * ProfitStats ) ResetToday () {
268
268
s .TodayPnL = fixedpoint .Zero
269
269
s .TodayNetProfit = fixedpoint .Zero
270
- s .TodayProfit = fixedpoint .Zero
271
- s .TodayLoss = fixedpoint .Zero
270
+ s .TodayGrossProfit = fixedpoint .Zero
271
+ s .TodayGrossLoss = fixedpoint .Zero
272
272
273
273
var beginningOfTheDay = util .BeginningOfTheDay (time .Now ().Local ())
274
274
s .TodaySince = beginningOfTheDay .Unix ()
@@ -288,10 +288,10 @@ func (s *ProfitStats) PlainText() string {
288
288
s .Symbol ,
289
289
s .TodayPnL .String (), s .QuoteCurrency ,
290
290
s .TodayNetProfit .String (), s .QuoteCurrency ,
291
- s .TodayLoss .String (), s .QuoteCurrency ,
291
+ s .TodayGrossLoss .String (), s .QuoteCurrency ,
292
292
s .AccumulatedPnL .String (), s .QuoteCurrency ,
293
293
s .AccumulatedNetProfit .String (), s .QuoteCurrency ,
294
- s .AccumulatedLoss .String (), s .QuoteCurrency ,
294
+ s .AccumulatedGrossLoss .String (), s .QuoteCurrency ,
295
295
since .Format (time .RFC822 ),
296
296
)
297
297
}
@@ -313,10 +313,10 @@ func (s *ProfitStats) SlackAttachment() slack.Attachment {
313
313
})
314
314
}
315
315
316
- if ! s .TodayProfit .IsZero () {
316
+ if ! s .TodayGrossProfit .IsZero () {
317
317
fields = append (fields , slack.AttachmentField {
318
318
Title : "Profit Today" ,
319
- Value : pnlSignString (s .TodayProfit ) + " " + s .QuoteCurrency ,
319
+ Value : pnlSignString (s .TodayGrossProfit ) + " " + s .QuoteCurrency ,
320
320
Short : true ,
321
321
})
322
322
}
@@ -329,10 +329,10 @@ func (s *ProfitStats) SlackAttachment() slack.Attachment {
329
329
})
330
330
}
331
331
332
- if ! s .TodayLoss .IsZero () {
332
+ if ! s .TodayGrossLoss .IsZero () {
333
333
fields = append (fields , slack.AttachmentField {
334
334
Title : "Loss Today" ,
335
- Value : pnlSignString (s .TodayLoss ) + " " + s .QuoteCurrency ,
335
+ Value : pnlSignString (s .TodayGrossLoss ) + " " + s .QuoteCurrency ,
336
336
Short : true ,
337
337
})
338
338
}
@@ -344,10 +344,10 @@ func (s *ProfitStats) SlackAttachment() slack.Attachment {
344
344
})
345
345
}
346
346
347
- if ! s .AccumulatedProfit .IsZero () {
347
+ if ! s .AccumulatedGrossProfit .IsZero () {
348
348
fields = append (fields , slack.AttachmentField {
349
349
Title : "Accumulated Profit" ,
350
- Value : pnlSignString (s .AccumulatedProfit ) + " " + s .QuoteCurrency ,
350
+ Value : pnlSignString (s .AccumulatedGrossProfit ) + " " + s .QuoteCurrency ,
351
351
})
352
352
}
353
353
@@ -358,10 +358,10 @@ func (s *ProfitStats) SlackAttachment() slack.Attachment {
358
358
})
359
359
}
360
360
361
- if ! s .AccumulatedLoss .IsZero () {
361
+ if ! s .AccumulatedGrossLoss .IsZero () {
362
362
fields = append (fields , slack.AttachmentField {
363
363
Title : "Accumulated Loss" ,
364
- Value : pnlSignString (s .AccumulatedLoss ) + " " + s .QuoteCurrency ,
364
+ Value : pnlSignString (s .AccumulatedGrossLoss ) + " " + s .QuoteCurrency ,
365
365
})
366
366
}
367
367
0 commit comments