ivolatility-backtesting 2.139__tar.gz → 2.140__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ivolatility_backtesting
3
- Version: 2.139
3
+ Version: 2.140
4
4
  Summary: A universal backtesting framework for financial strategies using the IVolatility API.
5
5
  Author-email: IVolatility <support@ivolatility.com>
6
6
  Project-URL: Homepage, https://ivolatility.com
@@ -56,6 +56,9 @@ def _ivb_user_agent():
56
56
 
57
57
 
58
58
  _IVB_UA = _ivb_user_agent()
59
+ # ivollive/DEV: point every REST call at the internal API when IVOL_API_BASE_URL is
60
+ # set (workspace has an internal key, invalid for prod). Default stays external.
61
+ _API_BASE = __import__('os').getenv('IVOL_API_BASE_URL') or 'https://restapi.ivolatility.com'
59
62
  try:
60
63
  # _session lives in the ivolatility.ivolatility submodule; the top-level
61
64
  # package does not re-export it (same lookup as _thread_safe_session)
@@ -8142,7 +8145,7 @@ def _api_call_internal(endpoint, cache_config, debug, debug_level, skip_parquet_
8142
8145
  # TIMING: URL construction (for debug)
8143
8146
  if debug_level >= 3 or (debug and APIManager._api_key):
8144
8147
  t_url_start = time.perf_counter()
8145
- base_url = "https://restapi.ivolatility.com"
8148
+ base_url = _API_BASE
8146
8149
  url_params = {}
8147
8150
  for key, value in kwargs.items():
8148
8151
  clean_key = key.rstrip('_') if key.endswith('_') else key
@@ -9313,7 +9316,7 @@ class StopLossManager:
9313
9316
  # Log API call
9314
9317
  api_key = APIManager._api_key or "API_KEY"
9315
9318
  api_key_short = f"{api_key[:10]}...{api_key[-6:]}" if api_key and len(api_key) > 16 else api_key
9316
- full_url = f"https://restapi.ivolatility.com{endpoint}?apiKey={api_key_short}&symbol={symbol}&date={date_str}&expDate={exp_date_str}&strike={strike}&optType={api_opt_type}&minuteType={minute_interval}"
9319
+ full_url = f"{_API_BASE}{endpoint}?apiKey={api_key_short}&symbol={symbol}&date={date_str}&expDate={exp_date_str}&strike={strike}&optType={api_opt_type}&minuteType={minute_interval}"
9317
9320
  _bt_logger.info(f"[INTRADAY-OPTIONS] {full_url}")
9318
9321
 
9319
9322
  result = method(
@@ -11495,7 +11498,7 @@ class StopLossManager:
11495
11498
 
11496
11499
  # Log intraday API call with full URL
11497
11500
  api_key = APIManager._api_key or "API_KEY"
11498
- full_url = f"https://restapi.ivolatility.com/equities/intraday/stock-prices?apiKey={api_key}&symbol={symbol}&date={date_str}&minuteType={minute_interval}"
11501
+ full_url = f"{_API_BASE}/equities/intraday/stock-prices?apiKey={api_key}&symbol={symbol}&date={date_str}&minuteType={minute_interval}"
11499
11502
  if self.debuginfo >= 2:
11500
11503
  print(f" 📡 Intraday API: {full_url}")
11501
11504
  _bt_logger.info(f"[INTRADAY] {full_url}")
@@ -20932,7 +20935,7 @@ def _resolve_futures_underlying(symbol, region=None, mic=None,
20932
20935
  for attempt in (1, 2):
20933
20936
  try:
20934
20937
  r = _requests.get(
20935
- 'https://restapi.ivolatility.com/futures/eod/fut-underlying-info',
20938
+ f'{_API_BASE}/futures/eod/fut-underlying-info',
20936
20939
  params=params, timeout=60, headers={'User-Agent': _IVB_UA})
20937
20940
  if r.status_code != 200:
20938
20941
  if debuginfo >= 1:
@@ -21150,7 +21153,7 @@ def _load_futures_for_hedge(config, preloaded):
21150
21153
  chunk_end = min(current + _td(days=chunk_days), end_dt)
21151
21154
  try:
21152
21155
  r = _requests.get(
21153
- 'https://restapi.ivolatility.com/futures/eod/prices',
21156
+ f'{_API_BASE}/futures/eod/prices',
21154
21157
  params={'apiKey': _api_key, 'symbol': fut_root,
21155
21158
  'from': current.strftime('%Y-%m-%d'),
21156
21159
  'to': chunk_end.strftime('%Y-%m-%d')},
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ivolatility_backtesting
3
- Version: 2.139
3
+ Version: 2.140
4
4
  Summary: A universal backtesting framework for financial strategies using the IVolatility API.
5
5
  Author-email: IVolatility <support@ivolatility.com>
6
6
  Project-URL: Homepage, https://ivolatility.com
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "ivolatility_backtesting"
7
- version = "2.139"
7
+ version = "2.140"
8
8
  description = "A universal backtesting framework for financial strategies using the IVolatility API."
9
9
  readme = "README.md"
10
10
  authors = [