Skip to content
This repository has been archived by the owner on Aug 15, 2023. It is now read-only.

Commit

Permalink
fix: convert string fees to number and use the min (#106)
Browse files Browse the repository at this point in the history
Co-authored-by: Sebastien Verreault <sebver@pm.me>
  • Loading branch information
sebastienverreault and Sebastien Verreault authored Jun 19, 2022
1 parent 853c18d commit 9affef3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
6 changes: 3 additions & 3 deletions dealer/src/OkexExchange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -434,11 +434,11 @@ export class OkexExchange extends ExchangeBase {
"exchange.privateGetAssetCurrencies() returned: {response}",
)
if (btcCurrency?.minWd)
config.minOnChainWithdrawalAmount = btcCurrency?.minWd
config.minOnChainWithdrawalAmount = Number(btcCurrency?.minWd)
if (btcCurrency?.minFee)
config.minOnChainWithdrawalFee = btcCurrency?.minFee
config.minOnChainWithdrawalFee = Number(btcCurrency?.minFee)
if (btcCurrency?.maxFee)
config.maxOnChainWithdrawalFee = btcCurrency?.maxFee
config.maxOnChainWithdrawalFee = Number(btcCurrency?.maxFee)
this.logger.debug(
{ config, response: btcCurrency },
"ExchangeConfiguration after update: {config}",
Expand Down
5 changes: 2 additions & 3 deletions dealer/src/OkexPerpetualSwapStrategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -526,11 +526,10 @@ export class OkexPerpetualSwapStrategy implements HedgingStrategy {

// then initiate the withdrawal which by default uses the funding account
const config = this.exchangeConfig as OkexExchangeConfiguration
const averageFee =
(config.minOnChainWithdrawalFee + config.maxOnChainWithdrawalFee) / 2
const averageFee = config.minOnChainWithdrawalFee
const withdrawArgs = {
currency: TradeCurrency.BTC,
quantity: transferSizeInBtc,
quantity: transferSizeInBtc - averageFee,
address: withdrawOnChainAddress,
params: {
fee: averageFee,
Expand Down

0 comments on commit 9affef3

Please sign in to comment.