Skip to main content

The official Python client for communicating with Greeksoft's CTCL Application API

Project description

GreekSoft API

Greeksoft API is a Python-based package that allows users to subscribe to the Greek token and retrieve the latest tick by tick data. This project helps in authenticating a user, broadcasting tokens, and placing orders in a seamless manner.

Features Authentication:

By passing a username, session password, and user password, the project authenticates the user.

Token Retrieval:

Retrieves the latest token broadcast.

Order Placement:

Capable of placing orders once authenticated.

Technologies Used

Python built-in Libs & third party libs (Pandas, numpy,requests,etc.)

What's New in Version 0.1.1

New Feature: Added New Feature to get Contract Data of All NSE,BSE,MCX...etc at one function call as api.get_contract_data().

New Feature: Added New Feature to get OHLC data of the passed 'greektoken' of said Date with its interval from minutes to hrs as api.get_ohlc_data(token,date,interval)

Major Changes: After Calling Token_broadcast function we just have to use .get() method, below are the instruction given as follows.

pip install greeksoft

Usage Once installed, you can use the project by importing the Greek_API from the greek_api_client package. Below is an example of how to use the API:

from greeksoft import GreekAPI

username="username" # String Format

session_pwd="session_pwd"  #String Format

user_pwd="user_pwd" #String Format

procli="procli" # for client id procli="2", retail id procli='1'

ac_no='ac_no' # if retail id pass account number in String Format. 

api = Greek_API(username,session_pwd,user_pwd,procli,ac_no,is_secure,is_base_64,rest_ip,rest_port)
      # Authenticates the provided credentials and handles the JSON, secure, and unsecure flags
      # as per the server configuration. The `rest_ip` and `rest_port` are user-defined inputs
      # to enable server communication based on the specific setup required by the organization.

token_no='102000000' # string format

# Authenticate and fetch the latest token

token_b = api.token_broadcast('token_no','asset_type') # token_no in 'String', asset_type='option' or 'future' or 'equity' in string format.

# token=token_b.get('token') <-- get token no

# symbol=token_b.get('symbol') <-- get symbol name of token passed

# time=token_b.get('ltt') <-- provide the time

# strike=token_b.get('strikeprice') <-- get Strike

# option_type=token_b.get('optiontype') <-- get Option type CE or PE

# instrument=token_b.get('instrument') <-- get instrument type FUTSTK,OPTSTK...

# bid_price=token_b.get('bid') <-- get bid price of token passed

# ask_price=token_b.get('ask') <-- get ask price of token passed


# Subscribe with the Greek Token and pass it in list eg:token_list=['','',...] into the declared variable. 

token_list=['102000000','102000000',...] # Only pass Greek Token.

req_data='' For passing empty string we will get only token,symbol,last traded price, last traded time.

req_data='depth' For passing depth as string we will get only token, symbol,depth inplace of last traded price, last traded time.

req_data='ask/bid' For passing ask/bid as string we will get token, symbol,ask price and its bid price, last traded time.req_data

req_data='allresp' For passing allresp as string we will get token.symbol,all data of traded at the respective time and its last traded time.

for data in api.get_apollo_resp(token_list,req_data='allresp' or 'ask/bid' or 'depth' or ''): # To get response of tokens passed of list using loop.
    print(data)

# Place order passing required parameters, # token_no='102000000', symbol="RELIANCE", qty="minimum_lot" for respective token,

# price= value get from bid/ask price from token broadcast against respective token in strictly in string format,

#buysell= if buy then pass 1 and for sell 2 in integer format,

# For Respective symbols in options: lot='1' corresponds to 75 units (qty='75') same as respective symbols quantity
# For equity: lot='1' corresponds to 1 unit (qty='1')
# For futures: lot='1' corresponds to 1 unit (qty='1')

#ordtype=1, trigprice=0,exchange='NSE','BSE'..etc whichever token is based on exchange type,

#strategyname="example" strategy name will be anything as per userinput.

var_response=api.place_order(tokenno,symbol,lot,qty,price,buysell,ordtype,trigprice,exchange,strategyname) # pass the required parameters

print(var_response) # acknowledge the response get from place order function.

**NetPosition as per StrategyWise**

net_position_strategywise=api.Net_Position_Details_strategywise() # to get the net position of Greek ID as per strategy wise
print(net_position)

**NetPosition request**

net_position_request=api.Net_Position_request() # to get the limited data of net position of Greek ID.strategy

**NetPosition Detailed**

net_position_detailed=api.Net_position_Detailed() # to get the detailed data of the net position of Greek ID

**Order Traded Status**

order_traded_status=api.Order_Trade_status('gorderid') # to get the status of booked order status of Greekorder_Id passed as string.

**Pending Order**

pending_order=api.all_pending_order() # by calling this function we will get all pending order status as while using this function no parameters required to be passed.

**Cancel Order**

cancel_order=api.cancel_order(ord_id) # Passing the greek orderid as string and to cancel the pending order.

**Modify Order**

modify_order=api.modify_order(price,lot,qty,ordtype,gorderid) # to modify the pending order by its latest ask/bid price as in string ,in lot will be the value of multiple of minimum_lot in string,its quantity in string, ordtype in interger and mandatory part gorderid as greek order id in string.

**Rejected Order**

rejected_order=api.api.Orderbook_Rejected() # to get list of all rejected order.

**Orderbook All**

orderbook_all=api.Orderbook_All() # to get the list of all placed order,pending_order ,with all strategy wise.

**Orderbook Traded**

orderbook_traded=api.Orderbook_Traded() # to get the list of all placed and confirmed Booked orders data with all strategy wise.

**Unsubscribe Token**
api.unsubscribe_token(token) # Token in string--MANDATORY

**Close connection**
api.close_connection() # to terminate all sessions

**Contract Data**
api.get_contract_data() # to get all get_contract_data data which contains greektoken, exchange token,expiry,etc...

**OHLC Data**
api.get_ohlc_data(token,date,interval) # token='greektoken', date='YYYYMMDD'<--format interval= 1 for 1hr and 0.1 for minutes.


License

This project is licensed under the MIT License - see the LICENSE file for details.

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

greeksoft-0.1.1.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

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

greeksoft-0.1.1-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file greeksoft-0.1.1.tar.gz.

File metadata

  • Download URL: greeksoft-0.1.1.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.0

File hashes

Hashes for greeksoft-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e36699b8df69f75d7acc96824cc83179c61bce4f823febaa91b5b8bbe0168c9e
MD5 149710515dbe57e384c1c55377197d1b
BLAKE2b-256 25ddcc04faa63049ca8620528d96ea600db4097545d9a1922a17f3fc9787efc2

See more details on using hashes here.

File details

Details for the file greeksoft-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: greeksoft-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.0

File hashes

Hashes for greeksoft-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 897411143ef1d5cf11e739f40f576e6dde4a3278ba5ae23f8e4586b851bac7d0
MD5 c42996eac322aaa6f1b5ec6f28a1c5f1
BLAKE2b-256 a52d040f26585ead4e23b18ed856bca101215ed3766a87b95cb0b7cd02123892

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