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

Implement OKEx v5 api #326

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update OkexClient test according to new okex V5 API
  • Loading branch information
MarhiievHE committed Apr 22, 2022
commit 5aeef89a6dfb0960ec467ab9bd9a0614f7568db5
40 changes: 20 additions & 20 deletions __tests__/exchanges/OkexClient.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ testClient({
exchangeName: "OKEx",
clientName: "OKExClient - Futures",
fetchMarkets: async () => {
const results: any = await get("https://www.okex.com/api/futures/v3/instruments");
return results
.filter(p => p.base_currency === "BTC")
const results: any = await get("https://www.okx.com/api/v5/public/instruments?instType=FUTURES");
return results.data
.filter(p => p.settleCcy === "BTC")
.map(p => ({
id: p.instrument_id,
base: p.base_currency,
quote: p.quote_currency,
type: "futures",
id: p.instId,
base: p.settleCcy,
quote: p.ctValCcy,
type: "FUTURES",
}));
},
...assertions,
Expand All @@ -97,14 +97,14 @@ testClient({
exchangeName: "OKEx",
clientName: "OKExClient - Swap",
fetchMarkets: async () => {
const results: any = await get("https://www.okex.com/api/swap/v3/instruments");
return results
.filter(p => ["BTC", "ETH", "LTC"].includes(p.base_currency))
const results: any = await get("https://www.okx.com/api/v5/public/instruments?instType=SWAP");
return results.data
.filter(p => ["BTC", "ETH", "LTC"].includes(p.settleCcy))
.map(p => ({
id: p.instrument_id,
base: p.base_currency,
quote: p.quote_currency,
type: "swap",
id: p.instId,
base: p.settleCcy,
quote: p.ctValCcy,
type: "SWAP",
}));
},
...assertions,
Expand All @@ -115,13 +115,13 @@ testClient({
exchangeName: "OKEx",
clientName: "OKExClient - Options",
fetchMarkets: async () => {
const results: any = await get("https://www.okex.com/api/option/v3/instruments/BTC-USD");
return results
const results: any = await get("https://www.okx.com/api/v5/public/instruments?instType=OPTION&uly=BTC-USD");
return results.data
.map(p => ({
id: p.instrument_id,
base: p.base_currency,
quote: p.quote_currency,
type: "option",
id: p.instId,
base: p.settleCcy,
quote: p.ctValCcy,
type: "OPTION",
}))
.filter(p => p.id.endsWith("-C"))
.slice(0, 20);
Expand Down