voly 0.0.51__py3-none-any.whl → 0.0.53__py3-none-any.whl
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.
- voly/core/data.py +9 -8
- {voly-0.0.51.dist-info → voly-0.0.53.dist-info}/METADATA +1 -1
- {voly-0.0.51.dist-info → voly-0.0.53.dist-info}/RECORD +6 -6
- {voly-0.0.51.dist-info → voly-0.0.53.dist-info}/LICENSE +0 -0
- {voly-0.0.51.dist-info → voly-0.0.53.dist-info}/WHEEL +0 -0
- {voly-0.0.51.dist-info → voly-0.0.53.dist-info}/top_level.txt +0 -0
voly/core/data.py
CHANGED
|
@@ -12,7 +12,7 @@ import json
|
|
|
12
12
|
import pandas as pd
|
|
13
13
|
import requests
|
|
14
14
|
import time
|
|
15
|
-
|
|
15
|
+
import datetime as dt
|
|
16
16
|
import re
|
|
17
17
|
import numpy as np
|
|
18
18
|
from typing import List, Dict, Any, Optional, Union
|
|
@@ -197,19 +197,20 @@ def process_option_chain(df: pd.DataFrame, currency: str) -> pd.DataFrame:
|
|
|
197
197
|
logger.info(f"Processing data for {currency}...")
|
|
198
198
|
|
|
199
199
|
# Apply extraction to create new columns
|
|
200
|
-
|
|
201
|
-
df['
|
|
202
|
-
df['
|
|
203
|
-
df['
|
|
200
|
+
splits = df['instrument_name'].str.split('-')
|
|
201
|
+
df['currency'] = splits.str[0]
|
|
202
|
+
df['maturity_name'] = splits.str[1]
|
|
203
|
+
df['strike'] = splits.str[2]
|
|
204
|
+
df['option_type'] = splits.str[3]
|
|
204
205
|
|
|
205
206
|
# Create maturity date at 8:00 AM UTC
|
|
206
207
|
df['maturity_date'] = pd.to_datetime(df['maturity_name'].apply(
|
|
207
|
-
lambda x: int(datetime.strptime(x, "%d%b%y")
|
|
208
|
-
.replace(hour=8, minute=0, second=0, tzinfo=timezone.utc)
|
|
208
|
+
lambda x: int(dt.datetime.strptime(x, "%d%b%y")
|
|
209
|
+
.replace(hour=8, minute=0, second=0, tzinfo=dt.timezone.utc)
|
|
209
210
|
.timestamp() * 1000)), unit='ms')
|
|
210
211
|
|
|
211
212
|
# Get reference time from timestamp
|
|
212
|
-
reference_time =
|
|
213
|
+
reference_time = dt.datetime.fromtimestamp(df['timestamp'].iloc[0] / 1000)
|
|
213
214
|
|
|
214
215
|
# Calculate days to expiry (DTE)
|
|
215
216
|
df['dtm'] = (df['maturity_date'] - reference_time).dt.total_seconds() / (24 * 60 * 60)
|
|
@@ -5,14 +5,14 @@ voly/formulas.py,sha256=Xgaq4lx1fNzRfu9W84fMNeH6GRJ0FNFNUUUYn5ffjjE,8843
|
|
|
5
5
|
voly/models.py,sha256=LXXIlpXZQEfXTuCngxC8Hd3bWtw6wdXDCSGxTLmHM-c,3659
|
|
6
6
|
voly/core/__init__.py,sha256=bu6fS2I1Pj9fPPnl-zY3L7NqrZSY5Zy6NY2uMUvdhKs,183
|
|
7
7
|
voly/core/charts.py,sha256=T8cogkiHj8NcFxfARumNvAjLJUAxsMlHUOVgshwjye8,26474
|
|
8
|
-
voly/core/data.py,sha256=
|
|
8
|
+
voly/core/data.py,sha256=pj4sRLthmg6cCajW6VP66FLzaVbX4HRW_XATPLip5Oc,8848
|
|
9
9
|
voly/core/fit.py,sha256=PCKedwjY2Xsl_Gv9t46dAnEnFbz0T1oJsZsb__GWCSw,9878
|
|
10
10
|
voly/core/interpolate.py,sha256=ztVIePJZOh-CIbn69wkh1JW2rKywNe2FEewRN0zcSAo,8185
|
|
11
11
|
voly/core/rnd.py,sha256=8FTU-Qp9epW9yE4XSOdiFGIRXrGyXqF6mVgZn1NMvxk,11813
|
|
12
12
|
voly/utils/__init__.py,sha256=E05mWatyC-PDOsCxQV1p5Xi1IgpOomxrNURyCx_gB-w,200
|
|
13
13
|
voly/utils/logger.py,sha256=4-_2bVJmq17Q0d7Rd2mPg1AeR8gxv6EPvcmBDMFWcSM,1744
|
|
14
|
-
voly-0.0.
|
|
15
|
-
voly-0.0.
|
|
16
|
-
voly-0.0.
|
|
17
|
-
voly-0.0.
|
|
18
|
-
voly-0.0.
|
|
14
|
+
voly-0.0.53.dist-info/LICENSE,sha256=wcHIVbE12jfcBOai_wqBKY6xvNQU5E909xL1zZNq_2Q,1065
|
|
15
|
+
voly-0.0.53.dist-info/METADATA,sha256=udC74lzJ0-IDx5Zgg_79q4VMLVd7Hdrdl_r6SxB4g-0,4092
|
|
16
|
+
voly-0.0.53.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
|
|
17
|
+
voly-0.0.53.dist-info/top_level.txt,sha256=ZfLw2sSxF-LrKAkgGjOmeTcw6_gD-30zvtdEY5W4B7c,5
|
|
18
|
+
voly-0.0.53.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|