Fugle Realtime API client library for Python
$ pip install fugle-realtime
The library a Python client that supports HTTP API and WebSocket.
from fugle_realtime import HttpClient
api_client = HttpClient(api_token='demo')
api_client.intraday.meta(symbolId='2884')
api_client.intraday.quote(symbolId='2884')
api_client.intraday.chart(symbolId='2884')
api_client.intraday.dealts(symbolId='2884', limit=50)
api_client.intraday.volumes(symbolId='2884')
api_client.historical.candles('2884', '2022-02-07', '2022-02-11', None)
api_client.historical.candles('2884', None, None, 'open,high,low,close,volume,turnover,change')
import time
from fugle_realtime import WebSocketClient
def handle_message(message):
print(message)
def main():
ws_client = WebSocketClient(api_token='demo')
ws = ws_client.intraday.quote(symbolId='2884', on_message=handle_message)
ws.run_async()
time.sleep(3)
ws.close()
if __name__ == '__main__':
main()