Skip to content
This repository was archived by the owner on Nov 18, 2024. It is now read-only.

Commit 29a832d

Browse files
committed
- Choose stable vs unstable terminal build.
- Version Fixes
1 parent 3da5e02 commit 29a832d

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "thetadata"
7-
version = "0.9.1"
7+
version = "0.9.2"
88
authors = [
99
{ name="Bailey Danseglio", email="[email protected]" },
1010
{ name="Adler Weber", email="[email protected]" },

thetadata/client.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ class ThetaClient:
247247

248248
def __init__(self, port: int = 11000, timeout: Optional[float] = 60, launch: bool = True, jvm_mem: int = 0,
249249
username: str = "default", passwd: str = "default", auto_update: bool = True, use_bundle: bool = True,
250-
host: str = "localhost", streaming_port: int = 10000):
250+
host: str = "localhost", streaming_port: int = 10000, stable: bool = True):
251251
"""Construct a client instance to interface with market data. If no username and passwd fields are provided,
252252
the terminal will connect to thetadata servers with free data permissions.
253253
@@ -286,7 +286,7 @@ def __init__(self, port: int = 11000, timeout: Optional[float] = 60, launch: boo
286286
"20 requests / minute.\nA data subscription can be purchased at https://thetadata.net. "
287287
"If you already have a ThetaData\nsubscription, specify the username and passwd parameters.")
288288
print('------------------------------------------------------------------------------------------------')
289-
if check_download(auto_update):
289+
if check_download(auto_update, stable):
290290
Thread(target=launch_terminal, args=[username, passwd, use_bundle, jvm_mem, auto_update]).start()
291291
else:
292292
print("You are not launching the terminal. This means you should have an external instance already running.")

thetadata/terminal.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -92,18 +92,22 @@ def launch_terminal(username: str = None, passwd: str = None, use_bundle: bool =
9292
print(line.decode('utf-8').rstrip("\n"))
9393

9494

95-
def check_download(auto_update: bool) -> bool:
95+
def check_download(auto_update: bool, stable: bool) -> bool:
96+
if stable:
97+
link = 'https://download-latest.thetadata.us'
98+
else:
99+
link = 'https://download-unstable.thetadata.us'
96100
try:
97101
if not os.path.exists('ThetaTerminal.jar') or auto_update:
98-
jar = urllib.request.urlopen("https://download-latest.thetadata.us")
102+
jar = urllib.request.urlopen(link)
99103
with open('ThetaTerminal.jar', 'wb') as output:
100104
output.write(jar.read())
101105
output.close()
102106
return True
103107
except:
104108
try:
105109
if not os.path.exists('ThetaTerminal.jar') or auto_update:
106-
jar = urllib.request.urlopen("http://download-latest.thetadata.us")
110+
jar = urllib.request.urlopen(link)
107111
with open('ThetaTerminal.jar', 'wb') as output:
108112
output.write(jar.read())
109113
output.close()

0 commit comments

Comments
 (0)