Skip to main content

A Package designed for connecting to a Stock Broker that uses Symphony Fintech Solutions Pvt. Ltd for there API.

Project description

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("API_KEY")
API_secret = os.getenv("API_SECRET")
API_source = os.getenv("API_SOURCE")
API_root = os.getenv("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())
""""""""""""""""""""""""""""""""""""""""""

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

xts_api_client-0.1.7.tar.gz (15.4 MB view details)

Uploaded Source

Built Distribution

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

xts_api_client-0.1.7-py3-none-any.whl (25.4 kB view details)

Uploaded Python 3

File details

Details for the file xts_api_client-0.1.7.tar.gz.

File metadata

  • Download URL: xts_api_client-0.1.7.tar.gz
  • Upload date:
  • Size: 15.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.5

File hashes

Hashes for xts_api_client-0.1.7.tar.gz
Algorithm Hash digest
SHA256 1ac2d7e95bf2136c82dc635d2e21e0a5e992c8cd24e309c3aca22a2f0c684910
MD5 c46e0b7a14aaf88616926bc85884b0ce
BLAKE2b-256 35ffce700f15aadd5a3b75232726c7c7017b9a57e8205b7f61b3b6925bb6420f

See more details on using hashes here.

File details

Details for the file xts_api_client-0.1.7-py3-none-any.whl.

File metadata

File hashes

Hashes for xts_api_client-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 2046aae2f3e739ff6153d0f0d167e2439de4fb2c39e8b8b3c23f270bbc16f688
MD5 c7481db5be6deb1f878f65b4108f4572
BLAKE2b-256 083cfd5860b5e160cda6b092418f0e2f589d92bc8d947c238c984b4790eb7f3a

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