@tradejs/connectors 3.1.29-beta.299 → 3.1.29-beta.300
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +37 -0
- package/dist/index.mjs +37 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -724,6 +724,42 @@ var ByBitConnectorCreator = async (config, runtime) => {
|
|
|
724
724
|
}
|
|
725
725
|
return instruments;
|
|
726
726
|
};
|
|
727
|
+
const listDelistings = async () => {
|
|
728
|
+
const client = await getPublicClient();
|
|
729
|
+
const delistings = /* @__PURE__ */ new Map();
|
|
730
|
+
if (!client) return delistings;
|
|
731
|
+
let cursor;
|
|
732
|
+
do {
|
|
733
|
+
const response = await withTimeout(
|
|
734
|
+
client.getInstrumentsInfo({
|
|
735
|
+
category: BYBIT_CATEGORY2,
|
|
736
|
+
status: "Closed",
|
|
737
|
+
limit: LIMIT,
|
|
738
|
+
cursor
|
|
739
|
+
}),
|
|
740
|
+
1e4,
|
|
741
|
+
"Bybit delistings"
|
|
742
|
+
);
|
|
743
|
+
if (response.retCode !== 0) {
|
|
744
|
+
throw new Error(
|
|
745
|
+
`Bybit delistings failed: ${response.retCode} ${response.retMsg}`
|
|
746
|
+
);
|
|
747
|
+
}
|
|
748
|
+
for (const item of response.result.list) {
|
|
749
|
+
const symbol = item.symbol.trim().toUpperCase();
|
|
750
|
+
const timestamp = toFiniteNumberOrNull(item.deliveryTime);
|
|
751
|
+
if (symbol && item.status === "Closed" && item.contractType === "LinearPerpetual" && timestamp !== null && Number.isSafeInteger(timestamp) && timestamp > 0) {
|
|
752
|
+
delistings.set(symbol, timestamp);
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
const nextCursor = response.result.nextPageCursor;
|
|
756
|
+
if (nextCursor && nextCursor === cursor) {
|
|
757
|
+
throw new Error("Bybit delistings pagination did not advance");
|
|
758
|
+
}
|
|
759
|
+
cursor = nextCursor;
|
|
760
|
+
} while (cursor);
|
|
761
|
+
return delistings;
|
|
762
|
+
};
|
|
727
763
|
const loadInstrumentUniverse = (requestedUniverse) => {
|
|
728
764
|
const cached = instrumentCache.get(requestedUniverse);
|
|
729
765
|
if (cached && cached.expiresAt > Date.now()) {
|
|
@@ -1186,6 +1222,7 @@ var ByBitConnectorCreator = async (config, runtime) => {
|
|
|
1186
1222
|
accountId: config.accountId,
|
|
1187
1223
|
deploymentId: config.deploymentId,
|
|
1188
1224
|
listInstruments,
|
|
1225
|
+
listDelistings,
|
|
1189
1226
|
getState: async () => state,
|
|
1190
1227
|
setState: async (newState) => {
|
|
1191
1228
|
state = { ...state, ...newState };
|
package/dist/index.mjs
CHANGED
|
@@ -676,6 +676,42 @@ var ByBitConnectorCreator = async (config, runtime) => {
|
|
|
676
676
|
}
|
|
677
677
|
return instruments;
|
|
678
678
|
};
|
|
679
|
+
const listDelistings = async () => {
|
|
680
|
+
const client = await getPublicClient();
|
|
681
|
+
const delistings = /* @__PURE__ */ new Map();
|
|
682
|
+
if (!client) return delistings;
|
|
683
|
+
let cursor;
|
|
684
|
+
do {
|
|
685
|
+
const response = await withTimeout(
|
|
686
|
+
client.getInstrumentsInfo({
|
|
687
|
+
category: BYBIT_CATEGORY2,
|
|
688
|
+
status: "Closed",
|
|
689
|
+
limit: LIMIT,
|
|
690
|
+
cursor
|
|
691
|
+
}),
|
|
692
|
+
1e4,
|
|
693
|
+
"Bybit delistings"
|
|
694
|
+
);
|
|
695
|
+
if (response.retCode !== 0) {
|
|
696
|
+
throw new Error(
|
|
697
|
+
`Bybit delistings failed: ${response.retCode} ${response.retMsg}`
|
|
698
|
+
);
|
|
699
|
+
}
|
|
700
|
+
for (const item of response.result.list) {
|
|
701
|
+
const symbol = item.symbol.trim().toUpperCase();
|
|
702
|
+
const timestamp = toFiniteNumberOrNull(item.deliveryTime);
|
|
703
|
+
if (symbol && item.status === "Closed" && item.contractType === "LinearPerpetual" && timestamp !== null && Number.isSafeInteger(timestamp) && timestamp > 0) {
|
|
704
|
+
delistings.set(symbol, timestamp);
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
const nextCursor = response.result.nextPageCursor;
|
|
708
|
+
if (nextCursor && nextCursor === cursor) {
|
|
709
|
+
throw new Error("Bybit delistings pagination did not advance");
|
|
710
|
+
}
|
|
711
|
+
cursor = nextCursor;
|
|
712
|
+
} while (cursor);
|
|
713
|
+
return delistings;
|
|
714
|
+
};
|
|
679
715
|
const loadInstrumentUniverse = (requestedUniverse) => {
|
|
680
716
|
const cached = instrumentCache.get(requestedUniverse);
|
|
681
717
|
if (cached && cached.expiresAt > Date.now()) {
|
|
@@ -1138,6 +1174,7 @@ var ByBitConnectorCreator = async (config, runtime) => {
|
|
|
1138
1174
|
accountId: config.accountId,
|
|
1139
1175
|
deploymentId: config.deploymentId,
|
|
1140
1176
|
listInstruments,
|
|
1177
|
+
listDelistings,
|
|
1141
1178
|
getState: async () => state,
|
|
1142
1179
|
setState: async (newState) => {
|
|
1143
1180
|
state = { ...state, ...newState };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tradejs/connectors",
|
|
3
|
-
"version": "3.1.29-beta.
|
|
3
|
+
"version": "3.1.29-beta.300",
|
|
4
4
|
"description": "MIT-licensed exchange connectors and market data providers for the TradeJS framework.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tradejs",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@tradejs/core": "^3.1.29-beta.
|
|
43
|
-
"@tradejs/types": "^3.1.29-beta.
|
|
42
|
+
"@tradejs/core": "^3.1.29-beta.300",
|
|
43
|
+
"@tradejs/types": "^3.1.29-beta.300",
|
|
44
44
|
"bybit-api": "^4.7.1",
|
|
45
45
|
"chalk": "4.1.2",
|
|
46
46
|
"lodash": "^4.18.1"
|