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.
- {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/PKG-INFO +1 -17
- {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/README.md +0 -16
- {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/examples/spread_estimator.py +13 -9
- {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/examples/spread_monitor.py +4 -3
- {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/pyproject.toml +1 -1
- {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/quantjourney_bidask/_version.py +1 -1
- {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/quantjourney_bidask/edge.py +7 -3
- {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/quantjourney_bidask/edge_expanding.py +9 -3
- {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/quantjourney_bidask/edge_rolling.py +9 -3
- {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/CHANGELOG.md +0 -0
- {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/LICENSE +0 -0
- {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/MANIFEST.in +0 -0
- {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/data/fetch.py +0 -0
- {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/docs/usage_examples.ipynb +0 -0
- {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/examples/animated_spread_monitor.py +0 -0
- {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/examples/crypto_spread_comparison.py +0 -0
- {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/examples/ff.py +0 -0
- {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/examples/liquidity_risk_monitor.py +0 -0
- {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/examples/realtime_spread_monitor.py +0 -0
- {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/examples/simple_data_example.py +0 -0
- {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/examples/stock_liquidity_risk.py +0 -0
- {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/examples/visualization.py +0 -0
- {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/quantjourney_bidask/__init__.py +0 -0
- {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/quantjourney_bidask/data_fetcher.py +0 -0
- {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/quantjourney_bidask/websocket_fetcher.py +0 -0
- {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/quantjourney_bidask.egg-info/SOURCES.txt +0 -0
- {quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/requirements.txt +0 -0
- {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.
|
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
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
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 =
|
110
|
-
|
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
|
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 =
|
169
|
-
|
169
|
+
real_df = get_stock_data(
|
170
|
+
ticker="QQQ", # NASDAQ ETF
|
170
171
|
period="2mo",
|
171
172
|
interval="1h"
|
172
173
|
)
|
@@ -47,10 +47,14 @@ def edge(
|
|
47
47
|
Examples
|
48
48
|
--------
|
49
49
|
>>> import pandas as pd
|
50
|
-
>>>
|
51
|
-
>>>
|
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.
|
57
|
+
Estimated spread: 0.007109
|
54
58
|
"""
|
55
59
|
# Convert inputs to numpy arrays
|
56
60
|
open = np.asarray(open, dtype=float)
|
{quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/quantjourney_bidask/edge_expanding.py
RENAMED
@@ -41,9 +41,15 @@ def edge_expanding(
|
|
41
41
|
Examples
|
42
42
|
--------
|
43
43
|
>>> import pandas as pd
|
44
|
-
>>>
|
45
|
-
>>>
|
46
|
-
|
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
|
-
>>>
|
51
|
-
>>>
|
52
|
-
|
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()
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/examples/crypto_spread_comparison.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/quantjourney_bidask/websocket_fetcher.py
RENAMED
File without changes
|
{quantjourney_bidask-0.9.1 → quantjourney_bidask-0.9.2}/quantjourney_bidask.egg-info/SOURCES.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|