Skip to content

Commit c5cd1b3

Browse files
committed
ENH: Warn on initial cash lower than Bitcoin price
Refs: * kernc#134 * kernc#116 * kernc#151
1 parent dff1e65 commit c5cd1b3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

backtesting/backtesting.py

+5
Original file line numberDiff line numberDiff line change
@@ -1057,6 +1057,11 @@ def __init__(self,
10571057
raise ValueError('Some OHLC values are missing (NaN). '
10581058
'Please strip those lines with `df.dropna()` or '
10591059
'fill them in with `df.interpolate()` or whatever.')
1060+
if np.any(data['Close'] > cash):
1061+
warnings.warn('Some prices are larger than initial cash value. Note that fractional '
1062+
'trading is not supported. If you want to trade Bitcoin, '
1063+
'increase initial cash, or trade μBTC or satoshis instead (GH-134).',
1064+
stacklevel=2)
10601065
if not data.index.is_monotonic_increasing:
10611066
warnings.warn('Data index is not sorted in ascending order. Sorting.',
10621067
stacklevel=2)

0 commit comments

Comments
 (0)