mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 00:35:15 +00:00
types: add PriceVolume.Equals method
This commit is contained in:
parent
1ad10a9360
commit
fbc49c28ef
|
@ -12,6 +12,10 @@ type PriceVolume struct {
|
|||
Price, Volume fixedpoint.Value
|
||||
}
|
||||
|
||||
func (p PriceVolume) Equals(b PriceVolume) bool {
|
||||
return p.Price.Eq(b.Price) && p.Volume.Eq(b.Volume)
|
||||
}
|
||||
|
||||
func (p PriceVolume) String() string {
|
||||
return fmt.Sprintf("PriceVolume{ price: %s, volume: %s }", p.Price.String(), p.Volume.String())
|
||||
}
|
||||
|
@ -139,8 +143,7 @@ func (slice *PriceVolumeSlice) UnmarshalJSON(b []byte) error {
|
|||
|
||||
// ParsePriceVolumeSliceJSON tries to parse a 2 dimensional string array into a PriceVolumeSlice
|
||||
//
|
||||
// [["9000", "10"], ["9900", "10"], ... ]
|
||||
//
|
||||
// [["9000", "10"], ["9900", "10"], ... ]
|
||||
func ParsePriceVolumeSliceJSON(b []byte) (slice PriceVolumeSlice, err error) {
|
||||
var as [][]fixedpoint.Value
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user