mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
pkg/exchange: use NumFractionalDigits instead of math.Log10(Float64) due to precision problem
This commit is contained in:
parent
2a85bbebf0
commit
ba7e26c800
|
@ -2,7 +2,6 @@ package bybit
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"math"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -16,8 +15,8 @@ func toGlobalMarket(m bybitapi.Instrument) types.Market {
|
||||||
return types.Market{
|
return types.Market{
|
||||||
Symbol: m.Symbol,
|
Symbol: m.Symbol,
|
||||||
LocalSymbol: m.Symbol,
|
LocalSymbol: m.Symbol,
|
||||||
PricePrecision: -int(math.Log10(m.LotSizeFilter.QuotePrecision.Float64())),
|
PricePrecision: m.LotSizeFilter.QuotePrecision.NumFractionalDigits(),
|
||||||
VolumePrecision: -int(math.Log10(m.LotSizeFilter.BasePrecision.Float64())),
|
VolumePrecision: m.LotSizeFilter.BasePrecision.NumFractionalDigits(),
|
||||||
QuoteCurrency: m.QuoteCoin,
|
QuoteCurrency: m.QuoteCoin,
|
||||||
BaseCurrency: m.BaseCoin,
|
BaseCurrency: m.BaseCoin,
|
||||||
MinNotional: m.LotSizeFilter.MinOrderAmt,
|
MinNotional: m.LotSizeFilter.MinOrderAmt,
|
||||||
|
|
|
@ -3,7 +3,6 @@ package kucoin
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"hash/fnv"
|
"hash/fnv"
|
||||||
"math"
|
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -39,8 +38,8 @@ func toGlobalMarket(m kucoinapi.Symbol) types.Market {
|
||||||
return types.Market{
|
return types.Market{
|
||||||
Symbol: symbol,
|
Symbol: symbol,
|
||||||
LocalSymbol: m.Symbol,
|
LocalSymbol: m.Symbol,
|
||||||
PricePrecision: -int(math.Log10(m.PriceIncrement.Float64())), // convert 0.0001 to 4
|
PricePrecision: m.PriceIncrement.NumFractionalDigits(), // convert 0.0001 to 4
|
||||||
VolumePrecision: -int(math.Log10(m.BaseIncrement.Float64())),
|
VolumePrecision: m.BaseIncrement.NumFractionalDigits(),
|
||||||
QuoteCurrency: m.QuoteCurrency,
|
QuoteCurrency: m.QuoteCurrency,
|
||||||
BaseCurrency: m.BaseCurrency,
|
BaseCurrency: m.BaseCurrency,
|
||||||
MinNotional: m.QuoteMinSize,
|
MinNotional: m.QuoteMinSize,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user