Skip to content

Commit 9a5944e

Browse files
committed
fix bydfi
1 parent b508af8 commit 9a5944e

4 files changed

Lines changed: 9 additions & 2 deletions

File tree

python/ccxt/async_support/bydfi.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,6 +1267,8 @@ def create_order_request(self, symbol: str, type: OrderType, side: OrderSide, am
12671267
workingType = 'CONTRACT_PRICE'
12681268
workingType, params = self.handle_option_and_params(params, 'createOrder', 'triggerPriceType', workingType)
12691269
request['workingType'] = self.encode_working_type(workingType)
1270+
# Never forward unified triggerPrice into Bydfi's REST body(API uses stopPrice); stray keys come from helpers/tests on some runtimes.
1271+
params = self.omit(params, ['triggerPrice'])
12701272
return self.extend(request, params)
12711273

12721274
def encode_working_type(self, workingType: Str) -> Str:

python/ccxt/bydfi.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,6 +1267,8 @@ def create_order_request(self, symbol: str, type: OrderType, side: OrderSide, am
12671267
workingType = 'CONTRACT_PRICE'
12681268
workingType, params = self.handle_option_and_params(params, 'createOrder', 'triggerPriceType', workingType)
12691269
request['workingType'] = self.encode_working_type(workingType)
1270+
# Never forward unified triggerPrice into Bydfi's REST body(API uses stopPrice); stray keys come from helpers/tests on some runtimes.
1271+
params = self.omit(params, ['triggerPrice'])
12701272
return self.extend(request, params)
12711273

12721274
def encode_working_type(self, workingType: Str) -> Str:

ts/src/bydfi.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1309,6 +1309,9 @@ export default class bydfi extends Exchange {
13091309
[ workingType, params ] = this.handleOptionAndParams (params, 'createOrder', 'triggerPriceType', workingType);
13101310
request['workingType'] = this.encodeWorkingType (workingType);
13111311
}
1312+
// Never forward unified triggerPrice into Bydfi's REST body (API uses stopPrice); stray keys come from helpers/tests on some runtimes.
1313+
// Omit params.type so a polluted params dict (e.g. Python mutable default {}) cannot override the computed API order type.
1314+
params = this.omit (params, [ 'triggerPrice', 'type' ]);
13121315
return this.extend (request, params);
13131316
}
13141317

ts/src/test/static/request/bydfi.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
null,
3636
6000
3737
],
38-
"output": "{\"quantity\":\"1\",\"side\":\"SELL\",\"stopPrice\":\"6000\",\"symbol\":\"ETH-USDC\",\"triggerPrice\":\"0.18\",\"type\":\"TAKE_PROFIT\",\"wallet\":\"W001\",\"workingType\":\"CONTRACT_PRICE\"}"
38+
"output": "{\"quantity\":\"1\",\"side\":\"SELL\",\"stopPrice\":\"6000\",\"symbol\":\"ETH-USDC\",\"type\":\"TAKE_PROFIT_MARKET\",\"wallet\":\"W001\",\"workingType\":\"CONTRACT_PRICE\"}"
3939
}
4040
],
4141
"createStopLossOrder": [
@@ -51,7 +51,7 @@
5151
null,
5252
2000
5353
],
54-
"output": "{\"quantity\":\"1\",\"side\":\"SELL\",\"stopPrice\":\"2000\",\"symbol\":\"ETH-USDC\",\"triggerPrice\":\"0.01\",\"type\":\"STOP_MARKET\",\"wallet\":\"W001\",\"workingType\":\"CONTRACT_PRICE\"}"
54+
"output": "{\"quantity\":\"1\",\"side\":\"SELL\",\"stopPrice\":\"2000\",\"symbol\":\"ETH-USDC\",\"type\":\"STOP_MARKET\",\"wallet\":\"W001\",\"workingType\":\"CONTRACT_PRICE\"}"
5555
}
5656
],
5757
"createOrder": [

0 commit comments

Comments
 (0)