Skip to content

jogunjobi/app5

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Quantextive API Client

Dependencies

How to make API request?

class ApiClient in api_client.py is provisioned to make API requests. In the constructor of the ApiClient class a dictionary of default headers for all requests can be supplied. So that headers need not be supplied with each request.

default_headers = { 'x-api-key' : '<token>' }
client = ApiClient(default_headers)

To make a GET request, ApiClient.get() method is used with following params

  • api_key: API key required for authenticating the requests
  • name: string api name which will be appended to base_url
  • params: dict of url params

e.g.

import api_client

api = "market-data-eod"
params = { 
    'securityId': 'NSE:NNFM',
    'startDate': '2017-02-08',
    'endDate': '2017-02-10'
}
api_key = '<token>'

client = api_client.ApiClient()
print client.get(api_key, api, params).data_frame()

method get() returns a Response object from which below methods can be used to get response data as json of Pandas DataFrame. So

  • client.get(api_key, name, queryparams).json() will return response data as json, and
  • client.get(api_key, name, queryparams).data_frame() will return response data as pandas DataFrame
Running the test script
python tests/test.py

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published