mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +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,
|
||||
QuoteCurrency: symbol.QuoteAsset,
|
||||
BaseCurrency: symbol.BaseAsset,
|
||||
MinAmount: 0,
|
||||
MinNotional: 0,
|
||||
MinLot: 0,
|
||||
}
|
||||
|
||||
if f := symbol.MinNotionalFilter() ; f != nil {
|
||||
|
|
|
@ -34,6 +34,36 @@ func (e *Exchange) Name() types.ExchangeName {
|
|||
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 {
|
||||
return NewStream(e.key, e.secret)
|
||||
}
|
||||
|
|
|
@ -19,12 +19,14 @@ type PublicService struct {
|
|||
}
|
||||
|
||||
type Market struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
BaseUnit string `json:"base_unit"`
|
||||
BaseUnitPrecision int `json:"base_unit_precision"`
|
||||
QuoteUnit string `json:"quote_unit"`
|
||||
QuoteUnitPrecision int `json:"quote_unit_precision"`
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
BaseUnit string `json:"base_unit"`
|
||||
BaseUnitPrecision int `json:"base_unit_precision"`
|
||||
QuoteUnit string `json:"quote_unit"`
|
||||
QuoteUnitPrecision int `json:"quote_unit_precision"`
|
||||
MinBaseAmount float64 `json:"min_base_amount"`
|
||||
MinQuoteAmount float64 `json:"min_quote_amount"`
|
||||
}
|
||||
|
||||
type Ticker struct {
|
||||
|
|
Loading…
Reference in New Issue
Block a user