src/history/index.ts
v0.3.0 · 2.2 KB
// History and data for backtests and paper trading: fills (with TWAP slices),
// order grouping, round trips, candles, funding and window cache keys.
export type { FillLike, FillSide, HlCandle, HlFill, PositionSide, TimeWindow } from './types.js';
export {
DEFAULT_FILLS_PAGE_DELAY_MS,
USER_FILLS_PAGE_LIMIT,
coinDex,
createFillDeduper,
dedupFills,
fetchFillsByTime,
fetchRecentFills,
fillKey,
isSpotCoin,
sortFills,
} from './fills.js';
export type {
FetchFillsByTimeOptions,
FetchFillsResult,
FetchRecentFillsOptions,
FillDeduper,
FillDeduperOptions,
RecentFillsResult,
} from './fills.js';
export {
TWAP_SLICE_FILLS_LIMIT,
fetchTwapSliceFills,
fetchTwapSliceFillsByTime,
mergeFillsWithTwap,
parseTwapSliceFills,
} from './twap.js';
export type {
FetchTwapSliceFillsByTimeOptions,
FetchTwapSliceFillsOptions,
MergeFillsWithTwapOptions,
MergedFill,
TwapSliceFill,
TwapSliceFillsResult,
} from './twap.js';
export { groupFillsByOrder, orderGroupKey } from './group.js';
export type { OrderGroup } from './group.js';
export {
isClosingDir,
isPositionTradeDir,
realizedPnlSince,
reconstructRoundTrips,
} from './roundtrips.js';
export type {
OpenRoundTrip,
RealizedPnlQuery,
RealizedPnlResult,
RoundTrip,
RoundTripsResult,
} from './roundtrips.js';
export { summarizePnl } from './stats.js';
export type { PnlSummary } from './stats.js';
export {
CANDLE_INTERVALS,
CANDLE_RESPONSE_LIMIT,
VERIFIED_CANDLE_INTERVALS,
candleCloseTime,
candleIntervalMs,
estimateCandleCount,
fetchCandles,
fetchServerTimeMs,
findCandleGaps,
isCandleClosed,
isCandleInterval,
markCandleClosure,
nextCandleOpen,
normalizeCandles,
sliceCandlesByTime,
toCandleCoin,
toOhlcv,
} from './candles.js';
export type { CandleGap, CandleInterval, CandleWithStatus, FetchCandlesParams, FetchCandlesResult } from './candles.js';
export { fetchFundingHistory, fetchUserFunding, fundingPayment, sumFundingUsdc } from './funding.js';
export type { FundingPageResult, FundingPaginationOptions, FundingRateRecord, UserFundingEvent } from './funding.js';
export { DAY_MS, HOUR_MS, candleCacheKey, fillsCacheKey, lookbackWindow, quantizeWindow, utcDayWindow } from './cache.js';
export type { WindowCacheKey } from './cache.js';