add maxPrice, minPrice and tickSize config

This commit is contained in:
c9s 2020-10-14 10:34:33 +08:00
parent 64c2170cd5
commit 2b41f76082
2 changed files with 12 additions and 3 deletions

View File

@ -60,6 +60,11 @@ func (e *Exchange) QueryMarkets(ctx context.Context) (types.MarketMap, error) {
market.MinNotional = util.MustParseFloat(f.MinNotional)
}
// The LOT_SIZE filter defines the quantity (aka "lots" in auction terms) rules for a symbol.
// There are 3 parts:
// minQty defines the minimum quantity/icebergQty allowed.
// maxQty defines the maximum quantity/icebergQty allowed.
// stepSize defines the intervals that a quantity/icebergQty can be increased/decreased by.
if f := symbol.LotSizeFilter() ; f != nil {
market.MinLot = util.MustParseFloat(f.MinQuantity)
market.MinQuantity = util.MustParseFloat(f.MinQuantity)
@ -68,9 +73,9 @@ func (e *Exchange) QueryMarkets(ctx context.Context) (types.MarketMap, error) {
}
if f := symbol.PriceFilter() ; f != nil {
_ = f.MaxPrice
_ = f.MinPrice
_ = f.TickSize
market.MaxPrice = util.MustParseFloat(f.MaxPrice)
market.MinPrice = util.MustParseFloat(f.MinPrice)
market.TickSize = util.MustParseFloat(f.TickSize)
}
markets[symbol.Symbol] = market

View File

@ -20,6 +20,10 @@ type Market struct {
MinAmount float64
MinNotional float64
MinLot float64
MinPrice float64
MaxPrice float64
TickSize float64
}
func (m Market) FormatPrice(val float64) string {