Skip to main content

Vortex APIs to place orders in Rupeezy application

Project description

Vortex API Python Client

Installation

pip install vortex-api

Api Usage

from vortex_api import VortexAPI
from vortex_api import Constants as Vc

client = VortexAPI("your api secret","your application id")

print(client.login_url(callback_param="hi"))

client.exchange_token("auth token received in the callback url")

client.orders(limit=20, offset=1)

# Place order 

client.place_order(
       exchange = Vc.ExchangeTypes.NSE_EQUITY,
       token = 22,
       transaction_type =  Vc.TransactionSides.BUY,
       product = Vc.ProductTypes.DELIVERY,
       variety = Vc.VarietyTypes.REGULAR_LIMIT_ORDER,
       quantity = 1,
       price = 1700.0,
       trigger_price=0.0,
       disclosed_quantity= 0,
       validity = Vc.ValidityTypes.FULL_DAY)

#Get order book 
client.orders(limit=20,offset=1)

Connecting to websocket

Using the feed, you can listen to both price quote changes and order/trade updates. You need to define your own callbacks for on_price_update and on_order_update. The packet structure for on_order_update is the same as that received in postbacks and is available here

from vortex_api import VortexFeed
from vortex_api import Constants as Vc
import time

def main():
    # Get access token from any of the login methods
    wire = VortexFeed(access_token) 

    wire.on_price_update = on_price_update
    wire.on_order_update = on_order_update
    wire.on_connect = on_connect
    wire.connect(threaded=True) 
    # If you make threaded = False, anything after this line will not execute

    time.sleep(10)
    
    wire.unsubscribe(Vc.ExchangeTypes.NSE_EQUITY, 26000)
    wire.unsubscribe(Vc.ExchangeTypes.NSE_EQUITY, 26009)
    wire.unsubscribe(Vc.ExchangeTypes.NSE_EQUITY, 2885)


def on_price_update(ws,data): 
    print(data)

def on_order_update(ws,data): 
    print(data)

def on_connect(ws, response):
    ws.subscribe(Vc.ExchangeTypes.NSE_EQUITY, 26000, Vc.QuoteModes.LTP) #Subscribe to NIFTY 
    ws.subscribe(Vc.ExchangeTypes.NSE_EQUITY, 26009,Vc.QuoteModes.OHLCV) # Subscribe to BANKNIFTY 
    ws.subscribe(Vc.ExchangeTypes.NSE_EQUITY, 2885,Vc.QuoteModes.FULL) # Subscribe to RELIANCE 

if __name__ == "__main__":
    main()

Refer to the python document for all methods and features

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

vortex_api-2.1.8b5.tar.gz (41.2 kB view details)

Uploaded Source

Built Distribution

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

vortex_api-2.1.8b5-py3-none-any.whl (45.2 kB view details)

Uploaded Python 3

File details

Details for the file vortex_api-2.1.8b5.tar.gz.

File metadata

  • Download URL: vortex_api-2.1.8b5.tar.gz
  • Upload date:
  • Size: 41.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for vortex_api-2.1.8b5.tar.gz
Algorithm Hash digest
SHA256 985ed051e9d8eae8d698c9e59cc58d1abe6954394cf9c6ecccc5f04fc3e48281
MD5 01888d63ddc314b761c97dd38410633e
BLAKE2b-256 81b76c625304e79101d372dc09d5900149fd91ba99a4a53341ab0aea589bd4b4

See more details on using hashes here.

File details

Details for the file vortex_api-2.1.8b5-py3-none-any.whl.

File metadata

  • Download URL: vortex_api-2.1.8b5-py3-none-any.whl
  • Upload date:
  • Size: 45.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for vortex_api-2.1.8b5-py3-none-any.whl
Algorithm Hash digest
SHA256 43e5229e73b143ccaca89e388b6e03c40a6fd08a680bc4c982790b28074587f4
MD5 149d0c77a5b36addab6d1e29e9aede1c
BLAKE2b-256 296f67d553bca1b1418bb4cd885438b1584a83e9d82e6f0bea3a158b8e53cf76

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