exchanges-wrapper 1.4.6__tar.gz → 1.4.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {exchanges_wrapper-1.4.6 → exchanges_wrapper-1.4.8}/PKG-INFO +3 -5
- {exchanges_wrapper-1.4.6 → exchanges_wrapper-1.4.8}/README.md +1 -3
- {exchanges_wrapper-1.4.6 → exchanges_wrapper-1.4.8}/exchanges_wrapper/__init__.py +1 -1
- {exchanges_wrapper-1.4.6 → exchanges_wrapper-1.4.8}/exchanges_wrapper/api_pb2.py +2 -2
- {exchanges_wrapper-1.4.6 → exchanges_wrapper-1.4.8}/exchanges_wrapper/api_pb2_grpc.py +33 -0
- {exchanges_wrapper-1.4.6 → exchanges_wrapper-1.4.8}/exchanges_wrapper/bitfinex_parser.py +31 -44
- {exchanges_wrapper-1.4.6 → exchanges_wrapper-1.4.8}/exchanges_wrapper/bybit_parser.py +2 -2
- {exchanges_wrapper-1.4.6 → exchanges_wrapper-1.4.8}/exchanges_wrapper/c_structures.py +14 -16
- {exchanges_wrapper-1.4.6 → exchanges_wrapper-1.4.8}/exchanges_wrapper/client.py +60 -33
- {exchanges_wrapper-1.4.6 → exchanges_wrapper-1.4.8}/exchanges_wrapper/exch_srv.py +31 -20
- {exchanges_wrapper-1.4.6 → exchanges_wrapper-1.4.8}/exchanges_wrapper/exch_srv_cfg.toml.template +9 -1
- {exchanges_wrapper-1.4.6 → exchanges_wrapper-1.4.8}/exchanges_wrapper/huobi_parser.py +1 -1
- {exchanges_wrapper-1.4.6 → exchanges_wrapper-1.4.8}/exchanges_wrapper/okx_parser.py +4 -1
- {exchanges_wrapper-1.4.6 → exchanges_wrapper-1.4.8}/exchanges_wrapper/proto/exchanges_wrapper/api.proto +1 -0
- {exchanges_wrapper-1.4.6 → exchanges_wrapper-1.4.8}/exchanges_wrapper/web_sockets.py +46 -24
- {exchanges_wrapper-1.4.6 → exchanges_wrapper-1.4.8}/pyproject.toml +1 -1
- {exchanges_wrapper-1.4.6 → exchanges_wrapper-1.4.8}/LICENSE.md +0 -0
- {exchanges_wrapper-1.4.6 → exchanges_wrapper-1.4.8}/exchanges_wrapper/definitions.py +0 -0
- {exchanges_wrapper-1.4.6 → exchanges_wrapper-1.4.8}/exchanges_wrapper/errors.py +0 -0
- {exchanges_wrapper-1.4.6 → exchanges_wrapper-1.4.8}/exchanges_wrapper/events.py +0 -0
- {exchanges_wrapper-1.4.6 → exchanges_wrapper-1.4.8}/exchanges_wrapper/http_client.py +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: exchanges-wrapper
|
|
3
|
-
Version: 1.4.
|
|
3
|
+
Version: 1.4.8
|
|
4
4
|
Summary: REST API and WebSocket asyncio wrapper with grpc powered multiplexer server
|
|
5
5
|
Author-email: Thomas Marchand <thomas.marchand@tuta.io>, Jerry Fedorenko <jerry.fedorenko@yahoo.com>
|
|
6
|
-
Requires-Python: >=3.
|
|
6
|
+
Requires-Python: >=3.9
|
|
7
7
|
Description-Content-Type: text/markdown
|
|
8
8
|
Classifier: Programming Language :: Python :: 3
|
|
9
9
|
Classifier: Development Status :: 5 - Production/Stable
|
|
@@ -145,9 +145,7 @@ docker run -itP \
|
|
|
145
145
|
* For [Protocol Buffers](https://developers.google.com/protocol-buffers/docs/overview) serializing structured data see ```proto/exchanges_wrapper/api.proto```
|
|
146
146
|
|
|
147
147
|
## Donate
|
|
148
|
-
*
|
|
149
|
-
|
|
150
|
-
*USDT* (TRC20) TP1Y43dpY7rrRyTSLaSKDZmFirqvRcpopC
|
|
148
|
+
*USDT* (TRC20) TN8F3Dz8BU8VwECRh3LTKi7FrsU8eWfsZz
|
|
151
149
|
|
|
152
150
|
## Powered by exchanges-wrapper
|
|
153
151
|
<a><img align="middle" src="https://github.com/DogsTailFarmer/martin-binance/raw/public/doc/Modified%20martingale.svg" width="50"></a>
|
|
@@ -119,9 +119,7 @@ docker run -itP \
|
|
|
119
119
|
* For [Protocol Buffers](https://developers.google.com/protocol-buffers/docs/overview) serializing structured data see ```proto/exchanges_wrapper/api.proto```
|
|
120
120
|
|
|
121
121
|
## Donate
|
|
122
|
-
*
|
|
123
|
-
|
|
124
|
-
*USDT* (TRC20) TP1Y43dpY7rrRyTSLaSKDZmFirqvRcpopC
|
|
122
|
+
*USDT* (TRC20) TN8F3Dz8BU8VwECRh3LTKi7FrsU8eWfsZz
|
|
125
123
|
|
|
126
124
|
## Powered by exchanges-wrapper
|
|
127
125
|
<a><img align="middle" src="https://github.com/DogsTailFarmer/martin-binance/raw/public/doc/Modified%20martingale.svg" width="50"></a>
|
|
@@ -12,7 +12,7 @@ __maintainer__ = "Jerry Fedorenko"
|
|
|
12
12
|
__contact__ = "https://github.com/DogsTailFarmer"
|
|
13
13
|
__email__ = "jerry.fedorenko@yahoo.com"
|
|
14
14
|
__credits__ = ["https://github.com/DanyaSWorlD"]
|
|
15
|
-
__version__ = "1.4.
|
|
15
|
+
__version__ = "1.4.8"
|
|
16
16
|
|
|
17
17
|
from pathlib import Path
|
|
18
18
|
import shutil
|
|
@@ -14,7 +14,7 @@ _sym_db = _symbol_database.Default()
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1b\x65xchanges_wrapper/api.proto\x12\x06martin\"*\n\x17OnBalanceUpdateResponse\x12\x0f\n\x07\x62\x61lance\x18\x01 \x01(\t\"\x83\x01\n\x19\x46\x65tchFundingWalletRequest\x12\x11\n\tclient_id\x18\x01 \x01(\x03\x12\x10\n\x08trade_id\x18\x02 \x01(\t\x12\r\n\x05\x61sset\x18\x03 \x01(\t\x12\x1a\n\x12need_btc_valuation\x18\x04 \x01(\x08\x12\x16\n\x0ereceive_window\x18\x05 \x01(\x03\"\xd0\x01\n\x1a\x46\x65tchFundingWalletResponse\x12=\n\x08\x62\x61lances\x18\x01 \x03(\x0b\x32+.martin.FetchFundingWalletResponse.Balances\x1as\n\x08\x42\x61lances\x12\r\n\x05\x61sset\x18\x01 \x01(\t\x12\x0c\n\x04\x66ree\x18\x02 \x01(\t\x12\x0e\n\x06locked\x18\x03 \x01(\t\x12\x0e\n\x06\x66reeze\x18\x04 \x01(\t\x12\x13\n\x0bwithdrawing\x18\x05 \x01(\t\x12\x15\n\rbtc_valuation\x18\x06 \x01(\t\"\xc7\x02\n\x13\x43\x61ncelOrderResponse\x12\x0e\n\x06symbol\x18\x01 \x01(\t\x12\x19\n\x11origClientOrderId\x18\x02 \x01(\t\x12\x0f\n\x07orderId\x18\x03 \x01(\x04\x12\x13\n\x0borderListId\x18\x04 \x01(\x05\x12\x15\n\rclientOrderId\x18\x05 \x01(\t\x12\x14\n\x0ctransactTime\x18\x06 \x01(\x04\x12\r\n\x05price\x18\x07 \x01(\t\x12\x0f\n\x07origQty\x18\x08 \x01(\t\x12\x13\n\x0b\x65xecutedQty\x18\t \x01(\t\x12\x1b\n\x13\x63ummulativeQuoteQty\x18\n \x01(\t\x12\x0e\n\x06status\x18\x0b \x01(\t\x12\x13\n\x0btimeInForce\x18\x0c \x01(\t\x12\x0c\n\x04type\x18\r \x01(\t\x12\x0c\n\x04side\x18\x0e \x01(\t\x12\x1f\n\x17selfTradePreventionMode\x18\x0f \x01(\t\"[\n\x12\x43\x61ncelOrderRequest\x12\x11\n\tclient_id\x18\x01 \x01(\x03\x12\x10\n\x08trade_id\x18\x02 \x01(\t\x12\x0e\n\x06symbol\x18\x03 \x01(\t\x12\x10\n\x08order_id\x18\x04 \x01(\x03\"\xf0\x02\n\x18\x43reateLimitOrderResponse\x12\x0e\n\x06symbol\x18\x01 \x01(\t\x12\x0f\n\x07orderId\x18\x02 \x01(\x04\x12\x13\n\x0borderListId\x18\x03 \x01(\x11\x12\x15\n\rclientOrderId\x18\x04 \x01(\t\x12\x14\n\x0ctransactTime\x18\x05 \x01(\x04\x12\r\n\x05price\x18\x06 \x01(\t\x12\x0f\n\x07origQty\x18\x07 \x01(\t\x12\x13\n\x0b\x65xecutedQty\x18\x08 \x01(\t\x12\x1b\n\x13\x63ummulativeQuoteQty\x18\t \x01(\t\x12\x0e\n\x06status\x18\n \x01(\t\x12\x13\n\x0btimeInForce\x18\x0b \x01(\t\x12\x0c\n\x04type\x18\x0c \x01(\t\x12\x0c\n\x04side\x18\r \x01(\t\x12\x12\n\nstrategyId\x18\x0e \x01(\x04\x12\x14\n\x0cstrategyType\x18\x0f \x01(\x04\x12\x13\n\x0bworkingTime\x18\x10 \x01(\x12\x12\x1f\n\x17selfTradePreventionMode\x18\x11 \x01(\t\"\x9e\x01\n\x17\x43reateLimitOrderRequest\x12\x11\n\tclient_id\x18\x01 \x01(\x03\x12\x10\n\x08trade_id\x18\x02 \x01(\t\x12\x0e\n\x06symbol\x18\x03 \x01(\t\x12\x10\n\x08\x62uy_side\x18\x04 \x01(\x08\x12\x10\n\x08quantity\x18\x05 \x01(\t\x12\r\n\x05price\x18\x06 \x01(\t\x12\x1b\n\x13new_client_order_id\x18\x07 \x01(\x03\"\xf8\x05\n\x15OnOrderUpdateResponse\x12\x0e\n\x06symbol\x18\x01 \x01(\t\x12\x17\n\x0f\x63lient_order_id\x18\x02 \x01(\t\x12\x0c\n\x04side\x18\x03 \x01(\t\x12\x12\n\norder_type\x18\x04 \x01(\t\x12\x15\n\rtime_in_force\x18\x05 \x01(\t\x12\x16\n\x0eorder_quantity\x18\x06 \x01(\t\x12\x13\n\x0border_price\x18\x07 \x01(\t\x12\x12\n\nstop_price\x18\x08 \x01(\t\x12\x18\n\x10iceberg_quantity\x18\t \x01(\t\x12\x15\n\rorder_list_id\x18\n \x01(\x11\x12\x1a\n\x12original_client_id\x18\x0b \x01(\t\x12\x16\n\x0e\x65xecution_type\x18\x0c \x01(\t\x12\x14\n\x0corder_status\x18\r \x01(\t\x12\x1b\n\x13order_reject_reason\x18\x0e \x01(\t\x12\x10\n\x08order_id\x18\x0f \x01(\x04\x12\x1e\n\x16last_executed_quantity\x18\x10 \x01(\t\x12\"\n\x1a\x63umulative_filled_quantity\x18\x11 \x01(\t\x12\x1b\n\x13last_executed_price\x18\x12 \x01(\t\x12\x19\n\x11\x63ommission_amount\x18\x13 \x01(\t\x12\x18\n\x10\x63ommission_asset\x18\x14 \x01(\t\x12\x18\n\x10transaction_time\x18\x15 \x01(\x04\x12\x10\n\x08trade_id\x18\x16 \x01(\x12\x12\x10\n\x08ignore_a\x18\x17 \x01(\x04\x12\x15\n\rin_order_book\x18\x18 \x01(\x08\x12\x15\n\ris_maker_side\x18\x19 \x01(\x08\x12\x10\n\x08ignore_b\x18\x1a \x01(\x08\x12\x1b\n\x13order_creation_time\x18\x1b \x01(\x04\x12\x1e\n\x16quote_asset_transacted\x18\x1c \x01(\t\x12#\n\x1blast_quote_asset_transacted\x18\x1d \x01(\t\x12\x1c\n\x14quote_order_quantity\x18\x1e \x01(\t\"&\n\x15OnFundsUpdateResponse\x12\r\n\x05\x66unds\x18\x01 \x01(\t\"t\n\x14OnFundsUpdateRequest\x12\x11\n\tclient_id\x18\x01 \x01(\x03\x12\x10\n\x08trade_id\x18\x02 \x01(\t\x12\x0e\n\x06symbol\x18\x03 \x01(\t\x12\x12\n\nbase_asset\x18\x04 \x01(\t\x12\x13\n\x0bquote_asset\x18\x05 \x01(\t\"1\n\x0eSimpleResponse\x12\x0f\n\x07success\x18\x01 \x01(\x08\x12\x0e\n\x06result\x18\x02 \x01(\t\"e\n\x16OnTickerUpdateResponse\x12\x0e\n\x06symbol\x18\x01 \x01(\t\x12\x12\n\nopen_price\x18\x02 \x01(\t\x12\x13\n\x0b\x63lose_price\x18\x03 \x01(\t\x12\x12\n\nevent_time\x18\x04 \x01(\x04\"\xbd\x02\n\x18\x41\x63\x63ountTradeListResponse\x12\x35\n\x05items\x18\x01 \x03(\x0b\x32&.martin.AccountTradeListResponse.Trade\x1a\xe9\x01\n\x05Trade\x12\x0e\n\x06symbol\x18\x01 \x01(\t\x12\n\n\x02id\x18\x02 \x01(\x04\x12\x0f\n\x07orderId\x18\x03 \x01(\x04\x12\x13\n\x0borderListId\x18\x04 \x01(\x11\x12\r\n\x05price\x18\x05 \x01(\t\x12\x0b\n\x03qty\x18\x06 \x01(\t\x12\x10\n\x08quoteQty\x18\x07 \x01(\t\x12\x12\n\ncommission\x18\x08 \x01(\t\x12\x17\n\x0f\x63ommissionAsset\x18\t \x01(\t\x12\x0c\n\x04time\x18\n \x01(\x04\x12\x0f\n\x07isBuyer\x18\x0b \x01(\x08\x12\x0f\n\x07isMaker\x18\x0c \x01(\x08\x12\x13\n\x0bisBestMatch\x18\r \x01(\x08\"q\n\x17\x41\x63\x63ountTradeListRequest\x12\x11\n\tclient_id\x18\x01 \x01(\x03\x12\x10\n\x08trade_id\x18\x02 \x01(\t\x12\x0e\n\x06symbol\x18\x03 \x01(\t\x12\r\n\x05limit\x18\x04 \x01(\r\x12\x12\n\nstart_time\x18\x05 \x01(\x03\"%\n\x13\x46\x65tchKlinesResponse\x12\x0e\n\x06klines\x18\x01 \x03(\t\"J\n\x16OnKlinesUpdateResponse\x12\x0e\n\x06symbol\x18\x01 \x01(\t\x12\x10\n\x08interval\x18\x02 \x01(\t\x12\x0e\n\x06\x63\x61ndle\x18\x03 \x01(\t\"j\n\x12\x46\x65tchKlinesRequest\x12\x11\n\tclient_id\x18\x01 \x01(\x03\x12\x10\n\x08trade_id\x18\x02 \x01(\t\x12\x0e\n\x06symbol\x18\x03 \x01(\t\x12\x10\n\x08interval\x18\x04 \x01(\t\x12\r\n\x05limit\x18\x05 \x01(\r\"\xb7\x03\n(FetchTickerPriceChangeStatisticsResponse\x12\x0e\n\x06symbol\x18\x01 \x01(\t\x12\x13\n\x0bpriceChange\x18\x02 \x01(\t\x12\x1a\n\x12priceChangePercent\x18\x03 \x01(\t\x12\x18\n\x10weightedAvgPrice\x18\x04 \x01(\t\x12\x16\n\x0eprevClosePrice\x18\x05 \x01(\t\x12\x11\n\tlastPrice\x18\x06 \x01(\t\x12\x0f\n\x07lastQty\x18\x07 \x01(\t\x12\x10\n\x08\x62idPrice\x18\x08 \x01(\t\x12\x0e\n\x06\x62idQty\x18\t \x01(\t\x12\x10\n\x08\x61skPrice\x18\n \x01(\t\x12\x0e\n\x06\x61skQty\x18\x0b \x01(\t\x12\x11\n\topenPrice\x18\x0c \x01(\t\x12\x11\n\thighPrice\x18\r \x01(\t\x12\x10\n\x08lowPrice\x18\x0e \x01(\t\x12\x0e\n\x06volume\x18\x0f \x01(\t\x12\x13\n\x0bquoteVolume\x18\x10 \x01(\t\x12\x10\n\x08openTime\x18\x11 \x01(\x04\x12\x11\n\tcloseTime\x18\x12 \x01(\x04\x12\x0f\n\x07\x66irstId\x18\x13 \x01(\x04\x12\x0e\n\x06lastId\x18\x14 \x01(\x04\x12\r\n\x05\x63ount\x18\x15 \x01(\x04\"?\n\x1e\x46\x65tchSymbolPriceTickerResponse\x12\x0e\n\x06symbol\x18\x01 \x01(\t\x12\r\n\x05price\x18\x02 \x01(\t\"J\n\x16\x46\x65tchOrderBookResponse\x12\x14\n\x0clastUpdateId\x18\x01 \x01(\x04\x12\x0c\n\x04\x62ids\x18\x02 \x03(\t\x12\x0c\n\x04\x61sks\x18\x03 \x03(\t\"\x96\x01\n\x1b\x46\x65tchAccountBalanceResponse\x12>\n\x08\x62\x61lances\x18\x01 \x03(\x0b\x32,.martin.FetchAccountBalanceResponse.Balances\x1a\x37\n\x08\x42\x61lances\x12\r\n\x05\x61sset\x18\x01 \x01(\t\x12\x0c\n\x04\x66ree\x18\x02 \x01(\t\x12\x0e\n\x06locked\x18\x03 \x01(\t\"\xcb\x15\n\x1f\x46\x65tchExchangeInfoSymbolResponse\x12\x0e\n\x06symbol\x18\x01 \x01(\t\x12\x0e\n\x06status\x18\x02 \x01(\t\x12\x11\n\tbaseAsset\x18\x03 \x01(\t\x12\x1a\n\x12\x62\x61seAssetPrecision\x18\x04 \x01(\r\x12\x12\n\nquoteAsset\x18\x05 \x01(\t\x12\x16\n\x0equotePrecision\x18\x06 \x01(\r\x12\x1b\n\x13quoteAssetPrecision\x18\x07 \x01(\r\x12\x1f\n\x17\x62\x61seCommissionPrecision\x18\x08 \x01(\r\x12 \n\x18quoteCommissionPrecision\x18\t \x01(\r\x12\x12\n\norderTypes\x18\n \x03(\t\x12\x16\n\x0eicebergAllowed\x18\x0b \x01(\x08\x12\x12\n\nocoAllowed\x18\x0c \x01(\x08\x12\"\n\x1aquoteOrderQtyMarketAllowed\x18\r \x01(\x08\x12\x19\n\x11\x61llowTrailingStop\x18\x0e \x01(\x08\x12\x1c\n\x14\x63\x61ncelReplaceAllowed\x18\x0f \x01(\x08\x12\x1c\n\x14isSpotTradingAllowed\x18\x10 \x01(\x08\x12\x1e\n\x16isMarginTradingAllowed\x18\x11 \x01(\x08\x12@\n\x07\x66ilters\x18\x12 \x01(\x0b\x32/.martin.FetchExchangeInfoSymbolResponse.Filters\x12\x13\n\x0bpermissions\x18\x13 \x03(\t\x12&\n\x1e\x64\x65\x66\x61ultSelfTradePreventionMode\x18\x14 \x01(\t\x12\'\n\x1f\x61llowedSelfTradePreventionModes\x18\x15 \x03(\t\x1a\xc9\x10\n\x07\x46ilters\x12V\n\x0cprice_filter\x18\x01 \x01(\x0b\x32;.martin.FetchExchangeInfoSymbolResponse.Filters.PriceFilterH\x00\x88\x01\x01\x12X\n\rpercent_price\x18\x02 \x01(\x0b\x32<.martin.FetchExchangeInfoSymbolResponse.Filters.PercentPriceH\x01\x88\x01\x01\x12N\n\x08lot_size\x18\x03 \x01(\x0b\x32\x37.martin.FetchExchangeInfoSymbolResponse.Filters.LotSizeH\x02\x88\x01\x01\x12V\n\x0cmin_notional\x18\x04 \x01(\x0b\x32;.martin.FetchExchangeInfoSymbolResponse.Filters.MinNotionalH\x03\x88\x01\x01\x12X\n\riceberg_parts\x18\x05 \x01(\x0b\x32<.martin.FetchExchangeInfoSymbolResponse.Filters.IcebergPartsH\x04\x88\x01\x01\x12[\n\x0fmarket_lot_size\x18\x06 \x01(\x0b\x32=.martin.FetchExchangeInfoSymbolResponse.Filters.MarketLotSizeH\x05\x88\x01\x01\x12Y\n\x0emax_num_orders\x18\x07 \x01(\x0b\x32<.martin.FetchExchangeInfoSymbolResponse.Filters.MaxNumOrdersH\x06\x88\x01\x01\x12\x62\n\x13max_num_algo_orders\x18\x08 \x01(\x0b\x32@.martin.FetchExchangeInfoSymbolResponse.Filters.MaxNumAlgoOrdersH\x07\x88\x01\x01\x12h\n\x16max_num_iceberg_orders\x18\t \x01(\x0b\x32\x43.martin.FetchExchangeInfoSymbolResponse.Filters.MaxNumIcebergOrdersH\x08\x88\x01\x01\x12V\n\x0cmax_position\x18\n \x01(\x0b\x32;.martin.FetchExchangeInfoSymbolResponse.Filters.MaxPositionH\t\x88\x01\x01\x12O\n\x08notional\x18\x0b \x01(\x0b\x32\x38.martin.FetchExchangeInfoSymbolResponse.Filters.NotionalH\n\x88\x01\x01\x1aW\n\x0bPriceFilter\x12\x12\n\nfilterType\x18\x01 \x01(\t\x12\x10\n\x08minPrice\x18\x02 \x01(\t\x12\x10\n\x08maxPrice\x18\x03 \x01(\t\x12\x10\n\x08tickSize\x18\x04 \x01(\t\x1a\x66\n\x0cPercentPrice\x12\x12\n\nfilterType\x18\x01 \x01(\t\x12\x14\n\x0cmultiplierUp\x18\x02 \x01(\t\x12\x16\n\x0emultiplierDown\x18\x03 \x01(\t\x12\x14\n\x0c\x61vgPriceMins\x18\x04 \x01(\r\x1aO\n\x07LotSize\x12\x12\n\nfilterType\x18\x01 \x01(\t\x12\x0e\n\x06minQty\x18\x02 \x01(\t\x12\x0e\n\x06maxQty\x18\x03 \x01(\t\x12\x10\n\x08stepSize\x18\x04 \x01(\t\x1a\x63\n\x0bMinNotional\x12\x12\n\nfilterType\x18\x01 \x01(\t\x12\x13\n\x0bminNotional\x18\x02 \x01(\t\x12\x15\n\rapplyToMarket\x18\x03 \x01(\x08\x12\x14\n\x0c\x61vgPriceMins\x18\x04 \x01(\r\x1a\x31\n\x0cIcebergParts\x12\x12\n\nfilterType\x18\x01 \x01(\t\x12\r\n\x05limit\x18\x02 \x01(\r\x1aU\n\rMarketLotSize\x12\x12\n\nfilterType\x18\x01 \x01(\t\x12\x0e\n\x06minQty\x18\x02 \x01(\t\x12\x0e\n\x06maxQty\x18\x03 \x01(\t\x12\x10\n\x08stepSize\x18\x04 \x01(\t\x1a\x38\n\x0cMaxNumOrders\x12\x12\n\nfilterType\x18\x01 \x01(\t\x12\x14\n\x0cmaxNumOrders\x18\x02 \x01(\r\x1a@\n\x10MaxNumAlgoOrders\x12\x12\n\nfilterType\x18\x01 \x01(\t\x12\x18\n\x10maxNumAlgoOrders\x18\x02 \x01(\r\x1a\x46\n\x13MaxNumIcebergOrders\x12\x12\n\nfilterType\x18\x01 \x01(\t\x12\x1b\n\x13maxNumIcebergOrders\x18\x02 \x01(\r\x1a\x36\n\x0bMaxPosition\x12\x12\n\nfilterType\x18\x01 \x01(\t\x12\x13\n\x0bmaxPosition\x18\x02 \x01(\t\x1a\x92\x01\n\x08Notional\x12\x12\n\nfilterType\x18\x01 \x01(\t\x12\x13\n\x0bminNotional\x18\x02 \x01(\t\x12\x18\n\x10\x61pplyMinToMarket\x18\x03 \x01(\x08\x12\x13\n\x0bmaxNotional\x18\x04 \x01(\t\x12\x18\n\x10\x61pplyMaxToMarket\x18\x05 \x01(\x08\x12\x14\n\x0c\x61vgPriceMins\x18\x06 \x01(\rB\x0f\n\r_price_filterB\x10\n\x0e_percent_priceB\x0b\n\t_lot_sizeB\x0f\n\r_min_notionalB\x10\n\x0e_iceberg_partsB\x12\n\x10_market_lot_sizeB\x11\n\x0f_max_num_ordersB\x16\n\x14_max_num_algo_ordersB\x19\n\x17_max_num_iceberg_ordersB\x0f\n\r_max_positionB\x0b\n\t_notional\"\x8f\x01\n\x11\x46\x65tchOrderRequest\x12\x11\n\tclient_id\x18\x01 \x01(\x03\x12\x10\n\x08trade_id\x18\x02 \x01(\t\x12\x0e\n\x06symbol\x18\x03 \x01(\t\x12\x10\n\x08order_id\x18\x04 \x01(\x03\x12\x17\n\x0f\x63lient_order_id\x18\x05 \x01(\t\x12\x1a\n\x12\x66illed_update_call\x18\x06 \x01(\x08\"\xa1\x03\n\x12\x46\x65tchOrderResponse\x12\x0e\n\x06symbol\x18\x01 \x01(\t\x12\x0f\n\x07orderId\x18\x02 \x01(\x04\x12\x13\n\x0borderListId\x18\x03 \x01(\x11\x12\x15\n\rclientOrderId\x18\x04 \x01(\t\x12\r\n\x05price\x18\x05 \x01(\t\x12\x0f\n\x07origQty\x18\x06 \x01(\t\x12\x13\n\x0b\x65xecutedQty\x18\x07 \x01(\t\x12\x1b\n\x13\x63ummulativeQuoteQty\x18\x08 \x01(\t\x12\x0e\n\x06status\x18\t \x01(\t\x12\x13\n\x0btimeInForce\x18\n \x01(\t\x12\x0c\n\x04type\x18\x0b \x01(\t\x12\x0c\n\x04side\x18\x0c \x01(\t\x12\x11\n\tstopPrice\x18\r \x01(\t\x12\x12\n\nicebergQty\x18\x0e \x01(\t\x12\x0c\n\x04time\x18\x0f \x01(\x04\x12\x12\n\nupdateTime\x18\x10 \x01(\x04\x12\x11\n\tisWorking\x18\x11 \x01(\x08\x12\x13\n\x0bworkingTime\x18\x12 \x01(\x12\x12\x19\n\x11origQuoteOrderQty\x18\x13 \x01(\t\x12\x1f\n\x17selfTradePreventionMode\x18\x14 \x01(\t\"\xfc\x03\n\x17\x46\x65tchOpenOrdersResponse\x12\x14\n\x0crate_limiter\x18\x01 \x01(\x05\x12\x34\n\x05items\x18\x02 \x03(\x0b\x32%.martin.FetchOpenOrdersResponse.Order\x1a\x94\x03\n\x05Order\x12\x0e\n\x06symbol\x18\x01 \x01(\t\x12\x0f\n\x07orderId\x18\x02 \x01(\x04\x12\x13\n\x0borderListId\x18\x03 \x01(\x11\x12\x15\n\rclientOrderId\x18\x04 \x01(\t\x12\r\n\x05price\x18\x05 \x01(\t\x12\x0f\n\x07origQty\x18\x06 \x01(\t\x12\x13\n\x0b\x65xecutedQty\x18\x07 \x01(\t\x12\x1b\n\x13\x63ummulativeQuoteQty\x18\x08 \x01(\t\x12\x0e\n\x06status\x18\t \x01(\t\x12\x13\n\x0btimeInForce\x18\n \x01(\t\x12\x0c\n\x04type\x18\x0b \x01(\t\x12\x0c\n\x04side\x18\x0c \x01(\t\x12\x11\n\tstopPrice\x18\r \x01(\t\x12\x12\n\nicebergQty\x18\x0e \x01(\t\x12\x0c\n\x04time\x18\x0f \x01(\x04\x12\x12\n\nupdateTime\x18\x10 \x01(\x04\x12\x11\n\tisWorking\x18\x11 \x01(\x08\x12\x19\n\x11origQuoteOrderQty\x18\x12 \x01(\t\x12\x13\n\x0bworkingTime\x18\x13 \x01(\x12\x12\x1f\n\x17selfTradePreventionMode\x18\x14 \x01(\t\"T\n\rMarketRequest\x12\x11\n\tclient_id\x18\x01 \x01(\x03\x12\x10\n\x08trade_id\x18\x02 \x01(\t\x12\x0e\n\x06symbol\x18\x03 \x01(\t\x12\x0e\n\x06\x61mount\x18\x04 \x01(\t\"\xa0\x01\n\x12StartStreamRequest\x12\x11\n\tclient_id\x18\x01 \x01(\x03\x12\x10\n\x08trade_id\x18\x02 \x01(\t\x12\x0e\n\x06symbol\x18\x03 \x01(\t\x12\x1b\n\x13market_stream_count\x18\x04 \x01(\x05\x12\x19\n\x11user_stream_count\x18\x05 \x01(\x05\x12\x1d\n\x15update_max_queue_size\x18\x06 \x01(\x08\"k\n\x1bOpenClientConnectionRequest\x12\x10\n\x08trade_id\x18\x01 \x01(\t\x12\x14\n\x0c\x61\x63\x63ount_name\x18\x02 \x01(\t\x12\x14\n\x0crate_limiter\x18\x03 \x01(\x05\x12\x0e\n\x06symbol\x18\x04 \x01(\t\"z\n\x16OpenClientConnectionId\x12\x11\n\tclient_id\x18\x01 \x01(\x03\x12\x10\n\x08trade_id\x18\x02 \x01(\t\x12\x13\n\x0bsrv_version\x18\x03 \x01(\t\x12\x14\n\x0crate_limiter\x18\x04 \x01(\x05\x12\x10\n\x08\x65xchange\x18\x05 \x01(\t\"=\n\x16\x46\x65tchServerTimeRequest\x12\x11\n\tclient_id\x18\x01 \x01(\x03\x12\x10\n\x08trade_id\x18\x02 \x01(\t\".\n\x17\x46\x65tchServerTimeResponse\x12\x13\n\x0bserver_time\x18\x01 \x01(\x04\x32\xbc\x10\n\x06Martin\x12]\n\x14OpenClientConnection\x12#.martin.OpenClientConnectionRequest\x1a\x1e.martin.OpenClientConnectionId\"\x00\x12T\n\x0f\x46\x65tchServerTime\x12\x1e.martin.OpenClientConnectionId\x1a\x1f.martin.FetchServerTimeResponse\"\x00\x12K\n\x0f\x46\x65tchOpenOrders\x12\x15.martin.MarketRequest\x1a\x1f.martin.FetchOpenOrdersResponse\"\x00\x12\x42\n\x0f\x43\x61ncelAllOrders\x12\x15.martin.MarketRequest\x1a\x16.martin.SimpleResponse\"\x00\x12[\n\x17\x46\x65tchExchangeInfoSymbol\x12\x15.martin.MarketRequest\x1a\'.martin.FetchExchangeInfoSymbolResponse\"\x00\x12`\n\x17\x46\x65tchAccountInformation\x12\x1e.martin.OpenClientConnectionId\x1a#.martin.FetchAccountBalanceResponse\"\x00\x12I\n\x0e\x46\x65tchOrderBook\x12\x15.martin.MarketRequest\x1a\x1e.martin.FetchOrderBookResponse\"\x00\x12Y\n\x16\x46\x65tchSymbolPriceTicker\x12\x15.martin.MarketRequest\x1a&.martin.FetchSymbolPriceTickerResponse\"\x00\x12m\n FetchTickerPriceChangeStatistics\x12\x15.martin.MarketRequest\x1a\x30.martin.FetchTickerPriceChangeStatisticsResponse\"\x00\x12H\n\x0b\x46\x65tchKlines\x12\x1a.martin.FetchKlinesRequest\x1a\x1b.martin.FetchKlinesResponse\"\x00\x12\\\n\x15\x46\x65tchAccountTradeList\x12\x1f.martin.AccountTradeListRequest\x1a .martin.AccountTradeListResponse\"\x00\x12K\n\x0eOnTickerUpdate\x12\x15.martin.MarketRequest\x1a\x1e.martin.OnTickerUpdateResponse\"\x00\x30\x01\x12N\n\x11OnOrderBookUpdate\x12\x15.martin.MarketRequest\x1a\x1e.martin.FetchOrderBookResponse\"\x00\x30\x01\x12=\n\nStopStream\x12\x15.martin.MarketRequest\x1a\x16.martin.SimpleResponse\"\x00\x12\x43\n\x0bStartStream\x12\x1a.martin.StartStreamRequest\x1a\x16.martin.SimpleResponse\"\x00\x12P\n\rOnFundsUpdate\x12\x1c.martin.OnFundsUpdateRequest\x1a\x1d.martin.OnFundsUpdateResponse\"\x00\x30\x01\x12M\n\x0fOnBalanceUpdate\x12\x15.martin.MarketRequest\x1a\x1f.martin.OnBalanceUpdateResponse\"\x00\x30\x01\x12\x42\n\rOnOrderUpdate\x12\x15.martin.MarketRequest\x1a\x16.martin.SimpleResponse\"\x00\x30\x01\x12W\n\x10\x43reateLimitOrder\x12\x1f.martin.CreateLimitOrderRequest\x1a .martin.CreateLimitOrderResponse\"\x00\x12H\n\x0b\x43\x61ncelOrder\x12\x1a.martin.CancelOrderRequest\x1a\x1b.martin.CancelOrderResponse\"\x00\x12\x45\n\nFetchOrder\x12\x19.martin.FetchOrderRequest\x1a\x1a.martin.FetchOrderResponse\"\x00\x12J\n\x0eResetRateLimit\x12\x1e.martin.OpenClientConnectionId\x1a\x16.martin.SimpleResponse\"\x00\x12P\n\x0eOnKlinesUpdate\x12\x1a.martin.FetchKlinesRequest\x1a\x1e.martin.OnKlinesUpdateResponse\"\x00\x30\x01\x12]\n\x12\x46\x65tchFundingWallet\x12!.martin.FetchFundingWalletRequest\x1a\".martin.FetchFundingWalletResponse\"\x00\x12\x43\n\x10TransferToMaster\x12\x15.martin.MarketRequest\x1a\x16.martin.SimpleResponse\"\x00\x12>\n\x0b\x43heckStream\x12\x15.martin.MarketRequest\x1a\x16.martin.SimpleResponse\"\x00\x62\x06proto3')
|
|
17
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1b\x65xchanges_wrapper/api.proto\x12\x06martin\"*\n\x17OnBalanceUpdateResponse\x12\x0f\n\x07\x62\x61lance\x18\x01 \x01(\t\"\x83\x01\n\x19\x46\x65tchFundingWalletRequest\x12\x11\n\tclient_id\x18\x01 \x01(\x03\x12\x10\n\x08trade_id\x18\x02 \x01(\t\x12\r\n\x05\x61sset\x18\x03 \x01(\t\x12\x1a\n\x12need_btc_valuation\x18\x04 \x01(\x08\x12\x16\n\x0ereceive_window\x18\x05 \x01(\x03\"\xd0\x01\n\x1a\x46\x65tchFundingWalletResponse\x12=\n\x08\x62\x61lances\x18\x01 \x03(\x0b\x32+.martin.FetchFundingWalletResponse.Balances\x1as\n\x08\x42\x61lances\x12\r\n\x05\x61sset\x18\x01 \x01(\t\x12\x0c\n\x04\x66ree\x18\x02 \x01(\t\x12\x0e\n\x06locked\x18\x03 \x01(\t\x12\x0e\n\x06\x66reeze\x18\x04 \x01(\t\x12\x13\n\x0bwithdrawing\x18\x05 \x01(\t\x12\x15\n\rbtc_valuation\x18\x06 \x01(\t\"\xc7\x02\n\x13\x43\x61ncelOrderResponse\x12\x0e\n\x06symbol\x18\x01 \x01(\t\x12\x19\n\x11origClientOrderId\x18\x02 \x01(\t\x12\x0f\n\x07orderId\x18\x03 \x01(\x04\x12\x13\n\x0borderListId\x18\x04 \x01(\x05\x12\x15\n\rclientOrderId\x18\x05 \x01(\t\x12\x14\n\x0ctransactTime\x18\x06 \x01(\x04\x12\r\n\x05price\x18\x07 \x01(\t\x12\x0f\n\x07origQty\x18\x08 \x01(\t\x12\x13\n\x0b\x65xecutedQty\x18\t \x01(\t\x12\x1b\n\x13\x63ummulativeQuoteQty\x18\n \x01(\t\x12\x0e\n\x06status\x18\x0b \x01(\t\x12\x13\n\x0btimeInForce\x18\x0c \x01(\t\x12\x0c\n\x04type\x18\r \x01(\t\x12\x0c\n\x04side\x18\x0e \x01(\t\x12\x1f\n\x17selfTradePreventionMode\x18\x0f \x01(\t\"[\n\x12\x43\x61ncelOrderRequest\x12\x11\n\tclient_id\x18\x01 \x01(\x03\x12\x10\n\x08trade_id\x18\x02 \x01(\t\x12\x0e\n\x06symbol\x18\x03 \x01(\t\x12\x10\n\x08order_id\x18\x04 \x01(\x03\"\xf0\x02\n\x18\x43reateLimitOrderResponse\x12\x0e\n\x06symbol\x18\x01 \x01(\t\x12\x0f\n\x07orderId\x18\x02 \x01(\x04\x12\x13\n\x0borderListId\x18\x03 \x01(\x11\x12\x15\n\rclientOrderId\x18\x04 \x01(\t\x12\x14\n\x0ctransactTime\x18\x05 \x01(\x04\x12\r\n\x05price\x18\x06 \x01(\t\x12\x0f\n\x07origQty\x18\x07 \x01(\t\x12\x13\n\x0b\x65xecutedQty\x18\x08 \x01(\t\x12\x1b\n\x13\x63ummulativeQuoteQty\x18\t \x01(\t\x12\x0e\n\x06status\x18\n \x01(\t\x12\x13\n\x0btimeInForce\x18\x0b \x01(\t\x12\x0c\n\x04type\x18\x0c \x01(\t\x12\x0c\n\x04side\x18\r \x01(\t\x12\x12\n\nstrategyId\x18\x0e \x01(\x04\x12\x14\n\x0cstrategyType\x18\x0f \x01(\x04\x12\x13\n\x0bworkingTime\x18\x10 \x01(\x12\x12\x1f\n\x17selfTradePreventionMode\x18\x11 \x01(\t\"\x9e\x01\n\x17\x43reateLimitOrderRequest\x12\x11\n\tclient_id\x18\x01 \x01(\x03\x12\x10\n\x08trade_id\x18\x02 \x01(\t\x12\x0e\n\x06symbol\x18\x03 \x01(\t\x12\x10\n\x08\x62uy_side\x18\x04 \x01(\x08\x12\x10\n\x08quantity\x18\x05 \x01(\t\x12\r\n\x05price\x18\x06 \x01(\t\x12\x1b\n\x13new_client_order_id\x18\x07 \x01(\x03\"\xf8\x05\n\x15OnOrderUpdateResponse\x12\x0e\n\x06symbol\x18\x01 \x01(\t\x12\x17\n\x0f\x63lient_order_id\x18\x02 \x01(\t\x12\x0c\n\x04side\x18\x03 \x01(\t\x12\x12\n\norder_type\x18\x04 \x01(\t\x12\x15\n\rtime_in_force\x18\x05 \x01(\t\x12\x16\n\x0eorder_quantity\x18\x06 \x01(\t\x12\x13\n\x0border_price\x18\x07 \x01(\t\x12\x12\n\nstop_price\x18\x08 \x01(\t\x12\x18\n\x10iceberg_quantity\x18\t \x01(\t\x12\x15\n\rorder_list_id\x18\n \x01(\x11\x12\x1a\n\x12original_client_id\x18\x0b \x01(\t\x12\x16\n\x0e\x65xecution_type\x18\x0c \x01(\t\x12\x14\n\x0corder_status\x18\r \x01(\t\x12\x1b\n\x13order_reject_reason\x18\x0e \x01(\t\x12\x10\n\x08order_id\x18\x0f \x01(\x04\x12\x1e\n\x16last_executed_quantity\x18\x10 \x01(\t\x12\"\n\x1a\x63umulative_filled_quantity\x18\x11 \x01(\t\x12\x1b\n\x13last_executed_price\x18\x12 \x01(\t\x12\x19\n\x11\x63ommission_amount\x18\x13 \x01(\t\x12\x18\n\x10\x63ommission_asset\x18\x14 \x01(\t\x12\x18\n\x10transaction_time\x18\x15 \x01(\x04\x12\x10\n\x08trade_id\x18\x16 \x01(\x12\x12\x10\n\x08ignore_a\x18\x17 \x01(\x04\x12\x15\n\rin_order_book\x18\x18 \x01(\x08\x12\x15\n\ris_maker_side\x18\x19 \x01(\x08\x12\x10\n\x08ignore_b\x18\x1a \x01(\x08\x12\x1b\n\x13order_creation_time\x18\x1b \x01(\x04\x12\x1e\n\x16quote_asset_transacted\x18\x1c \x01(\t\x12#\n\x1blast_quote_asset_transacted\x18\x1d \x01(\t\x12\x1c\n\x14quote_order_quantity\x18\x1e \x01(\t\"&\n\x15OnFundsUpdateResponse\x12\r\n\x05\x66unds\x18\x01 \x01(\t\"t\n\x14OnFundsUpdateRequest\x12\x11\n\tclient_id\x18\x01 \x01(\x03\x12\x10\n\x08trade_id\x18\x02 \x01(\t\x12\x0e\n\x06symbol\x18\x03 \x01(\t\x12\x12\n\nbase_asset\x18\x04 \x01(\t\x12\x13\n\x0bquote_asset\x18\x05 \x01(\t\"1\n\x0eSimpleResponse\x12\x0f\n\x07success\x18\x01 \x01(\x08\x12\x0e\n\x06result\x18\x02 \x01(\t\"e\n\x16OnTickerUpdateResponse\x12\x0e\n\x06symbol\x18\x01 \x01(\t\x12\x12\n\nopen_price\x18\x02 \x01(\t\x12\x13\n\x0b\x63lose_price\x18\x03 \x01(\t\x12\x12\n\nevent_time\x18\x04 \x01(\x04\"\xbd\x02\n\x18\x41\x63\x63ountTradeListResponse\x12\x35\n\x05items\x18\x01 \x03(\x0b\x32&.martin.AccountTradeListResponse.Trade\x1a\xe9\x01\n\x05Trade\x12\x0e\n\x06symbol\x18\x01 \x01(\t\x12\n\n\x02id\x18\x02 \x01(\x04\x12\x0f\n\x07orderId\x18\x03 \x01(\x04\x12\x13\n\x0borderListId\x18\x04 \x01(\x11\x12\r\n\x05price\x18\x05 \x01(\t\x12\x0b\n\x03qty\x18\x06 \x01(\t\x12\x10\n\x08quoteQty\x18\x07 \x01(\t\x12\x12\n\ncommission\x18\x08 \x01(\t\x12\x17\n\x0f\x63ommissionAsset\x18\t \x01(\t\x12\x0c\n\x04time\x18\n \x01(\x04\x12\x0f\n\x07isBuyer\x18\x0b \x01(\x08\x12\x0f\n\x07isMaker\x18\x0c \x01(\x08\x12\x13\n\x0bisBestMatch\x18\r \x01(\x08\"q\n\x17\x41\x63\x63ountTradeListRequest\x12\x11\n\tclient_id\x18\x01 \x01(\x03\x12\x10\n\x08trade_id\x18\x02 \x01(\t\x12\x0e\n\x06symbol\x18\x03 \x01(\t\x12\r\n\x05limit\x18\x04 \x01(\r\x12\x12\n\nstart_time\x18\x05 \x01(\x03\"%\n\x13\x46\x65tchKlinesResponse\x12\x0e\n\x06klines\x18\x01 \x03(\t\"J\n\x16OnKlinesUpdateResponse\x12\x0e\n\x06symbol\x18\x01 \x01(\t\x12\x10\n\x08interval\x18\x02 \x01(\t\x12\x0e\n\x06\x63\x61ndle\x18\x03 \x01(\t\"j\n\x12\x46\x65tchKlinesRequest\x12\x11\n\tclient_id\x18\x01 \x01(\x03\x12\x10\n\x08trade_id\x18\x02 \x01(\t\x12\x0e\n\x06symbol\x18\x03 \x01(\t\x12\x10\n\x08interval\x18\x04 \x01(\t\x12\r\n\x05limit\x18\x05 \x01(\r\"\xb7\x03\n(FetchTickerPriceChangeStatisticsResponse\x12\x0e\n\x06symbol\x18\x01 \x01(\t\x12\x13\n\x0bpriceChange\x18\x02 \x01(\t\x12\x1a\n\x12priceChangePercent\x18\x03 \x01(\t\x12\x18\n\x10weightedAvgPrice\x18\x04 \x01(\t\x12\x16\n\x0eprevClosePrice\x18\x05 \x01(\t\x12\x11\n\tlastPrice\x18\x06 \x01(\t\x12\x0f\n\x07lastQty\x18\x07 \x01(\t\x12\x10\n\x08\x62idPrice\x18\x08 \x01(\t\x12\x0e\n\x06\x62idQty\x18\t \x01(\t\x12\x10\n\x08\x61skPrice\x18\n \x01(\t\x12\x0e\n\x06\x61skQty\x18\x0b \x01(\t\x12\x11\n\topenPrice\x18\x0c \x01(\t\x12\x11\n\thighPrice\x18\r \x01(\t\x12\x10\n\x08lowPrice\x18\x0e \x01(\t\x12\x0e\n\x06volume\x18\x0f \x01(\t\x12\x13\n\x0bquoteVolume\x18\x10 \x01(\t\x12\x10\n\x08openTime\x18\x11 \x01(\x04\x12\x11\n\tcloseTime\x18\x12 \x01(\x04\x12\x0f\n\x07\x66irstId\x18\x13 \x01(\x04\x12\x0e\n\x06lastId\x18\x14 \x01(\x04\x12\r\n\x05\x63ount\x18\x15 \x01(\x04\"?\n\x1e\x46\x65tchSymbolPriceTickerResponse\x12\x0e\n\x06symbol\x18\x01 \x01(\t\x12\r\n\x05price\x18\x02 \x01(\t\"J\n\x16\x46\x65tchOrderBookResponse\x12\x14\n\x0clastUpdateId\x18\x01 \x01(\x04\x12\x0c\n\x04\x62ids\x18\x02 \x03(\t\x12\x0c\n\x04\x61sks\x18\x03 \x03(\t\"\x96\x01\n\x1b\x46\x65tchAccountBalanceResponse\x12>\n\x08\x62\x61lances\x18\x01 \x03(\x0b\x32,.martin.FetchAccountBalanceResponse.Balances\x1a\x37\n\x08\x42\x61lances\x12\r\n\x05\x61sset\x18\x01 \x01(\t\x12\x0c\n\x04\x66ree\x18\x02 \x01(\t\x12\x0e\n\x06locked\x18\x03 \x01(\t\"\xcb\x15\n\x1f\x46\x65tchExchangeInfoSymbolResponse\x12\x0e\n\x06symbol\x18\x01 \x01(\t\x12\x0e\n\x06status\x18\x02 \x01(\t\x12\x11\n\tbaseAsset\x18\x03 \x01(\t\x12\x1a\n\x12\x62\x61seAssetPrecision\x18\x04 \x01(\r\x12\x12\n\nquoteAsset\x18\x05 \x01(\t\x12\x16\n\x0equotePrecision\x18\x06 \x01(\r\x12\x1b\n\x13quoteAssetPrecision\x18\x07 \x01(\r\x12\x1f\n\x17\x62\x61seCommissionPrecision\x18\x08 \x01(\r\x12 \n\x18quoteCommissionPrecision\x18\t \x01(\r\x12\x12\n\norderTypes\x18\n \x03(\t\x12\x16\n\x0eicebergAllowed\x18\x0b \x01(\x08\x12\x12\n\nocoAllowed\x18\x0c \x01(\x08\x12\"\n\x1aquoteOrderQtyMarketAllowed\x18\r \x01(\x08\x12\x19\n\x11\x61llowTrailingStop\x18\x0e \x01(\x08\x12\x1c\n\x14\x63\x61ncelReplaceAllowed\x18\x0f \x01(\x08\x12\x1c\n\x14isSpotTradingAllowed\x18\x10 \x01(\x08\x12\x1e\n\x16isMarginTradingAllowed\x18\x11 \x01(\x08\x12@\n\x07\x66ilters\x18\x12 \x01(\x0b\x32/.martin.FetchExchangeInfoSymbolResponse.Filters\x12\x13\n\x0bpermissions\x18\x13 \x03(\t\x12&\n\x1e\x64\x65\x66\x61ultSelfTradePreventionMode\x18\x14 \x01(\t\x12\'\n\x1f\x61llowedSelfTradePreventionModes\x18\x15 \x03(\t\x1a\xc9\x10\n\x07\x46ilters\x12V\n\x0cprice_filter\x18\x01 \x01(\x0b\x32;.martin.FetchExchangeInfoSymbolResponse.Filters.PriceFilterH\x00\x88\x01\x01\x12X\n\rpercent_price\x18\x02 \x01(\x0b\x32<.martin.FetchExchangeInfoSymbolResponse.Filters.PercentPriceH\x01\x88\x01\x01\x12N\n\x08lot_size\x18\x03 \x01(\x0b\x32\x37.martin.FetchExchangeInfoSymbolResponse.Filters.LotSizeH\x02\x88\x01\x01\x12V\n\x0cmin_notional\x18\x04 \x01(\x0b\x32;.martin.FetchExchangeInfoSymbolResponse.Filters.MinNotionalH\x03\x88\x01\x01\x12X\n\riceberg_parts\x18\x05 \x01(\x0b\x32<.martin.FetchExchangeInfoSymbolResponse.Filters.IcebergPartsH\x04\x88\x01\x01\x12[\n\x0fmarket_lot_size\x18\x06 \x01(\x0b\x32=.martin.FetchExchangeInfoSymbolResponse.Filters.MarketLotSizeH\x05\x88\x01\x01\x12Y\n\x0emax_num_orders\x18\x07 \x01(\x0b\x32<.martin.FetchExchangeInfoSymbolResponse.Filters.MaxNumOrdersH\x06\x88\x01\x01\x12\x62\n\x13max_num_algo_orders\x18\x08 \x01(\x0b\x32@.martin.FetchExchangeInfoSymbolResponse.Filters.MaxNumAlgoOrdersH\x07\x88\x01\x01\x12h\n\x16max_num_iceberg_orders\x18\t \x01(\x0b\x32\x43.martin.FetchExchangeInfoSymbolResponse.Filters.MaxNumIcebergOrdersH\x08\x88\x01\x01\x12V\n\x0cmax_position\x18\n \x01(\x0b\x32;.martin.FetchExchangeInfoSymbolResponse.Filters.MaxPositionH\t\x88\x01\x01\x12O\n\x08notional\x18\x0b \x01(\x0b\x32\x38.martin.FetchExchangeInfoSymbolResponse.Filters.NotionalH\n\x88\x01\x01\x1aW\n\x0bPriceFilter\x12\x12\n\nfilterType\x18\x01 \x01(\t\x12\x10\n\x08minPrice\x18\x02 \x01(\t\x12\x10\n\x08maxPrice\x18\x03 \x01(\t\x12\x10\n\x08tickSize\x18\x04 \x01(\t\x1a\x66\n\x0cPercentPrice\x12\x12\n\nfilterType\x18\x01 \x01(\t\x12\x14\n\x0cmultiplierUp\x18\x02 \x01(\t\x12\x16\n\x0emultiplierDown\x18\x03 \x01(\t\x12\x14\n\x0c\x61vgPriceMins\x18\x04 \x01(\r\x1aO\n\x07LotSize\x12\x12\n\nfilterType\x18\x01 \x01(\t\x12\x0e\n\x06minQty\x18\x02 \x01(\t\x12\x0e\n\x06maxQty\x18\x03 \x01(\t\x12\x10\n\x08stepSize\x18\x04 \x01(\t\x1a\x63\n\x0bMinNotional\x12\x12\n\nfilterType\x18\x01 \x01(\t\x12\x13\n\x0bminNotional\x18\x02 \x01(\t\x12\x15\n\rapplyToMarket\x18\x03 \x01(\x08\x12\x14\n\x0c\x61vgPriceMins\x18\x04 \x01(\r\x1a\x31\n\x0cIcebergParts\x12\x12\n\nfilterType\x18\x01 \x01(\t\x12\r\n\x05limit\x18\x02 \x01(\r\x1aU\n\rMarketLotSize\x12\x12\n\nfilterType\x18\x01 \x01(\t\x12\x0e\n\x06minQty\x18\x02 \x01(\t\x12\x0e\n\x06maxQty\x18\x03 \x01(\t\x12\x10\n\x08stepSize\x18\x04 \x01(\t\x1a\x38\n\x0cMaxNumOrders\x12\x12\n\nfilterType\x18\x01 \x01(\t\x12\x14\n\x0cmaxNumOrders\x18\x02 \x01(\r\x1a@\n\x10MaxNumAlgoOrders\x12\x12\n\nfilterType\x18\x01 \x01(\t\x12\x18\n\x10maxNumAlgoOrders\x18\x02 \x01(\r\x1a\x46\n\x13MaxNumIcebergOrders\x12\x12\n\nfilterType\x18\x01 \x01(\t\x12\x1b\n\x13maxNumIcebergOrders\x18\x02 \x01(\r\x1a\x36\n\x0bMaxPosition\x12\x12\n\nfilterType\x18\x01 \x01(\t\x12\x13\n\x0bmaxPosition\x18\x02 \x01(\t\x1a\x92\x01\n\x08Notional\x12\x12\n\nfilterType\x18\x01 \x01(\t\x12\x13\n\x0bminNotional\x18\x02 \x01(\t\x12\x18\n\x10\x61pplyMinToMarket\x18\x03 \x01(\x08\x12\x13\n\x0bmaxNotional\x18\x04 \x01(\t\x12\x18\n\x10\x61pplyMaxToMarket\x18\x05 \x01(\x08\x12\x14\n\x0c\x61vgPriceMins\x18\x06 \x01(\rB\x0f\n\r_price_filterB\x10\n\x0e_percent_priceB\x0b\n\t_lot_sizeB\x0f\n\r_min_notionalB\x10\n\x0e_iceberg_partsB\x12\n\x10_market_lot_sizeB\x11\n\x0f_max_num_ordersB\x16\n\x14_max_num_algo_ordersB\x19\n\x17_max_num_iceberg_ordersB\x0f\n\r_max_positionB\x0b\n\t_notional\"\x8f\x01\n\x11\x46\x65tchOrderRequest\x12\x11\n\tclient_id\x18\x01 \x01(\x03\x12\x10\n\x08trade_id\x18\x02 \x01(\t\x12\x0e\n\x06symbol\x18\x03 \x01(\t\x12\x10\n\x08order_id\x18\x04 \x01(\x03\x12\x17\n\x0f\x63lient_order_id\x18\x05 \x01(\t\x12\x1a\n\x12\x66illed_update_call\x18\x06 \x01(\x08\"\xa1\x03\n\x12\x46\x65tchOrderResponse\x12\x0e\n\x06symbol\x18\x01 \x01(\t\x12\x0f\n\x07orderId\x18\x02 \x01(\x04\x12\x13\n\x0borderListId\x18\x03 \x01(\x11\x12\x15\n\rclientOrderId\x18\x04 \x01(\t\x12\r\n\x05price\x18\x05 \x01(\t\x12\x0f\n\x07origQty\x18\x06 \x01(\t\x12\x13\n\x0b\x65xecutedQty\x18\x07 \x01(\t\x12\x1b\n\x13\x63ummulativeQuoteQty\x18\x08 \x01(\t\x12\x0e\n\x06status\x18\t \x01(\t\x12\x13\n\x0btimeInForce\x18\n \x01(\t\x12\x0c\n\x04type\x18\x0b \x01(\t\x12\x0c\n\x04side\x18\x0c \x01(\t\x12\x11\n\tstopPrice\x18\r \x01(\t\x12\x12\n\nicebergQty\x18\x0e \x01(\t\x12\x0c\n\x04time\x18\x0f \x01(\x04\x12\x12\n\nupdateTime\x18\x10 \x01(\x04\x12\x11\n\tisWorking\x18\x11 \x01(\x08\x12\x13\n\x0bworkingTime\x18\x12 \x01(\x12\x12\x19\n\x11origQuoteOrderQty\x18\x13 \x01(\t\x12\x1f\n\x17selfTradePreventionMode\x18\x14 \x01(\t\"\xfc\x03\n\x17\x46\x65tchOpenOrdersResponse\x12\x14\n\x0crate_limiter\x18\x01 \x01(\x05\x12\x34\n\x05items\x18\x02 \x03(\x0b\x32%.martin.FetchOpenOrdersResponse.Order\x1a\x94\x03\n\x05Order\x12\x0e\n\x06symbol\x18\x01 \x01(\t\x12\x0f\n\x07orderId\x18\x02 \x01(\x04\x12\x13\n\x0borderListId\x18\x03 \x01(\x11\x12\x15\n\rclientOrderId\x18\x04 \x01(\t\x12\r\n\x05price\x18\x05 \x01(\t\x12\x0f\n\x07origQty\x18\x06 \x01(\t\x12\x13\n\x0b\x65xecutedQty\x18\x07 \x01(\t\x12\x1b\n\x13\x63ummulativeQuoteQty\x18\x08 \x01(\t\x12\x0e\n\x06status\x18\t \x01(\t\x12\x13\n\x0btimeInForce\x18\n \x01(\t\x12\x0c\n\x04type\x18\x0b \x01(\t\x12\x0c\n\x04side\x18\x0c \x01(\t\x12\x11\n\tstopPrice\x18\r \x01(\t\x12\x12\n\nicebergQty\x18\x0e \x01(\t\x12\x0c\n\x04time\x18\x0f \x01(\x04\x12\x12\n\nupdateTime\x18\x10 \x01(\x04\x12\x11\n\tisWorking\x18\x11 \x01(\x08\x12\x19\n\x11origQuoteOrderQty\x18\x12 \x01(\t\x12\x13\n\x0bworkingTime\x18\x13 \x01(\x12\x12\x1f\n\x17selfTradePreventionMode\x18\x14 \x01(\t\"T\n\rMarketRequest\x12\x11\n\tclient_id\x18\x01 \x01(\x03\x12\x10\n\x08trade_id\x18\x02 \x01(\t\x12\x0e\n\x06symbol\x18\x03 \x01(\t\x12\x0e\n\x06\x61mount\x18\x04 \x01(\t\"\xa0\x01\n\x12StartStreamRequest\x12\x11\n\tclient_id\x18\x01 \x01(\x03\x12\x10\n\x08trade_id\x18\x02 \x01(\t\x12\x0e\n\x06symbol\x18\x03 \x01(\t\x12\x1b\n\x13market_stream_count\x18\x04 \x01(\x05\x12\x19\n\x11user_stream_count\x18\x05 \x01(\x05\x12\x1d\n\x15update_max_queue_size\x18\x06 \x01(\x08\"k\n\x1bOpenClientConnectionRequest\x12\x10\n\x08trade_id\x18\x01 \x01(\t\x12\x14\n\x0c\x61\x63\x63ount_name\x18\x02 \x01(\t\x12\x14\n\x0crate_limiter\x18\x03 \x01(\x05\x12\x0e\n\x06symbol\x18\x04 \x01(\t\"z\n\x16OpenClientConnectionId\x12\x11\n\tclient_id\x18\x01 \x01(\x03\x12\x10\n\x08trade_id\x18\x02 \x01(\t\x12\x13\n\x0bsrv_version\x18\x03 \x01(\t\x12\x14\n\x0crate_limiter\x18\x04 \x01(\x05\x12\x10\n\x08\x65xchange\x18\x05 \x01(\t\"=\n\x16\x46\x65tchServerTimeRequest\x12\x11\n\tclient_id\x18\x01 \x01(\x03\x12\x10\n\x08trade_id\x18\x02 \x01(\t\".\n\x17\x46\x65tchServerTimeResponse\x12\x13\n\x0bserver_time\x18\x01 \x01(\x04\x32\x87\x11\n\x06Martin\x12]\n\x14OpenClientConnection\x12#.martin.OpenClientConnectionRequest\x1a\x1e.martin.OpenClientConnectionId\"\x00\x12T\n\x0f\x46\x65tchServerTime\x12\x1e.martin.OpenClientConnectionId\x1a\x1f.martin.FetchServerTimeResponse\"\x00\x12K\n\x0f\x46\x65tchOpenOrders\x12\x15.martin.MarketRequest\x1a\x1f.martin.FetchOpenOrdersResponse\"\x00\x12\x42\n\x0f\x43\x61ncelAllOrders\x12\x15.martin.MarketRequest\x1a\x16.martin.SimpleResponse\"\x00\x12[\n\x17\x46\x65tchExchangeInfoSymbol\x12\x15.martin.MarketRequest\x1a\'.martin.FetchExchangeInfoSymbolResponse\"\x00\x12`\n\x17\x46\x65tchAccountInformation\x12\x1e.martin.OpenClientConnectionId\x1a#.martin.FetchAccountBalanceResponse\"\x00\x12I\n\x0e\x46\x65tchOrderBook\x12\x15.martin.MarketRequest\x1a\x1e.martin.FetchOrderBookResponse\"\x00\x12Y\n\x16\x46\x65tchSymbolPriceTicker\x12\x15.martin.MarketRequest\x1a&.martin.FetchSymbolPriceTickerResponse\"\x00\x12m\n FetchTickerPriceChangeStatistics\x12\x15.martin.MarketRequest\x1a\x30.martin.FetchTickerPriceChangeStatisticsResponse\"\x00\x12H\n\x0b\x46\x65tchKlines\x12\x1a.martin.FetchKlinesRequest\x1a\x1b.martin.FetchKlinesResponse\"\x00\x12\\\n\x15\x46\x65tchAccountTradeList\x12\x1f.martin.AccountTradeListRequest\x1a .martin.AccountTradeListResponse\"\x00\x12K\n\x0eOnTickerUpdate\x12\x15.martin.MarketRequest\x1a\x1e.martin.OnTickerUpdateResponse\"\x00\x30\x01\x12N\n\x11OnOrderBookUpdate\x12\x15.martin.MarketRequest\x1a\x1e.martin.FetchOrderBookResponse\"\x00\x30\x01\x12=\n\nStopStream\x12\x15.martin.MarketRequest\x1a\x16.martin.SimpleResponse\"\x00\x12\x43\n\x0bStartStream\x12\x1a.martin.StartStreamRequest\x1a\x16.martin.SimpleResponse\"\x00\x12P\n\rOnFundsUpdate\x12\x1c.martin.OnFundsUpdateRequest\x1a\x1d.martin.OnFundsUpdateResponse\"\x00\x30\x01\x12M\n\x0fOnBalanceUpdate\x12\x15.martin.MarketRequest\x1a\x1f.martin.OnBalanceUpdateResponse\"\x00\x30\x01\x12\x42\n\rOnOrderUpdate\x12\x15.martin.MarketRequest\x1a\x16.martin.SimpleResponse\"\x00\x30\x01\x12W\n\x10\x43reateLimitOrder\x12\x1f.martin.CreateLimitOrderRequest\x1a .martin.CreateLimitOrderResponse\"\x00\x12H\n\x0b\x43\x61ncelOrder\x12\x1a.martin.CancelOrderRequest\x1a\x1b.martin.CancelOrderResponse\"\x00\x12\x45\n\nFetchOrder\x12\x19.martin.FetchOrderRequest\x1a\x1a.martin.FetchOrderResponse\"\x00\x12J\n\x0eResetRateLimit\x12\x1e.martin.OpenClientConnectionId\x1a\x16.martin.SimpleResponse\"\x00\x12P\n\x0eOnKlinesUpdate\x12\x1a.martin.FetchKlinesRequest\x1a\x1e.martin.OnKlinesUpdateResponse\"\x00\x30\x01\x12]\n\x12\x46\x65tchFundingWallet\x12!.martin.FetchFundingWalletRequest\x1a\".martin.FetchFundingWalletResponse\"\x00\x12\x43\n\x10TransferToMaster\x12\x15.martin.MarketRequest\x1a\x16.martin.SimpleResponse\"\x00\x12>\n\x0b\x43heckStream\x12\x15.martin.MarketRequest\x1a\x16.martin.SimpleResponse\"\x00\x12I\n\x16OneClickArrivalDeposit\x12\x15.martin.MarketRequest\x1a\x16.martin.SimpleResponse\"\x00\x62\x06proto3')
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
@@ -509,5 +509,5 @@ if _descriptor._USE_C_DESCRIPTORS == False:
|
|
|
509
509
|
_FETCHSERVERTIMERESPONSE._serialized_start=8240
|
|
510
510
|
_FETCHSERVERTIMERESPONSE._serialized_end=8286
|
|
511
511
|
_MARTIN._serialized_start=8289
|
|
512
|
-
_MARTIN._serialized_end=
|
|
512
|
+
_MARTIN._serialized_end=10472
|
|
513
513
|
# @@protoc_insertion_point(module_scope)
|
|
@@ -144,6 +144,11 @@ class MartinStub(object):
|
|
|
144
144
|
request_serializer=exchanges__wrapper_dot_api__pb2.MarketRequest.SerializeToString,
|
|
145
145
|
response_deserializer=exchanges__wrapper_dot_api__pb2.SimpleResponse.FromString,
|
|
146
146
|
)
|
|
147
|
+
self.OneClickArrivalDeposit = channel.unary_unary(
|
|
148
|
+
'/martin.Martin/OneClickArrivalDeposit',
|
|
149
|
+
request_serializer=exchanges__wrapper_dot_api__pb2.MarketRequest.SerializeToString,
|
|
150
|
+
response_deserializer=exchanges__wrapper_dot_api__pb2.SimpleResponse.FromString,
|
|
151
|
+
)
|
|
147
152
|
|
|
148
153
|
|
|
149
154
|
class MartinServicer(object):
|
|
@@ -305,6 +310,12 @@ class MartinServicer(object):
|
|
|
305
310
|
context.set_details('Method not implemented!')
|
|
306
311
|
raise NotImplementedError('Method not implemented!')
|
|
307
312
|
|
|
313
|
+
def OneClickArrivalDeposit(self, request, context):
|
|
314
|
+
"""Missing associated documentation comment in .proto file."""
|
|
315
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
316
|
+
context.set_details('Method not implemented!')
|
|
317
|
+
raise NotImplementedError('Method not implemented!')
|
|
318
|
+
|
|
308
319
|
|
|
309
320
|
def add_MartinServicer_to_server(servicer, server):
|
|
310
321
|
rpc_method_handlers = {
|
|
@@ -438,6 +449,11 @@ def add_MartinServicer_to_server(servicer, server):
|
|
|
438
449
|
request_deserializer=exchanges__wrapper_dot_api__pb2.MarketRequest.FromString,
|
|
439
450
|
response_serializer=exchanges__wrapper_dot_api__pb2.SimpleResponse.SerializeToString,
|
|
440
451
|
),
|
|
452
|
+
'OneClickArrivalDeposit': grpc.unary_unary_rpc_method_handler(
|
|
453
|
+
servicer.OneClickArrivalDeposit,
|
|
454
|
+
request_deserializer=exchanges__wrapper_dot_api__pb2.MarketRequest.FromString,
|
|
455
|
+
response_serializer=exchanges__wrapper_dot_api__pb2.SimpleResponse.SerializeToString,
|
|
456
|
+
),
|
|
441
457
|
}
|
|
442
458
|
generic_handler = grpc.method_handlers_generic_handler(
|
|
443
459
|
'martin.Martin', rpc_method_handlers)
|
|
@@ -889,3 +905,20 @@ class Martin(object):
|
|
|
889
905
|
exchanges__wrapper_dot_api__pb2.SimpleResponse.FromString,
|
|
890
906
|
options, channel_credentials,
|
|
891
907
|
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
908
|
+
|
|
909
|
+
@staticmethod
|
|
910
|
+
def OneClickArrivalDeposit(request,
|
|
911
|
+
target,
|
|
912
|
+
options=(),
|
|
913
|
+
channel_credentials=None,
|
|
914
|
+
call_credentials=None,
|
|
915
|
+
insecure=False,
|
|
916
|
+
compression=None,
|
|
917
|
+
wait_for_ready=None,
|
|
918
|
+
timeout=None,
|
|
919
|
+
metadata=None):
|
|
920
|
+
return grpc.experimental.unary_unary(request, target, '/martin.Martin/OneClickArrivalDeposit',
|
|
921
|
+
exchanges__wrapper_dot_api__pb2.MarketRequest.SerializeToString,
|
|
922
|
+
exchanges__wrapper_dot_api__pb2.SimpleResponse.FromString,
|
|
923
|
+
options, channel_credentials,
|
|
924
|
+
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
@@ -101,7 +101,6 @@ def exchange_info(symbols_details: [], tickers: [], symbol_t) -> {}:
|
|
|
101
101
|
_tick_size = tick_size(market.get('price_precision'), _price)
|
|
102
102
|
_min_qty = float(market.get('minimum_order_size'))
|
|
103
103
|
_max_qty = float(market.get('maximum_order_size'))
|
|
104
|
-
_step_size = 0.00001
|
|
105
104
|
_min_notional = _min_qty * _price
|
|
106
105
|
|
|
107
106
|
_price_filter = {
|
|
@@ -114,7 +113,7 @@ def exchange_info(symbols_details: [], tickers: [], symbol_t) -> {}:
|
|
|
114
113
|
"filterType": "LOT_SIZE",
|
|
115
114
|
"minQty": str(_min_qty),
|
|
116
115
|
"maxQty": str(_max_qty),
|
|
117
|
-
"stepSize": str(
|
|
116
|
+
"stepSize": str(10**(-_base_asset_precision))
|
|
118
117
|
}
|
|
119
118
|
_min_notional = {
|
|
120
119
|
"filterType": "MIN_NOTIONAL",
|
|
@@ -190,7 +189,7 @@ def account_information(res: []) -> {}:
|
|
|
190
189
|
}
|
|
191
190
|
|
|
192
191
|
|
|
193
|
-
def order(res: [], response_type=None,
|
|
192
|
+
def order(res: [], response_type=None, cancelled=False) -> {}:
|
|
194
193
|
# print(f"order.order: {res}")
|
|
195
194
|
symbol = res[3][1:].replace(':', '')
|
|
196
195
|
order_id = res[0]
|
|
@@ -203,35 +202,16 @@ def order(res: [], response_type=None, wss_te=None, cancelled=False) -> {}:
|
|
|
203
202
|
cummulative_quote_qty = str(Decimal(executed_qty) * Decimal(avg_fill_price))
|
|
204
203
|
orig_quote_order_qty = str(Decimal(orig_qty) * Decimal(price))
|
|
205
204
|
#
|
|
206
|
-
if 'CANCELED' in res[13]:
|
|
205
|
+
if 'CANCELED' in res[13] or cancelled:
|
|
207
206
|
status = 'CANCELED'
|
|
208
207
|
elif Decimal(orig_qty) > Decimal(executed_qty) > 0:
|
|
209
208
|
status = 'PARTIALLY_FILLED'
|
|
210
209
|
elif Decimal(executed_qty) >= Decimal(orig_qty):
|
|
211
210
|
status = 'FILLED'
|
|
212
|
-
elif cancelled:
|
|
213
|
-
status = 'CANCELED'
|
|
214
211
|
else:
|
|
215
212
|
status = 'NEW'
|
|
216
213
|
#
|
|
217
214
|
_type = "LIMIT"
|
|
218
|
-
# https://docs.bitfinex.com/reference/ws-auth-trades
|
|
219
|
-
if wss_te:
|
|
220
|
-
executed_qty = Decimal(str(0))
|
|
221
|
-
cummulative_quote_qty = Decimal(str(0))
|
|
222
|
-
trades_id = []
|
|
223
|
-
for trade in wss_te:
|
|
224
|
-
trade_id = trade[0]
|
|
225
|
-
if trade_id not in trades_id:
|
|
226
|
-
trades_id.append(trade_id)
|
|
227
|
-
exec_amount = Decimal(str(abs(trade[4])))
|
|
228
|
-
exec_price = Decimal(str(trade[5]))
|
|
229
|
-
executed_qty += exec_amount
|
|
230
|
-
cummulative_quote_qty += exec_amount * exec_price
|
|
231
|
-
status = 'FILLED' if executed_qty >= Decimal(orig_qty) else 'PARTIALLY_FILLED'
|
|
232
|
-
executed_qty = str(executed_qty)
|
|
233
|
-
cummulative_quote_qty = str(cummulative_quote_qty)
|
|
234
|
-
_type = "MARKET"
|
|
235
215
|
|
|
236
216
|
time_in_force = "GTC"
|
|
237
217
|
side = 'BUY' if res[7] > 0 else 'SELL'
|
|
@@ -502,28 +482,34 @@ def on_balance_update(res: []) -> {}:
|
|
|
502
482
|
}
|
|
503
483
|
|
|
504
484
|
|
|
505
|
-
def on_order_update(res: [],
|
|
506
|
-
#
|
|
485
|
+
def on_order_update(res: [], _order: {}) -> {}:
|
|
486
|
+
# logger.info(f"on_order_update.res: {res}, order: {_order}")
|
|
507
487
|
side = 'BUY' if res[7] > 0 else 'SELL'
|
|
508
488
|
#
|
|
509
|
-
order_quantity =
|
|
510
|
-
cumulative_filled_quantity =
|
|
511
|
-
cumulative_quote_asset = str(
|
|
489
|
+
order_quantity = _order["origQty"]
|
|
490
|
+
cumulative_filled_quantity = _order["executedQty"]
|
|
491
|
+
cumulative_quote_asset = str(cumulative_filled_quantity * Decimal(str(res[17])))
|
|
512
492
|
quote_order_qty = str(Decimal(order_quantity) * Decimal(str(res[16])))
|
|
513
493
|
#
|
|
514
494
|
trade_id = -1
|
|
515
495
|
last_executed_quantity = "0"
|
|
516
496
|
last_executed_price = "0"
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
497
|
+
is_maker = False
|
|
498
|
+
commission_amount = "0"
|
|
499
|
+
commission_asset = ""
|
|
500
|
+
if _event := _order['lastEvent']:
|
|
501
|
+
trade_id = _event[0]
|
|
502
|
+
last_executed_quantity = str(abs(_event[4]))
|
|
503
|
+
last_executed_price = str(_event[5])
|
|
504
|
+
is_maker = _event[8] == 1
|
|
505
|
+
commission_amount = str(_event[9]) if _event[9] else "0"
|
|
506
|
+
commission_asset = _event[10] or ""
|
|
521
507
|
last_quote_asset_transacted = str(Decimal(last_executed_quantity) * Decimal(last_executed_price))
|
|
522
508
|
if 'CANCELED' in res[13]:
|
|
523
509
|
status = 'CANCELED'
|
|
524
|
-
elif
|
|
510
|
+
elif order_quantity > cumulative_filled_quantity > 0:
|
|
525
511
|
status = 'PARTIALLY_FILLED'
|
|
526
|
-
elif
|
|
512
|
+
elif cumulative_filled_quantity >= order_quantity:
|
|
527
513
|
status = 'FILLED'
|
|
528
514
|
else:
|
|
529
515
|
status = 'NEW'
|
|
@@ -535,7 +521,7 @@ def on_order_update(res: [], last_event: tuple) -> {}:
|
|
|
535
521
|
"S": side,
|
|
536
522
|
"o": "LIMIT",
|
|
537
523
|
"f": "GTC",
|
|
538
|
-
"q": order_quantity,
|
|
524
|
+
"q": str(order_quantity),
|
|
539
525
|
"p": str(res[16]),
|
|
540
526
|
"P": "0.00000000",
|
|
541
527
|
"F": "0.00000000",
|
|
@@ -546,15 +532,15 @@ def on_order_update(res: [], last_event: tuple) -> {}:
|
|
|
546
532
|
"r": "NONE",
|
|
547
533
|
"i": res[0],
|
|
548
534
|
"l": last_executed_quantity,
|
|
549
|
-
"z": cumulative_filled_quantity,
|
|
535
|
+
"z": str(cumulative_filled_quantity),
|
|
550
536
|
"L": last_executed_price,
|
|
551
|
-
"n":
|
|
552
|
-
"N":
|
|
537
|
+
"n": commission_amount,
|
|
538
|
+
"N": commission_asset,
|
|
553
539
|
"T": res[5],
|
|
554
540
|
"t": trade_id,
|
|
555
541
|
"I": 123456789,
|
|
556
542
|
"w": True,
|
|
557
|
-
"m":
|
|
543
|
+
"m": is_maker,
|
|
558
544
|
"M": False,
|
|
559
545
|
"O": res[4],
|
|
560
546
|
"Z": cumulative_quote_asset,
|
|
@@ -563,8 +549,8 @@ def on_order_update(res: [], last_event: tuple) -> {}:
|
|
|
563
549
|
}
|
|
564
550
|
|
|
565
551
|
|
|
566
|
-
def on_order_trade(res: [], executed_qty: str) -> {}:
|
|
567
|
-
#
|
|
552
|
+
def on_order_trade(res: [], orig_qty: str, executed_qty: str) -> {}:
|
|
553
|
+
# logger.info(f"on_order_trade.res: {res}, qty: {orig_qty}, filled: {executed_qty}")
|
|
568
554
|
side = 'BUY' if res[4] > 0 else 'SELL'
|
|
569
555
|
#
|
|
570
556
|
status = 'PARTIALLY_FILLED'
|
|
@@ -572,6 +558,7 @@ def on_order_trade(res: [], executed_qty: str) -> {}:
|
|
|
572
558
|
last_executed_quantity = str(abs(res[4]))
|
|
573
559
|
last_executed_price = str(res[5])
|
|
574
560
|
last_quote_asset = str(Decimal(last_executed_quantity) * Decimal(last_executed_price))
|
|
561
|
+
quote_order_qty = str(Decimal(executed_qty) * Decimal(last_executed_price))
|
|
575
562
|
return {
|
|
576
563
|
"e": "executionReport",
|
|
577
564
|
"E": res[2],
|
|
@@ -580,7 +567,7 @@ def on_order_trade(res: [], executed_qty: str) -> {}:
|
|
|
580
567
|
"S": side,
|
|
581
568
|
"o": "LIMIT",
|
|
582
569
|
"f": "GTC",
|
|
583
|
-
"q":
|
|
570
|
+
"q": orig_qty,
|
|
584
571
|
"p": str(res[7]),
|
|
585
572
|
"P": "0.00000000",
|
|
586
573
|
"F": "0.00000000",
|
|
@@ -593,7 +580,7 @@ def on_order_trade(res: [], executed_qty: str) -> {}:
|
|
|
593
580
|
"l": last_executed_quantity,
|
|
594
581
|
"z": executed_qty,
|
|
595
582
|
"L": last_executed_price,
|
|
596
|
-
"n": str(res[9]),
|
|
583
|
+
"n": str(res[9]) if res[9] else "0",
|
|
597
584
|
"N": res[10],
|
|
598
585
|
"T": res[2],
|
|
599
586
|
"t": res[0],
|
|
@@ -602,7 +589,7 @@ def on_order_trade(res: [], executed_qty: str) -> {}:
|
|
|
602
589
|
"m": res[8] == 1,
|
|
603
590
|
"M": False,
|
|
604
591
|
"O": res[2],
|
|
605
|
-
"Z":
|
|
592
|
+
"Z": quote_order_qty,
|
|
606
593
|
"Y": last_quote_asset,
|
|
607
594
|
"Q": "0.0",
|
|
608
595
|
}
|
|
@@ -67,7 +67,7 @@ def exchange_info(server_time: int, trading_symbol: list) -> dict:
|
|
|
67
67
|
"filterType": "LOT_SIZE",
|
|
68
68
|
"minQty": market['lotSizeFilter']['minOrderQty'],
|
|
69
69
|
"maxQty": market['lotSizeFilter']['maxOrderQty'],
|
|
70
|
-
"stepSize": market['lotSizeFilter']['
|
|
70
|
+
"stepSize": market['lotSizeFilter']['basePrecision']
|
|
71
71
|
}
|
|
72
72
|
_min_notional = {
|
|
73
73
|
"filterType": "MIN_NOTIONAL",
|
|
@@ -403,7 +403,7 @@ def on_trade_update(res: dict) -> dict:
|
|
|
403
403
|
"t": int(res.get("execId", -1)),
|
|
404
404
|
"I": 123456789,
|
|
405
405
|
"w": True,
|
|
406
|
-
"m": False,
|
|
406
|
+
"m": res.get("isMaker", False),
|
|
407
407
|
"M": False,
|
|
408
408
|
"O": int(res.get("execTime", res.get("createdTime"))),
|
|
409
409
|
"Z": cumulative_quote_asset,
|
|
@@ -16,33 +16,31 @@ class OrderUpdateEvent:
|
|
|
16
16
|
self.time_in_force = event_data["timeInForce"]
|
|
17
17
|
self.order_quantity = event_data["origQty"]
|
|
18
18
|
self.order_price = event_data["price"]
|
|
19
|
-
self.stop_price = event_data
|
|
20
|
-
self.iceberg_quantity = event_data
|
|
19
|
+
self.stop_price = event_data.get("stopPrice")
|
|
20
|
+
self.iceberg_quantity = event_data.get("icebergQty")
|
|
21
21
|
self.order_list_id = event_data["orderListId"]
|
|
22
22
|
self.original_client_id = event_data["clientOrderId"]
|
|
23
23
|
self.execution_type = "TRADE"
|
|
24
24
|
self.order_status = event_data["status"]
|
|
25
25
|
self.order_reject_reason = "NONE"
|
|
26
26
|
self.order_id = event_data["orderId"]
|
|
27
|
-
self.last_executed_quantity =
|
|
28
|
-
self.
|
|
29
|
-
self.
|
|
30
|
-
self.
|
|
31
|
-
self.commission_asset = ""
|
|
32
|
-
self.transaction_time = event_data["updateTime"]
|
|
27
|
+
self.last_executed_quantity = self.cumulative_filled_quantity = event_data["executedQty"]
|
|
28
|
+
self.commission_amount = event_data.get("commission_amount", "0.0")
|
|
29
|
+
self.commission_asset = event_data.get("commission_asset", "")
|
|
30
|
+
self.transaction_time = event_data.get("updateTime", event_data.get("transactTime"))
|
|
33
31
|
self.trade_id = -1
|
|
34
32
|
self.ignore_a = int()
|
|
35
33
|
self.in_order_book = True
|
|
36
|
-
self.is_maker_side = False
|
|
34
|
+
self.is_maker_side = event_data.get("is_maker_side", False)
|
|
37
35
|
self.ignore_b = False
|
|
38
|
-
self.order_creation_time = event_data
|
|
36
|
+
self.order_creation_time = event_data.get("time", self.transaction_time)
|
|
39
37
|
self.quote_asset_transacted = event_data["cummulativeQuoteQty"]
|
|
40
|
-
self.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
38
|
+
self.quote_order_quantity = event_data.get(
|
|
39
|
+
"origQuoteOrderQty", str(Decimal(self.order_quantity) * Decimal(self.order_price))
|
|
40
|
+
)
|
|
41
|
+
self.last_executed_price = str(Decimal(self.quote_asset_transacted) /
|
|
42
|
+
Decimal(self.cumulative_filled_quantity))
|
|
43
|
+
self.last_quote_asset_transacted = str(Decimal(self.last_executed_quantity) * Decimal(self.last_executed_price))
|
|
46
44
|
|
|
47
45
|
|
|
48
46
|
class OrderTradesEvent:
|
|
@@ -10,6 +10,8 @@ from collections import defaultdict
|
|
|
10
10
|
import pyotp
|
|
11
11
|
from expiringdict import ExpiringDict
|
|
12
12
|
import uuid
|
|
13
|
+
from decimal import Decimal
|
|
14
|
+
from urllib.parse import quote
|
|
13
15
|
|
|
14
16
|
from exchanges_wrapper.http_client import ClientBinance, ClientBFX, ClientHBP, ClientOKX, ClientBybit
|
|
15
17
|
from exchanges_wrapper.errors import ExchangePyError
|
|
@@ -94,7 +96,7 @@ class Client:
|
|
|
94
96
|
self.rate_limits = None
|
|
95
97
|
self.data_streams = defaultdict(set)
|
|
96
98
|
self.active_orders = {}
|
|
97
|
-
self.wss_buffer = ExpiringDict(max_len=50, max_age_seconds=STATUS_TIMEOUT*
|
|
99
|
+
self.wss_buffer = ExpiringDict(max_len=50, max_age_seconds=STATUS_TIMEOUT*20)
|
|
98
100
|
self.stream_queue = defaultdict(set)
|
|
99
101
|
self.on_order_update_queues = {}
|
|
100
102
|
self.account_id = None
|
|
@@ -219,35 +221,52 @@ class Client:
|
|
|
219
221
|
symbol_info = self.symbols.get(symbol)
|
|
220
222
|
return f"{symbol_info.get('baseAsset')}-{symbol_info.get('quoteAsset')}"
|
|
221
223
|
|
|
222
|
-
def
|
|
224
|
+
def active_order(self, order_id: int, quantity="0", executed_qty="0", last_event=None):
|
|
225
|
+
if order_id not in self.active_orders:
|
|
226
|
+
self.active_orders[order_id] = {
|
|
227
|
+
'origQty': Decimal(quantity),
|
|
228
|
+
'executedQty': Decimal(executed_qty),
|
|
229
|
+
'lastEvent': last_event if last_event else [],
|
|
230
|
+
'eventIds': [],
|
|
231
|
+
'cancelled': False
|
|
232
|
+
}
|
|
233
|
+
elif last_event is not None:
|
|
234
|
+
self.active_orders[order_id]['lastEvent'] = last_event
|
|
235
|
+
|
|
236
|
+
self.active_orders[order_id]['lifeTime'] = int(time.time()) + 60 * STATUS_TIMEOUT
|
|
237
|
+
|
|
238
|
+
if not self.active_orders[order_id]["origQty"]:
|
|
239
|
+
self.active_orders[order_id]["origQty"] = Decimal(quantity)
|
|
240
|
+
|
|
241
|
+
def active_orders_clear(self):
|
|
223
242
|
ts = int(time.time())
|
|
224
|
-
self.active_orders = {
|
|
225
|
-
|
|
226
|
-
|
|
243
|
+
self.active_orders = {
|
|
244
|
+
key: val for key, val in self.active_orders.items() if val['lifeTime'] > ts
|
|
245
|
+
}
|
|
227
246
|
|
|
228
|
-
def refine_amount(self, symbol, amount: Union[str,
|
|
247
|
+
def refine_amount(self, symbol, amount: Union[str, Decimal], _quote=False):
|
|
229
248
|
if type(amount) is str: # to save time for developers
|
|
230
|
-
amount =
|
|
249
|
+
amount = Decimal(amount)
|
|
231
250
|
if self.loaded:
|
|
232
251
|
precision = self.symbols[symbol]["baseAssetPrecision"]
|
|
233
252
|
lot_size_filter = self.symbols[symbol]["filters"]["LOT_SIZE"]
|
|
234
|
-
step_size =
|
|
253
|
+
step_size = Decimal(lot_size_filter["stepSize"])
|
|
235
254
|
# noinspection PyStringFormat
|
|
236
255
|
amount = (
|
|
237
|
-
(f"%.{precision}f" % truncate(amount if
|
|
256
|
+
(f"%.{precision}f" % truncate(amount if _quote else (amount - amount % step_size), precision))
|
|
238
257
|
.rstrip("0")
|
|
239
258
|
.rstrip(".")
|
|
240
259
|
)
|
|
241
260
|
return amount
|
|
242
261
|
|
|
243
|
-
def refine_price(self, symbol, price: Union[str,
|
|
262
|
+
def refine_price(self, symbol, price: Union[str, Decimal]):
|
|
244
263
|
if isinstance(price, str): # to save time for developers
|
|
245
|
-
price =
|
|
264
|
+
price = Decimal(price)
|
|
246
265
|
|
|
247
266
|
if self.loaded:
|
|
248
267
|
precision = self.symbols[symbol]["baseAssetPrecision"]
|
|
249
268
|
price_filter = self.symbols[symbol]["filters"]["PRICE_FILTER"]
|
|
250
|
-
price = price - (price %
|
|
269
|
+
price = price - (price % Decimal(price_filter["tickSize"]))
|
|
251
270
|
# noinspection PyStringFormat
|
|
252
271
|
price = (
|
|
253
272
|
(f"%.{precision}f" % truncate(price, precision))
|
|
@@ -732,6 +751,16 @@ class Client:
|
|
|
732
751
|
# endregion
|
|
733
752
|
|
|
734
753
|
# region ACCOUNT ENDPOINTS
|
|
754
|
+
# binance-docs.github.io/apidocs/spot/en/#one-click-arrival-deposit-apply-for-expired-address-deposit-user_data
|
|
755
|
+
async def one_click_arrival_deposit(self, tx_id):
|
|
756
|
+
if self.exchange == 'binance':
|
|
757
|
+
params = {"txId": tx_id}
|
|
758
|
+
return await self.http.send_api_call(
|
|
759
|
+
"/sapi/v1/capital/deposit/credit-apply",
|
|
760
|
+
method="POST",
|
|
761
|
+
params=params,
|
|
762
|
+
signed=True,
|
|
763
|
+
)
|
|
735
764
|
|
|
736
765
|
async def fetch_api_info(self):
|
|
737
766
|
res, _ = await self.http.send_api_call("/v5/user/query-api", signed=True)
|
|
@@ -841,20 +870,9 @@ class Client:
|
|
|
841
870
|
**params,
|
|
842
871
|
)
|
|
843
872
|
)
|
|
844
|
-
logger.debug(f"create_order.res: {res}")
|
|
845
873
|
if res and isinstance(res, list) and res[6] == 'SUCCESS':
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
if ahead_ws:
|
|
849
|
-
logger.debug(f"create_order.ahead_ws: {ahead_ws}")
|
|
850
|
-
binance_res = bfx.order(res[4][0], response_type=False, wss_te=ahead_ws)
|
|
851
|
-
self.active_orders[order_id] = {
|
|
852
|
-
'lifeTime': int(time.time()) + 60 * STATUS_TIMEOUT,
|
|
853
|
-
'origQty': quantity,
|
|
854
|
-
'executedQty': "0",
|
|
855
|
-
'lastEvent': (),
|
|
856
|
-
'cancelled': False
|
|
857
|
-
}
|
|
874
|
+
self.active_order(res[4][0][0], quantity)
|
|
875
|
+
binance_res = bfx.order(res[4][0], response_type=False)
|
|
858
876
|
elif self.exchange == 'huobi':
|
|
859
877
|
params = {
|
|
860
878
|
'account-id': str(self.account_id),
|
|
@@ -1065,8 +1083,7 @@ class Client:
|
|
|
1065
1083
|
while timeout:
|
|
1066
1084
|
timeout -= 1
|
|
1067
1085
|
if self.active_orders.get(order_id, {}).get('cancelled', False):
|
|
1068
|
-
binance_res = bfx.order(res[4], response_type=True)
|
|
1069
|
-
binance_res.update({"status": 'CANCELED'})
|
|
1086
|
+
binance_res = bfx.order(res[4], response_type=True, cancelled=True)
|
|
1070
1087
|
break
|
|
1071
1088
|
await asyncio.sleep(0.1)
|
|
1072
1089
|
logger.debug(f"cancel_order.bitfinex {order_id}: timeout: {timeout}")
|
|
@@ -1576,12 +1593,22 @@ class Client:
|
|
|
1576
1593
|
params = {"asset": symbol, "amount": quantity}
|
|
1577
1594
|
if receive_window:
|
|
1578
1595
|
params["recvWindow"] = receive_window
|
|
1579
|
-
|
|
1580
|
-
"
|
|
1581
|
-
"
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1596
|
+
if self.master_email:
|
|
1597
|
+
logger.info(f"Collect {quantity}{symbol} to {self.master_email} sub-account")
|
|
1598
|
+
params["toEmail"] = quote(self.master_email)
|
|
1599
|
+
binance_res = await self.http.send_api_call(
|
|
1600
|
+
"/sapi/v1/sub-account/transfer/subToSub",
|
|
1601
|
+
"POST",
|
|
1602
|
+
params=params,
|
|
1603
|
+
signed=True
|
|
1604
|
+
)
|
|
1605
|
+
else:
|
|
1606
|
+
binance_res = await self.http.send_api_call(
|
|
1607
|
+
"/sapi/v1/sub-account/transfer/subToMaster",
|
|
1608
|
+
"POST",
|
|
1609
|
+
params=params,
|
|
1610
|
+
signed=True
|
|
1611
|
+
)
|
|
1585
1612
|
elif self.exchange == 'bitfinex':
|
|
1586
1613
|
if self.master_email is None or self.two_fa is None:
|
|
1587
1614
|
raise ValueError("This query requires master_email and 2FA")
|
|
@@ -10,13 +10,14 @@ import functools
|
|
|
10
10
|
import ujson as json
|
|
11
11
|
import logging.handlers
|
|
12
12
|
import toml
|
|
13
|
+
from decimal import Decimal
|
|
13
14
|
# noinspection PyPackageRequirements
|
|
14
15
|
import grpc
|
|
15
16
|
# noinspection PyPackageRequirements
|
|
16
17
|
from google.protobuf import json_format
|
|
17
18
|
#
|
|
18
19
|
from exchanges_wrapper import errors, api_pb2, api_pb2_grpc
|
|
19
|
-
from exchanges_wrapper.client import Client
|
|
20
|
+
from exchanges_wrapper.client import Client
|
|
20
21
|
from exchanges_wrapper.definitions import Side, OrderType, TimeInForce, ResponseType
|
|
21
22
|
from exchanges_wrapper.c_structures import OrderUpdateEvent, OrderTradesEvent, REST_RATE_LIMIT_INTERVAL
|
|
22
23
|
from exchanges_wrapper import WORK_PATH, CONFIG_FILE, LOG_FILE
|
|
@@ -221,6 +222,25 @@ class Martin(api_pb2_grpc.MartinServicer):
|
|
|
221
222
|
server_time = res.get('serverTime')
|
|
222
223
|
return api_pb2.FetchServerTimeResponse(server_time=server_time)
|
|
223
224
|
|
|
225
|
+
async def OneClickArrivalDeposit(self, request: api_pb2.MarketRequest,
|
|
226
|
+
_context: grpc.aio.ServicerContext) -> api_pb2.SimpleResponse():
|
|
227
|
+
open_client = OpenClient.get_client(request.client_id)
|
|
228
|
+
client = open_client.client
|
|
229
|
+
response = api_pb2.SimpleResponse()
|
|
230
|
+
tx_id = request.symbol
|
|
231
|
+
try:
|
|
232
|
+
res = await client.one_click_arrival_deposit(tx_id)
|
|
233
|
+
except asyncio.CancelledError:
|
|
234
|
+
pass # Task cancellation should not be logged as an error
|
|
235
|
+
except Exception as ex:
|
|
236
|
+
logger.error(f"OneClickArrivalDeposit for {open_client.name}:{request.symbol} exception: {ex}")
|
|
237
|
+
_context.set_details(f"{ex}")
|
|
238
|
+
_context.set_code(grpc.StatusCode.UNKNOWN)
|
|
239
|
+
else:
|
|
240
|
+
response.success = True
|
|
241
|
+
response.result = json.dumps(str(res))
|
|
242
|
+
return response
|
|
243
|
+
|
|
224
244
|
async def ResetRateLimit(self, request: api_pb2.OpenClientConnectionId,
|
|
225
245
|
_context: grpc.aio.ServicerContext) -> api_pb2.SimpleResponse:
|
|
226
246
|
Martin.rate_limiter = max(Martin.rate_limiter or 0, request.rate_limiter)
|
|
@@ -262,28 +282,19 @@ class Martin(api_pb2_grpc.MartinServicer):
|
|
|
262
282
|
_context.set_details(f"{ex}")
|
|
263
283
|
_context.set_code(grpc.StatusCode.UNKNOWN)
|
|
264
284
|
else:
|
|
265
|
-
# logger.info(f"FetchOpenOrders.res: {res}")
|
|
266
285
|
open_client.ts_rlc = time.time()
|
|
267
286
|
active_orders = []
|
|
268
287
|
for order in res:
|
|
269
288
|
order_id = order['orderId']
|
|
270
289
|
active_orders.append(order_id)
|
|
271
290
|
new_order = json_format.ParseDict(order, response_order, ignore_unknown_fields=True)
|
|
272
|
-
# logger.debug(f"FetchOpenOrders.new_order: {new_order}")
|
|
273
291
|
response.items.append(new_order)
|
|
274
292
|
if client.exchange == 'bitfinex':
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
else:
|
|
278
|
-
client.active_orders[order_id] = {
|
|
279
|
-
'lifeTime': int(time.time()) + 60 * STATUS_TIMEOUT,
|
|
280
|
-
'origQty': order['origQty'],
|
|
281
|
-
'executedQty': order['executedQty'],
|
|
282
|
-
'lastEvent': (),
|
|
283
|
-
'cancelled': False
|
|
284
|
-
}
|
|
293
|
+
client.active_order(order_id, order['origQty'], order['executedQty'])
|
|
294
|
+
|
|
285
295
|
if client.exchange == 'bitfinex':
|
|
286
|
-
client.active_orders_clear(
|
|
296
|
+
client.active_orders_clear()
|
|
297
|
+
|
|
287
298
|
response.rate_limiter = Martin.rate_limiter
|
|
288
299
|
return response
|
|
289
300
|
|
|
@@ -791,7 +802,6 @@ class Martin(api_pb2_grpc.MartinServicer):
|
|
|
791
802
|
return
|
|
792
803
|
else:
|
|
793
804
|
event = vars(_event)
|
|
794
|
-
# logger.info(f"OnOrderUpdate: {event}")
|
|
795
805
|
event.pop('handlers', None)
|
|
796
806
|
response.success = True
|
|
797
807
|
response.result = json.dumps(str(event))
|
|
@@ -867,14 +877,16 @@ class Martin(api_pb2_grpc.MartinServicer):
|
|
|
867
877
|
_context.set_details(f"{ex}")
|
|
868
878
|
_context.set_code(grpc.StatusCode.UNKNOWN)
|
|
869
879
|
else:
|
|
870
|
-
if
|
|
880
|
+
if not res or Decimal(res.get('executedQty', '0')):
|
|
871
881
|
await self.create_trade_stream_event(_queue, client, open_client, request)
|
|
872
|
-
await asyncio.sleep(HEARTBEAT)
|
|
873
882
|
json_format.ParseDict(res, response, ignore_unknown_fields=True)
|
|
874
883
|
return response
|
|
875
884
|
|
|
876
|
-
async def TransferToMaster(
|
|
877
|
-
|
|
885
|
+
async def TransferToMaster(
|
|
886
|
+
self,
|
|
887
|
+
request: api_pb2.MarketRequest,
|
|
888
|
+
_context: grpc.aio.ServicerContext
|
|
889
|
+
) -> api_pb2.SimpleResponse:
|
|
878
890
|
response = api_pb2.SimpleResponse()
|
|
879
891
|
response.success = False
|
|
880
892
|
open_client = OpenClient.get_client(request.client_id)
|
|
@@ -888,7 +900,6 @@ class Martin(api_pb2_grpc.MartinServicer):
|
|
|
888
900
|
_context.set_code(grpc.StatusCode.RESOURCE_EXHAUSTED)
|
|
889
901
|
except Exception as ex:
|
|
890
902
|
logger.error(f"TransferToMaster for {open_client.name}: {request.symbol} exception: {ex}")
|
|
891
|
-
# logger.debug(f"TransferToMaster for {open_client.name}: {request.symbol} error: {traceback.format_exc()}")
|
|
892
903
|
_context.set_details(f"{ex}")
|
|
893
904
|
_context.set_code(grpc.StatusCode.UNKNOWN)
|
|
894
905
|
else:
|
{exchanges_wrapper-1.4.6 → exchanges_wrapper-1.4.8}/exchanges_wrapper/exch_srv_cfg.toml.template
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Parameters for exchanges-wrapper REST API Server exch_srv.py
|
|
2
2
|
# Copyright © 2021 Jerry Fedorenko aka VM
|
|
3
|
-
# __version__ = "1.4.
|
|
3
|
+
# __version__ = "1.4.8"
|
|
4
4
|
|
|
5
5
|
# region endpoint
|
|
6
6
|
[endpoint]
|
|
@@ -78,6 +78,14 @@
|
|
|
78
78
|
api_secret = '*********** Place secret API key there ************'
|
|
79
79
|
test_net = false
|
|
80
80
|
|
|
81
|
+
[[accounts]]
|
|
82
|
+
exchange = 'binance'
|
|
83
|
+
name = 'BinanceSub2'
|
|
84
|
+
api_key = '*********** Place API key there ************'
|
|
85
|
+
api_secret = '*********** Place secret API key there ************'
|
|
86
|
+
master_email = 'sub1@mail.com' # If set, 'BinanceSub1' use for collecting assets instead of Main
|
|
87
|
+
test_net = false
|
|
88
|
+
|
|
81
89
|
# Binance.us accounts
|
|
82
90
|
[[accounts]]
|
|
83
91
|
exchange = 'binance_us'
|
|
@@ -163,6 +163,9 @@ def order(res: {}, response_type=None) -> {}:
|
|
|
163
163
|
"updateTime": update_time,
|
|
164
164
|
"isWorking": is_working,
|
|
165
165
|
"origQuoteOrderQty": orig_quote_order_qty,
|
|
166
|
+
"commission_amount": res.get('fee', "0"),
|
|
167
|
+
"commission_asset": res.get('feeCcy', ""),
|
|
168
|
+
"is_maker_side": False,
|
|
166
169
|
}
|
|
167
170
|
else:
|
|
168
171
|
return {
|
|
@@ -460,7 +463,7 @@ def on_order_update(res: {}) -> {}:
|
|
|
460
463
|
"t": int(res.get('tradeId') or -1),
|
|
461
464
|
"I": 123456789,
|
|
462
465
|
"w": True,
|
|
463
|
-
"m":
|
|
466
|
+
"m": bool(res.get('execType', 'T') == 'M'),
|
|
464
467
|
"M": False,
|
|
465
468
|
"O": int(res.get('cTime')),
|
|
466
469
|
"Z": cumulative_quote_asset,
|
|
@@ -36,6 +36,7 @@ service Martin {
|
|
|
36
36
|
rpc FetchFundingWallet(FetchFundingWalletRequest) returns (FetchFundingWalletResponse) {}
|
|
37
37
|
rpc TransferToMaster(MarketRequest) returns (SimpleResponse) {}
|
|
38
38
|
rpc CheckStream (MarketRequest) returns (SimpleResponse) {}
|
|
39
|
+
rpc OneClickArrivalDeposit (MarketRequest) returns (SimpleResponse) {}
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
message OnBalanceUpdateResponse {
|
|
@@ -389,32 +389,54 @@ class BfxPrivateEventsDataStream(EventsDataStream):
|
|
|
389
389
|
await self.ws_listener(request)
|
|
390
390
|
|
|
391
391
|
async def _handle_event(self, msg_data, *args):
|
|
392
|
-
|
|
392
|
+
event_type = msg_data[1]
|
|
393
|
+
event = msg_data[2]
|
|
394
|
+
|
|
395
|
+
# if event_type in ('os', 'on', 'ou', 'oc', 'te', 'tu'):
|
|
396
|
+
# logger.info(f"BitfinexPrivate: {event_type}: {event}")
|
|
397
|
+
|
|
393
398
|
content = None
|
|
394
|
-
if
|
|
395
|
-
content = bfx.on_funds_update(
|
|
396
|
-
elif
|
|
397
|
-
order_id =
|
|
398
|
-
|
|
399
|
-
content = bfx.on_order_update(
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
if self.client.active_orders.
|
|
405
|
-
self.client.
|
|
406
|
-
|
|
399
|
+
if event_type in ('wu', 'ws'):
|
|
400
|
+
content = bfx.on_funds_update(event)
|
|
401
|
+
elif event_type == 'on':
|
|
402
|
+
order_id = event[0]
|
|
403
|
+
self.client.active_order(order_id, quantity=str(abs(event[7])))
|
|
404
|
+
content = bfx.on_order_update(event, self.client.active_orders[order_id])
|
|
405
|
+
|
|
406
|
+
elif event_type in ('te', 'tu'):
|
|
407
|
+
order_id = event[3]
|
|
408
|
+
|
|
409
|
+
if order_id in self.client.active_orders and self.client.active_orders[order_id]["lastEvent"]:
|
|
410
|
+
if event[0] not in self.client.active_orders[order_id]["eventIds"]:
|
|
411
|
+
self.client.active_order(order_id, last_event=event)
|
|
412
|
+
self.client.active_orders[order_id]['executedQty'] += Decimal(str(abs(event[4])))
|
|
413
|
+
elif event_type == 'tu':
|
|
414
|
+
self.client.active_order(order_id, last_event=event)
|
|
407
415
|
else:
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
416
|
+
self.client.active_order(order_id, last_event=event)
|
|
417
|
+
self.client.active_orders[order_id]['executedQty'] += Decimal(str(abs(event[4])))
|
|
418
|
+
|
|
419
|
+
orig_qty = self.client.active_orders[order_id]['origQty']
|
|
420
|
+
executed_qty = self.client.active_orders[order_id]['executedQty']
|
|
421
|
+
if orig_qty and executed_qty < orig_qty and event[0] not in self.client.active_orders[order_id]["eventIds"]:
|
|
422
|
+
self.client.active_orders[order_id]["eventIds"].append(event[0])
|
|
423
|
+
content = bfx.on_order_trade(event, str(orig_qty), str(executed_qty))
|
|
424
|
+
elif oc_event := self.wss_event_buffer.pop(order_id, None):
|
|
425
|
+
content = bfx.on_order_update(oc_event, self.client.active_orders[order_id])
|
|
426
|
+
|
|
427
|
+
# logger.info(f"Active order: {order_id}: {self.client.active_orders[order_id]}")
|
|
428
|
+
|
|
429
|
+
elif event_type == 'oc':
|
|
430
|
+
order_id = event[0]
|
|
431
|
+
orig_qty = str(abs(event[7]))
|
|
432
|
+
self.client.active_order(order_id, quantity=orig_qty)
|
|
433
|
+
executed_qty = self.client.active_orders[order_id]['executedQty']
|
|
434
|
+
if 'CANCELED' in event[13] or executed_qty >= Decimal(orig_qty):
|
|
435
|
+
self.client.active_orders[order_id]['cancelled'] = True
|
|
436
|
+
content = bfx.on_order_update(event, self.client.active_orders[order_id])
|
|
437
|
+
else:
|
|
438
|
+
self.wss_event_buffer[order_id] = event
|
|
439
|
+
|
|
418
440
|
if content:
|
|
419
441
|
await self.client.events.wrap_event(content).fire(self.trade_id)
|
|
420
442
|
|
|
@@ -14,7 +14,7 @@ classifiers=["Programming Language :: Python :: 3",
|
|
|
14
14
|
"Operating System :: Microsoft :: Windows",
|
|
15
15
|
"Operating System :: MacOS"]
|
|
16
16
|
dynamic = ["version", "description"]
|
|
17
|
-
requires-python = ">=3.
|
|
17
|
+
requires-python = ">=3.9"
|
|
18
18
|
|
|
19
19
|
dependencies = [
|
|
20
20
|
"crypto-ws-api==2.0.6",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|