Skip to content

Commit a3ece1c

Browse files
authored
Merge pull request #2 from you-n-g/rl-simple
2 parents 68a88bb + 25a26c0 commit a3ece1c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

qlib/rl/order_execution/simulator_simple.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,9 @@ def __init__(
173173
self.ticks_for_order = self._get_ticks_slice(self.order.start_time, self.order.end_time)
174174

175175
self.cur_time = self.ticks_for_order[0]
176-
self.twap_price = float(self.backtest_data.get_deal_price().loc[self.ticks_for_order].mean())
176+
# NOTE: astype(float) is necessary in some systems.
177+
# this will align the precision with `.to_numpy()` in `_split_exec_vol`
178+
self.twap_price = float(self.backtest_data.get_deal_price().loc[self.ticks_for_order].astype(float).mean())
177179

178180
self.position = order.amount
179181

0 commit comments

Comments
 (0)