tradingapi 0.3.2__tar.gz → 0.3.3__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.
Files changed (31) hide show
  1. {tradingapi-0.3.2 → tradingapi-0.3.3}/PKG-INFO +1 -1
  2. {tradingapi-0.3.2 → tradingapi-0.3.3}/pyproject.toml +1 -1
  3. {tradingapi-0.3.2 → tradingapi-0.3.3}/tradingapi/utils.py +3 -20
  4. {tradingapi-0.3.2 → tradingapi-0.3.3}/tradingapi.egg-info/PKG-INFO +1 -1
  5. {tradingapi-0.3.2 → tradingapi-0.3.3}/README.md +0 -0
  6. {tradingapi-0.3.2 → tradingapi-0.3.3}/setup.cfg +0 -0
  7. {tradingapi-0.3.2 → tradingapi-0.3.3}/tests/test_find_option_with_delta.py +0 -0
  8. {tradingapi-0.3.2 → tradingapi-0.3.3}/tradingapi/__init__.py +0 -0
  9. {tradingapi-0.3.2 → tradingapi-0.3.3}/tradingapi/allocation.py +0 -0
  10. {tradingapi-0.3.2 → tradingapi-0.3.3}/tradingapi/attribution.py +0 -0
  11. {tradingapi-0.3.2 → tradingapi-0.3.3}/tradingapi/broker_base.py +0 -0
  12. {tradingapi-0.3.2 → tradingapi-0.3.3}/tradingapi/config/commissions_20241216.yaml +0 -0
  13. {tradingapi-0.3.2 → tradingapi-0.3.3}/tradingapi/config/config_sample.yaml +0 -0
  14. {tradingapi-0.3.2 → tradingapi-0.3.3}/tradingapi/config.py +0 -0
  15. {tradingapi-0.3.2 → tradingapi-0.3.3}/tradingapi/dhan.py +0 -0
  16. {tradingapi-0.3.2 → tradingapi-0.3.3}/tradingapi/error_handling.py +0 -0
  17. {tradingapi-0.3.2 → tradingapi-0.3.3}/tradingapi/exceptions.py +0 -0
  18. {tradingapi-0.3.2 → tradingapi-0.3.3}/tradingapi/fivepaisa.py +0 -0
  19. {tradingapi-0.3.2 → tradingapi-0.3.3}/tradingapi/flattrade.py +0 -0
  20. {tradingapi-0.3.2 → tradingapi-0.3.3}/tradingapi/globals.py +0 -0
  21. {tradingapi-0.3.2 → tradingapi-0.3.3}/tradingapi/icicidirect.py +0 -0
  22. {tradingapi-0.3.2 → tradingapi-0.3.3}/tradingapi/icicidirect_generate_session.py +0 -0
  23. {tradingapi-0.3.2 → tradingapi-0.3.3}/tradingapi/market_data_exchanges.py +0 -0
  24. {tradingapi-0.3.2 → tradingapi-0.3.3}/tradingapi/proxy_utils.py +0 -0
  25. {tradingapi-0.3.2 → tradingapi-0.3.3}/tradingapi/shoonya.py +0 -0
  26. {tradingapi-0.3.2 → tradingapi-0.3.3}/tradingapi/span.py +0 -0
  27. {tradingapi-0.3.2 → tradingapi-0.3.3}/tradingapi.egg-info/SOURCES.txt +0 -0
  28. {tradingapi-0.3.2 → tradingapi-0.3.3}/tradingapi.egg-info/dependency_links.txt +0 -0
  29. {tradingapi-0.3.2 → tradingapi-0.3.3}/tradingapi.egg-info/entry_points.txt +0 -0
  30. {tradingapi-0.3.2 → tradingapi-0.3.3}/tradingapi.egg-info/requires.txt +0 -0
  31. {tradingapi-0.3.2 → tradingapi-0.3.3}/tradingapi.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tradingapi
3
- Version: 0.3.2
3
+ Version: 0.3.3
4
4
  Summary: Trade integration with brokers
5
5
  Author-email: Pankaj Sharma <sharma.pankaj.kumar@gmail.com>
6
6
  License-Expression: MIT
@@ -28,7 +28,7 @@ packages = ["tradingapi"]
28
28
 
29
29
  [project]
30
30
  name = "tradingapi"
31
- version = "0.3.2"
31
+ version = "0.3.3"
32
32
  description = "Trade integration with brokers"
33
33
  readme = "README.md"
34
34
  license = "MIT"
@@ -3247,7 +3247,7 @@ def find_option_with_delta(
3247
3247
  valid_delta_count = 0
3248
3248
  nan_delta_count = 0
3249
3249
  nan_delta_strikes = [] # track strikes where delta could not be calculated
3250
- # Cache so seeding sweep + binary search + linear fallback never recompute the same strike.
3250
+ # Cache so seeding sweep + binary search never recompute the same strike.
3251
3251
  delta_cache: dict[int, float] = {}
3252
3252
 
3253
3253
  def _delta_at(idx: int) -> float:
@@ -3296,15 +3296,9 @@ def find_option_with_delta(
3296
3296
  _consider(idx, ad)
3297
3297
 
3298
3298
  if len(seed_samples) < 2:
3299
- # Too few seeds; fall through to linear scan over the whole chain.
3300
- for idx in range(n):
3301
- d = _delta_at(idx)
3302
- if math.isnan(d):
3303
- continue
3304
- _consider(idx, abs(d))
3305
3299
  if best_index < 0:
3306
3300
  trading_logger.log_warning(
3307
- f"find_option_with_delta: no valid option strike found (linear fallback after seed failure). "
3301
+ f"find_option_with_delta: no valid option strike found (seed failure). "
3308
3302
  f"price_f={price_f} target_delta={target_delta} return_lower_delta={return_lower_delta} "
3309
3303
  f"chain_len={n} strike_range=[{strike_lo}, {strike_hi}] "
3310
3304
  f"valid_delta_count={valid_delta_count} nan_delta_count={nan_delta_count} "
@@ -3333,7 +3327,7 @@ def find_option_with_delta(
3333
3327
  if math.isnan(d):
3334
3328
  alt = _nearest_valid(mid, left, right)
3335
3329
  if alt < 0:
3336
- # Wide NaN band bail to linear fallback below.
3330
+ # Wide NaN band: stop here instead of expanding into a full-chain scan.
3337
3331
  break
3338
3332
  eff_idx = alt
3339
3333
  d = delta_cache[alt]
@@ -3351,17 +3345,6 @@ def find_option_with_delta(
3351
3345
  else:
3352
3346
  right = eff_idx - 1
3353
3347
 
3354
- # --- Change 3: linear-scan fallback if binary search failed to land a best ---
3355
- if best_index < 0:
3356
- for idx in range(n):
3357
- if idx in delta_cache:
3358
- d = delta_cache[idx]
3359
- else:
3360
- d = _delta_at(idx)
3361
- if math.isnan(d):
3362
- continue
3363
- _consider(idx, abs(d))
3364
-
3365
3348
  if best_index < 0:
3366
3349
  trading_logger.log_warning(
3367
3350
  f"find_option_with_delta: no valid option strike found. "
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tradingapi
3
- Version: 0.3.2
3
+ Version: 0.3.3
4
4
  Summary: Trade integration with brokers
5
5
  Author-email: Pankaj Sharma <sharma.pankaj.kumar@gmail.com>
6
6
  License-Expression: MIT
File without changes
File without changes