mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-21 22:43:52 +00:00
Merge pull request #1372 from bailantaotao/edwin/fix-precision
FIX: [bybit][kucoin] fix negative volume, price precision
This commit is contained in:
commit
dcd837f0f9
|
@ -2,7 +2,6 @@ package bybit
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
|
@ -16,8 +15,8 @@ func toGlobalMarket(m bybitapi.Instrument) types.Market {
|
|||
return types.Market{
|
||||
Symbol: m.Symbol,
|
||||
LocalSymbol: m.Symbol,
|
||||
PricePrecision: int(math.Log10(m.LotSizeFilter.QuotePrecision.Float64())),
|
||||
VolumePrecision: int(math.Log10(m.LotSizeFilter.BasePrecision.Float64())),
|
||||
PricePrecision: m.LotSizeFilter.QuotePrecision.NumFractionalDigits(),
|
||||
VolumePrecision: m.LotSizeFilter.BasePrecision.NumFractionalDigits(),
|
||||
QuoteCurrency: m.QuoteCoin,
|
||||
BaseCurrency: m.BaseCoin,
|
||||
MinNotional: m.LotSizeFilter.MinOrderAmt,
|
||||
|
|
|
@ -2,7 +2,6 @@ package bybit
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"strconv"
|
||||
"testing"
|
||||
"time"
|
||||
|
@ -67,8 +66,8 @@ func TestToGlobalMarket(t *testing.T) {
|
|||
exp := types.Market{
|
||||
Symbol: inst.Symbol,
|
||||
LocalSymbol: inst.Symbol,
|
||||
PricePrecision: int(math.Log10(inst.LotSizeFilter.QuotePrecision.Float64())),
|
||||
VolumePrecision: int(math.Log10(inst.LotSizeFilter.BasePrecision.Float64())),
|
||||
PricePrecision: 8,
|
||||
VolumePrecision: 6,
|
||||
QuoteCurrency: inst.QuoteCoin,
|
||||
BaseCurrency: inst.BaseCoin,
|
||||
MinNotional: inst.LotSizeFilter.MinOrderAmt,
|
||||
|
|
|
@ -3,7 +3,6 @@ package kucoin
|
|||
import (
|
||||
"fmt"
|
||||
"hash/fnv"
|
||||
"math"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
@ -39,8 +38,8 @@ func toGlobalMarket(m kucoinapi.Symbol) types.Market {
|
|||
return types.Market{
|
||||
Symbol: symbol,
|
||||
LocalSymbol: m.Symbol,
|
||||
PricePrecision: int(math.Log10(m.PriceIncrement.Float64())), // convert 0.0001 to 4
|
||||
VolumePrecision: int(math.Log10(m.BaseIncrement.Float64())),
|
||||
PricePrecision: m.PriceIncrement.NumFractionalDigits(), // convert 0.0001 to 4
|
||||
VolumePrecision: m.BaseIncrement.NumFractionalDigits(),
|
||||
QuoteCurrency: m.QuoteCurrency,
|
||||
BaseCurrency: m.BaseCurrency,
|
||||
MinNotional: m.QuoteMinSize,
|
||||
|
|
Loading…
Reference in New Issue
Block a user