Skip to content

Commit a4fe0a4

Browse files
authored
Fix for ProcessHistoricalTrades (#555)
Fixed periods movement. Removed ClampDates method.
1 parent b6f1ab3 commit a4fe0a4

File tree

1 file changed

+5
-24
lines changed

1 file changed

+5
-24
lines changed

src/ExchangeSharp/API/Exchanges/_Base/ExchangeHistoricalTradeHelper.cs

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*
1+
/*
22
MIT LICENSE
33
44
Copyright 2017 Digital Ruby, LLC - http://www.digitalruby.com
@@ -119,9 +119,10 @@ public async Task ProcessHistoricalTrades()
119119
{
120120
if (DirectionIsBackwards)
121121
{
122-
// no trades found, move the whole block back
123-
endDateMoving = startDateMoving.Subtract(BlockTime);
124-
}
122+
// no trades found, move the whole block back
123+
endDateMoving = startDateMoving;
124+
startDateMoving = endDateMoving.Subtract(BlockTime);
125+
}
125126
else
126127
{
127128
// no trades found, move the whole block forward
@@ -188,7 +189,6 @@ public async Task ProcessHistoricalTrades()
188189
break;
189190
}
190191
}
191-
ClampDates(ref startDateMoving, ref endDateMoving);
192192
await Task.Delay(DelayMilliseconds);
193193
}
194194
}
@@ -205,25 +205,6 @@ private void SetDates(out DateTime startDateMoving, out DateTime endDateMoving)
205205
startDateMoving = StartDate.Value;
206206
endDateMoving = startDateMoving.Add(BlockTime);
207207
}
208-
ClampDates(ref startDateMoving, ref endDateMoving);
209-
}
210-
211-
private void ClampDates(ref DateTime startDateMoving, ref DateTime endDateMoving)
212-
{
213-
if (DirectionIsBackwards)
214-
{
215-
if (startDateMoving < StartDate.Value)
216-
{
217-
startDateMoving = StartDate.Value;
218-
}
219-
}
220-
else
221-
{
222-
if (endDateMoving > EndDate.Value)
223-
{
224-
endDateMoving = EndDate.Value;
225-
}
226-
}
227208
}
228209
}
229210
}

0 commit comments

Comments
 (0)