Skip to content
This repository has been archived by the owner on Jan 22, 2020. It is now read-only.

Commit

Permalink
Fixes #322
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Fleckenstein authored and Scott Fleckenstein committed Jan 11, 2017
1 parent 971495e commit 9c5aa1e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ FROM
co.priced,
co.price
ORDER BY co.price DESC
ORDER BY co.price ASC
LIMIT $1
)) summary
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,17 @@ func TestGetOrderBookSummary_Regress310(t *testing.T) {
// 0.1, 0.2, and 0.3 should appear first, when the
// query is correct. In a failing scenario the 0.2
// transaction should not appear.

tt.Assert.Equal(0.1, summary[0].Pricef)
tt.Assert.Equal(0.2, summary[1].Pricef)
tt.Assert.Equal(0.3, summary[2].Pricef)
bids := summary.Bids()
tt.Assert.Equal(10.2, bids[0].Pricef)
tt.Assert.Equal(10.1, bids[1].Pricef)
tt.Assert.Equal(10.0, bids[2].Pricef)

// validate the inverse order book is correct as well
err = q.GetOrderBookSummary(&summary, buying, selling)
tt.Require.NoError(err)
tt.Require.Len(summary, 20)

tt.Assert.Equal(1.0/10.2, summary[0].Pricef)
tt.Assert.Equal(1.0/10.1, summary[1].Pricef)
tt.Assert.Equal(1.0/10.0, summary[2].Pricef)
asks := summary.Asks()
tt.Assert.Equal(1.0/10.2, asks[0].Pricef)
tt.Assert.Equal(1.0/10.1, asks[1].Pricef)
tt.Assert.Equal(1.0/10.0, asks[2].Pricef)
}

0 comments on commit 9c5aa1e

Please sign in to comment.