exchanges-wrapper


Nameexchanges-wrapper JSON
Version 2.1.29 PyPI version JSON
download
home_pageNone
SummaryREST API and WebSocket asyncio wrapper with grpc powered multiplexer server
upload_time2025-02-18 19:03:28
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseNone
keywords
VCS
bugtrack_url
requirements crypto-ws-api pyotp simplejson toml aiohttp websockets expiringdict ujson betterproto grpclib
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <h1 align="center"><img align="center" src="https://raw.githubusercontent.com/gist/DogsTailFarmer/167eaf65cebfe95d954082c7f181a2cc/raw/a67270de8663ad3de4733330ff64c9ba3153f87d/Logo%202v3.svg" width="75">Crypto exchanges API/WSS wrapper with grpc powered server</h1>

<h2 align="center">Binance, Bitfinex, Huobi, OKX, Bybit,</h2>

<h3 align="center">For SPOT markets</h3>

***
<a href="https://pypi.org/project/exchanges-wrapper/"><img src="https://img.shields.io/pypi/v/exchanges-wrapper" alt="PyPI version"></a>
<a href="https://codeclimate.com/github/DogsTailFarmer/exchanges-wrapper/maintainability"><img src="https://api.codeclimate.com/v1/badges/f333ab9b1f3024699e09/maintainability" /></a>
<a href="https://deepsource.io/gh/DogsTailFarmer/exchanges-wrapper/?ref=repository-badge}" target="_blank"><img alt="DeepSource" title="DeepSource" src="https://deepsource.io/gh/DogsTailFarmer/exchanges-wrapper.svg/?label=resolved+issues&token=XuG5PmzMiKlDL921-qREIuX_"/></a>
<a href="https://deepsource.io/gh/DogsTailFarmer/exchanges-wrapper/?ref=repository-badge}" target="_blank"><img alt="DeepSource" title="DeepSource" src="https://deepsource.io/gh/DogsTailFarmer/exchanges-wrapper.svg/?label=active+issues&token=XuG5PmzMiKlDL921-qREIuX_"/></a>
<a href="https://sonarcloud.io/summary/new_code?id=DogsTailFarmer_exchanges-wrapper" target="_blank"><img alt="sonarcloud" title="sonarcloud" src="https://sonarcloud.io/api/project_badges/measure?project=DogsTailFarmer_exchanges-wrapper&metric=alert_status"/></a>
<a href="https://pepy.tech/project/exchanges-wrapper" target="_blank"><img alt="Downloads" title="Downloads" src="https://static.pepy.tech/badge/exchanges-wrapper/month"/></a>
***
From `2.1.21` must be updated `exch_srv_cfg.toml` from `exchanges_wrapper/exch_srv_cfg.toml.template`
***

## exchanges-wrapper vs [binance.py](https://github.com/Th0rgal/binance.py)
The main difference is the development of the project for trading with many exchanges.

Next is adding a new module ```exchanges_wrapper/exch_srv.py``` as a multiplexer layer, providing simultaneous async interaction for many accounts
and many trading pairs through one connection. It's powered by [gRPC](https://grpc.io/about/)
Remote Procedure Call framework.

Warning. Coverage of overridden binance.py packages is significant but not complete.
Served methods describes into ```example/exch_client.py```

