Skip to content

Commit b66f393

Browse files
authored
Merge pull request #9 from miraclesu/fix/price-invert
fix: price invert
2 parents 90c9fdd + b7853b9 commit b66f393

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

entities/price.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ func (p *Price) Adjusted() *Fraction {
6060
return p.Fraction.Multiply(p.Scalar)
6161
}
6262

63-
func (p *Price) Invert() {
64-
p.BaseCurrency, p.QuoteCurrency = p.QuoteCurrency, p.BaseCurrency
63+
func (p *Price) Invert() *Price {
64+
return NewPrice(p.QuoteCurrency, p.BaseCurrency, p.Numerator, p.Denominator)
6565
}
6666

6767
func (p *Price) Multiply(other *Price) (*Price, error) {

0 commit comments

Comments
 (0)