mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-21 22:43:52 +00:00
liqmaker: fix actual orders printing
This commit is contained in:
parent
6004114696
commit
2b0e4e0512
|
@ -136,6 +136,23 @@ func TestLiquidityOrderGenerator(t *testing.T) {
|
|||
BUY,0.2589,105.5
|
||||
BUY,0.2558,110.67
|
||||
BUY,0.2527,116.09
|
||||
`, orders[0:13])
|
||||
BUY,0.2496,121.77
|
||||
BUY,0.2465,127.74
|
||||
BUY,0.2434,133.99
|
||||
BUY,0.2403,140.55
|
||||
BUY,0.2372,147.44
|
||||
BUY,0.2341,154.65
|
||||
BUY,0.231,162.23
|
||||
BUY,0.2279,170.17
|
||||
BUY,0.2248,178.5
|
||||
BUY,0.2217,187.24
|
||||
BUY,0.2186,196.41
|
||||
BUY,0.2155,206.03
|
||||
BUY,0.2124,216.12
|
||||
BUY,0.2093,226.7
|
||||
BUY,0.2062,237.8
|
||||
BUY,0.2031,249.44
|
||||
BUY,0.2,261.66
|
||||
`, orders)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -62,17 +62,19 @@ func AssertOrdersPriceSideQuantityFromText(
|
|||
) {
|
||||
asserts := ParsePriceSideQuantityAssertions(text)
|
||||
assert.Equalf(t, len(asserts), len(orders), "expecting %d orders", len(asserts))
|
||||
actualInText := "Actual Orders:\n"
|
||||
for i, a := range asserts {
|
||||
order := orders[i]
|
||||
assert.Equalf(t, a.Price.Float64(), order.Price.Float64(), "order #%d price should be %f", i+1, a.Price.Float64())
|
||||
assert.Equalf(t, a.Quantity.Float64(), order.Quantity.Float64(), "order #%d quantity should be %f", i+1, a.Quantity.Float64())
|
||||
assert.Equalf(t, a.Side, orders[i].Side, "order at price %f should be %s", a.Price.Float64(), a.Side)
|
||||
|
||||
actualInText += fmt.Sprintf("%s,%s,%s\n", order.Side, order.Price.String(), order.Quantity.String())
|
||||
}
|
||||
|
||||
if t.Failed() {
|
||||
actualInText := "Actual Orders:\n"
|
||||
for _, order := range orders {
|
||||
actualInText += fmt.Sprintf("%s,%s,%s\n", order.Side, order.Price.String(), order.Quantity.String())
|
||||
}
|
||||
t.Log(actualInText)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user