Skip to content

Commit ad7b594

Browse files
authored
Merge pull request #45 from EodHistoricalData/dev
Dev
2 parents e02c020 + b02da1b commit ad7b594

4 files changed

Lines changed: 20 additions & 26 deletions

File tree

eodhd/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88

99

1010
# Version of eodhd package
11-
__version__ = "1.0.26"
11+
__version__ = "1.0.27"

eodhd/websocketclient.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def __init__(
2727
raise ValueError("API key is invalid")
2828

2929
# Validate endpoint
30-
if endpoint not in ["us", "us_quote", "forex", "crypto"]:
30+
if endpoint not in ["us", "us-quote", "forex", "crypto"]:
3131
raise ValueError("Endpoint is invalid")
3232

3333
# Validate symbol list

example_websockets.py

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,24 @@
11
"""Websocket example"""
22

3-
from time import sleep
3+
import time
44
from eodhd import WebSocketClient
55

6-
7-
def main() -> None:
8-
"""Main"""
9-
10-
websocket = WebSocketClient(
11-
# Demo API key for testing purposes
6+
client = WebSocketClient(
127
api_key="OeAFFmMliFG5orCUuwAKQ8l4WWFQ67YX",
138
endpoint="crypto",
14-
symbols=["BTC-USD"]
15-
# api_key="OeAFFmMliFG5orCUuwAKQ8l4WWFQ67YX", endpoint="forex", symbols=["EURUSD"]
16-
# api_key="OeAFFmMliFG5orCUuwAKQ8l4WWFQ67YX", endpoint="us", symbols=["AAPL"]
17-
)
18-
websocket.start()
19-
20-
message_count = 0
21-
while True:
22-
if websocket:
23-
if message_count != websocket.message_count:
24-
print(websocket.message)
25-
message_count = websocket.message_count
26-
sleep(0.25) # output every 1/4 second, websocket is realtime
27-
9+
symbols=["BTC-USD"],
10+
display_stream=False,
11+
display_candle_1m=True,
12+
display_candle_5m=False,
13+
display_candle_1h=False,
14+
)
15+
client.start()
2816

29-
if __name__ == "__main__":
30-
main()
17+
try:
18+
while client.running:
19+
res = client.get_data()
20+
print(res)
21+
time.sleep(1)
22+
except KeyboardInterrupt:
23+
print("\nStopping due to user request.")
24+
client.stop()

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# This call to setup() does all the work
1717
setup(
1818
name="eodhd",
19-
version="1.0.26",
19+
version="1.0.27",
2020
description="Official EODHD API Python Library",
2121
long_description=long_description,
2222
long_description_content_type="text/markdown",

0 commit comments

Comments
 (0)