Skip to content
This repository has been archived by the owner on Sep 9, 2023. It is now read-only.

Commit

Permalink
gemini: convert to TS
Browse files Browse the repository at this point in the history
  • Loading branch information
bmancini55 committed Jun 14, 2021
1 parent 84e150b commit 78e6854
Show file tree
Hide file tree
Showing 5 changed files with 573 additions and 507 deletions.
2 changes: 2 additions & 0 deletions __tests__/TestRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export type L2SnapshotOptions = {
hasTimestampMs?: boolean;
hasSequenceId?: boolean;
hasCount?: boolean;
hasEventId?: boolean;
tests?: (spec: any, result: any) => void;
};

Expand All @@ -104,6 +105,7 @@ export type L2UpdateOptions = {
hasTimestampMs?: boolean;
hasSequenceId?: boolean;
hasLastSequenceId?: boolean;
hasEventId?: boolean;
hasEventMs?: boolean;
hasCount?: boolean;
tests?: (spec: any, result: any) => void;
Expand Down
82 changes: 82 additions & 0 deletions __tests__/exchanges/GeminiClient.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import { testClient } from "../TestRunner";
import { GeminiClient } from "../../src/exchanges/Geminiclient";

testClient({
clientFactory: () => new GeminiClient(),
clientName: "GeminiClient",
exchangeName: "Gemini",
markets: [
{
id: "btcusd",
base: "BTC",
quote: "USD",
},
{
id: "ethusd",
base: "ETH",
quote: "USD",
},
{
id: "ltcusd",
base: "LTC",
quote: "USD",
},
],

getEventingSocket(client, market) {
return (client as any)._subscriptions.get(market.id).wss;
},

testConnectEvents: true,
testDisconnectEvents: true,
testReconnectionEvents: true,
testCloseEvents: true,

hasTickers: true,
hasTrades: true,
hasCandles: false,
hasLevel2Snapshots: false,
hasLevel2Updates: true,
hasLevel3Snapshots: false,
hasLevel3Updates: false,

trade: {
hasTradeId: true,
},

ticker: {
hasTimestamp: true,
hasLast: true,
hasOpen: false,
hasHigh: false,
hasLow: false,
hasVolume: false,
hasQuoteVolume: false,
hasChange: false,
hasChangePercent: false,
hasBid: true,
hasBidVolume: false,
hasAsk: true,
hasAskVolume: false,
},

l2snapshot: {
hasTimestampMs: false,
hasSequenceId: true,
hasEventId: true,
hasCount: false,
},

l2update: {
done: function (spec, result, update) {
const hasAsks = update.asks && update.asks.length > 0;
const hasBids = update.bids && update.bids.length > 0;
return hasAsks || hasBids;
},
hasSnapshot: true,
hasTimestampMs: true,
hasSequenceId: true,
hasEventId: true,
hasCount: false,
},
});
82 changes: 0 additions & 82 deletions __tests__/exchanges/gemini-client.spec.js

This file was deleted.

Loading

0 comments on commit 78e6854

Please sign in to comment.