File tree Expand file tree Collapse file tree 3 files changed +4
-4
lines changed Expand file tree Collapse file tree 3 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -165,10 +165,10 @@ def _weighted_returns(s, trades=trades):
165
165
return ((df ['Size' ].abs () * df ['ReturnPct' ]) / df ['Size' ].abs ().sum ()).sum ()
166
166
167
167
def _group_trades (column ):
168
- def f (s , new_index = pd .Index (df .index .astype (int )), bars = trades [column ]):
168
+ def f (s , new_index = pd .Index (df .index .astype (np . int64 )), bars = trades [column ]):
169
169
if s .size :
170
170
# Via int64 because on pandas recently broken datetime
171
- mean_time = int (bars .loc [s .index ].astype (int ).mean ())
171
+ mean_time = int (bars .loc [s .index ].astype (np . int64 ).mean ())
172
172
new_bar_idx = new_index .get_indexer ([mean_time ], method = 'nearest' )[0 ]
173
173
return new_bar_idx
174
174
return f
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ def compute_drawdown_duration_peaks(dd: pd.Series):
15
15
iloc = np .unique (np .r_ [(dd == 0 ).values .nonzero ()[0 ], len (dd ) - 1 ])
16
16
iloc = pd .Series (iloc , index = dd .index [iloc ])
17
17
df = iloc .to_frame ('iloc' ).assign (prev = iloc .shift ())
18
- df = df [df ['iloc' ] > df ['prev' ] + 1 ].astype (int )
18
+ df = df [df ['iloc' ] > df ['prev' ] + 1 ].astype (np . int64 )
19
19
20
20
# If no drawdown since no trade, avoid below for pandas sake and return nan series
21
21
if not len (df ):
Original file line number Diff line number Diff line change @@ -1536,7 +1536,7 @@ def _optimize_sambo() -> Union[pd.Series,
1536
1536
if values .dtype .kind in 'mM' : # timedelta, datetime64
1537
1537
# these dtypes are unsupported in SAMBO, so convert to raw int
1538
1538
# TODO: save dtype and convert back later
1539
- values = values .astype (int )
1539
+ values = values .astype (np . int64 )
1540
1540
1541
1541
if values .dtype .kind in 'iumM' :
1542
1542
dimensions .append ((values .min (), values .max () + 1 ))
You can’t perform that action at this time.
0 commit comments