mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 14:55:16 +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,
|
||||
|
|
|
@ -105,7 +105,9 @@ func (e *Exchange) QueryMarkets(ctx context.Context) (types.MarketMap, error) {
|
|||
symbolMap[symbol] = m.Name
|
||||
|
||||
market := types.Market{
|
||||
Symbol: symbol,
|
||||
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",
|
||||
})
|
||||
|
@ -47,7 +50,9 @@ func (e *Exchange) QueryMarkets(ctx context.Context) (types.MarketMap, error) {
|
|||
for _, instrument := range instruments {
|
||||
symbol := toGlobalSymbol(instrument.InstrumentID)
|
||||
market := types.Market{
|
||||
Symbol: symbol,
|
||||
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
|
||||
}
|
||||
|
|
|
@ -47,7 +47,9 @@ func (d *Duration) UnmarshalJSON(data []byte) error {
|
|||
}
|
||||
|
||||
type Market struct {
|
||||
Symbol string
|
||||
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