quantjourney-bidask 0.9.1__tar.gz → 0.9.2__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 (28) hide show
  1. {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/PKG-INFO +1 -17
  2. {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/README.md +0 -16
  3. {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/examples/spread_estimator.py +13 -9
  4. {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/examples/spread_monitor.py +4 -3
  5. {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/pyproject.toml +1 -1
  6. {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/quantjourney_bidask/_version.py +1 -1
  7. {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/quantjourney_bidask/edge.py +7 -3
  8. {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/quantjourney_bidask/edge_expanding.py +9 -3
  9. {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/quantjourney_bidask/edge_rolling.py +9 -3
  10. {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/CHANGELOG.md +0 -0
  11. {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/LICENSE +0 -0
  12. {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/MANIFEST.in +0 -0
  13. {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/data/fetch.py +0 -0
  14. {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/docs/usage_examples.ipynb +0 -0
  15. {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/examples/animated_spread_monitor.py +0 -0
  16. {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/examples/crypto_spread_comparison.py +0 -0
  17. {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/examples/ff.py +0 -0
  18. {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/examples/liquidity_risk_monitor.py +0 -0
  19. {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/examples/realtime_spread_monitor.py +0 -0
  20. {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/examples/simple_data_example.py +0 -0
  21. {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/examples/stock_liquidity_risk.py +0 -0
  22. {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/examples/visualization.py +0 -0
  23. {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/quantjourney_bidask/__init__.py +0 -0
  24. {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/quantjourney_bidask/data_fetcher.py +0 -0
  25. {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/quantjourney_bidask/websocket_fetcher.py +0 -0
  26. {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/quantjourney_bidask.egg-info/SOURCES.txt +0 -0
  27. {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/requirements.txt +0 -0
  28. {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: quantjourney-bidask
3
- Version: 0.9.1
3
+ Version: 0.9.2
4
4
  Summary: Efficient bid-ask spread estimator from OHLC prices
5
5
  Author-email: Jakub Polec <jakub@quantjourney.pro>
6
6
  License-Expression: MIT
@@ -351,22 +351,6 @@ Real-time features:
351
351
  - Threshold alerts
352
352
  - Multi-symbol monitoring
353
353
 
354
- ## Academic Citation
355
-
356
- If you use this library in academic research, please cite:
357
-
358
- ```bibtex
359
- @article{ardia2024efficient,
360
- title={Efficient Estimation of Bid-Ask Spreads from Open, High, Low, and Close Prices},
361
- author={Ardia, David and Guidotti, Emanuele and Kroencke, Tim A},
362
- journal={Journal of Financial Economics},
363
- volume={161},
364
- pages={103916},
365
- year={2024},
366
- publisher={Elsevier}
367
- }
368
- ```
369
-
370
354
  ## License
371
355
 
372
356
  This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
@@ -310,22 +310,6 @@ Real-time features:
310
310
  - Threshold alerts
311
311
  - Multi-symbol monitoring
312
312
 
313
- ## Academic Citation
314
-
315
- If you use this library in academic research, please cite:
316
-
317
- ```bibtex
318
- @article{ardia2024efficient,
319
- title={Efficient Estimation of Bid-Ask Spreads from Open, High, Low, and Close Prices},
320
- author={Ardia, David and Guidotti, Emanuele and Kroencke, Tim A},
321
- journal={Journal of Financial Economics},
322
- volume={161},
323
- pages={103916},
324
- year={2024},
325
- publisher={Elsevier}
326
- }
327
- ```
328
-
329
313
  ## License
330
314
 
331
315
  This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
@@ -22,13 +22,17 @@ print("Spread Estimator Examples")
22
22
  print("========================")
23
23
 
24
24
  # Test data download from the original paper
25
- print("\n1. Testing with original paper's dataset...")
26
- try:
27
- df = pd.read_csv("https://raw.githubusercontent.com/eguidotti/bidask/main/pseudocode/ohlc.csv")
28
- spread = edge(df.Open, df.High, df.Low, df.Close)
29
- print(f"Paper test data spread: {spread:.6f} (expected: ~0.010185)")
30
- except Exception as e:
31
- print(f"Could not fetch test data: {e}")
25
+ print("\n1. Testing with sample OHLC data...")
26
+ # Create sample OHLC data for testing
27
+ sample_data = {
28
+ 'Open': [100.0, 101.5, 99.8, 102.1, 100.9, 103.2, 101.7, 104.5, 102.3, 105.1],
29
+ 'High': [102.3, 103.0, 101.2, 103.5, 102.0, 104.8, 103.1, 106.2, 104.0, 106.5],
30
+ 'Low': [99.5, 100.8, 98.9, 101.0, 100.1, 102.5, 101.0, 103.8, 101.5, 104.2],
31
+ 'Close': [101.2, 102.5, 100.3, 102.8, 101.5, 104.1, 102.4, 105.7, 103.2, 105.8]
32
+ }
33
+ df = pd.DataFrame(sample_data)
34
+ spread = edge(df.Open, df.High, df.Low, df.Close)
35
+ print(f"Sample data spread: {spread:.6f}")
32
36
 
33
37
  # Generate synthetic data for testing
34
38
  print("\n2. Testing with synthetic data...")
@@ -106,8 +110,8 @@ print(f"True embedded spread: {spread_pct*100:.4f}%")
106
110
  print("\n5. Real data examples (Yahoo Finance)...")
107
111
  try:
108
112
  # Fetch SPY data
109
- spy_df = fetch_yfinance_data(
110
- tickers=["SPY"],
113
+ spy_df = get_stock_data(
114
+ ticker="SPY",
111
115
  period="1mo",
112
116
  interval="1d"
113
117
  )
@@ -9,7 +9,8 @@ import pandas as pd
9
9
  import matplotlib.pyplot as plt
10
10
  import numpy as np
11
11
 
12
- from quantjourney_bidask import edge_rolling, fetch_yfinance_data
12
+ from quantjourney_bidask import edge_rolling
13
+ from data.fetch import get_stock_data
13
14
 
14
15
 
15
16
 
@@ -165,8 +166,8 @@ if len(high_spread_periods) > 0:
165
166
  print("\n5. Real data example...")
166
167
  try:
167
168
  # Fetch real data
168
- real_df = fetch_yfinance_data(
169
- tickers=["QQQ"], # NASDAQ ETF
169
+ real_df = get_stock_data(
170
+ ticker="QQQ", # NASDAQ ETF
170
171
  period="2mo",
171
172
  interval="1h"
172
173
  )
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
5
5
 
6
6
  [project]
7
7
  name = "quantjourney-bidask"
8
- version = "0.9.1"
8
+ version = "0.9.2"
9
9
  license = "MIT"
10
10
 
11
11
  authors = [
@@ -1,6 +1,6 @@
1
1
  """Version information for quantjourney_bidask."""
2
2
 
3
- __version__ = "0.9.1"
3
+ __version__ = "0.9.2"
4
4
  __author__ = "Jakub Polec"
5
5
  __email__ = "jakub@quantjourney.pro"
6
6
  __license__ = "MIT"
@@ -47,10 +47,14 @@ def edge(
47
47
  Examples
48
48
  --------
49
49
  >>> import pandas as pd
50
- >>> df = pd.read_csv("https://raw.githubusercontent.com/eguidotti/bidask/main/pseudocode/ohlc.csv")
51
- >>> spread = edge(df.Open, df.High, df.Low, df.Close)
50
+ >>> # Example OHLC data
51
+ >>> open_prices = [100.0, 101.5, 99.8, 102.1, 100.9]
52
+ >>> high_prices = [102.3, 103.0, 101.2, 103.5, 102.0]
53
+ >>> low_prices = [99.5, 100.8, 98.9, 101.0, 100.1]
54
+ >>> close_prices = [101.2, 102.5, 100.3, 102.8, 101.5]
55
+ >>> spread = edge(open_prices, high_prices, low_prices, close_prices)
52
56
  >>> print(f"Estimated spread: {spread:.6f}")
53
- Estimated spread: 0.010185
57
+ Estimated spread: 0.007109
54
58
  """
55
59
  # Convert inputs to numpy arrays
56
60
  open = np.asarray(open, dtype=float)
@@ -41,9 +41,15 @@ def edge_expanding(
41
41
  Examples
42
42
  --------
43
43
  >>> import pandas as pd
44
- >>> df = pd.read_csv("https://raw.githubusercontent.com/eguidotti/bidask/main/pseudocode/ohlc.csv")
45
- >>> spreads = edge_expanding(df, min_periods=21)
46
- >>> print(spreads.head())
44
+ >>> # Example OHLC DataFrame
45
+ >>> df = pd.DataFrame({
46
+ ... 'open': [100.0, 101.5, 99.8, 102.1, 100.9, 103.2],
47
+ ... 'high': [102.3, 103.0, 101.2, 103.5, 102.0, 104.8],
48
+ ... 'low': [99.5, 100.8, 98.9, 101.0, 100.1, 102.5],
49
+ ... 'close': [101.2, 102.5, 100.3, 102.8, 101.5, 104.1]
50
+ ... })
51
+ >>> spreads = edge_expanding(df, min_periods=3)
52
+ >>> print(spreads.dropna())
47
53
  """
48
54
  # Standardize column names
49
55
  df = df.rename(columns=str.lower).copy()
@@ -47,9 +47,15 @@ def edge_rolling(
47
47
  Examples
48
48
  --------
49
49
  >>> import pandas as pd
50
- >>> df = pd.read_csv("https://raw.githubusercontent.com/eguidotti/bidask/main/pseudocode/ohlc.csv")
51
- >>> spreads = edge_rolling(df, window=21)
52
- >>> print(spreads.head())
50
+ >>> # Example OHLC DataFrame
51
+ >>> df = pd.DataFrame({
52
+ ... 'open': [100.0, 101.5, 99.8, 102.1, 100.9],
53
+ ... 'high': [102.3, 103.0, 101.2, 103.5, 102.0],
54
+ ... 'low': [99.5, 100.8, 98.9, 101.0, 100.1],
55
+ ... 'close': [101.2, 102.5, 100.3, 102.8, 101.5]
56
+ ... })
57
+ >>> spreads = edge_rolling(df, window=3)
58
+ >>> print(spreads.dropna())
53
59
  """
54
60
  # Standardize column names
55
61
  df = df.rename(columns=str.lower).copy()