@blackcube/xgate-sdk 0.25.5 → 0.56.0
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.cjs +54 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +44 -1
- package/dist/index.d.ts +44 -1
- package/dist/index.js +54 -1
- package/dist/index.js.map +1 -1
- package/package.json +11 -11
package/dist/index.d.cts
CHANGED
|
@@ -39,6 +39,37 @@ declare enum XgateEx {
|
|
|
39
39
|
/** Toutes les venues connues, dans l'ordre de déclaration. */
|
|
40
40
|
declare const XGATE_EXCHANGES: readonly XgateEx[];
|
|
41
41
|
|
|
42
|
+
/**
|
|
43
|
+
* CE QUE COTE UNE PAIRE — de la crypto, ou autre chose.
|
|
44
|
+
*
|
|
45
|
+
* Les venues perpétuelles ne listent plus seulement des cryptos : bybit publie 164 actions, 43 ETF et
|
|
46
|
+
* quatre matières premières, binance ouvre des `TRADIFI_PERPETUAL` sur NVDA et l'or, extended range
|
|
47
|
+
* ses actions en `RWA`. Le catalogue les rendait toutes indistinctes.
|
|
48
|
+
*
|
|
49
|
+
* ⚠️ CE N'EST PAS UNE COMMODITÉ DE CLASSEMENT. Le 2026-08-24, `PURR` cotait 11 $ chez bybit et
|
|
50
|
+
* 0,13 $ chez hyperliquid : le premier est une ACTION, le second le memecoin natif d'Hyperliquid.
|
|
51
|
+
* Même ticker, deux actifs — et un consommateur qui médiane « le prix de PURR » entre venues
|
|
52
|
+
* publiait un nombre qui n'était le prix d'aucun des deux. Le rapport n'était même pas constant
|
|
53
|
+
* (71 à 116 sur douze jours), ce qui excluait une échelle de cotation.
|
|
54
|
+
*
|
|
55
|
+
* ⚠️ ET CE N'EST PAS DÉDUCTIBLE DU TICKER. `SPX` est le memecoin SPX6900 chez binance, bybit et
|
|
56
|
+
* extended — qui le disent tous les trois (`underlyingSubType: ["Meme"]`, `subCategory: "Meme"`) —
|
|
57
|
+
* alors que l'indice S&P 500 s'appelle `SP500` chez pacifica. Une règle sur le nom aurait classé les
|
|
58
|
+
* deux à l'envers.
|
|
59
|
+
*/
|
|
60
|
+
type AssetClass = 'crypto' | 'stock' | 'commodity' | 'index' | 'etf' | 'forex';
|
|
61
|
+
/**
|
|
62
|
+
* LA CLASSE D'ACTIF D'UNE PAIRE, ou `undefined` quand la venue ne se prononce pas.
|
|
63
|
+
*
|
|
64
|
+
* ⚠️ `undefined` N'EST PAS « CRYPTO ». hyperliquid et pacifica cotent NVDA, TSLA, XAU et PLTR sans
|
|
65
|
+
* publier la moindre catégorie : les classer d'office en crypto reproduirait exactement l'erreur
|
|
66
|
+
* qu'on corrige ici. « On ne sait pas » est une information ; une valeur inventée n'en est pas une.
|
|
67
|
+
*
|
|
68
|
+
* Une catégorie inconnue rend `undefined` plutôt que de retomber sur `crypto` — le jour où une venue
|
|
69
|
+
* en ajoute une, on veut le voir, pas l'absorber.
|
|
70
|
+
*/
|
|
71
|
+
declare function assetClassOf(xex: XgateEx, xtras?: Record<string, unknown>): AssetClass | undefined;
|
|
72
|
+
|
|
42
73
|
/** Type de marché. */
|
|
43
74
|
type MarketKind = 'perp' | 'spot';
|
|
44
75
|
/**
|
|
@@ -77,6 +108,18 @@ interface IPair {
|
|
|
77
108
|
* ramène toutes les venues à la même unité.
|
|
78
109
|
*/
|
|
79
110
|
multiplier: number;
|
|
111
|
+
/**
|
|
112
|
+
* CE QUE LA PAIRE COTE — `undefined` quand la venue ne le dit pas.
|
|
113
|
+
*
|
|
114
|
+
* Les venues perpétuelles ne listent plus que de la crypto : bybit publie 164 actions, 43 ETF et
|
|
115
|
+
* quatre matières premières, binance ouvre des `TRADIFI_PERPETUAL` sur NVDA et l'or. Sans ce
|
|
116
|
+
* champ, un consommateur mélange deux actifs qui partagent un ticker — `PURR` valait 11 $ chez
|
|
117
|
+
* bybit (une ACTION) et 0,13 $ chez hyperliquid (le memecoin) le 2026-08-24.
|
|
118
|
+
*
|
|
119
|
+
* ⚠️ `undefined` NE VEUT PAS DIRE « crypto ». hyperliquid et pacifica cotent NVDA, TSLA et XAU
|
|
120
|
+
* sans publier de catégorie : les supposer crypto referait l'erreur qu'on corrige.
|
|
121
|
+
*/
|
|
122
|
+
assetClass?: AssetClass;
|
|
80
123
|
/**
|
|
81
124
|
* ÉCHÉANCE du contrat. `undefined` pour un perpétuel — l'immense majorité.
|
|
82
125
|
*
|
|
@@ -1857,4 +1900,4 @@ declare function expiryOf(xtras?: Record<string, unknown>): Date | undefined;
|
|
|
1857
1900
|
*/
|
|
1858
1901
|
declare function isDated(xtras?: Record<string, unknown>): boolean;
|
|
1859
1902
|
|
|
1860
|
-
export { CANDLES_MAX_HISTORY, CANDLES_PER_CALL, CandlesService, CandlesStreamRegistry, CandlesStreamService, CatalogService, type Direction, type IAccountState, type IBalance, type ICandle, type ICandlesQuery, type IEntryWithProtection, type IEquityPoint, type IFundingPaid, type IMoveStop, type IMovement, type IOrder, type IPair, type IPosition, type IPrice, type IProtection, type IProtectionInput, type IProtectionLeg, type IPublicTrade, type ITarget, type ITrade, type ITradingAccess, type IWalletAccess, type IXexAccess, type IXexSpotSource, type MarketKind, type MovementKind, type MovementStatus, ORDER_STATUSES, type OrderStatus, type OrderType, PricesService, REST_THROTTLE_MS, SPOT_XEXES, type Side, SpotCandlesService, SpotCatalogService, SpotPricesService, SpotWsCandlesService, TIMEFRAME_MINUTES, type TimeInForce, Timeframe, TradingService, type Unsubscribe, WALLET_XEXES, WS_SUBSCRIPTION_LIMITS, WalletService, WsCandlesService, WsTradesService, XGATE_EXCHANGES, XgateEx, XgateModule, buildLevels, buildProtection, candlesMaxHistoryOf, candlesPerCallOf, canonicalFromBase, canonicalFromXex, expiryOf, isDated, multiplierFromXex, restThrottleOf, roundPrice, roundToStep, servesNatively, servesSpot, sourceFor, subscriptionLimitOf, timeframeMs };
|
|
1903
|
+
export { type AssetClass, CANDLES_MAX_HISTORY, CANDLES_PER_CALL, CandlesService, CandlesStreamRegistry, CandlesStreamService, CatalogService, type Direction, type IAccountState, type IBalance, type ICandle, type ICandlesQuery, type IEntryWithProtection, type IEquityPoint, type IFundingPaid, type IMoveStop, type IMovement, type IOrder, type IPair, type IPosition, type IPrice, type IProtection, type IProtectionInput, type IProtectionLeg, type IPublicTrade, type ITarget, type ITrade, type ITradingAccess, type IWalletAccess, type IXexAccess, type IXexSpotSource, type MarketKind, type MovementKind, type MovementStatus, ORDER_STATUSES, type OrderStatus, type OrderType, PricesService, REST_THROTTLE_MS, SPOT_XEXES, type Side, SpotCandlesService, SpotCatalogService, SpotPricesService, SpotWsCandlesService, TIMEFRAME_MINUTES, type TimeInForce, Timeframe, TradingService, type Unsubscribe, WALLET_XEXES, WS_SUBSCRIPTION_LIMITS, WalletService, WsCandlesService, WsTradesService, XGATE_EXCHANGES, XgateEx, XgateModule, assetClassOf, buildLevels, buildProtection, candlesMaxHistoryOf, candlesPerCallOf, canonicalFromBase, canonicalFromXex, expiryOf, isDated, multiplierFromXex, restThrottleOf, roundPrice, roundToStep, servesNatively, servesSpot, sourceFor, subscriptionLimitOf, timeframeMs };
|
package/dist/index.d.ts
CHANGED
|
@@ -39,6 +39,37 @@ declare enum XgateEx {
|
|
|
39
39
|
/** Toutes les venues connues, dans l'ordre de déclaration. */
|
|
40
40
|
declare const XGATE_EXCHANGES: readonly XgateEx[];
|
|
41
41
|
|
|
42
|
+
/**
|
|
43
|
+
* CE QUE COTE UNE PAIRE — de la crypto, ou autre chose.
|
|
44
|
+
*
|
|
45
|
+
* Les venues perpétuelles ne listent plus seulement des cryptos : bybit publie 164 actions, 43 ETF et
|
|
46
|
+
* quatre matières premières, binance ouvre des `TRADIFI_PERPETUAL` sur NVDA et l'or, extended range
|
|
47
|
+
* ses actions en `RWA`. Le catalogue les rendait toutes indistinctes.
|
|
48
|
+
*
|
|
49
|
+
* ⚠️ CE N'EST PAS UNE COMMODITÉ DE CLASSEMENT. Le 2026-08-24, `PURR` cotait 11 $ chez bybit et
|
|
50
|
+
* 0,13 $ chez hyperliquid : le premier est une ACTION, le second le memecoin natif d'Hyperliquid.
|
|
51
|
+
* Même ticker, deux actifs — et un consommateur qui médiane « le prix de PURR » entre venues
|
|
52
|
+
* publiait un nombre qui n'était le prix d'aucun des deux. Le rapport n'était même pas constant
|
|
53
|
+
* (71 à 116 sur douze jours), ce qui excluait une échelle de cotation.
|
|
54
|
+
*
|
|
55
|
+
* ⚠️ ET CE N'EST PAS DÉDUCTIBLE DU TICKER. `SPX` est le memecoin SPX6900 chez binance, bybit et
|
|
56
|
+
* extended — qui le disent tous les trois (`underlyingSubType: ["Meme"]`, `subCategory: "Meme"`) —
|
|
57
|
+
* alors que l'indice S&P 500 s'appelle `SP500` chez pacifica. Une règle sur le nom aurait classé les
|
|
58
|
+
* deux à l'envers.
|
|
59
|
+
*/
|
|
60
|
+
type AssetClass = 'crypto' | 'stock' | 'commodity' | 'index' | 'etf' | 'forex';
|
|
61
|
+
/**
|
|
62
|
+
* LA CLASSE D'ACTIF D'UNE PAIRE, ou `undefined` quand la venue ne se prononce pas.
|
|
63
|
+
*
|
|
64
|
+
* ⚠️ `undefined` N'EST PAS « CRYPTO ». hyperliquid et pacifica cotent NVDA, TSLA, XAU et PLTR sans
|
|
65
|
+
* publier la moindre catégorie : les classer d'office en crypto reproduirait exactement l'erreur
|
|
66
|
+
* qu'on corrige ici. « On ne sait pas » est une information ; une valeur inventée n'en est pas une.
|
|
67
|
+
*
|
|
68
|
+
* Une catégorie inconnue rend `undefined` plutôt que de retomber sur `crypto` — le jour où une venue
|
|
69
|
+
* en ajoute une, on veut le voir, pas l'absorber.
|
|
70
|
+
*/
|
|
71
|
+
declare function assetClassOf(xex: XgateEx, xtras?: Record<string, unknown>): AssetClass | undefined;
|
|
72
|
+
|
|
42
73
|
/** Type de marché. */
|
|
43
74
|
type MarketKind = 'perp' | 'spot';
|
|
44
75
|
/**
|
|
@@ -77,6 +108,18 @@ interface IPair {
|
|
|
77
108
|
* ramène toutes les venues à la même unité.
|
|
78
109
|
*/
|
|
79
110
|
multiplier: number;
|
|
111
|
+
/**
|
|
112
|
+
* CE QUE LA PAIRE COTE — `undefined` quand la venue ne le dit pas.
|
|
113
|
+
*
|
|
114
|
+
* Les venues perpétuelles ne listent plus que de la crypto : bybit publie 164 actions, 43 ETF et
|
|
115
|
+
* quatre matières premières, binance ouvre des `TRADIFI_PERPETUAL` sur NVDA et l'or. Sans ce
|
|
116
|
+
* champ, un consommateur mélange deux actifs qui partagent un ticker — `PURR` valait 11 $ chez
|
|
117
|
+
* bybit (une ACTION) et 0,13 $ chez hyperliquid (le memecoin) le 2026-08-24.
|
|
118
|
+
*
|
|
119
|
+
* ⚠️ `undefined` NE VEUT PAS DIRE « crypto ». hyperliquid et pacifica cotent NVDA, TSLA et XAU
|
|
120
|
+
* sans publier de catégorie : les supposer crypto referait l'erreur qu'on corrige.
|
|
121
|
+
*/
|
|
122
|
+
assetClass?: AssetClass;
|
|
80
123
|
/**
|
|
81
124
|
* ÉCHÉANCE du contrat. `undefined` pour un perpétuel — l'immense majorité.
|
|
82
125
|
*
|
|
@@ -1857,4 +1900,4 @@ declare function expiryOf(xtras?: Record<string, unknown>): Date | undefined;
|
|
|
1857
1900
|
*/
|
|
1858
1901
|
declare function isDated(xtras?: Record<string, unknown>): boolean;
|
|
1859
1902
|
|
|
1860
|
-
export { CANDLES_MAX_HISTORY, CANDLES_PER_CALL, CandlesService, CandlesStreamRegistry, CandlesStreamService, CatalogService, type Direction, type IAccountState, type IBalance, type ICandle, type ICandlesQuery, type IEntryWithProtection, type IEquityPoint, type IFundingPaid, type IMoveStop, type IMovement, type IOrder, type IPair, type IPosition, type IPrice, type IProtection, type IProtectionInput, type IProtectionLeg, type IPublicTrade, type ITarget, type ITrade, type ITradingAccess, type IWalletAccess, type IXexAccess, type IXexSpotSource, type MarketKind, type MovementKind, type MovementStatus, ORDER_STATUSES, type OrderStatus, type OrderType, PricesService, REST_THROTTLE_MS, SPOT_XEXES, type Side, SpotCandlesService, SpotCatalogService, SpotPricesService, SpotWsCandlesService, TIMEFRAME_MINUTES, type TimeInForce, Timeframe, TradingService, type Unsubscribe, WALLET_XEXES, WS_SUBSCRIPTION_LIMITS, WalletService, WsCandlesService, WsTradesService, XGATE_EXCHANGES, XgateEx, XgateModule, buildLevels, buildProtection, candlesMaxHistoryOf, candlesPerCallOf, canonicalFromBase, canonicalFromXex, expiryOf, isDated, multiplierFromXex, restThrottleOf, roundPrice, roundToStep, servesNatively, servesSpot, sourceFor, subscriptionLimitOf, timeframeMs };
|
|
1903
|
+
export { type AssetClass, CANDLES_MAX_HISTORY, CANDLES_PER_CALL, CandlesService, CandlesStreamRegistry, CandlesStreamService, CatalogService, type Direction, type IAccountState, type IBalance, type ICandle, type ICandlesQuery, type IEntryWithProtection, type IEquityPoint, type IFundingPaid, type IMoveStop, type IMovement, type IOrder, type IPair, type IPosition, type IPrice, type IProtection, type IProtectionInput, type IProtectionLeg, type IPublicTrade, type ITarget, type ITrade, type ITradingAccess, type IWalletAccess, type IXexAccess, type IXexSpotSource, type MarketKind, type MovementKind, type MovementStatus, ORDER_STATUSES, type OrderStatus, type OrderType, PricesService, REST_THROTTLE_MS, SPOT_XEXES, type Side, SpotCandlesService, SpotCatalogService, SpotPricesService, SpotWsCandlesService, TIMEFRAME_MINUTES, type TimeInForce, Timeframe, TradingService, type Unsubscribe, WALLET_XEXES, WS_SUBSCRIPTION_LIMITS, WalletService, WsCandlesService, WsTradesService, XGATE_EXCHANGES, XgateEx, XgateModule, assetClassOf, buildLevels, buildProtection, candlesMaxHistoryOf, candlesPerCallOf, canonicalFromBase, canonicalFromXex, expiryOf, isDated, multiplierFromXex, restThrottleOf, roundPrice, roundToStep, servesNatively, servesSpot, sourceFor, subscriptionLimitOf, timeframeMs };
|
package/dist/index.js
CHANGED
|
@@ -677,6 +677,57 @@ CandlesService = __decorateClass([
|
|
|
677
677
|
Injectable()
|
|
678
678
|
], CandlesService);
|
|
679
679
|
|
|
680
|
+
// src/helpers/asset-class.ts
|
|
681
|
+
var BINANCE = {
|
|
682
|
+
COIN: "crypto",
|
|
683
|
+
EQUITY: "stock",
|
|
684
|
+
CN_EQUITY: "stock",
|
|
685
|
+
HK_EQUITY: "stock",
|
|
686
|
+
KR_EQUITY: "stock",
|
|
687
|
+
PREMARKET: "stock",
|
|
688
|
+
COMMODITY: "commodity",
|
|
689
|
+
INDEX: "index"
|
|
690
|
+
};
|
|
691
|
+
var BYBIT = {
|
|
692
|
+
"": "crypto",
|
|
693
|
+
innovation: "crypto",
|
|
694
|
+
stock: "stock",
|
|
695
|
+
commodity: "commodity",
|
|
696
|
+
ETF: "etf"
|
|
697
|
+
};
|
|
698
|
+
var EXTENDED = {
|
|
699
|
+
Equity: "stock",
|
|
700
|
+
Commodity: "commodity",
|
|
701
|
+
"ETF/Index": "index",
|
|
702
|
+
FX: "forex",
|
|
703
|
+
"Pre-market": "stock"
|
|
704
|
+
};
|
|
705
|
+
function assetClassOf(xex, xtras) {
|
|
706
|
+
if (xtras === void 0) {
|
|
707
|
+
return void 0;
|
|
708
|
+
}
|
|
709
|
+
if (xex === "binance") {
|
|
710
|
+
const brut = xtras.underlyingType;
|
|
711
|
+
return typeof brut === "string" ? BINANCE[brut] : void 0;
|
|
712
|
+
}
|
|
713
|
+
if (xex === "bybit") {
|
|
714
|
+
const brut = xtras.symbolType;
|
|
715
|
+
return typeof brut === "string" ? BYBIT[brut] : void 0;
|
|
716
|
+
}
|
|
717
|
+
if (xex === "extended") {
|
|
718
|
+
const categorie = xtras.category;
|
|
719
|
+
if (typeof categorie !== "string") {
|
|
720
|
+
return void 0;
|
|
721
|
+
}
|
|
722
|
+
if (categorie !== "RWA") {
|
|
723
|
+
return "crypto";
|
|
724
|
+
}
|
|
725
|
+
const sous = xtras.subCategory;
|
|
726
|
+
return typeof sous === "string" ? EXTENDED[sous] : void 0;
|
|
727
|
+
}
|
|
728
|
+
return void 0;
|
|
729
|
+
}
|
|
730
|
+
|
|
680
731
|
// src/helpers/contract-expiry.ts
|
|
681
732
|
var DATED_CONTRACT_TYPES = /* @__PURE__ */ new Set([
|
|
682
733
|
// binance : les trimestriels (`BTCUSDT_260925`, `ETHUSDT_261225`).
|
|
@@ -759,6 +810,7 @@ var CatalogService = class {
|
|
|
759
810
|
xex,
|
|
760
811
|
kind: pair.kind,
|
|
761
812
|
multiplier: multiplierFromXex(pair.name),
|
|
813
|
+
assetClass: assetClassOf(xex, pair.xtras),
|
|
762
814
|
expiresAt: expiryOf(pair.xtras),
|
|
763
815
|
ref: pair.ref ?? null,
|
|
764
816
|
szDecimals: pair.szDecimals,
|
|
@@ -947,6 +999,7 @@ var SpotCatalogService = class {
|
|
|
947
999
|
// Le comptant porte les mêmes échelles que le perp : `SATSUSDT` (×1) et `1000SATSUSDT`
|
|
948
1000
|
// coexistent, et c'est justement entre eux que la comparaison serait fausse.
|
|
949
1001
|
multiplier: multiplierFromXex(pair.name),
|
|
1002
|
+
assetClass: assetClassOf(xex, pair.xtras),
|
|
950
1003
|
ref: pair.ref ?? null,
|
|
951
1004
|
szDecimals: pair.szDecimals,
|
|
952
1005
|
tickSize: pair.tickSize,
|
|
@@ -2163,6 +2216,6 @@ function candlesMaxHistoryOf(xex) {
|
|
|
2163
2216
|
return CANDLES_MAX_HISTORY[xex];
|
|
2164
2217
|
}
|
|
2165
2218
|
|
|
2166
|
-
export { CANDLES_MAX_HISTORY, CANDLES_PER_CALL, CandlesService, CandlesStreamRegistry, CandlesStreamService, CatalogService, ORDER_STATUSES, PricesService, REST_THROTTLE_MS, SPOT_XEXES, SpotCandlesService, SpotCatalogService, SpotPricesService, SpotWsCandlesService, TIMEFRAME_MINUTES, Timeframe, TradingService, WALLET_XEXES, WS_SUBSCRIPTION_LIMITS, WalletService, WsCandlesService, WsTradesService, XGATE_EXCHANGES, XgateEx, XgateModule, buildLevels, buildProtection, candlesMaxHistoryOf, candlesPerCallOf, canonicalFromBase, canonicalFromXex, expiryOf, isDated, multiplierFromXex, restThrottleOf, roundPrice, roundToStep, servesNatively, servesSpot, sourceFor, subscriptionLimitOf, timeframeMs };
|
|
2219
|
+
export { CANDLES_MAX_HISTORY, CANDLES_PER_CALL, CandlesService, CandlesStreamRegistry, CandlesStreamService, CatalogService, ORDER_STATUSES, PricesService, REST_THROTTLE_MS, SPOT_XEXES, SpotCandlesService, SpotCatalogService, SpotPricesService, SpotWsCandlesService, TIMEFRAME_MINUTES, Timeframe, TradingService, WALLET_XEXES, WS_SUBSCRIPTION_LIMITS, WalletService, WsCandlesService, WsTradesService, XGATE_EXCHANGES, XgateEx, XgateModule, assetClassOf, buildLevels, buildProtection, candlesMaxHistoryOf, candlesPerCallOf, canonicalFromBase, canonicalFromXex, expiryOf, isDated, multiplierFromXex, restThrottleOf, roundPrice, roundToStep, servesNatively, servesSpot, sourceFor, subscriptionLimitOf, timeframeMs };
|
|
2167
2220
|
//# sourceMappingURL=index.js.map
|
|
2168
2221
|
//# sourceMappingURL=index.js.map
|