API client for Quantextive AEX Data Platform
Project description
## Quantextive AEX API Client
#### Dependencies
- [**Requests: HTTP for Humans**](http://docs.python-requests.org/en/master/)
- install it using **pip**
```python
pip install request
```
- [**Pandas**](http://pandas.pydata.org/)
- install it using **pip**
```python
pip install pandas
```
#### How to make an API request?
class `ApiClient` in [`qtx.py`](qtx.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.
```python
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
**EXAMPLE**
```python
import qtx
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()
```
The `get()` method returns a `Response` object from which below methods can be used to get response data as **json** or **Pandas DataFrame**.
- `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
python tests/test.py
```
#### Dependencies
- [**Requests: HTTP for Humans**](http://docs.python-requests.org/en/master/)
- install it using **pip**
```python
pip install request
```
- [**Pandas**](http://pandas.pydata.org/)
- install it using **pip**
```python
pip install pandas
```
#### How to make an API request?
class `ApiClient` in [`qtx.py`](qtx.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.
```python
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
**EXAMPLE**
```python
import qtx
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()
```
The `get()` method returns a `Response` object from which below methods can be used to get response data as **json** or **Pandas DataFrame**.
- `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
python tests/test.py
```
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
qtx-0.2.tar.gz
(2.6 kB
view details)
File details
Details for the file qtx-0.2.tar.gz
.
File metadata
- Download URL: qtx-0.2.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a52bbcb08b50102342592572b590df9f07f4b35b45812413a106c8744f86468 |
|
MD5 | a25a7ed12e9ded1fd2eebeea599f2a28 |
|
BLAKE2b-256 | a7e207254c844ae8732beb3121127dce41f604daa7c517a8cf77479db25faf6c |