apollox-connector-python1.2


Nameapollox-connector-python1.2 JSON
Version 1.2.0 PyPI version JSON
download
home_pagehttps://github.com/amumuku/apollox-connector-python
SummaryThis is a lightweight library that works as a connector to Apollox Finance public API.
upload_time2024-04-11 03:16:28
maintainerNone
docs_urlNone
authorNone
requires_python>=3.6
licenseMIT
keywords apollox public api
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # apllox-connector-python

[![Python 3.6](https://img.shields.io/badge/python-3.6+-blue.svg)](https://www.python.org/downloads/release/python-360/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

This is a lightweight library that works as a connector to [Apollo Finance public API](https://github.com/apollox-finance/apollox-finance-api-docs)

## Installation

```bash
pip install apollox-connector-python
```

## Documentation


## RESTful APIs

Usage examples:
```python
from apollox.rest_api import Client 

# Get timestamp
client = Client()
print(client.time())


client = Client(key='<api_key>', secret='<api_secret>')

# Get account information
print(client.account())

# Post a new order
params = {
    'symbol': 'BTCUSDT',
    'side': 'SELL',
    'type': 'LIMIT',
    'timeInForce': 'GTC',
    'quantity': 0.002,
    'price': 59808
}

response = client.new_order(**params)
print(response)
```
Please find `examples` folder to check for more endpoints.

### Base URL
`https://fapi.apollox.finance`

### Optional parameters

PEP8 suggests _lowercase with words separated by underscores_, but for this connector,
the methods' optional parameters should follow their exact naming as in the API documentation.

```python
# Recognised parameter name
response = client.query_order('BTCUSDT', orderListId=1)

# Unrecognised parameter name
response = client.query_order('BTCUSDT', order_list_id=1)
```

### RecvWindow parameter

Additional parameter `recvWindow` is available for endpoints requiring signature.<br/>
It defaults to `5000` (milliseconds) and can be any value lower than `60000`(milliseconds).
Anything beyond the limit will result in an error response from ApolloX server.

```python
from apollox.rest_api import Client

client = Client(key, secret)
response = client.query_order('BTCUSDT', orderId=11, recvWindow=10000)
```

### Timeout

`timeout` is available to be assigned with the number of seconds you find most appropriate to wait for a server response.<br/>
Please remember the value as it won't be shown in error message _no bytes have been received on the underlying socket for timeout seconds_.<br/>
By default, `timeout` is None. Hence, requests do not time out.

```python
from apollox.rest_api import Client

client= Client(timeout=1)
```

### Proxy
proxy is supported

```python
from bapollo.rest_api import Client

proxies = { 'https': 'http://1.2.3.4:8080' }

client= Client(proxies=proxies)
```

### Response Metadata

The ApolloX API server provides weight usages in the headers of each response.
You can display them by initializing the client with `show_limit_usage=True`:

```python
from apollox.rest_api import Client

client = Client(show_limit_usage=True)
print(client.time())
```

You can also display full response metadata to help in debugging:

```python
client = Client(show_header=True)
print(client.time())
```

If `ClientError` is received, it'll display full response meta information.

### Display logs

Setting the log level to `DEBUG` will log the request URL, payload and response text.

### Error

There are 2 types of error returned from the library:
- `apollox.error.ClientError`
    - This is thrown when server returns `4XX`, it's an issue from client side.
    - It has 4 properties:
        - `status_code` - HTTP status code
        - `error_code` - Server's error code, e.g. `-1102`
        - `error_message` - Server's error message, e.g. `Unknown order sent.`
        - `header` - Full response header. 
- `apollox.error.ServerError`
    - This is thrown when server returns `5XX`, it's an issue from server side.

## Websocket

```python
from apollox.websocket.client.stream import WebsocketClient as Client

def message_handler(message):
    print(message)

ws_client = Client()
ws_client.start()

ws_client.mini_ticker(
    symbol='bnbusdt',
    id=1,
    callback=message_handler,
)

# Combine selected streams
ws_client.instant_subscribe(
    stream=['bnbusdt@bookTicker', 'ethusdt@bookTicker'],
    callback=message_handler,
)

ws_client.stop()
```
More websocket examples are available in the `examples` folder

### Heartbeat

Once connected, the websocket server sends a ping frame every 3 minutes and requires a response pong frame back within
a 10 minutes period. This package handles the pong responses automatically.


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/amumuku/apollox-connector-python",
    "name": "apollox-connector-python1.2",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "Apollox, Public API",
    "author": null,
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/71/8f/f3f4308881f3a3af075bfeff80e397db9a6326f0f88c61e4f692d16b628e/apollox-connector-python1.2-1.2.0.tar.gz",
    "platform": null,
    "description": "# apllox-connector-python\n\n[![Python 3.6](https://img.shields.io/badge/python-3.6+-blue.svg)](https://www.python.org/downloads/release/python-360/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nThis is a lightweight library that works as a connector to [Apollo Finance public API](https://github.com/apollox-finance/apollox-finance-api-docs)\n\n## Installation\n\n```bash\npip install apollox-connector-python\n```\n\n## Documentation\n\n\n## RESTful APIs\n\nUsage examples:\n```python\nfrom apollox.rest_api import Client \n\n# Get timestamp\nclient = Client()\nprint(client.time())\n\n\nclient = Client(key='<api_key>', secret='<api_secret>')\n\n# Get account information\nprint(client.account())\n\n# Post a new order\nparams = {\n    'symbol': 'BTCUSDT',\n    'side': 'SELL',\n    'type': 'LIMIT',\n    'timeInForce': 'GTC',\n    'quantity': 0.002,\n    'price': 59808\n}\n\nresponse = client.new_order(**params)\nprint(response)\n```\nPlease find `examples` folder to check for more endpoints.\n\n### Base URL\n`https://fapi.apollox.finance`\n\n### Optional parameters\n\nPEP8 suggests _lowercase with words separated by underscores_, but for this connector,\nthe methods' optional parameters should follow their exact naming as in the API documentation.\n\n```python\n# Recognised parameter name\nresponse = client.query_order('BTCUSDT', orderListId=1)\n\n# Unrecognised parameter name\nresponse = client.query_order('BTCUSDT', order_list_id=1)\n```\n\n### RecvWindow parameter\n\nAdditional parameter `recvWindow` is available for endpoints requiring signature.<br/>\nIt defaults to `5000` (milliseconds) and can be any value lower than `60000`(milliseconds).\nAnything beyond the limit will result in an error response from ApolloX server.\n\n```python\nfrom apollox.rest_api import Client\n\nclient = Client(key, secret)\nresponse = client.query_order('BTCUSDT', orderId=11, recvWindow=10000)\n```\n\n### Timeout\n\n`timeout` is available to be assigned with the number of seconds you find most appropriate to wait for a server response.<br/>\nPlease remember the value as it won't be shown in error message _no bytes have been received on the underlying socket for timeout seconds_.<br/>\nBy default, `timeout` is None. Hence, requests do not time out.\n\n```python\nfrom apollox.rest_api import Client\n\nclient= Client(timeout=1)\n```\n\n### Proxy\nproxy is supported\n\n```python\nfrom bapollo.rest_api import Client\n\nproxies = { 'https': 'http://1.2.3.4:8080' }\n\nclient= Client(proxies=proxies)\n```\n\n### Response Metadata\n\nThe ApolloX API server provides weight usages in the headers of each response.\nYou can display them by initializing the client with `show_limit_usage=True`:\n\n```python\nfrom apollox.rest_api import Client\n\nclient = Client(show_limit_usage=True)\nprint(client.time())\n```\n\nYou can also display full response metadata to help in debugging:\n\n```python\nclient = Client(show_header=True)\nprint(client.time())\n```\n\nIf `ClientError` is received, it'll display full response meta information.\n\n### Display logs\n\nSetting the log level to `DEBUG` will log the request URL, payload and response text.\n\n### Error\n\nThere are 2 types of error returned from the library:\n- `apollox.error.ClientError`\n    - This is thrown when server returns `4XX`, it's an issue from client side.\n    - It has 4 properties:\n        - `status_code` - HTTP status code\n        - `error_code` - Server's error code, e.g. `-1102`\n        - `error_message` - Server's error message, e.g. `Unknown order sent.`\n        - `header` - Full response header. \n- `apollox.error.ServerError`\n    - This is thrown when server returns `5XX`, it's an issue from server side.\n\n## Websocket\n\n```python\nfrom apollox.websocket.client.stream import WebsocketClient as Client\n\ndef message_handler(message):\n    print(message)\n\nws_client = Client()\nws_client.start()\n\nws_client.mini_ticker(\n    symbol='bnbusdt',\n    id=1,\n    callback=message_handler,\n)\n\n# Combine selected streams\nws_client.instant_subscribe(\n    stream=['bnbusdt@bookTicker', 'ethusdt@bookTicker'],\n    callback=message_handler,\n)\n\nws_client.stop()\n```\nMore websocket examples are available in the `examples` folder\n\n### Heartbeat\n\nOnce connected, the websocket server sends a ping frame every 3 minutes and requires a response pong frame back within\na 10 minutes period. This package handles the pong responses automatically.\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "This is a lightweight library that works as a connector to Apollox Finance public API.",
    "version": "1.2.0",
    "project_urls": {
        "Homepage": "https://github.com/amumuku/apollox-connector-python"
    },
    "split_keywords": [
        "apollox",
        " public api"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d0ae05cc44ab399a4ccbe44148ae9183275995a76f24f68e9dab275332b0053c",
                "md5": "02f691154cac3bef1eba237e28859e50",
                "sha256": "6ab141947fff808ba3604c5045ccb4276a6cf0b229f2e2ee69313532a4754270"
            },
            "downloads": -1,
            "filename": "apollox_connector_python1.2-1.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "02f691154cac3bef1eba237e28859e50",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 18215,
            "upload_time": "2024-04-11T03:16:26",
            "upload_time_iso_8601": "2024-04-11T03:16:26.792568Z",
            "url": "https://files.pythonhosted.org/packages/d0/ae/05cc44ab399a4ccbe44148ae9183275995a76f24f68e9dab275332b0053c/apollox_connector_python1.2-1.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "718ff3f4308881f3a3af075bfeff80e397db9a6326f0f88c61e4f692d16b628e",
                "md5": "87e5474383017225fb944fdf27bbb7c9",
                "sha256": "51f8954c5e36e76a54a37982126124fecaab19977d5dd9cafe5293728fc613c1"
            },
            "downloads": -1,
            "filename": "apollox-connector-python1.2-1.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "87e5474383017225fb944fdf27bbb7c9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 15931,
            "upload_time": "2024-04-11T03:16:28",
            "upload_time_iso_8601": "2024-04-11T03:16:28.823516Z",
            "url": "https://files.pythonhosted.org/packages/71/8f/f3f4308881f3a3af075bfeff80e397db9a6326f0f88c61e4f692d16b628e/apollox-connector-python1.2-1.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-11 03:16:28",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "amumuku",
    "github_project": "apollox-connector-python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "tox": true,
    "lcname": "apollox-connector-python1.2"
}
        
Elapsed time: 0.21692s