Skip to content

Commit

Permalink
Binance margin, USDS-M futures, COIN-M futures (#44)
Browse files Browse the repository at this point in the history
* USDS-M futures

* Binance margin endpoints
  • Loading branch information
nardew authored Apr 24, 2021
1 parent 387ba9e commit a0008d6
Show file tree
Hide file tree
Showing 33 changed files with 3,254 additions and 214 deletions.
20 changes: 19 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,23 @@ The project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html

## [Pending release]

## [4.0.0] - 2021-04-24

### Added

- `binance` margin and USDS-M futures endpoints
- following existing classes, methods and types were renamed:

```
binance.enums.CandelstickInterval -> binance.enums.Interval
binance.BinanceWebsocket.BestOrderBookTickerSubscription -> binance.BinanceWebsocket.OrderBookTickerSubscription
binance.BinanceWebsocket.BestOrderBookSymbolTickerSubscription -> binance.BinanceWebsocket.OrderBookSymbolTickerSubscription
binance.BinanceClient.get_candelsticks -> binance.BinanceClient.get_candlesticks
binance.BinanceClient.get_best_orderbook_ticker -> binance.BinanceClient.get_orderbook_ticker
bitforex.enums.CandelstickInterval -> bitforex.enums.CandlestickInterval
bitvavo.enums.CandelstickInterval -> bitvavo.enums.CandlestickInterval
```

## [3.10.0] - 2021-04-21

### Added
Expand Down Expand Up @@ -113,7 +130,8 @@ The project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html

The official release of `cryptoxlib-aio`.

[Pending release]: https://github.com/nardew/cryptoxlib-aio/compare/3.10.0...HEAD
[Pending release]: https://github.com/nardew/cryptoxlib-aio/compare/4.0.0...HEAD
[3.10.0]: https://github.com/nardew/cryptoxlib-aio/compare/3.10.0...4.0.0
[3.10.0]: https://github.com/nardew/cryptoxlib-aio/compare/3.9.0...3.10.0
[3.9.0]: https://github.com/nardew/cryptoxlib-aio/compare/3.8.1...3.9.0
[3.8.1]: https://github.com/nardew/cryptoxlib-aio/compare/3.8.0...3.8.1
Expand Down
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# cryptoxlib-aio 3.10.0
# cryptoxlib-aio 4.0.0

![](https://img.shields.io/badge/python-3.6-blue.svg) ![](https://img.shields.io/badge/python-3.7-blue.svg) ![](https://img.shields.io/badge/python-3.8-blue.svg)

Expand All @@ -8,13 +8,14 @@

---

**[! ! !]** Binance USDS-M futures and margin endpoints (thank you @davidmcnabnz) now available under `binance_futures` branch (see PR [#44](https://github.com/nardew/cryptoxlib-aio/pull/44) for code changes).
**==>** Binance USDS-M futures and margin endpoints (thank you @davidmcnabnz) now available!

---

### What's new in version 3.10.0
### What's been recently added

- `bitpanda` supports update of orders via streams (see `BitpandaWebsocket.py:UpdateOrderMessage`)
- `binance` margin and USDS-M futures endpoints!
- `bitpanda` supports update of orders via streams

For the full history of changes see [CHANGELOG](https://github.com/nardew/cryptoxlib-aio/blob/master/CHANGELOG.md).

Expand Down Expand Up @@ -50,7 +51,7 @@ As mentioned earlier, all exchanges listed below include full support for websoc
| ![aax](https://raw.githubusercontent.com/nardew/cryptoxlib-aio/master/images/aax.png) | AAX | [API](https://www.aax.com/apidoc/index.html#introduction) |
| ![bibox](https://user-images.githubusercontent.com/51840849/77257418-3262b000-6c85-11ea-8fb8-20bdf20b3592.jpg) | Bibox | [API](https://biboxcom.github.io/en/restful_intro.html#t0) |
| ![bibox_europe](https://raw.githubusercontent.com/nardew/cryptoxlib-aio/master/images/bibox_europe.png) | BiboxEurope | [API](https://github.com/BiboxEurope/API_Docs_en) |
| ![binance](https://user-images.githubusercontent.com/1294454/29604020-d5483cdc-87ee-11e7-94c7-d1a8d9169293.jpg) | Binance |[API](https://binance-docs.github.io/apidocs/spot/en/#change-log) |
| ![binance](https://user-images.githubusercontent.com/1294454/29604020-d5483cdc-87ee-11e7-94c7-d1a8d9169293.jpg) | Binance (spot, margin, USDS-M futures) |[API](https://binance-docs.github.io/apidocs/spot/en/#change-log) |
| ![bitforex](https://user-images.githubusercontent.com/1294454/44310033-69e9e600-a3d8-11e8-873d-54d74d1bc4e4.jpg) | Bitforex | [API](https://github.com/githubdev2020/API_Doc_en/wiki) |
| ![bitpanda](https://raw.githubusercontent.com/nardew/cryptoxlib-aio/master/images/bitpanda.png) | Bitpanda Pro | [API](https://developers.bitpanda.com/exchange/) |
| ![bitvavo](https://raw.githubusercontent.com/nardew/cryptoxlib-aio/master/images/bitvavo.png) | Bitvavo | [API](https://docs.bitvavo.com/#section/Introduction) |
Expand Down Expand Up @@ -122,7 +123,7 @@ bitforex.compose_subscriptions([

# Another bundle of subscriptions
bitforex.compose_subscriptions([
TickerSubscription(pair = Pair('BTC', 'USDT'), size = "2", interval = enums.CandelstickInterval.I_1MIN, callbacks = [ticker_update]),
TickerSubscription(pair = Pair('BTC', 'USDT'), size = "2", interval = enums.Interval.I_1MIN, callbacks = [ticker_update]),
Ticker24hSubscription(pair = Pair('BTC', 'USDT'), callbacks = [ticker24_update])
])

Expand Down
9 changes: 9 additions & 0 deletions cryptoxlib/CryptoXLib.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from cryptoxlib.clients.bibox_europe.BiboxEuropeClient import BiboxEuropeClient
from cryptoxlib.clients.bitpanda.BitpandaClient import BitpandaClient
from cryptoxlib.clients.binance.BinanceClient import BinanceClient, BinanceTestnetClient
from cryptoxlib.clients.binance.BinanceFuturesClient import BinanceUSDSMFuturesClient, BinanceUSDSMFuturesTestnetClient
from cryptoxlib.clients.binance import enums as binance_enums
from cryptoxlib.clients.bitvavo.BitvavoClient import BitvavoClient
from cryptoxlib.clients.btse.BtseClient import BtseClient
Expand Down Expand Up @@ -42,6 +43,14 @@ def create_binance_client(api_key: str, sec_key: str,
def create_binance_testnet_client(api_key: str, sec_key: str) -> BinanceTestnetClient:
return BinanceTestnetClient(api_key, sec_key)

@staticmethod
def create_binance_usds_m_futures_client(api_key: str, sec_key: str) -> BinanceUSDSMFuturesClient:
return BinanceUSDSMFuturesClient(api_key, sec_key)

@staticmethod
def create_binance_usds_m_futures_testnet_client(api_key: str, sec_key: str) -> BinanceUSDSMFuturesTestnetClient:
return BinanceUSDSMFuturesTestnetClient(api_key, sec_key)

@staticmethod
def create_bitvavo_client(api_key: str, sec_key: str) -> BitvavoClient:
return BitvavoClient(api_key, sec_key)
Expand Down
2 changes: 1 addition & 1 deletion cryptoxlib/CryptoXLibClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ async def _create_rest_call(self, rest_call_type: RestCallType, resource: str, d
else:
raise Exception(f"Unsupported REST call type {rest_call_type}.")

LOG.debug(f"> rest type [{rest_call_type.name}], resource [{resource}], params [{params}], headers [{headers}], data [{data}]")
LOG.debug(f"> rest type [{rest_call_type.name}], uri [{resource_uri}], params [{params}], headers [{headers}], data [{data}]")
async with rest_call as response:
status_code = response.status
headers = response.headers
Expand Down
4 changes: 2 additions & 2 deletions cryptoxlib/WebsocketMgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,8 @@ async def run(self) -> None:
for task in done:
try:
task.result()
except Exception:
LOG.debug("Websocket processing has led to an exception, all pending tasks will be cancelled.")
except Exception as e:
LOG.debug(f"Websocket processing has led to an exception, all pending tasks will be cancelled.")
for task in pending:
if not task.cancelled():
task.cancel()
Expand Down
Loading

0 comments on commit a0008d6

Please sign in to comment.