Skip to main content

Introduction

  • This package is written to be used as a XTS API Client in Python.
  • With the correct API credentials, User can access XTS interactive & market data.

Reference

Package Structure

  • To better consume the package, the user should have a clear understanding of the architecture of the package.

Here is the folder structure of the project:

└───xts_api_client
    │   interactive_socket.py
    │   interactive_socket_client.py
    │   market_data_socket.py
    │   market_data_socket_client.py
    │   py.typed
    │   xts_connect.py
    │   xts_connect_async.py
    │   xts_exception.py
    │   __init__.py
    │   
    ├───helper
        helper.py
        helper_classes.py
        __init__.py

There are two version of xts_connect. A synchronous version & an asynchronous version.

xts_connect.py

  • This module is written for simple test cases & basic understanding of the API, however in practical cases, user will have to use asynchronous methods.

xts_connect_async.py

  • For all intensive purposes, this module will be used only because of the nature of application.

Getting Started

  • The user should have API Key, API Secret Key & the URL with Port details for using this package.
  • XTS API is a REST based Trading API with Socket IO streaming component. This client makes it easier to consume the data from API into Python.
  • In XTS, there are two types of API, one for trading (interactive sessions) & one for market data.

Trading API

  • Trading APIs allows to integrate trading system with XTS Platform for placing orders, monitor your positions, manage your portfolio and much more.

Market Data API

  • Market Data API is a mixed HTTP REST and HTTP streaming API. It provides access to live quotes data on a wide range of symbols.

A Simple Example

  • Here's an example code block that loads API credentials from environment variables and uses them to log in to a MarketData API. It has been explained in subsequent steps.
import os
from dotenv import load_dotenv
load_dotenv()

API_key = os.getenv("XTS_MARKETDATA_API_KEY")
API_secret = os.getenv("XTS_MARKETDATA_SECRET_KEY")
API_source = os.getenv("XTS_SOURCE")
API_root = os.getenv("XTS_API_URL")

"""""""""""""""""""""""""""""""""""""""
      |DataFrame for Cash Market|
"""""""""""""""""""""""""""""""""""""""
from xts_api_client.xts_connect_async import XTSConnect
from xts_api_client.helper.helper import cm_master_string_to_df
import asyncio

async def main():
      xt_market_data = XTSConnect(
      apiKey = API_key,
      secretKey = API_secret,
      source = API_source,
      root = API_root
      )
      response_marketdata_login = await xt_market_data.marketdata_login()

      market_data_get_master = await xt_market_data.get_master(
      exchangeSegmentList = [xt_market_data.EXCHANGE_NSECM] # Works for BSECM as well.
      )

      print((cm_master_string_to_df(market_data_get_master['result'])))
if __name__ == "__main__":
    asyncio.run(main())
""""""""""""""""""""""""""""""""""""""""""

Metadata

Release files for xts-api-client 0.1.25

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xts-api-client 0.1.25
File Size Uploaded
xts_api_client-0.1.25.tar.gz 15.3 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for xts-api-client 0.1.25
File Interpreter ABI Platform
xts_api_client-0.1.25-py3-none-any.whl Python 3 none any Details

Total release size: 15.3 MB

Release files / xts_api_client-0.1.25.tar.gz

Download URL xts_api_client-0.1.25.tar.gz
Size 15.3 MB
Tags Source
SHA-256 checksum
How to use checksums
10b4ae2091a1dde96618600a3fbea0b210e6e70925d97424fe11bcc0255fd807
BLAKE2b-256 checksum
How to use checksums
1fc5d53e48ace08e5056bb29ba54c50c64edd95ab99943c83fe8ca3880d49506
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / xts_api_client-0.1.25-py3-none-any.whl

Download URL xts_api_client-0.1.25-py3-none-any.whl
Size 32.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d4fae79d5d843726ddf4651dd489f00e679bcc6ef644c0771358163860ae6a1e
BLAKE2b-256 checksum
How to use checksums
22676c9b4a30943654a3be0697e169c2723f73a2e229af40284fda42a5563398
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

0.1.26

2 release files

This release

0.1.25 This release

2 release files

0.1.24

2 release files

0.1.23

2 release files

0.1.21

2 release files

0.1.18

2 release files

0.1.17

2 release files

0.1.16

2 release files

0.1.15

1 release file

0.1.14

2 release files

0.1.13

2 release files

0.1.12

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page