Skip to content

Commit afcd6ed

Browse files
Merge branch 'master' of https://github.com/ccxt/ccxt
2 parents 8a044c0 + c9cf39c commit afcd6ed

5 files changed

Lines changed: 44 additions & 17 deletions

File tree

dist/ccxt.browser.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -320781,7 +320781,7 @@ class lbank extends _lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A {
320781320781
// "volume":6.3607,
320782320782
// "amount":77148.9303,
320783320783
// "price":12129,
320784-
// "direction":"sell", // or "sell_market"
320784+
// "direction":"sell", // buy, sell, buy_market, sell_market, buy_maker, sell_maker, buy_ioc, sell_ioc, buy_fok, sell_fok
320785320785
// "TS":"2019-06-28T19:55:49.460"
320786320786
// },
320787320787
// "type":"trade",
@@ -320821,7 +320821,7 @@ class lbank extends _lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A {
320821320821
// "volume":6.3607,
320822320822
// "amount":77148.9303,
320823320823
// "price":12129,
320824-
// "direction":"sell", // or "sell_market"
320824+
// "direction":"sell", // buy, sell, buy_market, sell_market, buy_maker, sell_maker, buy_ioc, sell_ioc, buy_fok, sell_fok
320825320825
// "TS":"2019-06-28T19:55:49.460"
320826320826
// }
320827320827
//
@@ -320830,8 +320830,15 @@ class lbank extends _lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A {
320830320830
if (timestamp === undefined) {
320831320831
timestamp = this.parse8601(datetime);
320832320832
}
320833-
let side = this.safeString2(trade, 'direction', 3);
320834-
side = side.replace('_market', '');
320833+
const rawSide = this.safeString2(trade, 'direction', 3);
320834+
const parts = rawSide.split('_');
320835+
const firstPart = this.safeString(parts, 0);
320836+
const secondPart = this.safeString(parts, 1);
320837+
let side = firstPart;
320838+
// reverse if it was 'maker'
320839+
if (secondPart !== undefined && secondPart === 'maker') {
320840+
side = (side === 'buy') ? 'sell' : 'buy';
320841+
}
320835320842
return this.safeTrade({
320836320843
'timestamp': timestamp,
320837320844
'datetime': datetime,

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/pro/lbank.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ class lbank extends lbank$1 {
428428
// "volume":6.3607,
429429
// "amount":77148.9303,
430430
// "price":12129,
431-
// "direction":"sell", // or "sell_market"
431+
// "direction":"sell", // buy, sell, buy_market, sell_market, buy_maker, sell_maker, buy_ioc, sell_ioc, buy_fok, sell_fok
432432
// "TS":"2019-06-28T19:55:49.460"
433433
// },
434434
// "type":"trade",
@@ -468,7 +468,7 @@ class lbank extends lbank$1 {
468468
// "volume":6.3607,
469469
// "amount":77148.9303,
470470
// "price":12129,
471-
// "direction":"sell", // or "sell_market"
471+
// "direction":"sell", // buy, sell, buy_market, sell_market, buy_maker, sell_maker, buy_ioc, sell_ioc, buy_fok, sell_fok
472472
// "TS":"2019-06-28T19:55:49.460"
473473
// }
474474
//
@@ -477,8 +477,15 @@ class lbank extends lbank$1 {
477477
if (timestamp === undefined) {
478478
timestamp = this.parse8601(datetime);
479479
}
480-
let side = this.safeString2(trade, 'direction', 3);
481-
side = side.replace('_market', '');
480+
const rawSide = this.safeString2(trade, 'direction', 3);
481+
const parts = rawSide.split('_');
482+
const firstPart = this.safeString(parts, 0);
483+
const secondPart = this.safeString(parts, 1);
484+
let side = firstPart;
485+
// reverse if it was 'maker'
486+
if (secondPart !== undefined && secondPart === 'maker') {
487+
side = (side === 'buy') ? 'sell' : 'buy';
488+
}
482489
return this.safeTrade({
483490
'timestamp': timestamp,
484491
'datetime': datetime,

js/src/pro/lbank.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ export default class lbank extends lbankRest {
430430
// "volume":6.3607,
431431
// "amount":77148.9303,
432432
// "price":12129,
433-
// "direction":"sell", // or "sell_market"
433+
// "direction":"sell", // buy, sell, buy_market, sell_market, buy_maker, sell_maker, buy_ioc, sell_ioc, buy_fok, sell_fok
434434
// "TS":"2019-06-28T19:55:49.460"
435435
// },
436436
// "type":"trade",
@@ -470,7 +470,7 @@ export default class lbank extends lbankRest {
470470
// "volume":6.3607,
471471
// "amount":77148.9303,
472472
// "price":12129,
473-
// "direction":"sell", // or "sell_market"
473+
// "direction":"sell", // buy, sell, buy_market, sell_market, buy_maker, sell_maker, buy_ioc, sell_ioc, buy_fok, sell_fok
474474
// "TS":"2019-06-28T19:55:49.460"
475475
// }
476476
//
@@ -479,8 +479,15 @@ export default class lbank extends lbankRest {
479479
if (timestamp === undefined) {
480480
timestamp = this.parse8601(datetime);
481481
}
482-
let side = this.safeString2(trade, 'direction', 3);
483-
side = side.replace('_market', '');
482+
const rawSide = this.safeString2(trade, 'direction', 3);
483+
const parts = rawSide.split('_');
484+
const firstPart = this.safeString(parts, 0);
485+
const secondPart = this.safeString(parts, 1);
486+
let side = firstPart;
487+
// reverse if it was 'maker'
488+
if (secondPart !== undefined && secondPart === 'maker') {
489+
side = (side === 'buy') ? 'sell' : 'buy';
490+
}
484491
return this.safeTrade({
485492
'timestamp': timestamp,
486493
'datetime': datetime,

python/ccxt/pro/lbank.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ def handle_trades(self, client, message):
429429
# "volume":6.3607,
430430
# "amount":77148.9303,
431431
# "price":12129,
432-
# "direction":"sell", # or "sell_market"
432+
# "direction":"sell", # buy, sell, buy_market, sell_market, buy_maker, sell_maker, buy_ioc, sell_ioc, buy_fok, sell_fok
433433
# "TS":"2019-06-28T19:55:49.460"
434434
# },
435435
# "type":"trade",
@@ -467,16 +467,22 @@ def parse_ws_trade(self, trade, market=None):
467467
# "volume":6.3607,
468468
# "amount":77148.9303,
469469
# "price":12129,
470-
# "direction":"sell", # or "sell_market"
470+
# "direction":"sell", # buy, sell, buy_market, sell_market, buy_maker, sell_maker, buy_ioc, sell_ioc, buy_fok, sell_fok
471471
# "TS":"2019-06-28T19:55:49.460"
472472
# }
473473
#
474474
timestamp = self.safe_integer(trade, 0)
475475
datetime = (self.iso8601(timestamp)) if (timestamp is not None) else (self.safe_string(trade, 'TS'))
476476
if timestamp is None:
477477
timestamp = self.parse8601(datetime)
478-
side = self.safe_string_2(trade, 'direction', 3)
479-
side = side.replace('_market', '')
478+
rawSide = self.safe_string_2(trade, 'direction', 3)
479+
parts = rawSide.split('_')
480+
firstPart = self.safe_string(parts, 0)
481+
secondPart = self.safe_string(parts, 1)
482+
side = firstPart
483+
# reverse if it was 'maker'
484+
if secondPart is not None and secondPart == 'maker':
485+
side = 'sell' if (side == 'buy') else 'buy'
480486
return self.safe_trade({
481487
'timestamp': timestamp,
482488
'datetime': datetime,

0 commit comments

Comments
 (0)