1
1
"""Module that contains Theta Client class."""
2
- from typing import Optional , Callable
2
+ from typing import Optional
3
3
from contextlib import contextmanager
4
- from functools import wraps
5
- from datetime import datetime , date
4
+
6
5
import socket
6
+
7
+ from pandas import DataFrame
7
8
from tqdm import tqdm
8
9
import pandas as pd
9
10
10
- from . import exceptions
11
11
from .enums import *
12
12
from .parsing import (
13
13
Header ,
@@ -101,6 +101,7 @@ def get_hist_option(
101
101
strike : float ,
102
102
right : OptionRight ,
103
103
date_range : DateRange ,
104
+ interval_size : int = 0 ,
104
105
progress_bar : bool = False ,
105
106
) -> pd .DataFrame :
106
107
"""
@@ -112,6 +113,7 @@ def get_hist_option(
112
113
:param strike: The strike price in USD, rounded to 1/10th of a cent.
113
114
:param right: The right of an option.
114
115
:param date_range: The dates to fetch.
116
+ :param interval_size: The interval size in milliseconds. Applicable only to OHLC & QUOTE requests.
115
117
:param progress_bar: Print a progress bar displaying download progress.
116
118
117
119
:return: The requested data as a pandas DataFrame.
@@ -125,7 +127,7 @@ def get_hist_option(
125
127
end_fmt = _format_date (date_range .end )
126
128
127
129
# send request
128
- hist_msg = f"MSG_CODE={ MessageType .HIST .value } &START_DATE={ start_fmt } &END_DATE={ end_fmt } &root={ root } &exp={ exp_fmt } &strike={ strike } &right={ right .value } &sec={ SecType .OPTION .value } &req={ req .value } \n "
130
+ hist_msg = f"MSG_CODE={ MessageType .HIST .value } &START_DATE={ start_fmt } &END_DATE={ end_fmt } &root={ root } &exp={ exp_fmt } &strike={ strike } &right={ right .value } &sec={ SecType .OPTION .value } &req={ req .value } &IVL= { interval_size } \n "
129
131
self ._server .sendall (hist_msg .encode ("utf-8" ))
130
132
131
133
# parse response header
0 commit comments