Skip to content

Edelweiss API Connect documentation

The Library Edelweiss API Connect is a set of REST-like APIs that expose many capabilities required to build a complete investment and trading platform. Execute orders in real time, manage user portfolio, stream live market data (WebSockets), and more, with the simple HTTP API collection This module provides an easy to use abstraction over the HTTP APIs. The HTTP calls have been converted to methods and their JSON responses are returned.

Introduction

#!python
import EdelweissAPIConnect


# Redirect the user to the login url - <https://www.edelweiss.in/api-connect/login?api_key=xxx>
# after the login flow, You will get request_id.
# Generate a session with this request id
# as follows.
edel = EdelweissAPIConnect.EdelweissAPIConnect("api_key_here", "api_secret", "request_id", True)

# Place an order
response = edel.PlaceTrade('Symbol',
                          'Exchange',
                          'Buy-Sell',
                          'Validity',
                          'OrderType',
                          'Quantity',
                          'ExchangeCode',
                          'LimitPrice',
                          'ProductCode')

# Fetch all orders
edel.OrderBook()
#Fetch all trades
edel.TradeBook()

A Typical Web Application

In a typical web application where a new instance of views, controllers etc. are created per incoming HTTP request, you will need to initialise a new instance of Edelweiss API Connect client per request as well. This is because each individual instance represents a single user that's authenticated, unlike an admin API where you may use one instance to manage many users. Hence, in your web application, typically: - You will initialise an instance of the Edelweiss client - Redirect the user to the Login URL - At the redirect url endpoint, obtain the request_id from the query parameters - Pass this 'request_id' along with 'api_key' and 'api_secret' at the time of initialization