Skip to main content

Truedata's Official Python Package

Project description

This is the official python (websocket) repo for TrueData.

What have we covered so far ?

  • Websocket APIs
    • Live data
    • Historical data

How do you use it ?

For beginners

  • Installing from PyPi
python3.7 -m pip install truedata
  • Connecting
from truedata_ws.websocket.TD import TD
td_app = TD('<enter_your_login_id>', '<enter_your_password>')
  • Starting live data
    For Single Symbols
req_id = td_app.start_live_data('<enter_symbol>')
# Example:
# req_id = start_live_data('CRUDEOIL-I')
# This returns an integer that can be used later to reference the data

For Multiple symbols

req_ids = td_app.start_live_data(['<symbol_1>', '<symbol_2>', '<symbol_3>', ...])
# Example:
# req_ids = td_app.start_live_data(['CRUDEOIL-I', 'BANKNIFTY-I', 'RELIANCE', 'ITC'])
# This returns a list that can be used to reference data later
  • Sample code for testing market data (single symbol)
from copy import deepcopy

live_data_obj = deepcopy(td_app.live_data[req_id])

while True:
    if not td_app.live_data[req_id] == live_data_obj:
        print(td_app.live_data[req_id])
        live_data_obj = deepcopy(td_app.live_data[req_id])
  • Sample code for testing market data (multiple symbols)
from copy import deepcopy

live_data_objs = {}
for req_id in req_ids:
    live_data_objs[req_id] = deepcopy(td_app.live_data[req_id])
    print(live_data_objs[req_id])

while True:
    for req_id in req_ids:
        if not td_app.live_data[req_id] == live_data_objs[req_id]:
            print(td_app.live_data[req_id])
            live_data_objs[req_id] = deepcopy(td_app.live_data[req_id])






What is the plan going forward ?

  • Ease of contract handling
  • Improved error handling

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

truedata_ws-0.1.17.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

truedata_ws-0.1.17-py3-none-any.whl (24.0 kB view details)

Uploaded Python 3

File details

Details for the file truedata_ws-0.1.17.tar.gz.

File metadata

  • Download URL: truedata_ws-0.1.17.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.5

File hashes

Hashes for truedata_ws-0.1.17.tar.gz
Algorithm Hash digest
SHA256 683bf66e5cffaf2929b7cc264bba4bfa1ae69dfc2d6a7c7e8bec2ad5f82c2bf2
MD5 abff485a7834f7603c1ebb29202c2565
BLAKE2b-256 d1562e6908c4948f29cddec5262357ed46884d3c9f482a591c778d3439ef99d0

See more details on using hashes here.

File details

Details for the file truedata_ws-0.1.17-py3-none-any.whl.

File metadata

  • Download URL: truedata_ws-0.1.17-py3-none-any.whl
  • Upload date:
  • Size: 24.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.5

File hashes

Hashes for truedata_ws-0.1.17-py3-none-any.whl
Algorithm Hash digest
SHA256 35db900825c029637bca250cb08daac43fe50f717b28c88f5b210e8da4870517
MD5 d938cbf5ef14272dd90285a73ec77e5d
BLAKE2b-256 e3e5492c5f6d510922e684ad394c2f4abe000be7dd43311ed4089202f0dd6a15

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page