### Initial capabilities (inherited from binance.py)
- Covers general endpoints (test connectivity and get exchange information's)
- Covers market data endpoints
- Covers Account endpoints (create and manage orders)
- Covers user data stream (receive real time user updates)
- Covers web socket streams (receive real time market updates)
- Async support
- Auto reconnect after exchanges API or network failure
- Completely free and without limitations

### Added Features
- Multi exchanges support
- Adaptive algorithm to ensure maximum performance and avoid exceeding the rates limits
- Passthrough logging
- WSS keepalive
- Reuse session for new client connections
- [Utilizing Websocket API (bidirectional) for the most commonly used methods:](https://github.com/DogsTailFarmer/crypto-ws-api)

## Extra exchanges implementation features
- Binance REST API and WSS are accepted as basic, connection of other exchanges wrapped their API to Binance compatible
- For other, some data cannot be obtained by directly calling one method, it is generated by a synthetic or calculation
method
- Some exchanges have not any testing or "paper trading" features, therefore, application development and testing is possible only
at real bidding. First, run applications on the [Binance Spot Test Network](https://testnet.binance.vision/) or (Bitfinex, OKX, Bybit) test account.

## Get started
### Prepare exchange account
* Create account on [Binance](https://accounts.binance.com/en/register?ref=FXQ6HY5O) and get 10% discount on all trading fee
* Create account on [Bitfinex](https://www.bitfinex.com/sign-up?refcode=v_4az2nCP) and get 6% rebate fee
* Create account on [HUOBI](https://www.huobi.com/en-us/topic/double-reward/?invite_code=9uaw3223) and get 10% cashback on all trading fee
* Create account on [OKX](https://www.okx.com/join/2607649) and get Mystery Boxes worth up to $10,000
* Create account on [Bybit](https://www.bybit.com/invite?ref=9KEW1K) and get exclusive referral rewards
 
* For test purpose log in at [Binance Spot Test Network](https://testnet.binance.vision/)
* Create API Key
* After install and create environment specify api_key and api_secret in ```/home/ubuntu/.MartinBinance/config/exch_srv_cfg.toml```

### Install use PIP
To install just run the following command:
```console
pip install exchanges-wrapper
```
After first install create environment by run ```exchanges-wrapper-init``` in terminal window.

The structure of the working directory will be created and the necessary files will be copied:
For Ubuntu it will be here: ```home/user/.MartinBinance/```

For upgrade to latest versions use:
```console
pip install -U exchanges-wrapper
```

#### Start server
* Run in terminal window
  ```
  exchanges-wrapper-init
  ``` 
and
  
  ```
  exchanges-wrapper-srv
  ``` 
  
* Use an example to study
  + Copy [example/ms_cfg.toml](https://github.com/DogsTailFarmer/exchanges-wrapper/blob/master/example/ms_cfg.toml)
  to ```/home/ubuntu/.MartinBinance/config/``` and select (uncomment) desired exchange. Don't change exchange name.
  + Run [example/exch_client.py](https://github.com/DogsTailFarmer/exchanges-wrapper/blob/master/example/exch_client.py)
  in other terminal window

### Use Docker image
```console
docker pull ghcr.io/dogstailfarmer/exchanges-wrapper:latest
```
#### First run
The structure of the working directory will be created and the necessary files will be copied:
For Ubuntu it will be here: ```home/user/.MartinBinance/```
```console
docker run --rm --entrypoint /bin/sh exchanges-wrapper -c "cat ./exchanges_wrapper/__init__.py" > init.py && \
docker run --rm --entrypoint /bin/sh exchanges-wrapper -c "cat ./exchanges_wrapper/exch_srv_cfg.toml.template" > exch_srv_cfg.toml.template &&\
 python3 init.py && rm init.py && rm exch_srv_cfg.toml.template
```
#### Start server
```console
docker run -itP \
 --mount type=bind,source=/home/ubuntu/.MartinBinance,target=/home/appuser/.MartinBinance \
 --network=host \
 --restart=always \
 --name=exchanges-wrapper \
 exchanges-wrapper
```

### Documentations
* Served methods and examples of their use are described at ```example/exch_client.py```
* For [Protocol Buffers](https://developers.google.com/protocol-buffers/docs/overview) serializing structured data see ```exchanges_wrapper/proto/martin.proto```

## Donate
*USDT* (TRC20) TN8F3Dz8BU8VwECRh3LTKi7FrsU8eWfsZz

## Powered by exchanges-wrapper
<a><img align="middle" src="https://github.com/DogsTailFarmer/martin-binance/raw/public/doc/Modified%20martingale.svg" width="50"></a>
[martin-binance](https://github.com/DogsTailFarmer/martin-binance)

Free trading system for crypto exchanges SPOT markets. Adaptive customizable reverse grid strategy based on martingale.


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "exchanges-wrapper",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": "Thomas Marchand <thomas.marchand@tuta.io>, Jerry Fedorenko <jerry.fedorenko@yahoo.com>",
    "download_url": "https://files.pythonhosted.org/packages/28/62/12bc4dac77484b235da017fe64b86e3a566fb90a0b4c0a5e135855085af5/exchanges_wrapper-2.1.29.tar.gz",
    "platform": null,
    "description": "<h1 align=\"center\"><img align=\"center\" src=\"https://raw.githubusercontent.com/gist/DogsTailFarmer/167eaf65cebfe95d954082c7f181a2cc/raw/a67270de8663ad3de4733330ff64c9ba3153f87d/Logo%202v3.svg\" width=\"75\">Crypto exchanges API/WSS wrapper with grpc powered server</h1>\n\n<h2 align=\"center\">Binance, Bitfinex, Huobi, OKX, Bybit,</h2>\n\n<h3 align=\"center\">For SPOT markets</h3>\n\n***\n<a href=\"https://pypi.org/project/exchanges-wrapper/\"><img src=\"https://img.shields.io/pypi/v/exchanges-wrapper\" alt=\"PyPI version\"></a>\n<a href=\"https://codeclimate.com/github/DogsTailFarmer/exchanges-wrapper/maintainability\"><img src=\"https://api.codeclimate.com/v1/badges/f333ab9b1f3024699e09/maintainability\" /></a>\n<a href=\"https://deepsource.io/gh/DogsTailFarmer/exchanges-wrapper/?ref=repository-badge}\" target=\"_blank\"><img alt=\"DeepSource\" title=\"DeepSource\" src=\"https://deepsource.io/gh/DogsTailFarmer/exchanges-wrapper.svg/?label=resolved+issues&token=XuG5PmzMiKlDL921-qREIuX_\"/></a>\n<a href=\"https://deepsource.io/gh/DogsTailFarmer/exchanges-wrapper/?ref=repository-badge}\" target=\"_blank\"><img alt=\"DeepSource\" title=\"DeepSource\" src=\"https://deepsource.io/gh/DogsTailFarmer/exchanges-wrapper.svg/?label=active+issues&token=XuG5PmzMiKlDL921-qREIuX_\"/></a>\n<a href=\"https://sonarcloud.io/summary/new_code?id=DogsTailFarmer_exchanges-wrapper\" target=\"_blank\"><img alt=\"sonarcloud\" title=\"sonarcloud\" src=\"https://sonarcloud.io/api/project_badges/measure?project=DogsTailFarmer_exchanges-wrapper&metric=alert_status\"/></a>\n<a href=\"https://pepy.tech/project/exchanges-wrapper\" target=\"_blank\"><img alt=\"Downloads\" title=\"Downloads\" src=\"https://static.pepy.tech/badge/exchanges-wrapper/month\"/></a>\n***\nFrom `2.1.21` must be updated `exch_srv_cfg.toml` from `exchanges_wrapper/exch_srv_cfg.toml.template`\n***\n\n## exchanges-wrapper vs [binance.py](https://github.com/Th0rgal/binance.py)\nThe main difference is the development of the project for trading with many exchanges.\n\nNext is adding a new module ```exchanges_wrapper/exch_srv.py``` as a multiplexer layer, providing simultaneous async interaction for many accounts\nand many trading pairs through one connection. It's powered by [gRPC](https://grpc.io/about/)\nRemote Procedure Call framework.\n\nWarning. Coverage of overridden binance.py packages is significant but not complete.\nServed methods describes into ```example/exch_client.py```\n\n### Initial capabilities (inherited from binance.py)\n- Covers general endpoints (test connectivity and get exchange information's)\n- Covers market data endpoints\n- Covers Account endpoints (create and manage orders)\n- Covers user data stream (receive real time user updates)\n- Covers web socket streams (receive real time market updates)\n- Async support\n- Auto reconnect after exchanges API or network failure\n- Completely free and without limitations\n\n### Added Features\n- Multi exchanges support\n- Adaptive algorithm to ensure maximum performance and avoid exceeding the rates limits\n- Passthrough logging\n- WSS keepalive\n- Reuse session for new client connections\n- [Utilizing Websocket API (bidirectional) for the most commonly used methods:](https://github.com/DogsTailFarmer/crypto-ws-api)\n\n## Extra exchanges implementation features\n- Binance REST API and WSS are accepted as basic, connection of other exchanges wrapped their API to Binance compatible\n- For other, some data cannot be obtained by directly calling one method, it is generated by a synthetic or calculation\nmethod\n- Some exchanges have not any testing or \"paper trading\" features, therefore, application development and testing is possible only\nat real bidding. First, run applications on the [Binance Spot Test Network](https://testnet.binance.vision/) or (Bitfinex, OKX, Bybit) test account.\n\n## Get started\n### Prepare exchange account\n* Create account on [Binance](https://accounts.binance.com/en/register?ref=FXQ6HY5O) and get 10% discount on all trading fee\n* Create account on [Bitfinex](https://www.bitfinex.com/sign-up?refcode=v_4az2nCP) and get 6% rebate fee\n* Create account on [HUOBI](https://www.huobi.com/en-us/topic/double-reward/?invite_code=9uaw3223) and get 10% cashback on all trading fee\n* Create account on [OKX](https://www.okx.com/join/2607649) and get Mystery Boxes worth up to $10,000\n* Create account on [Bybit](https://www.bybit.com/invite?ref=9KEW1K) and get exclusive referral rewards\n \n* For test purpose log in at [Binance Spot Test Network](https://testnet.binance.vision/)\n* Create API Key\n* After install and create environment specify api_key and api_secret in ```/home/ubuntu/.MartinBinance/config/exch_srv_cfg.toml```\n\n### Install use PIP\nTo install just run the following command:\n```console\npip install exchanges-wrapper\n```\nAfter first install create environment by run ```exchanges-wrapper-init``` in terminal window.\n\nThe structure of the working directory will be created and the necessary files will be copied:\nFor Ubuntu it will be here: ```home/user/.MartinBinance/```\n\nFor upgrade to latest versions use:\n```console\npip install -U exchanges-wrapper\n```\n\n#### Start server\n* Run in terminal window\n  ```\n  exchanges-wrapper-init\n  ``` \nand\n  \n  ```\n  exchanges-wrapper-srv\n  ``` \n  \n* Use an example to study\n  + Copy [example/ms_cfg.toml](https://github.com/DogsTailFarmer/exchanges-wrapper/blob/master/example/ms_cfg.toml)\n  to ```/home/ubuntu/.MartinBinance/config/``` and select (uncomment) desired exchange. Don't change exchange name.\n  + Run [example/exch_client.py](https://github.com/DogsTailFarmer/exchanges-wrapper/blob/master/example/exch_client.py)\n  in other terminal window\n\n### Use Docker image\n```console\ndocker pull ghcr.io/dogstailfarmer/exchanges-wrapper:latest\n```\n#### First run\nThe structure of the working directory will be created and the necessary files will be copied:\nFor Ubuntu it will be here: ```home/user/.MartinBinance/```\n```console\ndocker run --rm --entrypoint /bin/sh exchanges-wrapper -c \"cat ./exchanges_wrapper/__init__.py\" > init.py && \\\ndocker run --rm --entrypoint /bin/sh exchanges-wrapper -c \"cat ./exchanges_wrapper/exch_srv_cfg.toml.template\" > exch_srv_cfg.toml.template &&\\\n python3 init.py && rm init.py && rm exch_srv_cfg.toml.template\n```\n#### Start server\n```console\ndocker run -itP \\\n --mount type=bind,source=/home/ubuntu/.MartinBinance,target=/home/appuser/.MartinBinance \\\n --network=host \\\n --restart=always \\\n --name=exchanges-wrapper \\\n exchanges-wrapper\n```\n\n### Documentations\n* Served methods and examples of their use are described at ```example/exch_client.py```\n* For [Protocol Buffers](https://developers.google.com/protocol-buffers/docs/overview) serializing structured data see ```exchanges_wrapper/proto/martin.proto```\n\n## Donate\n*USDT* (TRC20) TN8F3Dz8BU8VwECRh3LTKi7FrsU8eWfsZz\n\n## Powered by exchanges-wrapper\n<a><img align=\"middle\" src=\"https://github.com/DogsTailFarmer/martin-binance/raw/public/doc/Modified%20martingale.svg\" width=\"50\"></a>\n[martin-binance](https://github.com/DogsTailFarmer/martin-binance)\n\nFree trading system for crypto exchanges SPOT markets. Adaptive customizable reverse grid strategy based on martingale.\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "REST API and WebSocket asyncio wrapper with grpc powered multiplexer server",
    "version": "2.1.29",
    "project_urls": {
        "Source": "https://github.com/DogsTailFarmer/exchanges-wrapper"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "0885842e5d67e61e753a2c0e7225515661a4998d3f31b66914455688542c2970",
                "md5": "e2db438c1b3b4e540177e2b7b71b89f2",
                "sha256": "a389262f58c1c9452f06892792fcce93d7c0fbe5be46f0cc6159e8a6e7f58d18"
            },
            "downloads": -1,
            "filename": "exchanges_wrapper-2.1.29-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e2db438c1b3b4e540177e2b7b71b89f2",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 66823,
            "upload_time": "2025-02-18T19:03:26",
            "upload_time_iso_8601": "2025-02-18T19:03:26.713753Z",
            "url": "https://files.pythonhosted.org/packages/08/85/842e5d67e61e753a2c0e7225515661a4998d3f31b66914455688542c2970/exchanges_wrapper-2.1.29-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "286212bc4dac77484b235da017fe64b86e3a566fb90a0b4c0a5e135855085af5",
                "md5": "067f790883ff14ea0e1cf8f361e4d7b6",
                "sha256": "510fab69604238ca7850c08ff082087b2056f488c16ed205e7d3a3ca9f886322"
            },
            "downloads": -1,
            "filename": "exchanges_wrapper-2.1.29.tar.gz",
            "has_sig": false,
            "md5_digest": "067f790883ff14ea0e1cf8f361e4d7b6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 58932,
            "upload_time": "2025-02-18T19:03:28",
            "upload_time_iso_8601": "2025-02-18T19:03:28.731355Z",
            "url": "https://files.pythonhosted.org/packages/28/62/12bc4dac77484b235da017fe64b86e3a566fb90a0b4c0a5e135855085af5/exchanges_wrapper-2.1.29.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-18 19:03:28",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "DogsTailFarmer",
    "github_project": "exchanges-wrapper",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "crypto-ws-api",
            "specs": [
                [
                    "==",
                    "2.0.16"
                ]
            ]
        },
        {
            "name": "pyotp",
            "specs": [
                [
                    "==",
                    "2.9.0"
                ]
            ]
        },
        {
            "name": "simplejson",
            "specs": [
                [
                    "==",
                    "3.19.3"
                ]
            ]
        },
        {
            "name": "toml",
            "specs": [
                [
                    "~=",
                    "0.10.2"
                ]
            ]
        },
        {
            "name": "aiohttp",
            "specs": [
                [
                    "~=",
                    "3.11.11"
                ]
            ]
        },
        {
            "name": "websockets",
            "specs": [
                [
                    "==",
                    "14.2"
                ]
            ]
        },
        {
            "name": "expiringdict",
            "specs": [
                [
                    "~=",
                    "1.2.2"
                ]
            ]
        },
        {
            "name": "ujson",
            "specs": [
                [
                    "~=",
                    "5.10.0"
                ]
            ]
        },
        {
            "name": "betterproto",
            "specs": [
                [
                    "==",
                    "2.0.0b7"
                ]
            ]
        },
        {
            "name": "grpclib",
            "specs": [
                [
                    "~=",
                    "0.4.7"
                ]
            ]
        }
    ],
    "lcname": "exchanges-wrapper"
}
        
Elapsed time: 0.68445s