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

Feat: keep funding reserve on exchange #113

Conversation

sebastienverreault
Copy link
Collaborator

No description provided.

hedgingBounds.MINIMUM_FUNDING_BALANCE_BTC,
)
} else {
this.logger.error(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure to understand this.. if this.getFundingAccountBalance() fail then we continue trying to withdraw?

also, I prefer the other style that you use for ok returns, something like line 584

if (!fundingAccountBalanceResult.ok) {
  this.logger.error(
    { fundingAccountBalanceResult },
    "getFundingAccountBalance() error: {fundingAccountBalanceResult}",
  )
  return { ... }
}

newTransferSizeInBtc = Math.max(
  0,
  fundingAccountBalanceResult.value.btcFreeBalance -
    hedgingBounds.MINIMUM_FUNDING_BALANCE_BTC,
)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah if it fails too bad or should it be an alert to get attention?

Copy link
Collaborator

@dolcalmi dolcalmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving but with some comments. Not sure if worth to do a lot of changes to code style if we will re-write the dealer

Comment on lines +540 to +541
fundingAccountBalanceResult.value.btcFreeBalance -
hedgingBounds.MINIMUM_FUNDING_BALANCE_BTC,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason to just not do a comparison? fundingAccountBalanceResult.value.btcFreeBalance > hedgingBounds.MINIMUM_FUNDING_BALANCE_BTC

this.logger.error(
{ withdrawalResponse },
"rebalancing withdrawal was NOT successful",
this.logger.debug(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same issue here with the else block.. code is cleaner using an early return

@sebastienverreault sebastienverreault merged commit 0d764e8 into GaloyMoney:main Jul 14, 2022
@sebastienverreault sebastienverreault deleted the feat-keep-funding-reserve-on-exchange branch July 14, 2022 05:38
galoybot pushed a commit that referenced this pull request Aug 22, 2022
…/bootstrap-5.1.6

Bump @types/bootstrap from 4.6.1 to 5.1.6
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants