@taphubhq/sdk-core 0.25.4 → 0.25.5
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 +15 -5
- package/dist/index.d.mts +19 -2
- package/dist/index.d.ts +19 -2
- package/dist/index.js +13 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -33,6 +33,8 @@ __export(index_exports, {
|
|
|
33
33
|
AgencyPairModule: () => AgencyPairModule,
|
|
34
34
|
AuthModule: () => AuthModule,
|
|
35
35
|
BidModule: () => BidModule,
|
|
36
|
+
CANDLE_EVENT: () => CANDLE_EVENT,
|
|
37
|
+
DEFAULT_CHART_HISTORY_LIMIT: () => DEFAULT_CHART_HISTORY_LIMIT,
|
|
36
38
|
LeaderboardModule: () => LeaderboardModule,
|
|
37
39
|
LocaleModule: () => LocaleModule,
|
|
38
40
|
NetworkQualityMonitor: () => NetworkQualityMonitor,
|
|
@@ -1147,6 +1149,9 @@ var BUILDER_AVAILABLE_GAME_PAIRS_QUERY = `query BuilderAvailableGamePairs($gamep
|
|
|
1147
1149
|
}
|
|
1148
1150
|
}`;
|
|
1149
1151
|
|
|
1152
|
+
// src/modules/pair/types.ts
|
|
1153
|
+
var DEFAULT_CHART_HISTORY_LIMIT = 600;
|
|
1154
|
+
|
|
1150
1155
|
// src/modules/pair/index.ts
|
|
1151
1156
|
var PairModule = class {
|
|
1152
1157
|
#graphql;
|
|
@@ -1204,11 +1209,8 @@ var PairModule = class {
|
|
|
1204
1209
|
return body.builderAvailableGamePairs.map(normalisePairInfo);
|
|
1205
1210
|
}
|
|
1206
1211
|
// REVIEW[bid-260602-v2]: chartHistory param/variable renamed pairId (was: agencyPairId/gameId)
|
|
1207
|
-
async chartHistory(pairId, limit, opts) {
|
|
1208
|
-
const variables = { pairId };
|
|
1209
|
-
if (limit !== void 0) {
|
|
1210
|
-
variables.limit = limit;
|
|
1211
|
-
}
|
|
1212
|
+
async chartHistory(pairId, limit = DEFAULT_CHART_HISTORY_LIMIT, opts) {
|
|
1213
|
+
const variables = { pairId, limit };
|
|
1212
1214
|
const body = await this.#graphql.request(
|
|
1213
1215
|
CHART_HISTORY_QUERY,
|
|
1214
1216
|
variables,
|
|
@@ -3159,6 +3161,12 @@ var TaphubClient = class {
|
|
|
3159
3161
|
}
|
|
3160
3162
|
};
|
|
3161
3163
|
|
|
3164
|
+
// src/modules/realtime/types.ts
|
|
3165
|
+
var CANDLE_EVENT = {
|
|
3166
|
+
NEW: "new",
|
|
3167
|
+
UPDATE: "update"
|
|
3168
|
+
};
|
|
3169
|
+
|
|
3162
3170
|
// src/utils/coefficient.ts
|
|
3163
3171
|
function errorFunction(x) {
|
|
3164
3172
|
const a1 = 0.254829592;
|
|
@@ -3248,6 +3256,8 @@ function calculateProbWin_v2(time1, time2, _price1, price2, creationTime, curren
|
|
|
3248
3256
|
AgencyPairModule,
|
|
3249
3257
|
AuthModule,
|
|
3250
3258
|
BidModule,
|
|
3259
|
+
CANDLE_EVENT,
|
|
3260
|
+
DEFAULT_CHART_HISTORY_LIMIT,
|
|
3251
3261
|
LeaderboardModule,
|
|
3252
3262
|
LocaleModule,
|
|
3253
3263
|
NetworkQualityMonitor,
|
package/dist/index.d.mts
CHANGED
|
@@ -709,6 +709,13 @@ interface PairInfo {
|
|
|
709
709
|
*/
|
|
710
710
|
agencyPairId: string | null;
|
|
711
711
|
}
|
|
712
|
+
/**
|
|
713
|
+
* Default number of candles fetched on initial chart load when the caller does
|
|
714
|
+
* not pass an explicit limit. The server clamps any request to its cache size
|
|
715
|
+
* (grid-api services.ChartHistoryMaxLimit = 1500), so this is purely how much
|
|
716
|
+
* history the chart shows by default — kept lower than the cap for faster init.
|
|
717
|
+
*/
|
|
718
|
+
declare const DEFAULT_CHART_HISTORY_LIMIT = 600;
|
|
712
719
|
interface Candle {
|
|
713
720
|
/** Unix epoch SECONDS (not ms). Multiply by 1000 for JS Date. */
|
|
714
721
|
time: number;
|
|
@@ -906,6 +913,16 @@ interface MqttTransport {
|
|
|
906
913
|
close(): void;
|
|
907
914
|
}
|
|
908
915
|
|
|
916
|
+
/**
|
|
917
|
+
* Candle tick kind. `new` = a fresh bar opened; `update` = the current bar was
|
|
918
|
+
* revised. Exported as named constants so consumers compare against these
|
|
919
|
+
* instead of bare string literals (a typo on a literal fails silently).
|
|
920
|
+
*/
|
|
921
|
+
declare const CANDLE_EVENT: {
|
|
922
|
+
readonly NEW: "new";
|
|
923
|
+
readonly UPDATE: "update";
|
|
924
|
+
};
|
|
925
|
+
type CandleEventType = (typeof CANDLE_EVENT)[keyof typeof CANDLE_EVENT];
|
|
909
926
|
/**
|
|
910
927
|
* Candle tick from MQTT.
|
|
911
928
|
* WARNING: `time` is Unix epoch MILLISECONDS.
|
|
@@ -913,7 +930,7 @@ interface MqttTransport {
|
|
|
913
930
|
* Do NOT multiply MQTT candle time by 1000.
|
|
914
931
|
*/
|
|
915
932
|
interface MqttCandleEvent {
|
|
916
|
-
type:
|
|
933
|
+
type: CandleEventType;
|
|
917
934
|
/** Unix epoch **milliseconds** — differs from GQL chartHistory (seconds) */
|
|
918
935
|
time: number;
|
|
919
936
|
o: number;
|
|
@@ -1415,4 +1432,4 @@ declare function adaptiveSimpson(f: (x: number) => number, a: number, b: number,
|
|
|
1415
1432
|
declare function calculateProbWin(time1: number, time2: number, _price1: number, price2: number, creationTime: number, currentPrice: number, volatility: number): number;
|
|
1416
1433
|
declare function calculateProbWin_v2(time1: number, time2: number, _price1: number, price2: number, creationTime: number, currentPrice: number, volatility: number): number;
|
|
1417
1434
|
|
|
1418
|
-
export { type AgencyPairFilter, AgencyPairModule, type AgencyPairStats, type AgencyPairStatus, AuthModule, type BackendHealth, type Bid, BidModule, type BidStatus, type CancelBidResult, type Candle, type Constraints, type Currency, type ErrorMessageCatalog, type ErrorMessageMeta, type ErrorMessagesResponse, GameChannel, type GameConfig, type GridConfig, type LeaderboardEntry, LeaderboardModule, type LeaderboardPeriod, type LeaderboardSortBy, LocaleModule, type LocaleRefreshResult, type LocaleResponse, type LocaleTranslations, type LoginResult, type Me, type MqttAcceptedBid, type MqttAgencyPairStatsEvent, type MqttAuthConfig, type MqttBalanceEvent, type MqttBidAcceptedEvent, type MqttBidLostEvent, type MqttBidWonEvent, type MqttCandleEvent, type MqttConfigEvent, type MqttIdealConfigEvent, type MqttWalletBalanceEvent, type MyRank, type NetworkLevel, type NetworkQuality, NetworkQualityMonitor, type Pair, type PairInfo, PairModule, type PlaceBidInput, type RankBoard, type RankEntry, type RankPeriod, type RankSort, RealtimeModule, type Sample, type SampleReason, type SignalSource, type SortDir, TaphubAuthError, TaphubClient, type TaphubClientConfig, TaphubError, TaphubEventBus, type TaphubEventMap, TaphubNetworkError, TaphubServerError, TaphubSlippageError, TaphubStorage, type TaphubStorageAdapter, TaphubValidationError, type User, UserBidsChannel, type UserBidsChannelEvents, UserModule, type UserPnL, type UserPnLPeriod, type Wallet as UserWallet, type Wallet$1 as Wallet, type WalletBalanceReason, WalletChannel, adaptiveSimpson, autoDetectStorage, calculateProbWin, calculateProbWin_v2, errorFunction, isCancelled, isLoss, isPending, isTerminal, isWin, normalCDF, normalPDF, normaliseLang, pairIdFromBidResultTopic };
|
|
1435
|
+
export { type AgencyPairFilter, AgencyPairModule, type AgencyPairStats, type AgencyPairStatus, AuthModule, type BackendHealth, type Bid, BidModule, type BidStatus, CANDLE_EVENT, type CancelBidResult, type Candle, type CandleEventType, type Constraints, type Currency, DEFAULT_CHART_HISTORY_LIMIT, type ErrorMessageCatalog, type ErrorMessageMeta, type ErrorMessagesResponse, GameChannel, type GameConfig, type GridConfig, type LeaderboardEntry, LeaderboardModule, type LeaderboardPeriod, type LeaderboardSortBy, LocaleModule, type LocaleRefreshResult, type LocaleResponse, type LocaleTranslations, type LoginResult, type Me, type MqttAcceptedBid, type MqttAgencyPairStatsEvent, type MqttAuthConfig, type MqttBalanceEvent, type MqttBidAcceptedEvent, type MqttBidLostEvent, type MqttBidWonEvent, type MqttCandleEvent, type MqttConfigEvent, type MqttIdealConfigEvent, type MqttWalletBalanceEvent, type MyRank, type NetworkLevel, type NetworkQuality, NetworkQualityMonitor, type Pair, type PairInfo, PairModule, type PlaceBidInput, type RankBoard, type RankEntry, type RankPeriod, type RankSort, RealtimeModule, type Sample, type SampleReason, type SignalSource, type SortDir, TaphubAuthError, TaphubClient, type TaphubClientConfig, TaphubError, TaphubEventBus, type TaphubEventMap, TaphubNetworkError, TaphubServerError, TaphubSlippageError, TaphubStorage, type TaphubStorageAdapter, TaphubValidationError, type User, UserBidsChannel, type UserBidsChannelEvents, UserModule, type UserPnL, type UserPnLPeriod, type Wallet as UserWallet, type Wallet$1 as Wallet, type WalletBalanceReason, WalletChannel, adaptiveSimpson, autoDetectStorage, calculateProbWin, calculateProbWin_v2, errorFunction, isCancelled, isLoss, isPending, isTerminal, isWin, normalCDF, normalPDF, normaliseLang, pairIdFromBidResultTopic };
|
package/dist/index.d.ts
CHANGED
|
@@ -709,6 +709,13 @@ interface PairInfo {
|
|
|
709
709
|
*/
|
|
710
710
|
agencyPairId: string | null;
|
|
711
711
|
}
|
|
712
|
+
/**
|
|
713
|
+
* Default number of candles fetched on initial chart load when the caller does
|
|
714
|
+
* not pass an explicit limit. The server clamps any request to its cache size
|
|
715
|
+
* (grid-api services.ChartHistoryMaxLimit = 1500), so this is purely how much
|
|
716
|
+
* history the chart shows by default — kept lower than the cap for faster init.
|
|
717
|
+
*/
|
|
718
|
+
declare const DEFAULT_CHART_HISTORY_LIMIT = 600;
|
|
712
719
|
interface Candle {
|
|
713
720
|
/** Unix epoch SECONDS (not ms). Multiply by 1000 for JS Date. */
|
|
714
721
|
time: number;
|
|
@@ -906,6 +913,16 @@ interface MqttTransport {
|
|
|
906
913
|
close(): void;
|
|
907
914
|
}
|
|
908
915
|
|
|
916
|
+
/**
|
|
917
|
+
* Candle tick kind. `new` = a fresh bar opened; `update` = the current bar was
|
|
918
|
+
* revised. Exported as named constants so consumers compare against these
|
|
919
|
+
* instead of bare string literals (a typo on a literal fails silently).
|
|
920
|
+
*/
|
|
921
|
+
declare const CANDLE_EVENT: {
|
|
922
|
+
readonly NEW: "new";
|
|
923
|
+
readonly UPDATE: "update";
|
|
924
|
+
};
|
|
925
|
+
type CandleEventType = (typeof CANDLE_EVENT)[keyof typeof CANDLE_EVENT];
|
|
909
926
|
/**
|
|
910
927
|
* Candle tick from MQTT.
|
|
911
928
|
* WARNING: `time` is Unix epoch MILLISECONDS.
|
|
@@ -913,7 +930,7 @@ interface MqttTransport {
|
|
|
913
930
|
* Do NOT multiply MQTT candle time by 1000.
|
|
914
931
|
*/
|
|
915
932
|
interface MqttCandleEvent {
|
|
916
|
-
type:
|
|
933
|
+
type: CandleEventType;
|
|
917
934
|
/** Unix epoch **milliseconds** — differs from GQL chartHistory (seconds) */
|
|
918
935
|
time: number;
|
|
919
936
|
o: number;
|
|
@@ -1415,4 +1432,4 @@ declare function adaptiveSimpson(f: (x: number) => number, a: number, b: number,
|
|
|
1415
1432
|
declare function calculateProbWin(time1: number, time2: number, _price1: number, price2: number, creationTime: number, currentPrice: number, volatility: number): number;
|
|
1416
1433
|
declare function calculateProbWin_v2(time1: number, time2: number, _price1: number, price2: number, creationTime: number, currentPrice: number, volatility: number): number;
|
|
1417
1434
|
|
|
1418
|
-
export { type AgencyPairFilter, AgencyPairModule, type AgencyPairStats, type AgencyPairStatus, AuthModule, type BackendHealth, type Bid, BidModule, type BidStatus, type CancelBidResult, type Candle, type Constraints, type Currency, type ErrorMessageCatalog, type ErrorMessageMeta, type ErrorMessagesResponse, GameChannel, type GameConfig, type GridConfig, type LeaderboardEntry, LeaderboardModule, type LeaderboardPeriod, type LeaderboardSortBy, LocaleModule, type LocaleRefreshResult, type LocaleResponse, type LocaleTranslations, type LoginResult, type Me, type MqttAcceptedBid, type MqttAgencyPairStatsEvent, type MqttAuthConfig, type MqttBalanceEvent, type MqttBidAcceptedEvent, type MqttBidLostEvent, type MqttBidWonEvent, type MqttCandleEvent, type MqttConfigEvent, type MqttIdealConfigEvent, type MqttWalletBalanceEvent, type MyRank, type NetworkLevel, type NetworkQuality, NetworkQualityMonitor, type Pair, type PairInfo, PairModule, type PlaceBidInput, type RankBoard, type RankEntry, type RankPeriod, type RankSort, RealtimeModule, type Sample, type SampleReason, type SignalSource, type SortDir, TaphubAuthError, TaphubClient, type TaphubClientConfig, TaphubError, TaphubEventBus, type TaphubEventMap, TaphubNetworkError, TaphubServerError, TaphubSlippageError, TaphubStorage, type TaphubStorageAdapter, TaphubValidationError, type User, UserBidsChannel, type UserBidsChannelEvents, UserModule, type UserPnL, type UserPnLPeriod, type Wallet as UserWallet, type Wallet$1 as Wallet, type WalletBalanceReason, WalletChannel, adaptiveSimpson, autoDetectStorage, calculateProbWin, calculateProbWin_v2, errorFunction, isCancelled, isLoss, isPending, isTerminal, isWin, normalCDF, normalPDF, normaliseLang, pairIdFromBidResultTopic };
|
|
1435
|
+
export { type AgencyPairFilter, AgencyPairModule, type AgencyPairStats, type AgencyPairStatus, AuthModule, type BackendHealth, type Bid, BidModule, type BidStatus, CANDLE_EVENT, type CancelBidResult, type Candle, type CandleEventType, type Constraints, type Currency, DEFAULT_CHART_HISTORY_LIMIT, type ErrorMessageCatalog, type ErrorMessageMeta, type ErrorMessagesResponse, GameChannel, type GameConfig, type GridConfig, type LeaderboardEntry, LeaderboardModule, type LeaderboardPeriod, type LeaderboardSortBy, LocaleModule, type LocaleRefreshResult, type LocaleResponse, type LocaleTranslations, type LoginResult, type Me, type MqttAcceptedBid, type MqttAgencyPairStatsEvent, type MqttAuthConfig, type MqttBalanceEvent, type MqttBidAcceptedEvent, type MqttBidLostEvent, type MqttBidWonEvent, type MqttCandleEvent, type MqttConfigEvent, type MqttIdealConfigEvent, type MqttWalletBalanceEvent, type MyRank, type NetworkLevel, type NetworkQuality, NetworkQualityMonitor, type Pair, type PairInfo, PairModule, type PlaceBidInput, type RankBoard, type RankEntry, type RankPeriod, type RankSort, RealtimeModule, type Sample, type SampleReason, type SignalSource, type SortDir, TaphubAuthError, TaphubClient, type TaphubClientConfig, TaphubError, TaphubEventBus, type TaphubEventMap, TaphubNetworkError, TaphubServerError, TaphubSlippageError, TaphubStorage, type TaphubStorageAdapter, TaphubValidationError, type User, UserBidsChannel, type UserBidsChannelEvents, UserModule, type UserPnL, type UserPnLPeriod, type Wallet as UserWallet, type Wallet$1 as Wallet, type WalletBalanceReason, WalletChannel, adaptiveSimpson, autoDetectStorage, calculateProbWin, calculateProbWin_v2, errorFunction, isCancelled, isLoss, isPending, isTerminal, isWin, normalCDF, normalPDF, normaliseLang, pairIdFromBidResultTopic };
|
package/dist/index.js
CHANGED
|
@@ -1080,6 +1080,9 @@ var BUILDER_AVAILABLE_GAME_PAIRS_QUERY = `query BuilderAvailableGamePairs($gamep
|
|
|
1080
1080
|
}
|
|
1081
1081
|
}`;
|
|
1082
1082
|
|
|
1083
|
+
// src/modules/pair/types.ts
|
|
1084
|
+
var DEFAULT_CHART_HISTORY_LIMIT = 600;
|
|
1085
|
+
|
|
1083
1086
|
// src/modules/pair/index.ts
|
|
1084
1087
|
var PairModule = class {
|
|
1085
1088
|
#graphql;
|
|
@@ -1137,11 +1140,8 @@ var PairModule = class {
|
|
|
1137
1140
|
return body.builderAvailableGamePairs.map(normalisePairInfo);
|
|
1138
1141
|
}
|
|
1139
1142
|
// REVIEW[bid-260602-v2]: chartHistory param/variable renamed pairId (was: agencyPairId/gameId)
|
|
1140
|
-
async chartHistory(pairId, limit, opts) {
|
|
1141
|
-
const variables = { pairId };
|
|
1142
|
-
if (limit !== void 0) {
|
|
1143
|
-
variables.limit = limit;
|
|
1144
|
-
}
|
|
1143
|
+
async chartHistory(pairId, limit = DEFAULT_CHART_HISTORY_LIMIT, opts) {
|
|
1144
|
+
const variables = { pairId, limit };
|
|
1145
1145
|
const body = await this.#graphql.request(
|
|
1146
1146
|
CHART_HISTORY_QUERY,
|
|
1147
1147
|
variables,
|
|
@@ -3092,6 +3092,12 @@ var TaphubClient = class {
|
|
|
3092
3092
|
}
|
|
3093
3093
|
};
|
|
3094
3094
|
|
|
3095
|
+
// src/modules/realtime/types.ts
|
|
3096
|
+
var CANDLE_EVENT = {
|
|
3097
|
+
NEW: "new",
|
|
3098
|
+
UPDATE: "update"
|
|
3099
|
+
};
|
|
3100
|
+
|
|
3095
3101
|
// src/utils/coefficient.ts
|
|
3096
3102
|
function errorFunction(x) {
|
|
3097
3103
|
const a1 = 0.254829592;
|
|
@@ -3180,6 +3186,8 @@ export {
|
|
|
3180
3186
|
AgencyPairModule,
|
|
3181
3187
|
AuthModule,
|
|
3182
3188
|
BidModule,
|
|
3189
|
+
CANDLE_EVENT,
|
|
3190
|
+
DEFAULT_CHART_HISTORY_LIMIT,
|
|
3183
3191
|
LeaderboardModule,
|
|
3184
3192
|
LocaleModule,
|
|
3185
3193
|
NetworkQualityMonitor,
|