ccxt 4.0.100__py2.py3-none-any.whl → 4.0.102__py2.py3-none-any.whl
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.
- ccxt/__init__.py +1 -3
- ccxt/abstract/binance.py +8 -0
- ccxt/abstract/binancecoinm.py +8 -0
- ccxt/abstract/binanceus.py +8 -0
- ccxt/abstract/binanceusdm.py +8 -0
- ccxt/abstract/bingx.py +16 -1
- ccxt/async_support/__init__.py +1 -3
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/binance.py +36 -1
- ccxt/async_support/bingx.py +41 -4
- ccxt/async_support/bitbank.py +11 -0
- ccxt/async_support/bitfinex.py +12 -8
- ccxt/async_support/bitflyer.py +39 -10
- ccxt/async_support/bitforex.py +0 -8
- ccxt/async_support/bitget.py +15 -5
- ccxt/async_support/bitmart.py +66 -0
- ccxt/async_support/bitstamp1.py +22 -0
- ccxt/async_support/bl3p.py +32 -0
- ccxt/async_support/bybit.py +120 -48
- ccxt/async_support/coinbasepro.py +11 -0
- ccxt/async_support/currencycom.py +1 -1
- ccxt/async_support/gemini.py +1 -0
- ccxt/async_support/huobi.py +1 -1
- ccxt/async_support/huobijp.py +1 -1
- ccxt/async_support/idex.py +1 -1
- ccxt/async_support/kucoinfutures.py +46 -51
- ccxt/async_support/lbank.py +1 -1
- ccxt/async_support/lbank2.py +1 -1
- ccxt/base/exchange.py +1 -1
- ccxt/binance.py +36 -1
- ccxt/bingx.py +41 -4
- ccxt/bitbank.py +11 -0
- ccxt/bitfinex.py +12 -8
- ccxt/bitflyer.py +39 -10
- ccxt/bitforex.py +0 -8
- ccxt/bitget.py +15 -5
- ccxt/bitmart.py +66 -0
- ccxt/bitstamp1.py +22 -0
- ccxt/bl3p.py +32 -0
- ccxt/bybit.py +120 -48
- ccxt/coinbasepro.py +11 -0
- ccxt/currencycom.py +1 -1
- ccxt/gemini.py +1 -0
- ccxt/huobi.py +1 -1
- ccxt/huobijp.py +1 -1
- ccxt/idex.py +1 -1
- ccxt/kucoinfutures.py +46 -51
- ccxt/lbank.py +1 -1
- ccxt/lbank2.py +1 -1
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/binance.py +7 -7
- ccxt/pro/bybit.py +16 -16
- ccxt/pro/coinbasepro.py +10 -10
- ccxt/pro/huobijp.py +1 -2
- ccxt/pro/krakenfutures.py +7 -7
- ccxt/pro/kucoin.py +42 -2
- ccxt/pro/kucoinfutures.py +3 -3
- ccxt/pro/phemex.py +2 -2
- ccxt/test/test_async.py +1 -1
- ccxt/test/test_sync.py +1 -1
- {ccxt-4.0.100.dist-info → ccxt-4.0.102.dist-info}/METADATA +6 -7
- {ccxt-4.0.100.dist-info → ccxt-4.0.102.dist-info}/RECORD +64 -65
- ccxt/abstract/bkex.py +0 -58
- {ccxt-4.0.100.dist-info → ccxt-4.0.102.dist-info}/WHEEL +0 -0
- {ccxt-4.0.100.dist-info → ccxt-4.0.102.dist-info}/top_level.txt +0 -0
@@ -850,58 +850,53 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
850
850
|
request = {
|
851
851
|
'symbol': market['id'],
|
852
852
|
}
|
853
|
-
response = await self.
|
853
|
+
response = await self.futuresPrivateGetPosition(self.extend(request, params))
|
854
854
|
#
|
855
|
-
#
|
856
|
-
#
|
857
|
-
#
|
858
|
-
#
|
859
|
-
#
|
860
|
-
#
|
861
|
-
#
|
862
|
-
#
|
863
|
-
#
|
864
|
-
#
|
865
|
-
#
|
866
|
-
#
|
867
|
-
#
|
868
|
-
#
|
869
|
-
#
|
870
|
-
#
|
871
|
-
#
|
872
|
-
#
|
873
|
-
#
|
874
|
-
#
|
875
|
-
#
|
876
|
-
#
|
877
|
-
#
|
878
|
-
#
|
879
|
-
#
|
880
|
-
#
|
881
|
-
#
|
882
|
-
#
|
883
|
-
#
|
884
|
-
#
|
885
|
-
#
|
886
|
-
#
|
887
|
-
#
|
888
|
-
#
|
889
|
-
#
|
890
|
-
#
|
891
|
-
#
|
892
|
-
#
|
893
|
-
#
|
894
|
-
#
|
895
|
-
#
|
896
|
-
#
|
897
|
-
# "isInverse": False,
|
898
|
-
# "maintainMargin": 0.004
|
899
|
-
# }
|
900
|
-
# ]
|
901
|
-
# }
|
855
|
+
# {
|
856
|
+
# "code": "200000",
|
857
|
+
# "data": {
|
858
|
+
# "id": "6505ee6eaff4070001f651c4",
|
859
|
+
# "symbol": "XBTUSDTM",
|
860
|
+
# "autoDeposit": False,
|
861
|
+
# "maintMarginReq": 0,
|
862
|
+
# "riskLimit": 200,
|
863
|
+
# "realLeverage": 0.0,
|
864
|
+
# "crossMode": False,
|
865
|
+
# "delevPercentage": 0.0,
|
866
|
+
# "currentTimestamp": 1694887534594,
|
867
|
+
# "currentQty": 0,
|
868
|
+
# "currentCost": 0.0,
|
869
|
+
# "currentComm": 0.0,
|
870
|
+
# "unrealisedCost": 0.0,
|
871
|
+
# "realisedGrossCost": 0.0,
|
872
|
+
# "realisedCost": 0.0,
|
873
|
+
# "isOpen": False,
|
874
|
+
# "markPrice": 26611.71,
|
875
|
+
# "markValue": 0.0,
|
876
|
+
# "posCost": 0.0,
|
877
|
+
# "posCross": 0,
|
878
|
+
# "posInit": 0.0,
|
879
|
+
# "posComm": 0.0,
|
880
|
+
# "posLoss": 0.0,
|
881
|
+
# "posMargin": 0.0,
|
882
|
+
# "posMaint": 0.0,
|
883
|
+
# "maintMargin": 0.0,
|
884
|
+
# "realisedGrossPnl": 0.0,
|
885
|
+
# "realisedPnl": 0.0,
|
886
|
+
# "unrealisedPnl": 0.0,
|
887
|
+
# "unrealisedPnlPcnt": 0,
|
888
|
+
# "unrealisedRoePcnt": 0,
|
889
|
+
# "avgEntryPrice": 0.0,
|
890
|
+
# "liquidationPrice": 0.0,
|
891
|
+
# "bankruptPrice": 0.0,
|
892
|
+
# "settleCurrency": "USDT",
|
893
|
+
# "maintainMargin": 0,
|
894
|
+
# "riskLimitLevel": 1
|
895
|
+
# }
|
896
|
+
# }
|
902
897
|
#
|
903
|
-
data = self.safe_value(response, 'data',
|
904
|
-
return self.parse_position(data
|
898
|
+
data = self.safe_value(response, 'data', {})
|
899
|
+
return self.parse_position(data, market)
|
905
900
|
|
906
901
|
async def fetch_positions(self, symbols: Optional[List[str]] = None, params={}):
|
907
902
|
"""
|
@@ -1043,7 +1038,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
1043
1038
|
'unrealizedPnl': self.parse_number(unrealisedPnl),
|
1044
1039
|
'contracts': self.parse_number(Precise.string_abs(size)),
|
1045
1040
|
'contractSize': self.safe_value(market, 'contractSize'),
|
1046
|
-
'realizedPnl': self.safe_number(position, '
|
1041
|
+
'realizedPnl': self.safe_number(position, 'realisedPnl'),
|
1047
1042
|
'marginRatio': None,
|
1048
1043
|
'liquidationPrice': self.safe_number(position, 'liquidationPrice'),
|
1049
1044
|
'markPrice': self.safe_number(position, 'markPrice'),
|
ccxt/async_support/lbank.py
CHANGED
@@ -394,7 +394,7 @@ class lbank(Exchange, ImplicitAPI):
|
|
394
394
|
if since is not None:
|
395
395
|
request['time'] = since
|
396
396
|
if limit is not None:
|
397
|
-
request['size'] = limit
|
397
|
+
request['size'] = min(limit, 600)
|
398
398
|
response = await self.publicGetTrades(self.extend(request, params))
|
399
399
|
return self.parse_trades(response, market, since, limit)
|
400
400
|
|
ccxt/async_support/lbank2.py
CHANGED
@@ -895,7 +895,7 @@ class lbank2(Exchange, ImplicitAPI):
|
|
895
895
|
if since is not None:
|
896
896
|
request['time'] = since
|
897
897
|
if limit is not None:
|
898
|
-
request['size'] = limit
|
898
|
+
request['size'] = min(limit, 600)
|
899
899
|
else:
|
900
900
|
request['size'] = 600 # max
|
901
901
|
method = self.safe_string(params, 'method')
|
ccxt/base/exchange.py
CHANGED
ccxt/binance.py
CHANGED
@@ -425,6 +425,7 @@ class binance(Exchange, ImplicitAPI):
|
|
425
425
|
'portfolio/interest-history': 0.6667,
|
426
426
|
'portfolio/asset-index-price': 0.1,
|
427
427
|
'portfolio/repay-futures-switch': 3, # Weight(IP): 30 => cost = 0.1 * 30 = 3
|
428
|
+
'portfolio/margin-asset-leverage': 5, # Weight(IP): 50 => cost = 0.1 * 50 = 5
|
428
429
|
# staking
|
429
430
|
'staking/productList': 0.1,
|
430
431
|
'staking/position': 0.1,
|
@@ -437,6 +438,11 @@ class binance(Exchange, ImplicitAPI):
|
|
437
438
|
'lending/auto-invest/plan/list': 0.1,
|
438
439
|
'lending/auto-invest/plan/id': 0.1,
|
439
440
|
'lending/auto-invest/history/list': 0.1,
|
441
|
+
'lending/auto-invest/index/info': 0.1, # Weight(IP): 1 => cost = 0.1 * 1 = 0.1
|
442
|
+
'lending/auto-invest/index/user-summary': 0.1, # Weight(IP): 1 => cost = 0.1 * 1 = 0.1
|
443
|
+
'lending/auto-invest/one-off/status': 0.1, # Weight(IP): 1 => cost = 0.1 * 1 = 0.1
|
444
|
+
'lending/auto-invest/redeem/history': 0.1, # Weight(IP): 1 => cost = 0.1 * 1 = 0.1
|
445
|
+
'lending/auto-invest/rebalance/history': 0.1, # Weight(IP): 1 => cost = 0.1 * 1 = 0.1
|
440
446
|
# simple earn
|
441
447
|
'simple-earn/flexible/list': 15,
|
442
448
|
'simple-earn/locked/list': 15,
|
@@ -564,6 +570,8 @@ class binance(Exchange, ImplicitAPI):
|
|
564
570
|
'lending/auto-invest/plan/add': 0.1, # Weight(IP): 1 => cost = 0.1 * 1 = 0.1
|
565
571
|
'lending/auto-invest/plan/edit': 0.1, # Weight(IP): 1 => cost = 0.1 * 1 = 0.1
|
566
572
|
'lending/auto-invest/plan/edit-status': 0.1, # Weight(IP): 1 => cost = 0.1 * 1 = 0.1
|
573
|
+
'lending/auto-invest/one-off': 0.1, # Weight(IP): 1 => cost = 0.1 * 1 = 0.1
|
574
|
+
'lending/auto-invest/redeem': 0.1, # Weight(IP): 1 => cost = 0.1 * 1 = 0.1
|
567
575
|
# simple earn
|
568
576
|
'simple-earn/flexible/subscribe': 0.1,
|
569
577
|
'simple-earn/locked/subscribe': 0.1,
|
@@ -3298,6 +3306,18 @@ class binance(Exchange, ImplicitAPI):
|
|
3298
3306
|
# "M": True # Was the trade the best price match?
|
3299
3307
|
# }
|
3300
3308
|
#
|
3309
|
+
# REST: aggregate trades for swap & future(both linear and inverse)
|
3310
|
+
#
|
3311
|
+
# {
|
3312
|
+
# "a": "269772814",
|
3313
|
+
# "p": "25864.1",
|
3314
|
+
# "q": "3",
|
3315
|
+
# "f": "662149354",
|
3316
|
+
# "l": "662149355",
|
3317
|
+
# "T": "1694209776022",
|
3318
|
+
# "m": False,
|
3319
|
+
# }
|
3320
|
+
#
|
3301
3321
|
# recent public trades and old public trades
|
3302
3322
|
# https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md#recent-trades-list
|
3303
3323
|
# https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md#old-trade-lookup-market_data
|
@@ -3529,7 +3549,8 @@ class binance(Exchange, ImplicitAPI):
|
|
3529
3549
|
if until is not None:
|
3530
3550
|
request['endTime'] = until
|
3531
3551
|
if limit is not None:
|
3532
|
-
|
3552
|
+
isFutureOrSwap = (market['swap'] or market['future'])
|
3553
|
+
request['limit'] = min(limit, 1000) if isFutureOrSwap else limit # default = 500, maximum = 1000
|
3533
3554
|
params = self.omit(params, ['until', 'fetchTradesMethod'])
|
3534
3555
|
#
|
3535
3556
|
# Caveats:
|
@@ -3557,6 +3578,20 @@ class binance(Exchange, ImplicitAPI):
|
|
3557
3578
|
# }
|
3558
3579
|
# ]
|
3559
3580
|
#
|
3581
|
+
# inverse(swap & future)
|
3582
|
+
#
|
3583
|
+
# [
|
3584
|
+
# {
|
3585
|
+
# "a": "269772814",
|
3586
|
+
# "p": "25864.1",
|
3587
|
+
# "q": "3",
|
3588
|
+
# "f": "662149354",
|
3589
|
+
# "l": "662149355",
|
3590
|
+
# "T": "1694209776022",
|
3591
|
+
# "m": False,
|
3592
|
+
# },
|
3593
|
+
# ]
|
3594
|
+
#
|
3560
3595
|
# recent public trades and historical public trades
|
3561
3596
|
#
|
3562
3597
|
# [
|
ccxt/bingx.py
CHANGED
@@ -153,6 +153,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
153
153
|
'quote/klines': 1,
|
154
154
|
'quote/openInterest': 1,
|
155
155
|
'quote/ticker': 1,
|
156
|
+
'quote/bookTicker': 1,
|
156
157
|
},
|
157
158
|
},
|
158
159
|
'private': {
|
@@ -204,11 +205,17 @@ class bingx(Exchange, ImplicitAPI):
|
|
204
205
|
'private': {
|
205
206
|
'get': {
|
206
207
|
'capital/config/getall': 3,
|
208
|
+
'capital/deposit/address': 1,
|
209
|
+
'capital/innerTransfer/records': 1,
|
210
|
+
'capital/subAccount/deposit/address': 1,
|
211
|
+
'capital/deposit/subHisrec': 1,
|
212
|
+
'capital/subAccount/innerTransfer/records': 1,
|
207
213
|
},
|
208
214
|
'post': {
|
209
215
|
'capital/withdraw/apply': 3,
|
210
216
|
'capital/innerTransfer/apply': 3,
|
211
217
|
'capital/subAccountInnerTransfer/apply': 3,
|
218
|
+
'capital/deposit/createSubAddress': 1,
|
212
219
|
},
|
213
220
|
},
|
214
221
|
},
|
@@ -219,6 +226,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
219
226
|
'get': {
|
220
227
|
'list': 3,
|
221
228
|
'assets': 3,
|
229
|
+
'apiKey/query': 1,
|
222
230
|
},
|
223
231
|
'post': {
|
224
232
|
'create': 3,
|
@@ -233,13 +241,42 @@ class bingx(Exchange, ImplicitAPI):
|
|
233
241
|
'account': {
|
234
242
|
'v1': {
|
235
243
|
'private': {
|
244
|
+
'get': {
|
245
|
+
'uid': 1,
|
246
|
+
},
|
236
247
|
'post': {
|
237
|
-
'uid': 3,
|
238
248
|
'innerTransfer/authorizeSubAccount': 3,
|
239
249
|
},
|
240
250
|
},
|
241
251
|
},
|
242
252
|
},
|
253
|
+
'copyTrading': {
|
254
|
+
'v1': {
|
255
|
+
'private': {
|
256
|
+
'get': {
|
257
|
+
'swap/trace/currentTrack': 1,
|
258
|
+
},
|
259
|
+
'post': {
|
260
|
+
'swap/trace/closeTrackOrder': 1,
|
261
|
+
'swap/trace/setTPSL': 1,
|
262
|
+
},
|
263
|
+
},
|
264
|
+
},
|
265
|
+
},
|
266
|
+
'api': {
|
267
|
+
'v3': {
|
268
|
+
'private': {
|
269
|
+
'get': {
|
270
|
+
'asset/transfer': 1,
|
271
|
+
'capital/deposit/hisrec': 1,
|
272
|
+
'capital/withdraw/history': 1,
|
273
|
+
},
|
274
|
+
'post': {
|
275
|
+
'post/asset/transfer': 1,
|
276
|
+
},
|
277
|
+
},
|
278
|
+
},
|
279
|
+
},
|
243
280
|
},
|
244
281
|
'timeframes': {
|
245
282
|
'1m': '1m',
|
@@ -1437,9 +1474,9 @@ class bingx(Exchange, ImplicitAPI):
|
|
1437
1474
|
:param float [price]: the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
1438
1475
|
:param dict [params]: extra parameters specific to the bingx api endpoint
|
1439
1476
|
:param bool [params.postOnly]: True to place a post only order
|
1440
|
-
:param
|
1441
|
-
:param float [params.stopLossPrice]: stop loss trigger price
|
1442
|
-
:param float [params.takeProfitPrice]: take profit trigger price
|
1477
|
+
:param float [params.triggerPrice]: *swap only* triggerPrice at which the attached take profit / stop loss order will be triggered
|
1478
|
+
:param float [params.stopLossPrice]: *swap only* stop loss trigger price
|
1479
|
+
:param float [params.takeProfitPrice]: *swap only* take profit trigger price
|
1443
1480
|
:returns dict: an `order structure <https://github.com/ccxt/ccxt/wiki/Manual#order-structure>`
|
1444
1481
|
"""
|
1445
1482
|
self.load_markets()
|
ccxt/bitbank.py
CHANGED
@@ -318,6 +318,17 @@ class bitbank(Exchange, ImplicitAPI):
|
|
318
318
|
return self.parse_order_book(orderbook, market['symbol'], timestamp)
|
319
319
|
|
320
320
|
def parse_trade(self, trade, market=None):
|
321
|
+
#
|
322
|
+
# fetchTrades
|
323
|
+
#
|
324
|
+
# {
|
325
|
+
# "transaction_id": "1143247037",
|
326
|
+
# "side": "buy",
|
327
|
+
# "price": "3836025",
|
328
|
+
# "amount": "0.0005",
|
329
|
+
# "executed_at": "1694249441593"
|
330
|
+
# }
|
331
|
+
#
|
321
332
|
timestamp = self.safe_integer(trade, 'executed_at')
|
322
333
|
market = self.safe_market(None, market)
|
323
334
|
priceString = self.safe_string(trade, 'price')
|
ccxt/bitfinex.py
CHANGED
@@ -899,14 +899,6 @@ class bitfinex(Exchange, ImplicitAPI):
|
|
899
899
|
# "type":"sell"
|
900
900
|
# }
|
901
901
|
#
|
902
|
-
# { "timestamp":1637258238,
|
903
|
-
# "tid":894452800,
|
904
|
-
# "price":"0.99958",
|
905
|
-
# "amount":"261.90514",
|
906
|
-
# "exchange":"bitfinex",
|
907
|
-
# "type":"buy"
|
908
|
-
# }
|
909
|
-
#
|
910
902
|
# fetchMyTrades(private) v1
|
911
903
|
#
|
912
904
|
# {
|
@@ -981,6 +973,18 @@ class bitfinex(Exchange, ImplicitAPI):
|
|
981
973
|
if since is not None:
|
982
974
|
request['timestamp'] = self.parse_to_int(since / 1000)
|
983
975
|
response = self.publicGetTradesSymbol(self.extend(request, params))
|
976
|
+
#
|
977
|
+
# [
|
978
|
+
# {
|
979
|
+
# "timestamp": "1694284565",
|
980
|
+
# "tid": "1415415034",
|
981
|
+
# "price": "25862.0",
|
982
|
+
# "amount": "0.00020685",
|
983
|
+
# "exchange": "bitfinex",
|
984
|
+
# "type": "buy"
|
985
|
+
# },
|
986
|
+
# ]
|
987
|
+
#
|
984
988
|
return self.parse_trades(response, market, since, limit)
|
985
989
|
|
986
990
|
def fetch_my_trades(self, symbol: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
ccxt/bitflyer.py
CHANGED
@@ -395,7 +395,7 @@ class bitflyer(Exchange, ImplicitAPI):
|
|
395
395
|
#
|
396
396
|
# fetchTrades(public) v1
|
397
397
|
#
|
398
|
-
#
|
398
|
+
# {
|
399
399
|
# "id":2278466664,
|
400
400
|
# "side":"SELL",
|
401
401
|
# "price":56810.7,
|
@@ -405,16 +405,18 @@ class bitflyer(Exchange, ImplicitAPI):
|
|
405
405
|
# "sell_child_order_acceptance_id":"JRF20211119-114639-236919"
|
406
406
|
# }
|
407
407
|
#
|
408
|
-
#
|
409
|
-
# "id":2278463423,
|
410
|
-
# "side":"BUY",
|
411
|
-
# "price":56757.83,
|
412
|
-
# "size":0.6003,"exec_date":"2021-11-19T11:28:00.523",
|
413
|
-
# "buy_child_order_acceptance_id":"JRF20211119-112800-236526",
|
414
|
-
# "sell_child_order_acceptance_id":"JRF20211119-112734-062017"
|
415
|
-
# }
|
416
|
-
#
|
408
|
+
# fetchMyTrades
|
417
409
|
#
|
410
|
+
# {
|
411
|
+
# "id": 37233,
|
412
|
+
# "side": "BUY",
|
413
|
+
# "price": 33470,
|
414
|
+
# "size": 0.01,
|
415
|
+
# "exec_date": "2015-07-07T09:57:40.397",
|
416
|
+
# "child_order_id": "JOR20150707-060559-021935",
|
417
|
+
# "child_order_acceptance_id": "JRF20150707-060559-396699"
|
418
|
+
# "commission": 0,
|
419
|
+
# },
|
418
420
|
#
|
419
421
|
side = self.safe_string_lower(trade, 'side')
|
420
422
|
if side is not None:
|
@@ -465,6 +467,19 @@ class bitflyer(Exchange, ImplicitAPI):
|
|
465
467
|
if limit is not None:
|
466
468
|
request['count'] = limit
|
467
469
|
response = self.publicGetGetexecutions(self.extend(request, params))
|
470
|
+
#
|
471
|
+
# [
|
472
|
+
# {
|
473
|
+
# "id": 39287,
|
474
|
+
# "side": "BUY",
|
475
|
+
# "price": 31690,
|
476
|
+
# "size": 27.04,
|
477
|
+
# "exec_date": "2015-07-08T02:43:34.823",
|
478
|
+
# "buy_child_order_acceptance_id": "JRF20150707-200203-452209",
|
479
|
+
# "sell_child_order_acceptance_id": "JRF20150708-024334-060234"
|
480
|
+
# },
|
481
|
+
# ]
|
482
|
+
#
|
468
483
|
return self.parse_trades(response, market, since, limit)
|
469
484
|
|
470
485
|
def fetch_trading_fee(self, symbol: str, params={}):
|
@@ -677,6 +692,20 @@ class bitflyer(Exchange, ImplicitAPI):
|
|
677
692
|
if limit is not None:
|
678
693
|
request['count'] = limit
|
679
694
|
response = self.privateGetGetexecutions(self.extend(request, params))
|
695
|
+
#
|
696
|
+
# [
|
697
|
+
# {
|
698
|
+
# "id": 37233,
|
699
|
+
# "side": "BUY",
|
700
|
+
# "price": 33470,
|
701
|
+
# "size": 0.01,
|
702
|
+
# "exec_date": "2015-07-07T09:57:40.397",
|
703
|
+
# "child_order_id": "JOR20150707-060559-021935",
|
704
|
+
# "child_order_acceptance_id": "JRF20150707-060559-396699"
|
705
|
+
# "commission": 0,
|
706
|
+
# },
|
707
|
+
# ]
|
708
|
+
#
|
680
709
|
return self.parse_trades(response, market, since, limit)
|
681
710
|
|
682
711
|
def fetch_positions(self, symbols: Optional[List[str]] = None, params={}):
|
ccxt/bitforex.py
CHANGED
@@ -254,14 +254,6 @@ class bitforex(Exchange, ImplicitAPI):
|
|
254
254
|
# "tid":"1131019666"
|
255
255
|
# }
|
256
256
|
#
|
257
|
-
# {
|
258
|
-
# "price":57591.33,
|
259
|
-
# "amount":0.002,
|
260
|
-
# "time":1637329685322,
|
261
|
-
# "direction":1,
|
262
|
-
# "tid":"1131019639"
|
263
|
-
# }
|
264
|
-
#
|
265
257
|
# fetchMyTrades(private)
|
266
258
|
#
|
267
259
|
# {
|
ccxt/bitget.py
CHANGED
@@ -2106,7 +2106,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
2106
2106
|
# "fillTime": "1692073691000"
|
2107
2107
|
# }
|
2108
2108
|
#
|
2109
|
-
# swap
|
2109
|
+
# swap(public trades)
|
2110
2110
|
#
|
2111
2111
|
# {
|
2112
2112
|
# "tradeId": "1075199767891652609",
|
@@ -2228,6 +2228,16 @@ class bitget(Exchange, ImplicitAPI):
|
|
2228
2228
|
params = self.omit(params, 'method')
|
2229
2229
|
if swapMethod == 'publicMixGetMarketFillsHistory':
|
2230
2230
|
response = self.publicMixGetMarketFillsHistory(self.extend(request, params))
|
2231
|
+
#
|
2232
|
+
# {
|
2233
|
+
# "tradeId": "1084459062491590657",
|
2234
|
+
# "price": "25874",
|
2235
|
+
# "size": "1.624",
|
2236
|
+
# "side": "Buy",
|
2237
|
+
# "timestamp": "1694281109000",
|
2238
|
+
# "symbol": "BTCUSDT_UMCBL",
|
2239
|
+
# }
|
2240
|
+
#
|
2231
2241
|
elif swapMethod == 'publicMixGetMarketFills':
|
2232
2242
|
response = self.publicMixGetMarketFills(self.extend(request, params))
|
2233
2243
|
#
|
@@ -2860,11 +2870,11 @@ class bitget(Exchange, ImplicitAPI):
|
|
2860
2870
|
method = 'privateMixPostPlanPlacePositionsTPSL'
|
2861
2871
|
elif isStopLossOrTakeProfit:
|
2862
2872
|
if isStopLoss:
|
2863
|
-
|
2864
|
-
request['presetStopLossPrice'] = self.price_to_precision(symbol,
|
2873
|
+
slTriggerPrice = self.safe_value_2(stopLoss, 'triggerPrice', 'stopPrice')
|
2874
|
+
request['presetStopLossPrice'] = self.price_to_precision(symbol, slTriggerPrice)
|
2865
2875
|
if isTakeProfit:
|
2866
|
-
|
2867
|
-
request['presetTakeProfitPrice'] = self.price_to_precision(symbol,
|
2876
|
+
tpTriggerPrice = self.safe_value_2(takeProfit, 'triggerPrice', 'stopPrice')
|
2877
|
+
request['presetTakeProfitPrice'] = self.price_to_precision(symbol, tpTriggerPrice)
|
2868
2878
|
if postOnly:
|
2869
2879
|
request[timeInForceKey] = 'post_only'
|
2870
2880
|
elif timeInForce == 'gtc':
|
ccxt/bitmart.py
CHANGED
@@ -76,6 +76,9 @@ class bitmart(Exchange, ImplicitAPI):
|
|
76
76
|
'fetchDepositWithdrawFee': True,
|
77
77
|
'fetchDepositWithdrawFees': False,
|
78
78
|
'fetchFundingHistory': None,
|
79
|
+
'fetchFundingRate': True,
|
80
|
+
'fetchFundingRateHistory': False,
|
81
|
+
'fetchFundingRates': False,
|
79
82
|
'fetchMarginMode': False,
|
80
83
|
'fetchMarkets': True,
|
81
84
|
'fetchMyTrades': True,
|
@@ -3084,6 +3087,69 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3084
3087
|
}
|
3085
3088
|
return self.privatePostContractPrivateSubmitLeverage(self.extend(request, params))
|
3086
3089
|
|
3090
|
+
def fetch_funding_rate(self, symbol: str, params={}):
|
3091
|
+
"""
|
3092
|
+
fetch the current funding rate
|
3093
|
+
see https://developer-pro.bitmart.com/en/futures/#get-current-funding-rate
|
3094
|
+
:param str symbol: unified market symbol
|
3095
|
+
:param dict [params]: extra parameters specific to the bitmart api endpoint
|
3096
|
+
:returns dict: a `funding rate structure <https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-structure>`
|
3097
|
+
"""
|
3098
|
+
self.load_markets()
|
3099
|
+
market = self.market(symbol)
|
3100
|
+
if not market['swap']:
|
3101
|
+
raise BadSymbol(self.id + ' fetchFundingRate() supports swap contracts only')
|
3102
|
+
request = {
|
3103
|
+
'symbol': market['id'],
|
3104
|
+
}
|
3105
|
+
response = self.publicGetContractPublicFundingRate(self.extend(request, params))
|
3106
|
+
#
|
3107
|
+
# {
|
3108
|
+
# "code": 1000,
|
3109
|
+
# "message": "Ok",
|
3110
|
+
# "data": {
|
3111
|
+
# "timestamp": 1695184410697,
|
3112
|
+
# "symbol": "BTCUSDT",
|
3113
|
+
# "rate_value": "-0.00002614",
|
3114
|
+
# "expected_rate": "-0.00002"
|
3115
|
+
# },
|
3116
|
+
# "trace": "4cad855074654097ac7ba5257c47305d.54.16951844206655589"
|
3117
|
+
# }
|
3118
|
+
#
|
3119
|
+
data = self.safe_value(response, 'data', {})
|
3120
|
+
return self.parse_funding_rate(data, market)
|
3121
|
+
|
3122
|
+
def parse_funding_rate(self, contract, market=None):
|
3123
|
+
#
|
3124
|
+
# {
|
3125
|
+
# "timestamp": 1695184410697,
|
3126
|
+
# "symbol": "BTCUSDT",
|
3127
|
+
# "rate_value": "-0.00002614",
|
3128
|
+
# "expected_rate": "-0.00002"
|
3129
|
+
# }
|
3130
|
+
#
|
3131
|
+
marketId = self.safe_string(contract, 'symbol')
|
3132
|
+
timestamp = self.safe_integer(contract, 'timestamp')
|
3133
|
+
return {
|
3134
|
+
'info': contract,
|
3135
|
+
'symbol': self.safe_symbol(marketId, market),
|
3136
|
+
'markPrice': None,
|
3137
|
+
'indexPrice': None,
|
3138
|
+
'interestRate': None,
|
3139
|
+
'estimatedSettlePrice': None,
|
3140
|
+
'timestamp': timestamp,
|
3141
|
+
'datetime': self.iso8601(timestamp),
|
3142
|
+
'fundingRate': self.safe_number(contract, 'expected_rate'),
|
3143
|
+
'fundingTimestamp': None,
|
3144
|
+
'fundingDatetime': None,
|
3145
|
+
'nextFundingRate': None,
|
3146
|
+
'nextFundingTimestamp': None,
|
3147
|
+
'nextFundingDatetime': None,
|
3148
|
+
'previousFundingRate': self.safe_number(contract, 'rate_value'),
|
3149
|
+
'previousFundingTimestamp': None,
|
3150
|
+
'previousFundingDatetime': None,
|
3151
|
+
}
|
3152
|
+
|
3087
3153
|
def nonce(self):
|
3088
3154
|
return self.milliseconds()
|
3089
3155
|
|
ccxt/bitstamp1.py
CHANGED
@@ -213,6 +213,17 @@ class bitstamp1(Exchange, ImplicitAPI):
|
|
213
213
|
return self.parse_ticker(ticker, market)
|
214
214
|
|
215
215
|
def parse_trade(self, trade, market=None):
|
216
|
+
#
|
217
|
+
# public trade
|
218
|
+
#
|
219
|
+
# {
|
220
|
+
# "amount": "0.00114000",
|
221
|
+
# "date": "1694287856",
|
222
|
+
# "price": "25865",
|
223
|
+
# "tid": 298730788,
|
224
|
+
# "type": 0
|
225
|
+
# }
|
226
|
+
#
|
216
227
|
timestamp = self.safe_timestamp_2(trade, 'date', 'datetime')
|
217
228
|
side = 'buy' if (trade['type'] == 0) else 'sell'
|
218
229
|
orderId = self.safe_string(trade, 'order_id')
|
@@ -254,6 +265,17 @@ class bitstamp1(Exchange, ImplicitAPI):
|
|
254
265
|
'time': 'minute',
|
255
266
|
}
|
256
267
|
response = self.publicGetTransactions(self.extend(request, params))
|
268
|
+
#
|
269
|
+
# [
|
270
|
+
# {
|
271
|
+
# "amount": "0.00114000",
|
272
|
+
# "date": "1694287856",
|
273
|
+
# "price": "25865",
|
274
|
+
# "tid": 298730788,
|
275
|
+
# "type": 0
|
276
|
+
# },
|
277
|
+
# ]
|
278
|
+
#
|
257
279
|
return self.parse_trades(response, market, since, limit)
|
258
280
|
|
259
281
|
def parse_balance(self, response):
|