backtest-kit 7.6.0 → 7.8.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/build/index.cjs +156 -9
- package/build/index.mjs +156 -10
- package/package.json +1 -1
- package/types.d.ts +82 -5
package/build/index.cjs
CHANGED
|
@@ -3865,6 +3865,27 @@ class ClientExchange {
|
|
|
3865
3865
|
const vwap = sumPriceVolume / totalVolume;
|
|
3866
3866
|
return vwap;
|
|
3867
3867
|
}
|
|
3868
|
+
/**
|
|
3869
|
+
* Returns the close price of the last completed candle for the given interval.
|
|
3870
|
+
*
|
|
3871
|
+
* Fetches a single candle for the requested interval and returns its close price.
|
|
3872
|
+
*
|
|
3873
|
+
* @param symbol - Trading pair symbol
|
|
3874
|
+
* @param interval - Candle time interval (e.g., "1m", "1h")
|
|
3875
|
+
* @returns Promise resolving to close price of the last candle
|
|
3876
|
+
* @throws Error if no candles available
|
|
3877
|
+
*/
|
|
3878
|
+
async getClosePrice(symbol, interval) {
|
|
3879
|
+
this.params.logger.debug(`ClientExchange getClosePrice`, {
|
|
3880
|
+
symbol,
|
|
3881
|
+
interval,
|
|
3882
|
+
});
|
|
3883
|
+
const candles = await this.getCandles(symbol, interval, 1);
|
|
3884
|
+
if (candles.length === 0) {
|
|
3885
|
+
throw new Error(`ClientExchange getClosePrice: no candles data for symbol=${symbol}`);
|
|
3886
|
+
}
|
|
3887
|
+
return candles[candles.length - 1].close;
|
|
3888
|
+
}
|
|
3868
3889
|
/**
|
|
3869
3890
|
* Formats quantity according to exchange-specific rules for the given symbol.
|
|
3870
3891
|
* Applies proper decimal precision and rounding based on symbol's lot size filters.
|
|
@@ -4270,6 +4291,22 @@ class ExchangeConnectionService {
|
|
|
4270
4291
|
});
|
|
4271
4292
|
return await this.getExchange(this.methodContextService.context.exchangeName).getAveragePrice(symbol);
|
|
4272
4293
|
};
|
|
4294
|
+
/**
|
|
4295
|
+
* Returns the close price of the last completed candle for the given interval.
|
|
4296
|
+
*
|
|
4297
|
+
* Routes to exchange determined by methodContextService.context.exchangeName.
|
|
4298
|
+
*
|
|
4299
|
+
* @param symbol - Trading pair symbol (e.g., "BTCUSDT")
|
|
4300
|
+
* @param interval - Candle interval (e.g., "1h", "1d")
|
|
4301
|
+
* @returns Promise resolving to close price of the last candle
|
|
4302
|
+
*/
|
|
4303
|
+
this.getClosePrice = async (symbol, interval) => {
|
|
4304
|
+
this.loggerService.log("exchangeConnectionService getClosePrice", {
|
|
4305
|
+
symbol,
|
|
4306
|
+
interval,
|
|
4307
|
+
});
|
|
4308
|
+
return await this.getExchange(this.methodContextService.context.exchangeName).getClosePrice(symbol, interval);
|
|
4309
|
+
};
|
|
4273
4310
|
/**
|
|
4274
4311
|
* Formats price according to exchange-specific precision rules.
|
|
4275
4312
|
*
|
|
@@ -14860,6 +14897,34 @@ class ExchangeCoreService {
|
|
|
14860
14897
|
backtest,
|
|
14861
14898
|
});
|
|
14862
14899
|
};
|
|
14900
|
+
/**
|
|
14901
|
+
* Returns the close price of the last completed candle for the given interval with execution context.
|
|
14902
|
+
*
|
|
14903
|
+
* @param symbol - Trading pair symbol
|
|
14904
|
+
* @param interval - Candle interval (e.g., "1m", "1h")
|
|
14905
|
+
* @param when - Timestamp for context (used in backtest mode)
|
|
14906
|
+
* @param backtest - Whether running in backtest mode
|
|
14907
|
+
* @returns Promise resolving to close price of the last candle
|
|
14908
|
+
*/
|
|
14909
|
+
this.getClosePrice = async (symbol, interval, when, backtest) => {
|
|
14910
|
+
this.loggerService.log("exchangeCoreService getClosePrice", {
|
|
14911
|
+
symbol,
|
|
14912
|
+
interval,
|
|
14913
|
+
when,
|
|
14914
|
+
backtest,
|
|
14915
|
+
});
|
|
14916
|
+
if (!MethodContextService.hasContext()) {
|
|
14917
|
+
throw new Error("exchangeCoreService getClosePrice requires a method context");
|
|
14918
|
+
}
|
|
14919
|
+
await this.validate(this.methodContextService.context.exchangeName);
|
|
14920
|
+
return await ExecutionContextService.runInContext(async () => {
|
|
14921
|
+
return await this.exchangeConnectionService.getClosePrice(symbol, interval);
|
|
14922
|
+
}, {
|
|
14923
|
+
symbol,
|
|
14924
|
+
when,
|
|
14925
|
+
backtest,
|
|
14926
|
+
});
|
|
14927
|
+
};
|
|
14863
14928
|
/**
|
|
14864
14929
|
* Formats price with execution context.
|
|
14865
14930
|
*
|
|
@@ -33548,6 +33613,7 @@ async function getBacktestTimeframe(symbol) {
|
|
|
33548
33613
|
|
|
33549
33614
|
const EXCHANGE_METHOD_NAME_GET_CANDLES = "ExchangeUtils.getCandles";
|
|
33550
33615
|
const EXCHANGE_METHOD_NAME_GET_AVERAGE_PRICE = "ExchangeUtils.getAveragePrice";
|
|
33616
|
+
const EXCHANGE_METHOD_NAME_GET_CLOSE_PRICE = "ExchangeUtils.getClosePrice";
|
|
33551
33617
|
const EXCHANGE_METHOD_NAME_FORMAT_QUANTITY = "ExchangeUtils.formatQuantity";
|
|
33552
33618
|
const EXCHANGE_METHOD_NAME_FORMAT_PRICE = "ExchangeUtils.formatPrice";
|
|
33553
33619
|
const EXCHANGE_METHOD_NAME_GET_ORDER_BOOK = "ExchangeUtils.getOrderBook";
|
|
@@ -33905,6 +33971,35 @@ class ExchangeInstance {
|
|
|
33905
33971
|
const vwap = sumPriceVolume / totalVolume;
|
|
33906
33972
|
return vwap;
|
|
33907
33973
|
};
|
|
33974
|
+
/**
|
|
33975
|
+
* Returns the close price of the last completed candle for the given interval.
|
|
33976
|
+
*
|
|
33977
|
+
* Fetches a single candle for the requested interval and returns its close price.
|
|
33978
|
+
*
|
|
33979
|
+
* @param symbol - Trading pair symbol
|
|
33980
|
+
* @param interval - Candle time interval (e.g., "1m", "1h")
|
|
33981
|
+
* @returns Promise resolving to close price of the last candle
|
|
33982
|
+
* @throws Error if no candles available
|
|
33983
|
+
*
|
|
33984
|
+
* @example
|
|
33985
|
+
* ```typescript
|
|
33986
|
+
* const instance = new ExchangeInstance("binance");
|
|
33987
|
+
* const close = await instance.getClosePrice("BTCUSDT", "1h");
|
|
33988
|
+
* console.log(close); // 50125.43
|
|
33989
|
+
* ```
|
|
33990
|
+
*/
|
|
33991
|
+
this.getClosePrice = async (symbol, interval) => {
|
|
33992
|
+
backtest.loggerService.debug(`ExchangeInstance getClosePrice`, {
|
|
33993
|
+
exchangeName: this.exchangeName,
|
|
33994
|
+
symbol,
|
|
33995
|
+
interval,
|
|
33996
|
+
});
|
|
33997
|
+
const candles = await this.getCandles(symbol, interval, 1);
|
|
33998
|
+
if (candles.length === 0) {
|
|
33999
|
+
throw new Error(`ExchangeInstance getClosePrice: no candles data for symbol=${symbol}`);
|
|
34000
|
+
}
|
|
34001
|
+
return candles[candles.length - 1].close;
|
|
34002
|
+
};
|
|
33908
34003
|
/**
|
|
33909
34004
|
* Format quantity according to exchange precision rules.
|
|
33910
34005
|
*
|
|
@@ -34262,6 +34357,28 @@ class ExchangeUtils {
|
|
|
34262
34357
|
const instance = this._getInstance(context.exchangeName);
|
|
34263
34358
|
return await instance.getAveragePrice(symbol);
|
|
34264
34359
|
};
|
|
34360
|
+
/**
|
|
34361
|
+
* Returns the close price of the last completed candle for the given interval.
|
|
34362
|
+
*
|
|
34363
|
+
* @param symbol - Trading pair symbol
|
|
34364
|
+
* @param interval - Candle time interval (e.g., "1m", "1h")
|
|
34365
|
+
* @param context - Execution context with exchange name
|
|
34366
|
+
* @returns Promise resolving to close price of the last candle
|
|
34367
|
+
* @throws Error if no candles available
|
|
34368
|
+
*
|
|
34369
|
+
* @example
|
|
34370
|
+
* ```typescript
|
|
34371
|
+
* const close = await Exchange.getClosePrice("BTCUSDT", "1h", {
|
|
34372
|
+
* exchangeName: "binance"
|
|
34373
|
+
* });
|
|
34374
|
+
* console.log(close); // 50125.43
|
|
34375
|
+
* ```
|
|
34376
|
+
*/
|
|
34377
|
+
this.getClosePrice = async (symbol, interval, context) => {
|
|
34378
|
+
backtest.exchangeValidationService.validate(context.exchangeName, EXCHANGE_METHOD_NAME_GET_CLOSE_PRICE);
|
|
34379
|
+
const instance = this._getInstance(context.exchangeName);
|
|
34380
|
+
return await instance.getClosePrice(symbol, interval);
|
|
34381
|
+
};
|
|
34265
34382
|
/**
|
|
34266
34383
|
* Format quantity according to exchange precision rules.
|
|
34267
34384
|
*
|
|
@@ -34848,6 +34965,7 @@ function getActionSchema(actionName) {
|
|
|
34848
34965
|
|
|
34849
34966
|
const GET_CANDLES_METHOD_NAME = "exchange.getCandles";
|
|
34850
34967
|
const GET_AVERAGE_PRICE_METHOD_NAME = "exchange.getAveragePrice";
|
|
34968
|
+
const GET_CLOSE_PRICE_METHOD_NAME = "exchange.getClosePrice";
|
|
34851
34969
|
const FORMAT_PRICE_METHOD_NAME = "exchange.formatPrice";
|
|
34852
34970
|
const FORMAT_QUANTITY_METHOD_NAME = "exchange.formatQuantity";
|
|
34853
34971
|
const GET_DATE_METHOD_NAME = "exchange.getDate";
|
|
@@ -34945,6 +35063,32 @@ async function getAveragePrice(symbol) {
|
|
|
34945
35063
|
}
|
|
34946
35064
|
return await backtest.exchangeConnectionService.getAveragePrice(symbol);
|
|
34947
35065
|
}
|
|
35066
|
+
/**
|
|
35067
|
+
* Returns the close price of the last completed candle for the given interval.
|
|
35068
|
+
*
|
|
35069
|
+
* @param symbol - Trading pair symbol (e.g., "BTCUSDT")
|
|
35070
|
+
* @param interval - Candle interval ("1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h")
|
|
35071
|
+
* @returns Promise resolving to close price of the last candle
|
|
35072
|
+
*
|
|
35073
|
+
* @example
|
|
35074
|
+
* ```typescript
|
|
35075
|
+
* const close = await getClosePrice("BTCUSDT", "1h");
|
|
35076
|
+
* console.log(close); // 50125.43
|
|
35077
|
+
* ```
|
|
35078
|
+
*/
|
|
35079
|
+
async function getClosePrice(symbol, interval) {
|
|
35080
|
+
backtest.loggerService.info(GET_CLOSE_PRICE_METHOD_NAME, {
|
|
35081
|
+
symbol,
|
|
35082
|
+
interval,
|
|
35083
|
+
});
|
|
35084
|
+
if (!ExecutionContextService.hasContext()) {
|
|
35085
|
+
throw new Error("getClosePrice requires an execution context");
|
|
35086
|
+
}
|
|
35087
|
+
if (!MethodContextService.hasContext()) {
|
|
35088
|
+
throw new Error("getClosePrice requires a method context");
|
|
35089
|
+
}
|
|
35090
|
+
return await backtest.exchangeConnectionService.getClosePrice(symbol, interval);
|
|
35091
|
+
}
|
|
34948
35092
|
/**
|
|
34949
35093
|
* Formats a price value according to exchange rules.
|
|
34950
35094
|
*
|
|
@@ -47978,6 +48122,7 @@ async function getMinutesSinceLatestSignalCreated(symbol) {
|
|
|
47978
48122
|
* SL trades show peak < 0.15% (Feb08, Feb13) or never go positive (Feb25).
|
|
47979
48123
|
* Rule: if minutesOpen >= N and peakPercent < threshold (e.g. 0.3%) — exit.
|
|
47980
48124
|
*
|
|
48125
|
+
* @param symbol - Trading pair symbol
|
|
47981
48126
|
* @param dto.bucketName - State bucket name
|
|
47982
48127
|
* @param dto.initialValue - Default value when no persisted state exists
|
|
47983
48128
|
* @returns Promise resolving to current state value, or initialValue if no signal
|
|
@@ -47997,16 +48142,16 @@ async function getMinutesSinceLatestSignalCreated(symbol) {
|
|
|
47997
48142
|
* }
|
|
47998
48143
|
* ```
|
|
47999
48144
|
*/
|
|
48000
|
-
async function getSignalState(dto) {
|
|
48145
|
+
async function getSignalState(symbol, dto) {
|
|
48001
48146
|
const { bucketName, initialValue } = dto;
|
|
48002
|
-
backtest.loggerService.info(GET_SIGNAL_STATE_METHOD_NAME, { bucketName });
|
|
48147
|
+
backtest.loggerService.info(GET_SIGNAL_STATE_METHOD_NAME, { symbol, bucketName });
|
|
48003
48148
|
if (!ExecutionContextService.hasContext()) {
|
|
48004
48149
|
throw new Error("getSignalState requires an execution context");
|
|
48005
48150
|
}
|
|
48006
48151
|
if (!MethodContextService.hasContext()) {
|
|
48007
48152
|
throw new Error("getSignalState requires a method context");
|
|
48008
48153
|
}
|
|
48009
|
-
const { backtest: isBacktest
|
|
48154
|
+
const { backtest: isBacktest } = backtest.executionContextService.context;
|
|
48010
48155
|
const { exchangeName, frameName, strategyName } = backtest.methodContextService.context;
|
|
48011
48156
|
const currentPrice = await backtest.exchangeConnectionService.getAveragePrice(symbol);
|
|
48012
48157
|
let signal;
|
|
@@ -48042,6 +48187,7 @@ async function getSignalState(dto) {
|
|
|
48042
48187
|
* SL trades show peak < 0.15% (Feb08, Feb13) or never go positive (Feb25).
|
|
48043
48188
|
* Rule: if minutesOpen >= N and peakPercent < threshold (e.g. 0.3%) — exit.
|
|
48044
48189
|
*
|
|
48190
|
+
* @param symbol - Trading pair symbol
|
|
48045
48191
|
* @param dto.bucketName - State bucket name
|
|
48046
48192
|
* @param dto.initialValue - Default value when no persisted state exists
|
|
48047
48193
|
* @param dto.dispatch - New value or updater function receiving current value
|
|
@@ -48065,7 +48211,7 @@ async function getSignalState(dto) {
|
|
|
48065
48211
|
* );
|
|
48066
48212
|
* ```
|
|
48067
48213
|
*/
|
|
48068
|
-
async function setSignalState(dispatch, dto) {
|
|
48214
|
+
async function setSignalState(symbol, dispatch, dto) {
|
|
48069
48215
|
const { bucketName, initialValue } = dto;
|
|
48070
48216
|
backtest.loggerService.info(SET_SIGNAL_STATE_METHOD_NAME, { bucketName });
|
|
48071
48217
|
if (!ExecutionContextService.hasContext()) {
|
|
@@ -48074,7 +48220,7 @@ async function setSignalState(dispatch, dto) {
|
|
|
48074
48220
|
if (!MethodContextService.hasContext()) {
|
|
48075
48221
|
throw new Error("setSignalState requires a method context");
|
|
48076
48222
|
}
|
|
48077
|
-
const { backtest: isBacktest
|
|
48223
|
+
const { backtest: isBacktest } = backtest.executionContextService.context;
|
|
48078
48224
|
const { exchangeName, frameName, strategyName } = backtest.methodContextService.context;
|
|
48079
48225
|
const currentPrice = await backtest.exchangeConnectionService.getAveragePrice(symbol);
|
|
48080
48226
|
let signal;
|
|
@@ -48632,14 +48778,14 @@ async function setSessionData(symbol, value) {
|
|
|
48632
48778
|
}
|
|
48633
48779
|
|
|
48634
48780
|
const CREATE_SIGNAL_STATE_METHOD_NAME = "state.createSignalState";
|
|
48635
|
-
const CREATE_SET_STATE_FN = (params) => async (dispatch) => {
|
|
48781
|
+
const CREATE_SET_STATE_FN = (params) => async (symbol, dispatch) => {
|
|
48636
48782
|
if (!ExecutionContextService.hasContext()) {
|
|
48637
48783
|
throw new Error("createSignalState requires an execution context");
|
|
48638
48784
|
}
|
|
48639
48785
|
if (!MethodContextService.hasContext()) {
|
|
48640
48786
|
throw new Error("createSignalState requires a method context");
|
|
48641
48787
|
}
|
|
48642
|
-
const { backtest: isBacktest
|
|
48788
|
+
const { backtest: isBacktest } = backtest.executionContextService.context;
|
|
48643
48789
|
const { exchangeName, frameName, strategyName } = backtest.methodContextService.context;
|
|
48644
48790
|
const currentPrice = await backtest.exchangeConnectionService.getAveragePrice(symbol);
|
|
48645
48791
|
let signal;
|
|
@@ -48661,14 +48807,14 @@ const CREATE_SET_STATE_FN = (params) => async (dispatch) => {
|
|
|
48661
48807
|
}
|
|
48662
48808
|
throw new Error(`createSignalState requires a pending or scheduled signal for symbol=${symbol} bucketName=${params.bucketName}`);
|
|
48663
48809
|
};
|
|
48664
|
-
const CREATE_GET_STATE_FN = (params) => async () => {
|
|
48810
|
+
const CREATE_GET_STATE_FN = (params) => async (symbol) => {
|
|
48665
48811
|
if (!ExecutionContextService.hasContext()) {
|
|
48666
48812
|
throw new Error("createSignalState requires an execution context");
|
|
48667
48813
|
}
|
|
48668
48814
|
if (!MethodContextService.hasContext()) {
|
|
48669
48815
|
throw new Error("createSignalState requires a method context");
|
|
48670
48816
|
}
|
|
48671
|
-
const { backtest: isBacktest
|
|
48817
|
+
const { backtest: isBacktest } = backtest.executionContextService.context;
|
|
48672
48818
|
const { exchangeName, frameName, strategyName } = backtest.methodContextService.context;
|
|
48673
48819
|
const currentPrice = await backtest.exchangeConnectionService.getAveragePrice(symbol);
|
|
48674
48820
|
let signal;
|
|
@@ -61688,6 +61834,7 @@ exports.getAveragePrice = getAveragePrice;
|
|
|
61688
61834
|
exports.getBacktestTimeframe = getBacktestTimeframe;
|
|
61689
61835
|
exports.getBreakeven = getBreakeven;
|
|
61690
61836
|
exports.getCandles = getCandles;
|
|
61837
|
+
exports.getClosePrice = getClosePrice;
|
|
61691
61838
|
exports.getColumns = getColumns;
|
|
61692
61839
|
exports.getConfig = getConfig;
|
|
61693
61840
|
exports.getContext = getContext;
|
package/build/index.mjs
CHANGED
|
@@ -3845,6 +3845,27 @@ class ClientExchange {
|
|
|
3845
3845
|
const vwap = sumPriceVolume / totalVolume;
|
|
3846
3846
|
return vwap;
|
|
3847
3847
|
}
|
|
3848
|
+
/**
|
|
3849
|
+
* Returns the close price of the last completed candle for the given interval.
|
|
3850
|
+
*
|
|
3851
|
+
* Fetches a single candle for the requested interval and returns its close price.
|
|
3852
|
+
*
|
|
3853
|
+
* @param symbol - Trading pair symbol
|
|
3854
|
+
* @param interval - Candle time interval (e.g., "1m", "1h")
|
|
3855
|
+
* @returns Promise resolving to close price of the last candle
|
|
3856
|
+
* @throws Error if no candles available
|
|
3857
|
+
*/
|
|
3858
|
+
async getClosePrice(symbol, interval) {
|
|
3859
|
+
this.params.logger.debug(`ClientExchange getClosePrice`, {
|
|
3860
|
+
symbol,
|
|
3861
|
+
interval,
|
|
3862
|
+
});
|
|
3863
|
+
const candles = await this.getCandles(symbol, interval, 1);
|
|
3864
|
+
if (candles.length === 0) {
|
|
3865
|
+
throw new Error(`ClientExchange getClosePrice: no candles data for symbol=${symbol}`);
|
|
3866
|
+
}
|
|
3867
|
+
return candles[candles.length - 1].close;
|
|
3868
|
+
}
|
|
3848
3869
|
/**
|
|
3849
3870
|
* Formats quantity according to exchange-specific rules for the given symbol.
|
|
3850
3871
|
* Applies proper decimal precision and rounding based on symbol's lot size filters.
|
|
@@ -4250,6 +4271,22 @@ class ExchangeConnectionService {
|
|
|
4250
4271
|
});
|
|
4251
4272
|
return await this.getExchange(this.methodContextService.context.exchangeName).getAveragePrice(symbol);
|
|
4252
4273
|
};
|
|
4274
|
+
/**
|
|
4275
|
+
* Returns the close price of the last completed candle for the given interval.
|
|
4276
|
+
*
|
|
4277
|
+
* Routes to exchange determined by methodContextService.context.exchangeName.
|
|
4278
|
+
*
|
|
4279
|
+
* @param symbol - Trading pair symbol (e.g., "BTCUSDT")
|
|
4280
|
+
* @param interval - Candle interval (e.g., "1h", "1d")
|
|
4281
|
+
* @returns Promise resolving to close price of the last candle
|
|
4282
|
+
*/
|
|
4283
|
+
this.getClosePrice = async (symbol, interval) => {
|
|
4284
|
+
this.loggerService.log("exchangeConnectionService getClosePrice", {
|
|
4285
|
+
symbol,
|
|
4286
|
+
interval,
|
|
4287
|
+
});
|
|
4288
|
+
return await this.getExchange(this.methodContextService.context.exchangeName).getClosePrice(symbol, interval);
|
|
4289
|
+
};
|
|
4253
4290
|
/**
|
|
4254
4291
|
* Formats price according to exchange-specific precision rules.
|
|
4255
4292
|
*
|
|
@@ -14840,6 +14877,34 @@ class ExchangeCoreService {
|
|
|
14840
14877
|
backtest,
|
|
14841
14878
|
});
|
|
14842
14879
|
};
|
|
14880
|
+
/**
|
|
14881
|
+
* Returns the close price of the last completed candle for the given interval with execution context.
|
|
14882
|
+
*
|
|
14883
|
+
* @param symbol - Trading pair symbol
|
|
14884
|
+
* @param interval - Candle interval (e.g., "1m", "1h")
|
|
14885
|
+
* @param when - Timestamp for context (used in backtest mode)
|
|
14886
|
+
* @param backtest - Whether running in backtest mode
|
|
14887
|
+
* @returns Promise resolving to close price of the last candle
|
|
14888
|
+
*/
|
|
14889
|
+
this.getClosePrice = async (symbol, interval, when, backtest) => {
|
|
14890
|
+
this.loggerService.log("exchangeCoreService getClosePrice", {
|
|
14891
|
+
symbol,
|
|
14892
|
+
interval,
|
|
14893
|
+
when,
|
|
14894
|
+
backtest,
|
|
14895
|
+
});
|
|
14896
|
+
if (!MethodContextService.hasContext()) {
|
|
14897
|
+
throw new Error("exchangeCoreService getClosePrice requires a method context");
|
|
14898
|
+
}
|
|
14899
|
+
await this.validate(this.methodContextService.context.exchangeName);
|
|
14900
|
+
return await ExecutionContextService.runInContext(async () => {
|
|
14901
|
+
return await this.exchangeConnectionService.getClosePrice(symbol, interval);
|
|
14902
|
+
}, {
|
|
14903
|
+
symbol,
|
|
14904
|
+
when,
|
|
14905
|
+
backtest,
|
|
14906
|
+
});
|
|
14907
|
+
};
|
|
14843
14908
|
/**
|
|
14844
14909
|
* Formats price with execution context.
|
|
14845
14910
|
*
|
|
@@ -33528,6 +33593,7 @@ async function getBacktestTimeframe(symbol) {
|
|
|
33528
33593
|
|
|
33529
33594
|
const EXCHANGE_METHOD_NAME_GET_CANDLES = "ExchangeUtils.getCandles";
|
|
33530
33595
|
const EXCHANGE_METHOD_NAME_GET_AVERAGE_PRICE = "ExchangeUtils.getAveragePrice";
|
|
33596
|
+
const EXCHANGE_METHOD_NAME_GET_CLOSE_PRICE = "ExchangeUtils.getClosePrice";
|
|
33531
33597
|
const EXCHANGE_METHOD_NAME_FORMAT_QUANTITY = "ExchangeUtils.formatQuantity";
|
|
33532
33598
|
const EXCHANGE_METHOD_NAME_FORMAT_PRICE = "ExchangeUtils.formatPrice";
|
|
33533
33599
|
const EXCHANGE_METHOD_NAME_GET_ORDER_BOOK = "ExchangeUtils.getOrderBook";
|
|
@@ -33885,6 +33951,35 @@ class ExchangeInstance {
|
|
|
33885
33951
|
const vwap = sumPriceVolume / totalVolume;
|
|
33886
33952
|
return vwap;
|
|
33887
33953
|
};
|
|
33954
|
+
/**
|
|
33955
|
+
* Returns the close price of the last completed candle for the given interval.
|
|
33956
|
+
*
|
|
33957
|
+
* Fetches a single candle for the requested interval and returns its close price.
|
|
33958
|
+
*
|
|
33959
|
+
* @param symbol - Trading pair symbol
|
|
33960
|
+
* @param interval - Candle time interval (e.g., "1m", "1h")
|
|
33961
|
+
* @returns Promise resolving to close price of the last candle
|
|
33962
|
+
* @throws Error if no candles available
|
|
33963
|
+
*
|
|
33964
|
+
* @example
|
|
33965
|
+
* ```typescript
|
|
33966
|
+
* const instance = new ExchangeInstance("binance");
|
|
33967
|
+
* const close = await instance.getClosePrice("BTCUSDT", "1h");
|
|
33968
|
+
* console.log(close); // 50125.43
|
|
33969
|
+
* ```
|
|
33970
|
+
*/
|
|
33971
|
+
this.getClosePrice = async (symbol, interval) => {
|
|
33972
|
+
backtest.loggerService.debug(`ExchangeInstance getClosePrice`, {
|
|
33973
|
+
exchangeName: this.exchangeName,
|
|
33974
|
+
symbol,
|
|
33975
|
+
interval,
|
|
33976
|
+
});
|
|
33977
|
+
const candles = await this.getCandles(symbol, interval, 1);
|
|
33978
|
+
if (candles.length === 0) {
|
|
33979
|
+
throw new Error(`ExchangeInstance getClosePrice: no candles data for symbol=${symbol}`);
|
|
33980
|
+
}
|
|
33981
|
+
return candles[candles.length - 1].close;
|
|
33982
|
+
};
|
|
33888
33983
|
/**
|
|
33889
33984
|
* Format quantity according to exchange precision rules.
|
|
33890
33985
|
*
|
|
@@ -34242,6 +34337,28 @@ class ExchangeUtils {
|
|
|
34242
34337
|
const instance = this._getInstance(context.exchangeName);
|
|
34243
34338
|
return await instance.getAveragePrice(symbol);
|
|
34244
34339
|
};
|
|
34340
|
+
/**
|
|
34341
|
+
* Returns the close price of the last completed candle for the given interval.
|
|
34342
|
+
*
|
|
34343
|
+
* @param symbol - Trading pair symbol
|
|
34344
|
+
* @param interval - Candle time interval (e.g., "1m", "1h")
|
|
34345
|
+
* @param context - Execution context with exchange name
|
|
34346
|
+
* @returns Promise resolving to close price of the last candle
|
|
34347
|
+
* @throws Error if no candles available
|
|
34348
|
+
*
|
|
34349
|
+
* @example
|
|
34350
|
+
* ```typescript
|
|
34351
|
+
* const close = await Exchange.getClosePrice("BTCUSDT", "1h", {
|
|
34352
|
+
* exchangeName: "binance"
|
|
34353
|
+
* });
|
|
34354
|
+
* console.log(close); // 50125.43
|
|
34355
|
+
* ```
|
|
34356
|
+
*/
|
|
34357
|
+
this.getClosePrice = async (symbol, interval, context) => {
|
|
34358
|
+
backtest.exchangeValidationService.validate(context.exchangeName, EXCHANGE_METHOD_NAME_GET_CLOSE_PRICE);
|
|
34359
|
+
const instance = this._getInstance(context.exchangeName);
|
|
34360
|
+
return await instance.getClosePrice(symbol, interval);
|
|
34361
|
+
};
|
|
34245
34362
|
/**
|
|
34246
34363
|
* Format quantity according to exchange precision rules.
|
|
34247
34364
|
*
|
|
@@ -34828,6 +34945,7 @@ function getActionSchema(actionName) {
|
|
|
34828
34945
|
|
|
34829
34946
|
const GET_CANDLES_METHOD_NAME = "exchange.getCandles";
|
|
34830
34947
|
const GET_AVERAGE_PRICE_METHOD_NAME = "exchange.getAveragePrice";
|
|
34948
|
+
const GET_CLOSE_PRICE_METHOD_NAME = "exchange.getClosePrice";
|
|
34831
34949
|
const FORMAT_PRICE_METHOD_NAME = "exchange.formatPrice";
|
|
34832
34950
|
const FORMAT_QUANTITY_METHOD_NAME = "exchange.formatQuantity";
|
|
34833
34951
|
const GET_DATE_METHOD_NAME = "exchange.getDate";
|
|
@@ -34925,6 +35043,32 @@ async function getAveragePrice(symbol) {
|
|
|
34925
35043
|
}
|
|
34926
35044
|
return await backtest.exchangeConnectionService.getAveragePrice(symbol);
|
|
34927
35045
|
}
|
|
35046
|
+
/**
|
|
35047
|
+
* Returns the close price of the last completed candle for the given interval.
|
|
35048
|
+
*
|
|
35049
|
+
* @param symbol - Trading pair symbol (e.g., "BTCUSDT")
|
|
35050
|
+
* @param interval - Candle interval ("1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h")
|
|
35051
|
+
* @returns Promise resolving to close price of the last candle
|
|
35052
|
+
*
|
|
35053
|
+
* @example
|
|
35054
|
+
* ```typescript
|
|
35055
|
+
* const close = await getClosePrice("BTCUSDT", "1h");
|
|
35056
|
+
* console.log(close); // 50125.43
|
|
35057
|
+
* ```
|
|
35058
|
+
*/
|
|
35059
|
+
async function getClosePrice(symbol, interval) {
|
|
35060
|
+
backtest.loggerService.info(GET_CLOSE_PRICE_METHOD_NAME, {
|
|
35061
|
+
symbol,
|
|
35062
|
+
interval,
|
|
35063
|
+
});
|
|
35064
|
+
if (!ExecutionContextService.hasContext()) {
|
|
35065
|
+
throw new Error("getClosePrice requires an execution context");
|
|
35066
|
+
}
|
|
35067
|
+
if (!MethodContextService.hasContext()) {
|
|
35068
|
+
throw new Error("getClosePrice requires a method context");
|
|
35069
|
+
}
|
|
35070
|
+
return await backtest.exchangeConnectionService.getClosePrice(symbol, interval);
|
|
35071
|
+
}
|
|
34928
35072
|
/**
|
|
34929
35073
|
* Formats a price value according to exchange rules.
|
|
34930
35074
|
*
|
|
@@ -47958,6 +48102,7 @@ async function getMinutesSinceLatestSignalCreated(symbol) {
|
|
|
47958
48102
|
* SL trades show peak < 0.15% (Feb08, Feb13) or never go positive (Feb25).
|
|
47959
48103
|
* Rule: if minutesOpen >= N and peakPercent < threshold (e.g. 0.3%) — exit.
|
|
47960
48104
|
*
|
|
48105
|
+
* @param symbol - Trading pair symbol
|
|
47961
48106
|
* @param dto.bucketName - State bucket name
|
|
47962
48107
|
* @param dto.initialValue - Default value when no persisted state exists
|
|
47963
48108
|
* @returns Promise resolving to current state value, or initialValue if no signal
|
|
@@ -47977,16 +48122,16 @@ async function getMinutesSinceLatestSignalCreated(symbol) {
|
|
|
47977
48122
|
* }
|
|
47978
48123
|
* ```
|
|
47979
48124
|
*/
|
|
47980
|
-
async function getSignalState(dto) {
|
|
48125
|
+
async function getSignalState(symbol, dto) {
|
|
47981
48126
|
const { bucketName, initialValue } = dto;
|
|
47982
|
-
backtest.loggerService.info(GET_SIGNAL_STATE_METHOD_NAME, { bucketName });
|
|
48127
|
+
backtest.loggerService.info(GET_SIGNAL_STATE_METHOD_NAME, { symbol, bucketName });
|
|
47983
48128
|
if (!ExecutionContextService.hasContext()) {
|
|
47984
48129
|
throw new Error("getSignalState requires an execution context");
|
|
47985
48130
|
}
|
|
47986
48131
|
if (!MethodContextService.hasContext()) {
|
|
47987
48132
|
throw new Error("getSignalState requires a method context");
|
|
47988
48133
|
}
|
|
47989
|
-
const { backtest: isBacktest
|
|
48134
|
+
const { backtest: isBacktest } = backtest.executionContextService.context;
|
|
47990
48135
|
const { exchangeName, frameName, strategyName } = backtest.methodContextService.context;
|
|
47991
48136
|
const currentPrice = await backtest.exchangeConnectionService.getAveragePrice(symbol);
|
|
47992
48137
|
let signal;
|
|
@@ -48022,6 +48167,7 @@ async function getSignalState(dto) {
|
|
|
48022
48167
|
* SL trades show peak < 0.15% (Feb08, Feb13) or never go positive (Feb25).
|
|
48023
48168
|
* Rule: if minutesOpen >= N and peakPercent < threshold (e.g. 0.3%) — exit.
|
|
48024
48169
|
*
|
|
48170
|
+
* @param symbol - Trading pair symbol
|
|
48025
48171
|
* @param dto.bucketName - State bucket name
|
|
48026
48172
|
* @param dto.initialValue - Default value when no persisted state exists
|
|
48027
48173
|
* @param dto.dispatch - New value or updater function receiving current value
|
|
@@ -48045,7 +48191,7 @@ async function getSignalState(dto) {
|
|
|
48045
48191
|
* );
|
|
48046
48192
|
* ```
|
|
48047
48193
|
*/
|
|
48048
|
-
async function setSignalState(dispatch, dto) {
|
|
48194
|
+
async function setSignalState(symbol, dispatch, dto) {
|
|
48049
48195
|
const { bucketName, initialValue } = dto;
|
|
48050
48196
|
backtest.loggerService.info(SET_SIGNAL_STATE_METHOD_NAME, { bucketName });
|
|
48051
48197
|
if (!ExecutionContextService.hasContext()) {
|
|
@@ -48054,7 +48200,7 @@ async function setSignalState(dispatch, dto) {
|
|
|
48054
48200
|
if (!MethodContextService.hasContext()) {
|
|
48055
48201
|
throw new Error("setSignalState requires a method context");
|
|
48056
48202
|
}
|
|
48057
|
-
const { backtest: isBacktest
|
|
48203
|
+
const { backtest: isBacktest } = backtest.executionContextService.context;
|
|
48058
48204
|
const { exchangeName, frameName, strategyName } = backtest.methodContextService.context;
|
|
48059
48205
|
const currentPrice = await backtest.exchangeConnectionService.getAveragePrice(symbol);
|
|
48060
48206
|
let signal;
|
|
@@ -48612,14 +48758,14 @@ async function setSessionData(symbol, value) {
|
|
|
48612
48758
|
}
|
|
48613
48759
|
|
|
48614
48760
|
const CREATE_SIGNAL_STATE_METHOD_NAME = "state.createSignalState";
|
|
48615
|
-
const CREATE_SET_STATE_FN = (params) => async (dispatch) => {
|
|
48761
|
+
const CREATE_SET_STATE_FN = (params) => async (symbol, dispatch) => {
|
|
48616
48762
|
if (!ExecutionContextService.hasContext()) {
|
|
48617
48763
|
throw new Error("createSignalState requires an execution context");
|
|
48618
48764
|
}
|
|
48619
48765
|
if (!MethodContextService.hasContext()) {
|
|
48620
48766
|
throw new Error("createSignalState requires a method context");
|
|
48621
48767
|
}
|
|
48622
|
-
const { backtest: isBacktest
|
|
48768
|
+
const { backtest: isBacktest } = backtest.executionContextService.context;
|
|
48623
48769
|
const { exchangeName, frameName, strategyName } = backtest.methodContextService.context;
|
|
48624
48770
|
const currentPrice = await backtest.exchangeConnectionService.getAveragePrice(symbol);
|
|
48625
48771
|
let signal;
|
|
@@ -48641,14 +48787,14 @@ const CREATE_SET_STATE_FN = (params) => async (dispatch) => {
|
|
|
48641
48787
|
}
|
|
48642
48788
|
throw new Error(`createSignalState requires a pending or scheduled signal for symbol=${symbol} bucketName=${params.bucketName}`);
|
|
48643
48789
|
};
|
|
48644
|
-
const CREATE_GET_STATE_FN = (params) => async () => {
|
|
48790
|
+
const CREATE_GET_STATE_FN = (params) => async (symbol) => {
|
|
48645
48791
|
if (!ExecutionContextService.hasContext()) {
|
|
48646
48792
|
throw new Error("createSignalState requires an execution context");
|
|
48647
48793
|
}
|
|
48648
48794
|
if (!MethodContextService.hasContext()) {
|
|
48649
48795
|
throw new Error("createSignalState requires a method context");
|
|
48650
48796
|
}
|
|
48651
|
-
const { backtest: isBacktest
|
|
48797
|
+
const { backtest: isBacktest } = backtest.executionContextService.context;
|
|
48652
48798
|
const { exchangeName, frameName, strategyName } = backtest.methodContextService.context;
|
|
48653
48799
|
const currentPrice = await backtest.exchangeConnectionService.getAveragePrice(symbol);
|
|
48654
48800
|
let signal;
|
|
@@ -61555,4 +61701,4 @@ const validateSignal = (signal, currentPrice) => {
|
|
|
61555
61701
|
return !errors.length;
|
|
61556
61702
|
};
|
|
61557
61703
|
|
|
61558
|
-
export { ActionBase, Backtest, Breakeven, Broker, BrokerBase, Cache, Constant, Dump, Exchange, ExecutionContextService, Heat, HighestProfit, Interval, Live, Log, Markdown, MarkdownFileBase, MarkdownFolderBase, MarkdownWriter, MaxDrawdown, Memory, MemoryBacktest, MemoryBacktestAdapter, MemoryLive, MemoryLiveAdapter, MethodContextService, Notification, NotificationBacktest, NotificationLive, Partial, Performance, PersistBase, PersistBreakevenAdapter, PersistCandleAdapter, PersistIntervalAdapter, PersistLogAdapter, PersistMeasureAdapter, PersistMemoryAdapter, PersistNotificationAdapter, PersistPartialAdapter, PersistRecentAdapter, PersistRiskAdapter, PersistScheduleAdapter, PersistSessionAdapter, PersistSignalAdapter, PersistStateAdapter, PersistStorageAdapter, Position, PositionSize, Recent, RecentBacktest, RecentLive, Reflect$1 as Reflect, Report, ReportBase, ReportWriter, Risk, Schedule, Session, SessionBacktest, SessionLive, State, StateBacktest, StateBacktestAdapter, StateLive, StateLiveAdapter, Storage, StorageBacktest, StorageLive, Strategy, Sync, System, Walker, addActionSchema, addExchangeSchema, addFrameSchema, addRiskSchema, addSizingSchema, addStrategySchema, addWalkerSchema, alignToInterval, checkCandles, commitActivateScheduled, commitAverageBuy, commitBreakeven, commitCancelScheduled, commitClosePending, commitPartialLoss, commitPartialLossCost, commitPartialProfit, commitPartialProfitCost, commitSignalNotify, commitTrailingStop, commitTrailingStopCost, commitTrailingTake, commitTrailingTakeCost, createSignalState, dumpAgentAnswer, dumpError, dumpJson, dumpRecord, dumpTable, dumpText, emitters, formatPrice, formatQuantity, get, getActionSchema, getAggregatedTrades, getAveragePrice, getBacktestTimeframe, getBreakeven, getCandles, getColumns, getConfig, getContext, getDate, getDefaultColumns, getDefaultConfig, getEffectivePriceOpen, getExchangeSchema, getFrameSchema, getLatestSignal, getMaxDrawdownDistancePnlCost, getMaxDrawdownDistancePnlPercentage, getMinutesSinceLatestSignalCreated, getMode, getNextCandles, getOrderBook, getPendingSignal, getPositionActiveMinutes, getPositionCountdownMinutes, getPositionDrawdownMinutes, getPositionEffectivePrice, getPositionEntries, getPositionEntryOverlap, getPositionEstimateMinutes, getPositionHighestMaxDrawdownPnlCost, getPositionHighestMaxDrawdownPnlPercentage, getPositionHighestPnlCost, getPositionHighestPnlPercentage, getPositionHighestProfitBreakeven, getPositionHighestProfitDistancePnlCost, getPositionHighestProfitDistancePnlPercentage, getPositionHighestProfitMinutes, getPositionHighestProfitPrice, getPositionHighestProfitTimestamp, getPositionInvestedCost, getPositionInvestedCount, getPositionLevels, getPositionMaxDrawdownMinutes, getPositionMaxDrawdownPnlCost, getPositionMaxDrawdownPnlPercentage, getPositionMaxDrawdownPrice, getPositionMaxDrawdownTimestamp, getPositionPartialOverlap, getPositionPartials, getPositionPnlCost, getPositionPnlPercent, getPositionWaitingMinutes, getRawCandles, getRiskSchema, getScheduledSignal, getSessionData, getSignalState, getSizingSchema, getStrategySchema, getSymbol, getTimestamp, getTotalClosed, getTotalCostClosed, getTotalPercentClosed, getWalkerSchema, hasNoPendingSignal, hasNoScheduledSignal, hasTradeContext, investedCostToPercent, backtest as lib, listExchangeSchema, listFrameSchema, listMemory, listRiskSchema, listSizingSchema, listStrategySchema, listWalkerSchema, listenActivePing, listenActivePingOnce, listenBacktestProgress, listenBreakevenAvailable, listenBreakevenAvailableOnce, listenDoneBacktest, listenDoneBacktestOnce, listenDoneLive, listenDoneLiveOnce, listenDoneWalker, listenDoneWalkerOnce, listenError, listenExit, listenHighestProfit, listenHighestProfitOnce, listenIdlePing, listenIdlePingOnce, listenMaxDrawdown, listenMaxDrawdownOnce, listenPartialLossAvailable, listenPartialLossAvailableOnce, listenPartialProfitAvailable, listenPartialProfitAvailableOnce, listenPerformance, listenRisk, listenRiskOnce, listenSchedulePing, listenSchedulePingOnce, listenSignal, listenSignalBacktest, listenSignalBacktestOnce, listenSignalLive, listenSignalLiveOnce, listenSignalNotify, listenSignalNotifyOnce, listenSignalOnce, listenStrategyCommit, listenStrategyCommitOnce, listenSync, listenSyncOnce, listenValidation, listenWalker, listenWalkerComplete, listenWalkerOnce, listenWalkerProgress, overrideActionSchema, overrideExchangeSchema, overrideFrameSchema, overrideRiskSchema, overrideSizingSchema, overrideStrategySchema, overrideWalkerSchema, parseArgs, percentDiff, percentToCloseCost, percentValue, readMemory, removeMemory, roundTicks, runInMockContext, searchMemory, set, setColumns, setConfig, setLogger, setSessionData, setSignalState, shutdown, slPercentShiftToPrice, slPriceToPercentShift, stopStrategy, toProfitLossDto, tpPercentShiftToPrice, tpPriceToPercentShift, validate, validateCommonSignal, validatePendingSignal, validateScheduledSignal, validateSignal, waitForCandle, warmCandles, writeMemory };
|
|
61704
|
+
export { ActionBase, Backtest, Breakeven, Broker, BrokerBase, Cache, Constant, Dump, Exchange, ExecutionContextService, Heat, HighestProfit, Interval, Live, Log, Markdown, MarkdownFileBase, MarkdownFolderBase, MarkdownWriter, MaxDrawdown, Memory, MemoryBacktest, MemoryBacktestAdapter, MemoryLive, MemoryLiveAdapter, MethodContextService, Notification, NotificationBacktest, NotificationLive, Partial, Performance, PersistBase, PersistBreakevenAdapter, PersistCandleAdapter, PersistIntervalAdapter, PersistLogAdapter, PersistMeasureAdapter, PersistMemoryAdapter, PersistNotificationAdapter, PersistPartialAdapter, PersistRecentAdapter, PersistRiskAdapter, PersistScheduleAdapter, PersistSessionAdapter, PersistSignalAdapter, PersistStateAdapter, PersistStorageAdapter, Position, PositionSize, Recent, RecentBacktest, RecentLive, Reflect$1 as Reflect, Report, ReportBase, ReportWriter, Risk, Schedule, Session, SessionBacktest, SessionLive, State, StateBacktest, StateBacktestAdapter, StateLive, StateLiveAdapter, Storage, StorageBacktest, StorageLive, Strategy, Sync, System, Walker, addActionSchema, addExchangeSchema, addFrameSchema, addRiskSchema, addSizingSchema, addStrategySchema, addWalkerSchema, alignToInterval, checkCandles, commitActivateScheduled, commitAverageBuy, commitBreakeven, commitCancelScheduled, commitClosePending, commitPartialLoss, commitPartialLossCost, commitPartialProfit, commitPartialProfitCost, commitSignalNotify, commitTrailingStop, commitTrailingStopCost, commitTrailingTake, commitTrailingTakeCost, createSignalState, dumpAgentAnswer, dumpError, dumpJson, dumpRecord, dumpTable, dumpText, emitters, formatPrice, formatQuantity, get, getActionSchema, getAggregatedTrades, getAveragePrice, getBacktestTimeframe, getBreakeven, getCandles, getClosePrice, getColumns, getConfig, getContext, getDate, getDefaultColumns, getDefaultConfig, getEffectivePriceOpen, getExchangeSchema, getFrameSchema, getLatestSignal, getMaxDrawdownDistancePnlCost, getMaxDrawdownDistancePnlPercentage, getMinutesSinceLatestSignalCreated, getMode, getNextCandles, getOrderBook, getPendingSignal, getPositionActiveMinutes, getPositionCountdownMinutes, getPositionDrawdownMinutes, getPositionEffectivePrice, getPositionEntries, getPositionEntryOverlap, getPositionEstimateMinutes, getPositionHighestMaxDrawdownPnlCost, getPositionHighestMaxDrawdownPnlPercentage, getPositionHighestPnlCost, getPositionHighestPnlPercentage, getPositionHighestProfitBreakeven, getPositionHighestProfitDistancePnlCost, getPositionHighestProfitDistancePnlPercentage, getPositionHighestProfitMinutes, getPositionHighestProfitPrice, getPositionHighestProfitTimestamp, getPositionInvestedCost, getPositionInvestedCount, getPositionLevels, getPositionMaxDrawdownMinutes, getPositionMaxDrawdownPnlCost, getPositionMaxDrawdownPnlPercentage, getPositionMaxDrawdownPrice, getPositionMaxDrawdownTimestamp, getPositionPartialOverlap, getPositionPartials, getPositionPnlCost, getPositionPnlPercent, getPositionWaitingMinutes, getRawCandles, getRiskSchema, getScheduledSignal, getSessionData, getSignalState, getSizingSchema, getStrategySchema, getSymbol, getTimestamp, getTotalClosed, getTotalCostClosed, getTotalPercentClosed, getWalkerSchema, hasNoPendingSignal, hasNoScheduledSignal, hasTradeContext, investedCostToPercent, backtest as lib, listExchangeSchema, listFrameSchema, listMemory, listRiskSchema, listSizingSchema, listStrategySchema, listWalkerSchema, listenActivePing, listenActivePingOnce, listenBacktestProgress, listenBreakevenAvailable, listenBreakevenAvailableOnce, listenDoneBacktest, listenDoneBacktestOnce, listenDoneLive, listenDoneLiveOnce, listenDoneWalker, listenDoneWalkerOnce, listenError, listenExit, listenHighestProfit, listenHighestProfitOnce, listenIdlePing, listenIdlePingOnce, listenMaxDrawdown, listenMaxDrawdownOnce, listenPartialLossAvailable, listenPartialLossAvailableOnce, listenPartialProfitAvailable, listenPartialProfitAvailableOnce, listenPerformance, listenRisk, listenRiskOnce, listenSchedulePing, listenSchedulePingOnce, listenSignal, listenSignalBacktest, listenSignalBacktestOnce, listenSignalLive, listenSignalLiveOnce, listenSignalNotify, listenSignalNotifyOnce, listenSignalOnce, listenStrategyCommit, listenStrategyCommitOnce, listenSync, listenSyncOnce, listenValidation, listenWalker, listenWalkerComplete, listenWalkerOnce, listenWalkerProgress, overrideActionSchema, overrideExchangeSchema, overrideFrameSchema, overrideRiskSchema, overrideSizingSchema, overrideStrategySchema, overrideWalkerSchema, parseArgs, percentDiff, percentToCloseCost, percentValue, readMemory, removeMemory, roundTicks, runInMockContext, searchMemory, set, setColumns, setConfig, setLogger, setSessionData, setSignalState, shutdown, slPercentShiftToPrice, slPriceToPercentShift, stopStrategy, toProfitLossDto, tpPercentShiftToPrice, tpPriceToPercentShift, validate, validateCommonSignal, validatePendingSignal, validateScheduledSignal, validateSignal, waitForCandle, warmCandles, writeMemory };
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -4210,6 +4210,14 @@ interface IExchange {
|
|
|
4210
4210
|
* @returns Promise resolving to volume-weighted average price
|
|
4211
4211
|
*/
|
|
4212
4212
|
getAveragePrice: (symbol: string) => Promise<number>;
|
|
4213
|
+
/**
|
|
4214
|
+
* Returns the close price of the last completed candle for the given interval.
|
|
4215
|
+
*
|
|
4216
|
+
* @param symbol - Trading pair symbol
|
|
4217
|
+
* @param interval - Candle time interval (e.g., "1m", "1h")
|
|
4218
|
+
* @returns Promise resolving to close price of the last candle
|
|
4219
|
+
*/
|
|
4220
|
+
getClosePrice: (symbol: string, interval: CandleInterval) => Promise<number>;
|
|
4213
4221
|
/**
|
|
4214
4222
|
* Fetch order book for a trading pair.
|
|
4215
4223
|
*
|
|
@@ -9094,6 +9102,20 @@ declare function getCandles(symbol: string, interval: CandleInterval, limit: num
|
|
|
9094
9102
|
* ```
|
|
9095
9103
|
*/
|
|
9096
9104
|
declare function getAveragePrice(symbol: string): Promise<number>;
|
|
9105
|
+
/**
|
|
9106
|
+
* Returns the close price of the last completed candle for the given interval.
|
|
9107
|
+
*
|
|
9108
|
+
* @param symbol - Trading pair symbol (e.g., "BTCUSDT")
|
|
9109
|
+
* @param interval - Candle interval ("1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h")
|
|
9110
|
+
* @returns Promise resolving to close price of the last candle
|
|
9111
|
+
*
|
|
9112
|
+
* @example
|
|
9113
|
+
* ```typescript
|
|
9114
|
+
* const close = await getClosePrice("BTCUSDT", "1h");
|
|
9115
|
+
* console.log(close); // 50125.43
|
|
9116
|
+
* ```
|
|
9117
|
+
*/
|
|
9118
|
+
declare function getClosePrice(symbol: string, interval: CandleInterval): Promise<number>;
|
|
9097
9119
|
/**
|
|
9098
9120
|
* Formats a price value according to exchange rules.
|
|
9099
9121
|
*
|
|
@@ -9358,6 +9380,7 @@ declare function getMinutesSinceLatestSignalCreated(symbol: string): Promise<num
|
|
|
9358
9380
|
* SL trades show peak < 0.15% (Feb08, Feb13) or never go positive (Feb25).
|
|
9359
9381
|
* Rule: if minutesOpen >= N and peakPercent < threshold (e.g. 0.3%) — exit.
|
|
9360
9382
|
*
|
|
9383
|
+
* @param symbol - Trading pair symbol
|
|
9361
9384
|
* @param dto.bucketName - State bucket name
|
|
9362
9385
|
* @param dto.initialValue - Default value when no persisted state exists
|
|
9363
9386
|
* @returns Promise resolving to current state value, or initialValue if no signal
|
|
@@ -9377,7 +9400,7 @@ declare function getMinutesSinceLatestSignalCreated(symbol: string): Promise<num
|
|
|
9377
9400
|
* }
|
|
9378
9401
|
* ```
|
|
9379
9402
|
*/
|
|
9380
|
-
declare function getSignalState<Value extends object = object>(dto: {
|
|
9403
|
+
declare function getSignalState<Value extends object = object>(symbol: string, dto: {
|
|
9381
9404
|
bucketName: string;
|
|
9382
9405
|
initialValue: Value;
|
|
9383
9406
|
}): Promise<Value>;
|
|
@@ -9395,6 +9418,7 @@ declare function getSignalState<Value extends object = object>(dto: {
|
|
|
9395
9418
|
* SL trades show peak < 0.15% (Feb08, Feb13) or never go positive (Feb25).
|
|
9396
9419
|
* Rule: if minutesOpen >= N and peakPercent < threshold (e.g. 0.3%) — exit.
|
|
9397
9420
|
*
|
|
9421
|
+
* @param symbol - Trading pair symbol
|
|
9398
9422
|
* @param dto.bucketName - State bucket name
|
|
9399
9423
|
* @param dto.initialValue - Default value when no persisted state exists
|
|
9400
9424
|
* @param dto.dispatch - New value or updater function receiving current value
|
|
@@ -9418,7 +9442,7 @@ declare function getSignalState<Value extends object = object>(dto: {
|
|
|
9418
9442
|
* );
|
|
9419
9443
|
* ```
|
|
9420
9444
|
*/
|
|
9421
|
-
declare function setSignalState<Value extends object = object>(dispatch: Value | Dispatch$1<Value>, dto: {
|
|
9445
|
+
declare function setSignalState<Value extends object = object>(symbol: string, dispatch: Value | Dispatch$1<Value>, dto: {
|
|
9422
9446
|
bucketName: string;
|
|
9423
9447
|
initialValue: Value;
|
|
9424
9448
|
}): Promise<Value>;
|
|
@@ -9771,18 +9795,20 @@ interface IStateParams<Value extends object = object> {
|
|
|
9771
9795
|
/**
|
|
9772
9796
|
* Reads the current state value for the active pending or scheduled signal.
|
|
9773
9797
|
* Resolved from execution context — no signalId argument required.
|
|
9798
|
+
* @param symbol - Trading pair symbol
|
|
9774
9799
|
* @returns Current state value
|
|
9775
9800
|
* @throws Error if no pending or scheduled signal exists
|
|
9776
9801
|
*/
|
|
9777
|
-
type GetStateFn<Value extends object = object> = () => Promise<Value>;
|
|
9802
|
+
type GetStateFn<Value extends object = object> = (symbol: string) => Promise<Value>;
|
|
9778
9803
|
/**
|
|
9779
9804
|
* Updates the state value for the active pending or scheduled signal.
|
|
9780
9805
|
* Resolved from execution context — no signalId argument required.
|
|
9806
|
+
* @param symbol - Trading pair symbol
|
|
9781
9807
|
* @param dispatch - New value or updater function receiving current value
|
|
9782
9808
|
* @returns Updated state value
|
|
9783
9809
|
* @throws Error if no pending or scheduled signal exists
|
|
9784
9810
|
*/
|
|
9785
|
-
type SetStateFn<Value extends object = object> = (dispatch: Value | Dispatch<Value>) => Promise<Value>;
|
|
9811
|
+
type SetStateFn<Value extends object = object> = (symbol: string, dispatch: Value | Dispatch<Value>) => Promise<Value>;
|
|
9786
9812
|
/**
|
|
9787
9813
|
* Tuple returned by createSignalState — [getState, setState] bound to the bucket.
|
|
9788
9814
|
* Both functions resolve the active signal and backtest flag from execution context automatically.
|
|
@@ -23459,6 +23485,26 @@ declare class ExchangeUtils {
|
|
|
23459
23485
|
getAveragePrice: (symbol: string, context: {
|
|
23460
23486
|
exchangeName: ExchangeName;
|
|
23461
23487
|
}) => Promise<number>;
|
|
23488
|
+
/**
|
|
23489
|
+
* Returns the close price of the last completed candle for the given interval.
|
|
23490
|
+
*
|
|
23491
|
+
* @param symbol - Trading pair symbol
|
|
23492
|
+
* @param interval - Candle time interval (e.g., "1m", "1h")
|
|
23493
|
+
* @param context - Execution context with exchange name
|
|
23494
|
+
* @returns Promise resolving to close price of the last candle
|
|
23495
|
+
* @throws Error if no candles available
|
|
23496
|
+
*
|
|
23497
|
+
* @example
|
|
23498
|
+
* ```typescript
|
|
23499
|
+
* const close = await Exchange.getClosePrice("BTCUSDT", "1h", {
|
|
23500
|
+
* exchangeName: "binance"
|
|
23501
|
+
* });
|
|
23502
|
+
* console.log(close); // 50125.43
|
|
23503
|
+
* ```
|
|
23504
|
+
*/
|
|
23505
|
+
getClosePrice: (symbol: string, interval: CandleInterval, context: {
|
|
23506
|
+
exchangeName: ExchangeName;
|
|
23507
|
+
}) => Promise<number>;
|
|
23462
23508
|
/**
|
|
23463
23509
|
* Format quantity according to exchange precision rules.
|
|
23464
23510
|
*
|
|
@@ -26850,6 +26896,17 @@ declare class ClientExchange implements IExchange {
|
|
|
26850
26896
|
* @throws Error if no candles available
|
|
26851
26897
|
*/
|
|
26852
26898
|
getAveragePrice(symbol: string): Promise<number>;
|
|
26899
|
+
/**
|
|
26900
|
+
* Returns the close price of the last completed candle for the given interval.
|
|
26901
|
+
*
|
|
26902
|
+
* Fetches a single candle for the requested interval and returns its close price.
|
|
26903
|
+
*
|
|
26904
|
+
* @param symbol - Trading pair symbol
|
|
26905
|
+
* @param interval - Candle time interval (e.g., "1m", "1h")
|
|
26906
|
+
* @returns Promise resolving to close price of the last candle
|
|
26907
|
+
* @throws Error if no candles available
|
|
26908
|
+
*/
|
|
26909
|
+
getClosePrice(symbol: string, interval: CandleInterval): Promise<number>;
|
|
26853
26910
|
/**
|
|
26854
26911
|
* Formats quantity according to exchange-specific rules for the given symbol.
|
|
26855
26912
|
* Applies proper decimal precision and rounding based on symbol's lot size filters.
|
|
@@ -27004,6 +27061,16 @@ declare class ExchangeConnectionService implements IExchange {
|
|
|
27004
27061
|
* @returns Promise resolving to average price
|
|
27005
27062
|
*/
|
|
27006
27063
|
getAveragePrice: (symbol: string) => Promise<number>;
|
|
27064
|
+
/**
|
|
27065
|
+
* Returns the close price of the last completed candle for the given interval.
|
|
27066
|
+
*
|
|
27067
|
+
* Routes to exchange determined by methodContextService.context.exchangeName.
|
|
27068
|
+
*
|
|
27069
|
+
* @param symbol - Trading pair symbol (e.g., "BTCUSDT")
|
|
27070
|
+
* @param interval - Candle interval (e.g., "1h", "1d")
|
|
27071
|
+
* @returns Promise resolving to close price of the last candle
|
|
27072
|
+
*/
|
|
27073
|
+
getClosePrice: (symbol: string, interval: CandleInterval) => Promise<number>;
|
|
27007
27074
|
/**
|
|
27008
27075
|
* Formats price according to exchange-specific precision rules.
|
|
27009
27076
|
*
|
|
@@ -30041,6 +30108,16 @@ declare class ExchangeCoreService implements TExchange {
|
|
|
30041
30108
|
* @returns Promise resolving to VWAP price
|
|
30042
30109
|
*/
|
|
30043
30110
|
getAveragePrice: (symbol: string, when: Date, backtest: boolean) => Promise<number>;
|
|
30111
|
+
/**
|
|
30112
|
+
* Returns the close price of the last completed candle for the given interval with execution context.
|
|
30113
|
+
*
|
|
30114
|
+
* @param symbol - Trading pair symbol
|
|
30115
|
+
* @param interval - Candle interval (e.g., "1m", "1h")
|
|
30116
|
+
* @param when - Timestamp for context (used in backtest mode)
|
|
30117
|
+
* @param backtest - Whether running in backtest mode
|
|
30118
|
+
* @returns Promise resolving to close price of the last candle
|
|
30119
|
+
*/
|
|
30120
|
+
getClosePrice: (symbol: string, interval: CandleInterval, when: Date, backtest: boolean) => Promise<number>;
|
|
30044
30121
|
/**
|
|
30045
30122
|
* Formats price with execution context.
|
|
30046
30123
|
*
|
|
@@ -34044,4 +34121,4 @@ declare const getTotalClosed: (signal: Signal) => {
|
|
|
34044
34121
|
remainingCostBasis: number;
|
|
34045
34122
|
};
|
|
34046
34123
|
|
|
34047
|
-
export { ActionBase, type ActivateScheduledCommit, type ActivateScheduledCommitNotification, type ActivePingContract, type AverageBuyCommit, type AverageBuyCommitNotification, Backtest, type BacktestStatisticsModel, Breakeven, type BreakevenAvailableNotification, type BreakevenCommit, type BreakevenCommitNotification, type BreakevenContract, type BreakevenData, type BreakevenEvent, type BreakevenStatisticsModel, Broker, type BrokerAverageBuyPayload, BrokerBase, type BrokerBreakevenPayload, type BrokerPartialLossPayload, type BrokerPartialProfitPayload, type BrokerSignalClosePayload, type BrokerSignalOpenPayload, type BrokerTrailingStopPayload, type BrokerTrailingTakePayload, Cache, type CancelScheduledCommit, type CancelScheduledCommitNotification, type CandleData, type CandleInterval, type ClosePendingCommit, type ClosePendingCommitNotification, type ColumnConfig, type ColumnModel, type CommitPayload, Constant, type CriticalErrorNotification, type DoneContract, Dump, type EntityId, Exchange, ExecutionContextService, type FrameInterval, type GlobalConfig, Heat, type HeatmapStatisticsModel, HighestProfit, type HighestProfitContract, type HighestProfitEvent, type HighestProfitStatisticsModel, type IActionSchema, type IActivateScheduledCommitRow, type IAggregatedTradeData, type IBidData, type IBreakevenCommitRow, type IBroker, type ICandleData, type ICommitRow, type IDumpContext, type IDumpInstance, type IExchangeSchema, type IFrameSchema, type IHeatmapRow, type ILog, type ILogEntry, type ILogger, type IMarkdownDumpOptions, type IMemoryInstance, type INotificationUtils, type IOrderBookData, type IPartialLossCommitRow, type IPartialProfitCommitRow, type IPersistBase, type IPositionSizeATRParams, type IPositionSizeFixedPercentageParams, type IPositionSizeKellyParams, type IPublicAction, type IPublicCandleData, type IPublicSignalRow, type IRecentUtils, type IReportDumpOptions, type IRiskActivePosition, type IRiskCheckArgs, type IRiskSchema, type IRiskSignalRow, type IRiskValidation, type IRiskValidationFn, type IRiskValidationPayload, type IScheduledSignalCancelRow, type IScheduledSignalRow, type ISessionInstance, type ISignalDto, type ISignalIntervalDto, type ISignalRow, type ISizingCalculateParams, type ISizingCalculateParamsATR, type ISizingCalculateParamsFixedPercentage, type ISizingCalculateParamsKelly, type ISizingParams, type ISizingParamsATR, type ISizingParamsFixedPercentage, type ISizingParamsKelly, type ISizingSchema, type ISizingSchemaATR, type ISizingSchemaFixedPercentage, type ISizingSchemaKelly, type IStateInstance, type IStorageSignalRow, type IStorageUtils, type IStrategyPnL, type IStrategyResult, type IStrategySchema, type IStrategyTickResult, type IStrategyTickResultActive, type IStrategyTickResultCancelled, type IStrategyTickResultClosed, type IStrategyTickResultIdle, type IStrategyTickResultOpened, type IStrategyTickResultScheduled, type IStrategyTickResultWaiting, type ITrailingStopCommitRow, type ITrailingTakeCommitRow, type IWalkerResults, type IWalkerSchema, type IWalkerStrategyResult, type IdlePingContract, type InfoErrorNotification, Interval, type IntervalData, Live, type LiveStatisticsModel, Log, type LogData, Markdown, MarkdownFileBase, MarkdownFolderBase, type MarkdownName, MarkdownWriter, MaxDrawdown, type MaxDrawdownContract, type MaxDrawdownEvent, type MaxDrawdownStatisticsModel, type MeasureData, Memory, MemoryBacktest, MemoryBacktestAdapter, type MemoryData, MemoryLive, MemoryLiveAdapter, type MessageModel, type MessageRole, type MessageToolCall, MethodContextService, type MetricStats, Notification, NotificationBacktest, type NotificationData, NotificationLive, type NotificationModel, Partial$1 as Partial, type PartialData, type PartialEvent, type PartialLossAvailableNotification, type PartialLossCommit, type PartialLossCommitNotification, type PartialLossContract, type PartialProfitAvailableNotification, type PartialProfitCommit, type PartialProfitCommitNotification, type PartialProfitContract, type PartialStatisticsModel, Performance, type PerformanceContract, type PerformanceMetricType, type PerformanceStatisticsModel, PersistBase, PersistBreakevenAdapter, PersistCandleAdapter, PersistIntervalAdapter, PersistLogAdapter, PersistMeasureAdapter, PersistMemoryAdapter, PersistNotificationAdapter, PersistPartialAdapter, PersistRecentAdapter, PersistRiskAdapter, PersistScheduleAdapter, PersistSessionAdapter, PersistSignalAdapter, PersistStateAdapter, PersistStorageAdapter, Position, PositionSize, type ProgressBacktestContract, type ProgressWalkerContract, Recent, RecentBacktest, type RecentData, RecentLive, Reflect, Report, ReportBase, type ReportName, ReportWriter, Risk, type RiskContract, type RiskData, type RiskEvent, type RiskRejectionNotification, type RiskStatisticsModel, Schedule, type ScheduleData, type SchedulePingContract, type ScheduleStatisticsModel, type ScheduledEvent, Session, SessionBacktest, type SessionData, SessionLive, type SignalCancelledNotification, type SignalCloseContract, type SignalClosedNotification, type SignalData, type SignalInfoContract, type SignalInfoNotification, type SignalInterval, type SignalOpenContract, type SignalOpenedNotification, type SignalScheduledNotification, type SignalSyncCloseNotification, type SignalSyncContract, type SignalSyncOpenNotification, State, StateBacktest, StateBacktestAdapter, type StateData, StateLive, StateLiveAdapter, Storage, StorageBacktest, type StorageData, StorageLive, Strategy, type StrategyActionType, type StrategyCancelReason, type StrategyCloseReason, type StrategyCommitContract, type StrategyEvent, type StrategyStatisticsModel, Sync, type SyncEvent, type SyncStatisticsModel, System, type TBrokerCtor, type TDumpInstanceCtor, type TLogCtor, type TMarkdownBase, type TMemoryInstanceCtor, type TNotificationUtilsCtor, type TPersistBase, type TPersistBaseCtor, type TRecentUtilsCtor, type TReportBase, type TSessionInstanceCtor, type TStateInstanceCtor, type TStorageUtilsCtor, type TickEvent, type TrailingStopCommit, type TrailingStopCommitNotification, type TrailingTakeCommit, type TrailingTakeCommitNotification, type ValidationErrorNotification, Walker, type WalkerCompleteContract, type WalkerContract, type WalkerMetric, type SignalData$1 as WalkerSignalData, type WalkerStatisticsModel, addActionSchema, addExchangeSchema, addFrameSchema, addRiskSchema, addSizingSchema, addStrategySchema, addWalkerSchema, alignToInterval, checkCandles, commitActivateScheduled, commitAverageBuy, commitBreakeven, commitCancelScheduled, commitClosePending, commitPartialLoss, commitPartialLossCost, commitPartialProfit, commitPartialProfitCost, commitSignalNotify, commitTrailingStop, commitTrailingStopCost, commitTrailingTake, commitTrailingTakeCost, createSignalState, dumpAgentAnswer, dumpError, dumpJson, dumpRecord, dumpTable, dumpText, emitters, formatPrice, formatQuantity, get, getActionSchema, getAggregatedTrades, getAveragePrice, getBacktestTimeframe, getBreakeven, getCandles, getColumns, getConfig, getContext, getDate, getDefaultColumns, getDefaultConfig, getEffectivePriceOpen, getExchangeSchema, getFrameSchema, getLatestSignal, getMaxDrawdownDistancePnlCost, getMaxDrawdownDistancePnlPercentage, getMinutesSinceLatestSignalCreated, getMode, getNextCandles, getOrderBook, getPendingSignal, getPositionActiveMinutes, getPositionCountdownMinutes, getPositionDrawdownMinutes, getPositionEffectivePrice, getPositionEntries, getPositionEntryOverlap, getPositionEstimateMinutes, getPositionHighestMaxDrawdownPnlCost, getPositionHighestMaxDrawdownPnlPercentage, getPositionHighestPnlCost, getPositionHighestPnlPercentage, getPositionHighestProfitBreakeven, getPositionHighestProfitDistancePnlCost, getPositionHighestProfitDistancePnlPercentage, getPositionHighestProfitMinutes, getPositionHighestProfitPrice, getPositionHighestProfitTimestamp, getPositionInvestedCost, getPositionInvestedCount, getPositionLevels, getPositionMaxDrawdownMinutes, getPositionMaxDrawdownPnlCost, getPositionMaxDrawdownPnlPercentage, getPositionMaxDrawdownPrice, getPositionMaxDrawdownTimestamp, getPositionPartialOverlap, getPositionPartials, getPositionPnlCost, getPositionPnlPercent, getPositionWaitingMinutes, getRawCandles, getRiskSchema, getScheduledSignal, getSessionData, getSignalState, getSizingSchema, getStrategySchema, getSymbol, getTimestamp, getTotalClosed, getTotalCostClosed, getTotalPercentClosed, getWalkerSchema, hasNoPendingSignal, hasNoScheduledSignal, hasTradeContext, investedCostToPercent, backtest as lib, listExchangeSchema, listFrameSchema, listMemory, listRiskSchema, listSizingSchema, listStrategySchema, listWalkerSchema, listenActivePing, listenActivePingOnce, listenBacktestProgress, listenBreakevenAvailable, listenBreakevenAvailableOnce, listenDoneBacktest, listenDoneBacktestOnce, listenDoneLive, listenDoneLiveOnce, listenDoneWalker, listenDoneWalkerOnce, listenError, listenExit, listenHighestProfit, listenHighestProfitOnce, listenIdlePing, listenIdlePingOnce, listenMaxDrawdown, listenMaxDrawdownOnce, listenPartialLossAvailable, listenPartialLossAvailableOnce, listenPartialProfitAvailable, listenPartialProfitAvailableOnce, listenPerformance, listenRisk, listenRiskOnce, listenSchedulePing, listenSchedulePingOnce, listenSignal, listenSignalBacktest, listenSignalBacktestOnce, listenSignalLive, listenSignalLiveOnce, listenSignalNotify, listenSignalNotifyOnce, listenSignalOnce, listenStrategyCommit, listenStrategyCommitOnce, listenSync, listenSyncOnce, listenValidation, listenWalker, listenWalkerComplete, listenWalkerOnce, listenWalkerProgress, overrideActionSchema, overrideExchangeSchema, overrideFrameSchema, overrideRiskSchema, overrideSizingSchema, overrideStrategySchema, overrideWalkerSchema, parseArgs, percentDiff, percentToCloseCost, percentValue, readMemory, removeMemory, roundTicks, runInMockContext, searchMemory, set, setColumns, setConfig, setLogger, setSessionData, setSignalState, shutdown, slPercentShiftToPrice, slPriceToPercentShift, stopStrategy, toProfitLossDto, tpPercentShiftToPrice, tpPriceToPercentShift, validate, validateCommonSignal, validatePendingSignal, validateScheduledSignal, validateSignal, waitForCandle, warmCandles, writeMemory };
|
|
34124
|
+
export { ActionBase, type ActivateScheduledCommit, type ActivateScheduledCommitNotification, type ActivePingContract, type AverageBuyCommit, type AverageBuyCommitNotification, Backtest, type BacktestStatisticsModel, Breakeven, type BreakevenAvailableNotification, type BreakevenCommit, type BreakevenCommitNotification, type BreakevenContract, type BreakevenData, type BreakevenEvent, type BreakevenStatisticsModel, Broker, type BrokerAverageBuyPayload, BrokerBase, type BrokerBreakevenPayload, type BrokerPartialLossPayload, type BrokerPartialProfitPayload, type BrokerSignalClosePayload, type BrokerSignalOpenPayload, type BrokerTrailingStopPayload, type BrokerTrailingTakePayload, Cache, type CancelScheduledCommit, type CancelScheduledCommitNotification, type CandleData, type CandleInterval, type ClosePendingCommit, type ClosePendingCommitNotification, type ColumnConfig, type ColumnModel, type CommitPayload, Constant, type CriticalErrorNotification, type DoneContract, Dump, type EntityId, Exchange, ExecutionContextService, type FrameInterval, type GlobalConfig, Heat, type HeatmapStatisticsModel, HighestProfit, type HighestProfitContract, type HighestProfitEvent, type HighestProfitStatisticsModel, type IActionSchema, type IActivateScheduledCommitRow, type IAggregatedTradeData, type IBidData, type IBreakevenCommitRow, type IBroker, type ICandleData, type ICommitRow, type IDumpContext, type IDumpInstance, type IExchangeSchema, type IFrameSchema, type IHeatmapRow, type ILog, type ILogEntry, type ILogger, type IMarkdownDumpOptions, type IMemoryInstance, type INotificationUtils, type IOrderBookData, type IPartialLossCommitRow, type IPartialProfitCommitRow, type IPersistBase, type IPositionSizeATRParams, type IPositionSizeFixedPercentageParams, type IPositionSizeKellyParams, type IPublicAction, type IPublicCandleData, type IPublicSignalRow, type IRecentUtils, type IReportDumpOptions, type IRiskActivePosition, type IRiskCheckArgs, type IRiskSchema, type IRiskSignalRow, type IRiskValidation, type IRiskValidationFn, type IRiskValidationPayload, type IScheduledSignalCancelRow, type IScheduledSignalRow, type ISessionInstance, type ISignalDto, type ISignalIntervalDto, type ISignalRow, type ISizingCalculateParams, type ISizingCalculateParamsATR, type ISizingCalculateParamsFixedPercentage, type ISizingCalculateParamsKelly, type ISizingParams, type ISizingParamsATR, type ISizingParamsFixedPercentage, type ISizingParamsKelly, type ISizingSchema, type ISizingSchemaATR, type ISizingSchemaFixedPercentage, type ISizingSchemaKelly, type IStateInstance, type IStorageSignalRow, type IStorageUtils, type IStrategyPnL, type IStrategyResult, type IStrategySchema, type IStrategyTickResult, type IStrategyTickResultActive, type IStrategyTickResultCancelled, type IStrategyTickResultClosed, type IStrategyTickResultIdle, type IStrategyTickResultOpened, type IStrategyTickResultScheduled, type IStrategyTickResultWaiting, type ITrailingStopCommitRow, type ITrailingTakeCommitRow, type IWalkerResults, type IWalkerSchema, type IWalkerStrategyResult, type IdlePingContract, type InfoErrorNotification, Interval, type IntervalData, Live, type LiveStatisticsModel, Log, type LogData, Markdown, MarkdownFileBase, MarkdownFolderBase, type MarkdownName, MarkdownWriter, MaxDrawdown, type MaxDrawdownContract, type MaxDrawdownEvent, type MaxDrawdownStatisticsModel, type MeasureData, Memory, MemoryBacktest, MemoryBacktestAdapter, type MemoryData, MemoryLive, MemoryLiveAdapter, type MessageModel, type MessageRole, type MessageToolCall, MethodContextService, type MetricStats, Notification, NotificationBacktest, type NotificationData, NotificationLive, type NotificationModel, Partial$1 as Partial, type PartialData, type PartialEvent, type PartialLossAvailableNotification, type PartialLossCommit, type PartialLossCommitNotification, type PartialLossContract, type PartialProfitAvailableNotification, type PartialProfitCommit, type PartialProfitCommitNotification, type PartialProfitContract, type PartialStatisticsModel, Performance, type PerformanceContract, type PerformanceMetricType, type PerformanceStatisticsModel, PersistBase, PersistBreakevenAdapter, PersistCandleAdapter, PersistIntervalAdapter, PersistLogAdapter, PersistMeasureAdapter, PersistMemoryAdapter, PersistNotificationAdapter, PersistPartialAdapter, PersistRecentAdapter, PersistRiskAdapter, PersistScheduleAdapter, PersistSessionAdapter, PersistSignalAdapter, PersistStateAdapter, PersistStorageAdapter, Position, PositionSize, type ProgressBacktestContract, type ProgressWalkerContract, Recent, RecentBacktest, type RecentData, RecentLive, Reflect, Report, ReportBase, type ReportName, ReportWriter, Risk, type RiskContract, type RiskData, type RiskEvent, type RiskRejectionNotification, type RiskStatisticsModel, Schedule, type ScheduleData, type SchedulePingContract, type ScheduleStatisticsModel, type ScheduledEvent, Session, SessionBacktest, type SessionData, SessionLive, type SignalCancelledNotification, type SignalCloseContract, type SignalClosedNotification, type SignalData, type SignalInfoContract, type SignalInfoNotification, type SignalInterval, type SignalOpenContract, type SignalOpenedNotification, type SignalScheduledNotification, type SignalSyncCloseNotification, type SignalSyncContract, type SignalSyncOpenNotification, State, StateBacktest, StateBacktestAdapter, type StateData, StateLive, StateLiveAdapter, Storage, StorageBacktest, type StorageData, StorageLive, Strategy, type StrategyActionType, type StrategyCancelReason, type StrategyCloseReason, type StrategyCommitContract, type StrategyEvent, type StrategyStatisticsModel, Sync, type SyncEvent, type SyncStatisticsModel, System, type TBrokerCtor, type TDumpInstanceCtor, type TLogCtor, type TMarkdownBase, type TMemoryInstanceCtor, type TNotificationUtilsCtor, type TPersistBase, type TPersistBaseCtor, type TRecentUtilsCtor, type TReportBase, type TSessionInstanceCtor, type TStateInstanceCtor, type TStorageUtilsCtor, type TickEvent, type TrailingStopCommit, type TrailingStopCommitNotification, type TrailingTakeCommit, type TrailingTakeCommitNotification, type ValidationErrorNotification, Walker, type WalkerCompleteContract, type WalkerContract, type WalkerMetric, type SignalData$1 as WalkerSignalData, type WalkerStatisticsModel, addActionSchema, addExchangeSchema, addFrameSchema, addRiskSchema, addSizingSchema, addStrategySchema, addWalkerSchema, alignToInterval, checkCandles, commitActivateScheduled, commitAverageBuy, commitBreakeven, commitCancelScheduled, commitClosePending, commitPartialLoss, commitPartialLossCost, commitPartialProfit, commitPartialProfitCost, commitSignalNotify, commitTrailingStop, commitTrailingStopCost, commitTrailingTake, commitTrailingTakeCost, createSignalState, dumpAgentAnswer, dumpError, dumpJson, dumpRecord, dumpTable, dumpText, emitters, formatPrice, formatQuantity, get, getActionSchema, getAggregatedTrades, getAveragePrice, getBacktestTimeframe, getBreakeven, getCandles, getClosePrice, getColumns, getConfig, getContext, getDate, getDefaultColumns, getDefaultConfig, getEffectivePriceOpen, getExchangeSchema, getFrameSchema, getLatestSignal, getMaxDrawdownDistancePnlCost, getMaxDrawdownDistancePnlPercentage, getMinutesSinceLatestSignalCreated, getMode, getNextCandles, getOrderBook, getPendingSignal, getPositionActiveMinutes, getPositionCountdownMinutes, getPositionDrawdownMinutes, getPositionEffectivePrice, getPositionEntries, getPositionEntryOverlap, getPositionEstimateMinutes, getPositionHighestMaxDrawdownPnlCost, getPositionHighestMaxDrawdownPnlPercentage, getPositionHighestPnlCost, getPositionHighestPnlPercentage, getPositionHighestProfitBreakeven, getPositionHighestProfitDistancePnlCost, getPositionHighestProfitDistancePnlPercentage, getPositionHighestProfitMinutes, getPositionHighestProfitPrice, getPositionHighestProfitTimestamp, getPositionInvestedCost, getPositionInvestedCount, getPositionLevels, getPositionMaxDrawdownMinutes, getPositionMaxDrawdownPnlCost, getPositionMaxDrawdownPnlPercentage, getPositionMaxDrawdownPrice, getPositionMaxDrawdownTimestamp, getPositionPartialOverlap, getPositionPartials, getPositionPnlCost, getPositionPnlPercent, getPositionWaitingMinutes, getRawCandles, getRiskSchema, getScheduledSignal, getSessionData, getSignalState, getSizingSchema, getStrategySchema, getSymbol, getTimestamp, getTotalClosed, getTotalCostClosed, getTotalPercentClosed, getWalkerSchema, hasNoPendingSignal, hasNoScheduledSignal, hasTradeContext, investedCostToPercent, backtest as lib, listExchangeSchema, listFrameSchema, listMemory, listRiskSchema, listSizingSchema, listStrategySchema, listWalkerSchema, listenActivePing, listenActivePingOnce, listenBacktestProgress, listenBreakevenAvailable, listenBreakevenAvailableOnce, listenDoneBacktest, listenDoneBacktestOnce, listenDoneLive, listenDoneLiveOnce, listenDoneWalker, listenDoneWalkerOnce, listenError, listenExit, listenHighestProfit, listenHighestProfitOnce, listenIdlePing, listenIdlePingOnce, listenMaxDrawdown, listenMaxDrawdownOnce, listenPartialLossAvailable, listenPartialLossAvailableOnce, listenPartialProfitAvailable, listenPartialProfitAvailableOnce, listenPerformance, listenRisk, listenRiskOnce, listenSchedulePing, listenSchedulePingOnce, listenSignal, listenSignalBacktest, listenSignalBacktestOnce, listenSignalLive, listenSignalLiveOnce, listenSignalNotify, listenSignalNotifyOnce, listenSignalOnce, listenStrategyCommit, listenStrategyCommitOnce, listenSync, listenSyncOnce, listenValidation, listenWalker, listenWalkerComplete, listenWalkerOnce, listenWalkerProgress, overrideActionSchema, overrideExchangeSchema, overrideFrameSchema, overrideRiskSchema, overrideSizingSchema, overrideStrategySchema, overrideWalkerSchema, parseArgs, percentDiff, percentToCloseCost, percentValue, readMemory, removeMemory, roundTicks, runInMockContext, searchMemory, set, setColumns, setConfig, setLogger, setSessionData, setSignalState, shutdown, slPercentShiftToPrice, slPriceToPercentShift, stopStrategy, toProfitLossDto, tpPercentShiftToPrice, tpPriceToPercentShift, validate, validateCommonSignal, validatePendingSignal, validateScheduledSignal, validateSignal, waitForCandle, warmCandles, writeMemory };
|