Skip to content

Commit

Permalink
Merge pull request #122 from Polymarket/feat/orderbook-ts
Browse files Browse the repository at this point in the history
Adding `timestamp` to orderbook summaries
  • Loading branch information
poly-rodr authored Sep 24, 2024
2 parents f7f67e1 + dfce74b commit 8a9186c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ export interface OrderBookSummary {
market: string;
asset_id: string;
hash: string;
timestamp: string;
bids: OrderSummary[];
asks: OrderSummary[];
}
Expand Down
17 changes: 10 additions & 7 deletions tests/utilities.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5551,12 +5551,13 @@ describe("utilities", () => {
{ price: "0.7", size: "100" },
],
hash: "",
timestamp: "123456789",
} as OrderBookSummary;

expect(generateOrderBookSummaryHash(orderbook)).to.equal(
"b8b72c72c6534d1b3a4e7fb47b81672d0e94d5a5",
"a2e42a1dc528c65bb927faef7539ffef1b9484de",
);
expect(orderbook.hash).to.equal("b8b72c72c6534d1b3a4e7fb47b81672d0e94d5a5");
expect(orderbook.hash).to.equal("a2e42a1dc528c65bb927faef7539ffef1b9484de");

// -
orderbook = {
Expand All @@ -5570,13 +5571,14 @@ describe("utilities", () => {
{ price: "0.6", size: "100" },
{ price: "0.7", size: "100" },
],
hash: "b8b72c72c6534d1b3a4e7fb47b81672d0e94d5a5",
hash: "a2e42a1dc528c65bb927faef7539ffef1b9484de",
timestamp: "123456789",
} as OrderBookSummary;

expect(generateOrderBookSummaryHash(orderbook)).to.equal(
"b8b72c72c6534d1b3a4e7fb47b81672d0e94d5a5",
"a2e42a1dc528c65bb927faef7539ffef1b9484de",
);
expect(orderbook.hash).to.equal("b8b72c72c6534d1b3a4e7fb47b81672d0e94d5a5");
expect(orderbook.hash).to.equal("a2e42a1dc528c65bb927faef7539ffef1b9484de");

// -
orderbook = {
Expand All @@ -5585,12 +5587,13 @@ describe("utilities", () => {
bids: [],
asks: [],
hash: "",
timestamp: "",
} as OrderBookSummary;

expect(generateOrderBookSummaryHash(orderbook)).to.equal(
"7f81a35a09e1933a96b05edb51ac4be4a6163146",
"9da2ac9109ceed8d754f9a5f7a06998d8d3aa0af",
);
expect(orderbook.hash).to.equal("7f81a35a09e1933a96b05edb51ac4be4a6163146");
expect(orderbook.hash).to.equal("9da2ac9109ceed8d754f9a5f7a06998d8d3aa0af");
});

it("isTickSizeSmaller", () => {
Expand Down

0 comments on commit 8a9186c

Please sign in to comment.