orderbook: fix fields not being retrieved when getting orderbook.Base (#1793)

* orderbook: fix fields not being retrieved

* glorious: nits

---------

Co-authored-by: shazbert <ryan.oharareid@thrasher.io>
This commit is contained in:
Ryan O'Hara-Reid
2025-02-10 13:54:02 +11:00
committed by GitHub
parent 5c892307c7
commit 45652564f4
2 changed files with 15 additions and 0 deletions

View File

@@ -84,6 +84,8 @@ func (d *Depth) Retrieve() (*Base, error) {
VerifyOrderbook: d.verifyOrderbook,
MaxDepth: d.maxDepth,
ChecksumStringRequired: d.checksumStringRequired,
RestSnapshot: d.restSnapshot,
IDAlignment: d.idAligned,
}, nil
}

View File

@@ -96,7 +96,20 @@ func TestRetrieve(t *testing.T) {
assert.NoError(t, err, "Retrieve should not error")
assert.Len(t, ob.Asks, 1, "Should have correct Asks")
assert.Len(t, ob.Bids, 1, "Should have correct Bids")
assert.Equal(t, "THE BIG ONE!!!!!!", ob.Exchange, "Should have correct Exchange")
assert.Equal(t, currency.NewPair(currency.THETA, currency.USD), ob.Pair, "Should have correct Pair")
assert.Equal(t, asset.DownsideProfitContract, ob.Asset, "Should have correct Asset")
assert.Equal(t, d.options.lastUpdated, ob.LastUpdated, "Should have correct LastUpdated")
assert.Equal(t, d.options.updatePushedAt, ob.UpdatePushedAt, "Should have correct UpdatePushedAt")
assert.Equal(t, d.options.insertedAt, ob.InsertedAt, "Should have correct InsertedAt")
assert.EqualValues(t, 1337, ob.LastUpdateID, "Should have correct LastUpdateID")
assert.True(t, ob.PriceDuplication, "Should have correct PriceDuplication")
assert.True(t, ob.IsFundingRate, "Should have correct IsFundingRate")
assert.True(t, ob.VerifyOrderbook, "Should have correct VerifyOrderbook")
assert.True(t, ob.RestSnapshot, "Should have correct RestSnapshot")
assert.True(t, ob.IDAlignment, "Should have correct IDAligned")
assert.Equal(t, 10, ob.MaxDepth, "Should have correct MaxDepth")
assert.True(t, ob.ChecksumStringRequired, "Should have correct ChecksumStringRequired")
}
func TestTotalAmounts(t *testing.T) {