mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 00:35:15 +00:00
try to keep all orders from order store
This commit is contained in:
parent
c40982164a
commit
914d5cdc94
|
@ -10,6 +10,8 @@ type OrderStore struct {
|
|||
// any created orders for tracking trades
|
||||
mu sync.Mutex
|
||||
orders map[uint64]types.Order
|
||||
|
||||
RemoveCancelled bool
|
||||
}
|
||||
|
||||
func NewOrderStore() *OrderStore {
|
||||
|
@ -62,7 +64,12 @@ func (s *OrderStore) handleOrderUpdate(order types.Order) {
|
|||
case types.OrderStatusPartiallyFilled, types.OrderStatusNew, types.OrderStatusFilled:
|
||||
s.Update(order)
|
||||
|
||||
case types.OrderStatusCanceled, types.OrderStatusRejected:
|
||||
case types.OrderStatusCanceled:
|
||||
if s.RemoveCancelled {
|
||||
s.Remove(order)
|
||||
}
|
||||
|
||||
case types.OrderStatusRejected:
|
||||
s.Remove(order)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,51 +69,4 @@ func (m Market) CanonicalizeVolume(val float64) float64 {
|
|||
return math.Trunc(p*val) / p
|
||||
}
|
||||
|
||||
var MarketBTCUSDT = Market{
|
||||
Symbol: "BTCUSDT",
|
||||
BaseCurrency: "BTC",
|
||||
QuoteCurrency: "USDT",
|
||||
PricePrecision: 2,
|
||||
VolumePrecision: 6,
|
||||
MinQuantity: 0.000001,
|
||||
MinLot: 0.000001,
|
||||
MinAmount: 10.0,
|
||||
MinNotional: 10.0,
|
||||
}
|
||||
|
||||
var MarketETHUSDT = Market{
|
||||
Symbol: "ETHUSDT",
|
||||
BaseCurrency: "ETH",
|
||||
QuoteCurrency: "USDT",
|
||||
PricePrecision: 2,
|
||||
VolumePrecision: 5,
|
||||
MinQuantity: 0.01,
|
||||
MinLot: 0.01,
|
||||
MinAmount: 10.0,
|
||||
MinNotional: 10.0,
|
||||
}
|
||||
|
||||
var MarketBNBUSDT = Market{
|
||||
Symbol: "BNBUSDT",
|
||||
BaseCurrency: "BNB",
|
||||
QuoteCurrency: "USDT",
|
||||
PricePrecision: 4,
|
||||
VolumePrecision: 2,
|
||||
MinQuantity: 0.01,
|
||||
MinLot: 0.01,
|
||||
MinAmount: 10.0,
|
||||
MinNotional: 10.0,
|
||||
}
|
||||
|
||||
type MarketMap map[string]Market
|
||||
|
||||
var Markets = map[string]Market{
|
||||
"ETHUSDT": MarketETHUSDT,
|
||||
"BNBUSDT": MarketBNBUSDT,
|
||||
"BTCUSDT": MarketBTCUSDT,
|
||||
}
|
||||
|
||||
func FindMarket(symbol string) (m Market, ok bool) {
|
||||
m, ok = Markets[symbol]
|
||||
return m, ok
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user