show trade ID in the console

This commit is contained in:
c9s 2022-06-24 15:19:12 +08:00
parent 7b60e34821
commit 3ad1f0e351
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54
2 changed files with 7 additions and 1 deletions

View File

@ -18,6 +18,11 @@ type TradeBatchQuery struct {
}
func (e TradeBatchQuery) Query(ctx context.Context, symbol string, options *types.TradeQueryOptions) (c chan types.Trade, errC chan error) {
if options.EndTime == nil {
now := time.Now()
options.EndTime = &now
}
startTime := *options.StartTime
endTime := *options.EndTime
query := &AsyncTimeRangedBatchQuery{

View File

@ -146,7 +146,7 @@ func trimTrailingZero(a float64) string {
// String is for console output
func (trade Trade) String() string {
return fmt.Sprintf("TRADE %s %s %4s %-4s @ %-6s | AMOUNT %s | FEE %s %s | OrderID %d | %s",
return fmt.Sprintf("TRADE %s %s %4s %-4s @ %-6s | AMOUNT %s | FEE %s %s | OrderID %d | TID %d | %s",
trade.Exchange.String(),
trade.Symbol,
trade.Side,
@ -156,6 +156,7 @@ func (trade Trade) String() string {
trade.Fee.String(),
trade.FeeCurrency,
trade.OrderID,
trade.ID,
trade.Time.Time().Format(time.StampMilli),
)
}