More trivial formatting changes
This commit is contained in:
parent
f7f10a1003
commit
c0646ed021
@ -8,7 +8,7 @@ from os import getenv
|
|||||||
|
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
|
|
||||||
def read_data_from_socket(sock, recv_buffer=4096):
|
def read_data_from_socket(sock, recv_buffer = 4096):
|
||||||
buffer = b''
|
buffer = b''
|
||||||
data = b''
|
data = b''
|
||||||
while True:
|
while True:
|
||||||
@ -24,8 +24,8 @@ def read_data_from_socket(sock, recv_buffer=4096):
|
|||||||
|
|
||||||
def _get_daily_data(symbol: str, max_days: int) -> pd.DataFrame:
|
def _get_daily_data(symbol: str, max_days: int) -> pd.DataFrame:
|
||||||
message = 'HDX,{symbol},{max_days},1\n'.format(
|
message = 'HDX,{symbol},{max_days},1\n'.format(
|
||||||
symbol=symbol,
|
symbol = symbol,
|
||||||
max_days=max_days
|
max_days = max_days
|
||||||
)
|
)
|
||||||
|
|
||||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
@ -40,7 +40,7 @@ def _get_daily_data(symbol: str, max_days: int) -> pd.DataFrame:
|
|||||||
data = data.replace(',\n','\n')[:-1]
|
data = data.replace(',\n','\n')[:-1]
|
||||||
|
|
||||||
data = StringIO(data)
|
data = StringIO(data)
|
||||||
return pd.read_csv(data, index_col=False,
|
return pd.read_csv(data, index_col = False,
|
||||||
names=['Date', 'High', 'Low', 'Open', 'Close', 'Total Volume', 'Period Volume'])
|
names=['Date', 'High', 'Low', 'Open', 'Close', 'Total Volume', 'Period Volume'])
|
||||||
|
|
||||||
def get_daily_data(symbol: str, start_date: datetime, end_date: datetime) -> pd.DataFrame:
|
def get_daily_data(symbol: str, start_date: datetime, end_date: datetime) -> pd.DataFrame:
|
||||||
@ -51,7 +51,7 @@ def get_daily_data(symbol: str, start_date: datetime, end_date: datetime) -> pd.
|
|||||||
data['Date'] = pd.to_datetime(data['Date'])
|
data['Date'] = pd.to_datetime(data['Date'])
|
||||||
data['Date'] = data['Date'].dt.date
|
data['Date'] = data['Date'].dt.date
|
||||||
data = data[(data['Date'] >= start_date.date()) & (data['Date'] <= end_date.date())]
|
data = data[(data['Date'] >= start_date.date()) & (data['Date'] <= end_date.date())]
|
||||||
data = data.reset_index(drop=True)
|
data = data.reset_index(drop = True)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def seconds(value):
|
def seconds(value):
|
||||||
|
Loading…
Reference in New Issue
Block a user