mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 23:05:15 +00:00
add LocalSymbol field for exchange specific symbol
This commit is contained in:
parent
97b377da0a
commit
ea78c0308b
|
@ -122,6 +122,7 @@ func (e *Exchange) QueryMarkets(ctx context.Context) (types.MarketMap, error) {
|
|||
for _, symbol := range exchangeInfo.Symbols {
|
||||
market := types.Market{
|
||||
Symbol: symbol.Symbol,
|
||||
LocalSymbol: symbol.Symbol,
|
||||
PricePrecision: symbol.QuotePrecision,
|
||||
VolumePrecision: symbol.BaseAssetPrecision,
|
||||
QuoteCurrency: symbol.QuoteAsset,
|
||||
|
|
|
@ -106,6 +106,8 @@ func (e *Exchange) QueryMarkets(ctx context.Context) (types.MarketMap, error) {
|
|||
|
||||
market := types.Market{
|
||||
Symbol: symbol,
|
||||
LocalSymbol: m.Name,
|
||||
|
||||
// The max precision is length(DefaultPow). For example, currently fixedpoint.DefaultPow
|
||||
// is 1e8, so the max precision will be 8.
|
||||
PricePrecision: fixedpoint.NumFractionalDigits(fixedpoint.NewFromFloat(m.PriceIncrement)),
|
||||
|
|
|
@ -128,6 +128,7 @@ func (e *Exchange) QueryMarkets(ctx context.Context) (types.MarketMap, error) {
|
|||
|
||||
market := types.Market{
|
||||
Symbol: symbol,
|
||||
LocalSymbol: m.ID,
|
||||
PricePrecision: m.QuoteUnitPrecision,
|
||||
VolumePrecision: m.BaseUnitPrecision,
|
||||
QuoteCurrency: toGlobalCurrency(m.QuoteUnit),
|
||||
|
|
|
@ -9,6 +9,9 @@ import (
|
|||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// OKB is the platform currency of OKEx, pre-allocate static string here
|
||||
const OKB = "OKB"
|
||||
|
||||
var log = logrus.WithFields(logrus.Fields{
|
||||
"exchange": "okex",
|
||||
})
|
||||
|
@ -48,6 +51,8 @@ func (e *Exchange) QueryMarkets(ctx context.Context) (types.MarketMap, error) {
|
|||
symbol := toGlobalSymbol(instrument.InstrumentID)
|
||||
market := types.Market{
|
||||
Symbol: symbol,
|
||||
LocalSymbol: instrument.InstrumentID,
|
||||
|
||||
QuoteCurrency: instrument.QuoteCurrency,
|
||||
BaseCurrency: instrument.BaseCurrency,
|
||||
|
||||
|
@ -83,5 +88,5 @@ func (e *Exchange) QueryTickers(ctx context.Context, symbol string) (*types.Tick
|
|||
}
|
||||
|
||||
func (e *Exchange) PlatformFeeCurrency() string {
|
||||
return "OKB"
|
||||
return OKB
|
||||
}
|
||||
|
|
|
@ -48,6 +48,8 @@ func (d *Duration) UnmarshalJSON(data []byte) error {
|
|||
|
||||
type Market struct {
|
||||
Symbol string
|
||||
LocalSymbol string // LocalSymbol is used for exchange's API
|
||||
|
||||
PricePrecision int
|
||||
VolumePrecision int
|
||||
QuoteCurrency string
|
||||
|
|
Loading…
Reference in New Issue
Block a user