mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-25 08:15:15 +00:00
max: extend max exchange market information
This commit is contained in:
parent
6d00a7ba07
commit
c58375f57e
|
@ -51,9 +51,6 @@ func (e *Exchange) QueryMarkets(ctx context.Context) (types.MarketMap, error) {
|
||||||
VolumePrecision: symbol.BaseAssetPrecision,
|
VolumePrecision: symbol.BaseAssetPrecision,
|
||||||
QuoteCurrency: symbol.QuoteAsset,
|
QuoteCurrency: symbol.QuoteAsset,
|
||||||
BaseCurrency: symbol.BaseAsset,
|
BaseCurrency: symbol.BaseAsset,
|
||||||
MinAmount: 0,
|
|
||||||
MinNotional: 0,
|
|
||||||
MinLot: 0,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if f := symbol.MinNotionalFilter() ; f != nil {
|
if f := symbol.MinNotionalFilter() ; f != nil {
|
||||||
|
|
|
@ -34,6 +34,36 @@ func (e *Exchange) Name() types.ExchangeName {
|
||||||
return types.ExchangeMax
|
return types.ExchangeMax
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (e *Exchange) QueryMarkets(ctx context.Context) (types.MarketMap, error) {
|
||||||
|
remoteMarkets, err := e.client.PublicService.Markets()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
markets := types.MarketMap{}
|
||||||
|
for _, m := range remoteMarkets {
|
||||||
|
market := types.Market{
|
||||||
|
Symbol: toGlobalSymbol(m.ID),
|
||||||
|
PricePrecision: m.QuoteUnitPrecision,
|
||||||
|
VolumePrecision: m.BaseUnitPrecision,
|
||||||
|
QuoteCurrency: toGlobalCurrency(m.QuoteUnit),
|
||||||
|
BaseCurrency: toGlobalCurrency(m.BaseUnit),
|
||||||
|
MinNotional: m.MinQuoteAmount,
|
||||||
|
MinAmount: m.MinQuoteAmount,
|
||||||
|
MinLot: m.MinBaseAmount,
|
||||||
|
MinQuantity: m.MinBaseAmount,
|
||||||
|
MaxQuantity: 10000.0,
|
||||||
|
MinPrice: 0.1,
|
||||||
|
MaxPrice: 10000.0,
|
||||||
|
TickSize: 0.001,
|
||||||
|
}
|
||||||
|
|
||||||
|
markets[m.ID] = market
|
||||||
|
}
|
||||||
|
|
||||||
|
return markets, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (e *Exchange) NewStream() types.Stream {
|
func (e *Exchange) NewStream() types.Stream {
|
||||||
return NewStream(e.key, e.secret)
|
return NewStream(e.key, e.secret)
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,8 @@ type Market struct {
|
||||||
BaseUnitPrecision int `json:"base_unit_precision"`
|
BaseUnitPrecision int `json:"base_unit_precision"`
|
||||||
QuoteUnit string `json:"quote_unit"`
|
QuoteUnit string `json:"quote_unit"`
|
||||||
QuoteUnitPrecision int `json:"quote_unit_precision"`
|
QuoteUnitPrecision int `json:"quote_unit_precision"`
|
||||||
|
MinBaseAmount float64 `json:"min_base_amount"`
|
||||||
|
MinQuoteAmount float64 `json:"min_quote_amount"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Ticker struct {
|
type Ticker struct {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user