Skip to content

Commit 3a7b97c

Browse files
Merge branch 'master' of https://github.com/ccxt/ccxt
2 parents cae8e27 + 3aeb265 commit 3a7b97c

File tree

17 files changed

+159
-78
lines changed

17 files changed

+159
-78
lines changed

cs/ccxt/exchanges/blofin.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,9 @@ public override object describe()
150150
{ "api", new Dictionary<string, object>() {
151151
{ "rest", "https://openapi.blofin.com" },
152152
} },
153+
{ "test", new Dictionary<string, object>() {
154+
{ "rest", "https://demo-trading-openapi.blofin.com" },
155+
} },
153156
{ "referral", new Dictionary<string, object>() {
154157
{ "url", "https://blofin.com/register?referral_code=f79EsS" },
155158
{ "discount", 0.05 },

dist/ccxt.browser.js

Lines changed: 42 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22617,12 +22617,16 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
2261722617
},
2261822618
'hedged': true,
2261922619
'leverage': false,
22620-
'marketBuyRequiresPrice': false,
2262122620
'marketBuyByCost': true,
22622-
// exchange-supported features
22623-
'selfTradePrevention': true,
22624-
'trailing': true,
22625-
'iceberg': true, // todo implementation
22621+
'marketBuyRequiresPrice': false,
22622+
'selfTradePrevention': {
22623+
'expire_maker': true,
22624+
'expire_taker': true,
22625+
'expire_both': true,
22626+
'none': true,
22627+
},
22628+
'trailing': false,
22629+
'icebergAmount': true,
2262622630
},
2262722631
'createOrders': undefined,
2262822632
'fetchMyTrades': {
@@ -22663,7 +22667,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
2266322667
'limit': 1000,
2266422668
},
2266522669
},
22666-
'default': {
22670+
'forDerivatives': {
2266722671
'sandbox': true,
2266822672
'createOrder': {
2266922673
'marginMode': false,
@@ -22735,18 +22739,18 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
2273522739
},
2273622740
'swap': {
2273722741
'linear': {
22738-
'extends': 'default',
22742+
'extends': 'forDerivatives',
2273922743
},
2274022744
'inverse': {
22741-
'extends': 'default',
22745+
'extends': 'forDerivatives',
2274222746
},
2274322747
},
2274422748
'future': {
2274522749
'linear': {
22746-
'extends': 'default',
22750+
'extends': 'forDerivatives',
2274722751
},
2274822752
'inverse': {
22749-
'extends': 'default',
22753+
'extends': 'forDerivatives',
2275022754
},
2275122755
},
2275222756
},
@@ -27275,7 +27279,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
2727527279
* @method
2727627280
* @name binance#createOrder
2727727281
* @description create a trade order
27278-
* @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#new-order-trade
27282+
* @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/trading-endpoints#new-order-trade
2727927283
* @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#test-new-order-trade
2728027284
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/New-Order
2728127285
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/New-Order
@@ -27303,6 +27307,8 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
2730327307
* @param {float} [params.stopLossPrice] the price that a stop loss order is triggered at
2730427308
* @param {float} [params.takeProfitPrice] the price that a take profit order is triggered at
2730527309
* @param {boolean} [params.portfolioMargin] set to true if you would like to create an order in a portfolio margin account
27310+
* @param {string} [params.selfTradePrevention] set unified value for stp (see .features for available values)
27311+
* @param {float} [params.icebergAmount] set iceberg amount for limit orders
2730627312
* @param {string} [params.stopLossOrTakeProfit] 'stopLoss' or 'takeProfit', required for spot trailing orders
2730727313
* @param {string} [params.positionSide] *swap and portfolio margin only* "BOTH" for one-way mode, "LONG" for buy side of hedged mode, "SHORT" for sell side of hedged mode
2730827314
* @param {bool} [params.hedged] *swap and portfolio margin only* true for hedged mode, false for one way mode, default is false
@@ -27689,7 +27695,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
2768927695
}
2769027696
}
2769127697
if (timeInForceIsRequired && (this.safeString(params, 'timeInForce') === undefined) && (this.safeString(request, 'timeInForce') === undefined)) {
27692-
request['timeInForce'] = this.options['defaultTimeInForce']; // 'GTC' = Good To Cancel (default), 'IOC' = Immediate Or Cancel
27698+
request['timeInForce'] = this.safeString(this.options, 'defaultTimeInForce'); // 'GTC' = Good To Cancel (default), 'IOC' = Immediate Or Cancel
2769327699
}
2769427700
if (!isPortfolioMargin && market['contract'] && postOnly) {
2769527701
request['timeInForce'] = 'GTX';
@@ -27706,7 +27712,21 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
2770627712
}
2770727713
request['positionSide'] = (side === 'buy') ? 'LONG' : 'SHORT';
2770827714
}
27709-
const requestParams = this.omit(params, ['type', 'newClientOrderId', 'clientOrderId', 'postOnly', 'stopLossPrice', 'takeProfitPrice', 'stopPrice', 'triggerPrice', 'trailingTriggerPrice', 'trailingPercent', 'quoteOrderQty', 'cost', 'test', 'hedged']);
27715+
// unified stp
27716+
const selfTradePrevention = this.safeString(params, 'selfTradePrevention');
27717+
if (selfTradePrevention !== undefined) {
27718+
if (market['spot']) {
27719+
request['selfTradePreventionMode'] = selfTradePrevention.toUpperCase(); // binance enums exactly match the unified ccxt enums (but needs uppercase)
27720+
}
27721+
}
27722+
// unified iceberg
27723+
const icebergAmount = this.safeNumber(params, 'icebergAmount');
27724+
if (icebergAmount !== undefined) {
27725+
if (market['spot']) {
27726+
request['icebergQty'] = this.amountToPrecision(symbol, icebergAmount);
27727+
}
27728+
}
27729+
const requestParams = this.omit(params, ['type', 'newClientOrderId', 'clientOrderId', 'postOnly', 'stopLossPrice', 'takeProfitPrice', 'stopPrice', 'triggerPrice', 'trailingTriggerPrice', 'trailingPercent', 'quoteOrderQty', 'cost', 'test', 'hedged', 'selfTradePrevention', 'icebergAmount']);
2771027730
return this.extend(request, requestParams);
2771127731
}
2771227732
/**
@@ -181322,7 +181342,7 @@ class hollaex extends _abstract_hollaex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
181322181342

181323181343
// ---------------------------------------------------------------------------
181324181344
/**
181325-
* @class huobi
181345+
* @class htx
181326181346
* @augments Exchange
181327181347
*/
181328181348
class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A {
@@ -309654,7 +309674,7 @@ class htx extends _htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A {
309654309674
}
309655309675
/**
309656309676
* @method
309657-
* @name huobi#watchTicker
309677+
* @name htx#watchTicker
309658309678
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
309659309679
* @see https://www.htx.com/en-us/opend/newApiPages/?id=7ec53561-7773-11ed-9966-0242ac110003
309660309680
* @see https://www.htx.com/en-us/opend/newApiPages/?id=28c33ab2-77ae-11ed-9966-0242ac110003
@@ -309724,7 +309744,7 @@ class htx extends _htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A {
309724309744
}
309725309745
/**
309726309746
* @method
309727-
* @name huobi#watchTrades
309747+
* @name htx#watchTrades
309728309748
* @description get the list of most recent trades for a particular symbol
309729309749
* @see https://www.htx.com/en-us/opend/newApiPages/?id=7ec53b69-7773-11ed-9966-0242ac110003
309730309750
* @see https://www.htx.com/en-us/opend/newApiPages/?id=28c33c21-77ae-11ed-9966-0242ac110003
@@ -309790,7 +309810,7 @@ class htx extends _htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A {
309790309810
}
309791309811
/**
309792309812
* @method
309793-
* @name huobi#watchOHLCV
309813+
* @name htx#watchOHLCV
309794309814
* @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
309795309815
* @see https://www.htx.com/en-us/opend/newApiPages/?id=7ec53241-7773-11ed-9966-0242ac110003
309796309816
* @see https://www.htx.com/en-us/opend/newApiPages/?id=28c3346a-77ae-11ed-9966-0242ac110003
@@ -309853,7 +309873,7 @@ class htx extends _htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A {
309853309873
}
309854309874
/**
309855309875
* @method
309856-
* @name huobi#watchOrderBook
309876+
* @name htx#watchOrderBook
309857309877
* @see https://huobiapi.github.io/docs/dm/v1/en/#subscribe-market-depth-data
309858309878
* @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#subscribe-incremental-market-depth-data
309859309879
* @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-subscribe-incremental-market-depth-data
@@ -310199,7 +310219,7 @@ class htx extends _htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A {
310199310219
}
310200310220
/**
310201310221
* @method
310202-
* @name huobi#watchMyTrades
310222+
* @name htx#watchMyTrades
310203310223
* @description watches information on multiple trades made by the user
310204310224
* @see https://www.htx.com/en-us/opend/newApiPages/?id=7ec53dd5-7773-11ed-9966-0242ac110003
310205310225
* @param {string} symbol unified market symbol of the market trades were made in
@@ -310303,7 +310323,7 @@ class htx extends _htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A {
310303310323
}
310304310324
/**
310305310325
* @method
310306-
* @name huobi#watchOrders
310326+
* @name htx#watchOrders
310307310327
* @description watches information on multiple orders made by the user
310308310328
* @see https://www.htx.com/en-us/opend/newApiPages/?id=7ec53c8f-7773-11ed-9966-0242ac110003
310309310329
* @param {string} symbol unified market symbol of the market orders were made in
@@ -310757,7 +310777,7 @@ class htx extends _htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A {
310757310777
}
310758310778
/**
310759310779
* @method
310760-
* @name huobi#watchPositions
310780+
* @name htx#watchPositions
310761310781
* @see https://www.huobi.com/en-in/opend/newApiPages/?id=8cb7de1c-77b5-11ed-9966-0242ac110003
310762310782
* @see https://www.huobi.com/en-in/opend/newApiPages/?id=8cb7df0f-77b5-11ed-9966-0242ac110003
310763310783
* @see https://www.huobi.com/en-in/opend/newApiPages/?id=28c34a7d-77ae-11ed-9966-0242ac110003
@@ -310880,7 +310900,7 @@ class htx extends _htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A {
310880310900
}
310881310901
/**
310882310902
* @method
310883-
* @name huobi#watchBalance
310903+
* @name htx#watchBalance
310884310904
* @description watch balance and get the amount of funds available for trading or funds locked in orders
310885310905
* @see https://www.htx.com/en-us/opend/newApiPages/?id=7ec52e28-7773-11ed-9966-0242ac110003
310886310906
* @see https://www.htx.com/en-us/opend/newApiPages/?id=10000084-77b7-11ed-9966-0242ac110003

dist/ccxt.browser.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/cjs/src/binance.js

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1585,12 +1585,16 @@ class binance extends binance$1 {
15851585
},
15861586
'hedged': true,
15871587
'leverage': false,
1588-
'marketBuyRequiresPrice': false,
15891588
'marketBuyByCost': true,
1590-
// exchange-supported features
1591-
'selfTradePrevention': true,
1592-
'trailing': true,
1593-
'iceberg': true, // todo implementation
1589+
'marketBuyRequiresPrice': false,
1590+
'selfTradePrevention': {
1591+
'expire_maker': true,
1592+
'expire_taker': true,
1593+
'expire_both': true,
1594+
'none': true,
1595+
},
1596+
'trailing': false,
1597+
'icebergAmount': true,
15941598
},
15951599
'createOrders': undefined,
15961600
'fetchMyTrades': {
@@ -1631,7 +1635,7 @@ class binance extends binance$1 {
16311635
'limit': 1000,
16321636
},
16331637
},
1634-
'default': {
1638+
'forDerivatives': {
16351639
'sandbox': true,
16361640
'createOrder': {
16371641
'marginMode': false,
@@ -1703,18 +1707,18 @@ class binance extends binance$1 {
17031707
},
17041708
'swap': {
17051709
'linear': {
1706-
'extends': 'default',
1710+
'extends': 'forDerivatives',
17071711
},
17081712
'inverse': {
1709-
'extends': 'default',
1713+
'extends': 'forDerivatives',
17101714
},
17111715
},
17121716
'future': {
17131717
'linear': {
1714-
'extends': 'default',
1718+
'extends': 'forDerivatives',
17151719
},
17161720
'inverse': {
1717-
'extends': 'default',
1721+
'extends': 'forDerivatives',
17181722
},
17191723
},
17201724
},
@@ -6243,7 +6247,7 @@ class binance extends binance$1 {
62436247
* @method
62446248
* @name binance#createOrder
62456249
* @description create a trade order
6246-
* @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#new-order-trade
6250+
* @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/trading-endpoints#new-order-trade
62476251
* @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#test-new-order-trade
62486252
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/New-Order
62496253
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/New-Order
@@ -6271,6 +6275,8 @@ class binance extends binance$1 {
62716275
* @param {float} [params.stopLossPrice] the price that a stop loss order is triggered at
62726276
* @param {float} [params.takeProfitPrice] the price that a take profit order is triggered at
62736277
* @param {boolean} [params.portfolioMargin] set to true if you would like to create an order in a portfolio margin account
6278+
* @param {string} [params.selfTradePrevention] set unified value for stp (see .features for available values)
6279+
* @param {float} [params.icebergAmount] set iceberg amount for limit orders
62746280
* @param {string} [params.stopLossOrTakeProfit] 'stopLoss' or 'takeProfit', required for spot trailing orders
62756281
* @param {string} [params.positionSide] *swap and portfolio margin only* "BOTH" for one-way mode, "LONG" for buy side of hedged mode, "SHORT" for sell side of hedged mode
62766282
* @param {bool} [params.hedged] *swap and portfolio margin only* true for hedged mode, false for one way mode, default is false
@@ -6657,7 +6663,7 @@ class binance extends binance$1 {
66576663
}
66586664
}
66596665
if (timeInForceIsRequired && (this.safeString(params, 'timeInForce') === undefined) && (this.safeString(request, 'timeInForce') === undefined)) {
6660-
request['timeInForce'] = this.options['defaultTimeInForce']; // 'GTC' = Good To Cancel (default), 'IOC' = Immediate Or Cancel
6666+
request['timeInForce'] = this.safeString(this.options, 'defaultTimeInForce'); // 'GTC' = Good To Cancel (default), 'IOC' = Immediate Or Cancel
66616667
}
66626668
if (!isPortfolioMargin && market['contract'] && postOnly) {
66636669
request['timeInForce'] = 'GTX';
@@ -6674,7 +6680,21 @@ class binance extends binance$1 {
66746680
}
66756681
request['positionSide'] = (side === 'buy') ? 'LONG' : 'SHORT';
66766682
}
6677-
const requestParams = this.omit(params, ['type', 'newClientOrderId', 'clientOrderId', 'postOnly', 'stopLossPrice', 'takeProfitPrice', 'stopPrice', 'triggerPrice', 'trailingTriggerPrice', 'trailingPercent', 'quoteOrderQty', 'cost', 'test', 'hedged']);
6683+
// unified stp
6684+
const selfTradePrevention = this.safeString(params, 'selfTradePrevention');
6685+
if (selfTradePrevention !== undefined) {
6686+
if (market['spot']) {
6687+
request['selfTradePreventionMode'] = selfTradePrevention.toUpperCase(); // binance enums exactly match the unified ccxt enums (but needs uppercase)
6688+
}
6689+
}
6690+
// unified iceberg
6691+
const icebergAmount = this.safeNumber(params, 'icebergAmount');
6692+
if (icebergAmount !== undefined) {
6693+
if (market['spot']) {
6694+
request['icebergQty'] = this.amountToPrecision(symbol, icebergAmount);
6695+
}
6696+
}
6697+
const requestParams = this.omit(params, ['type', 'newClientOrderId', 'clientOrderId', 'postOnly', 'stopLossPrice', 'takeProfitPrice', 'stopPrice', 'triggerPrice', 'trailingTriggerPrice', 'trailingPercent', 'quoteOrderQty', 'cost', 'test', 'hedged', 'selfTradePrevention', 'icebergAmount']);
66786698
return this.extend(request, requestParams);
66796699
}
66806700
/**

dist/cjs/src/htx.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ var sha256 = require('./static_dependencies/noble-hashes/sha256.js');
99
// ----------------------------------------------------------------------------
1010
// ---------------------------------------------------------------------------
1111
/**
12-
* @class huobi
12+
* @class htx
1313
* @augments Exchange
1414
*/
1515
class htx extends htx$1 {

0 commit comments

Comments
 (0)