mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-22 19:15:15 +00:00
parent
312a3bc173
commit
2078ff8942
|
@ -43,15 +43,18 @@ export function getTradeEntries(dataset: PairHistory, filteredTrades: Trade[]) {
|
||||||
for (let i = 0, len = filteredTrades.length; i < len; i += 1) {
|
for (let i = 0, len = filteredTrades.length; i < len; i += 1) {
|
||||||
const trade: Trade = filteredTrades[i];
|
const trade: Trade = filteredTrades[i];
|
||||||
if (
|
if (
|
||||||
trade.open_timestamp >= dataset.data_start_ts &&
|
// Trade is open or closed and within timerange
|
||||||
trade.open_timestamp <= dataset.data_stop_ts
|
roundTimeframe(dataset.timeframe_ms ?? 0, trade.open_timestamp) <= dataset.data_stop_ts ||
|
||||||
|
!trade.close_timestamp ||
|
||||||
|
(trade.close_timestamp && trade.close_timestamp >= dataset.data_start_ts)
|
||||||
) {
|
) {
|
||||||
if (trade.orders) {
|
if (trade.orders) {
|
||||||
for (let i = 0; i < trade.orders.length; i++) {
|
for (let i = 0; i < trade.orders.length; i++) {
|
||||||
const order: Order = trade.orders[i];
|
const order: Order = trade.orders[i];
|
||||||
if (
|
if (
|
||||||
order.order_filled_timestamp &&
|
order.order_filled_timestamp &&
|
||||||
order.order_filled_timestamp <= dataset.data_stop_ts &&
|
roundTimeframe(dataset.timeframe_ms ?? 0, order.order_filled_timestamp) <=
|
||||||
|
dataset.data_stop_ts &&
|
||||||
order.order_filled_timestamp > dataset.data_start_ts
|
order.order_filled_timestamp > dataset.data_start_ts
|
||||||
) {
|
) {
|
||||||
// Trade entry
|
// Trade entry
|
||||||
|
@ -68,7 +71,8 @@ export function getTradeEntries(dataset: PairHistory, filteredTrades: Trade[]) {
|
||||||
// Trade exit
|
// Trade exit
|
||||||
} else if (i === trade.orders.length - 1 && trade.close_timestamp) {
|
} else if (i === trade.orders.length - 1 && trade.close_timestamp) {
|
||||||
if (
|
if (
|
||||||
trade.close_timestamp <= dataset.data_stop_ts &&
|
roundTimeframe(dataset.timeframe_ms ?? 0, trade.close_timestamp) <=
|
||||||
|
dataset.data_stop_ts &&
|
||||||
trade.close_timestamp > dataset.data_start_ts &&
|
trade.close_timestamp > dataset.data_start_ts &&
|
||||||
trade.is_open === false
|
trade.is_open === false
|
||||||
) {
|
) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user