Skip to content

Commit

Permalink
Merge pull request hummingbot#6937 from aarmoa/feat/injective_fee_cal…
Browse files Browse the repository at this point in the history
…culator_multiplier_config

feat/injective_fee_calculator_multiplier_config
  • Loading branch information
nikspz authored Mar 28, 2024
2 parents 141de0f + c545380 commit f3aaf6d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -506,10 +506,15 @@ async def _process_transaction_update(self, transaction_event: Dict[str, Any]):
await super()._process_transaction_update(transaction_event=transaction_event)

async def _configure_gas_fee_for_transaction(self, transaction: Transaction):
multiplier = (None
if CONSTANTS.GAS_LIMIT_ADJUSTMENT_MULTIPLIER is None
else Decimal(str(CONSTANTS.GAS_LIMIT_ADJUSTMENT_MULTIPLIER)))
if self._fee_calculator is None:
self._fee_calculator = self._fee_calculator_mode.create_calculator(
client=self._client,
composer=await self.composer(),
gas_price=CONSTANTS.TX_GAS_PRICE,
gas_limit_adjustment_multiplier=multiplier,
)

await self._fee_calculator.configure_gas_fee_for_transaction(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -536,10 +536,15 @@ async def _process_transaction_update(self, transaction_event: Dict[str, Any]):
await super()._process_transaction_update(transaction_event=transaction_event)

async def _configure_gas_fee_for_transaction(self, transaction: Transaction):
multiplier = (None
if CONSTANTS.GAS_LIMIT_ADJUSTMENT_MULTIPLIER is None
else Decimal(str(CONSTANTS.GAS_LIMIT_ADJUSTMENT_MULTIPLIER)))
if self._fee_calculator is None:
self._fee_calculator = self._fee_calculator_mode.create_calculator(
client=self._client,
composer=await self.composer(),
gas_price=CONSTANTS.TX_GAS_PRICE,
gas_limit_adjustment_multiplier=multiplier,
)

await self._fee_calculator.configure_gas_fee_for_transaction(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
HBOT_ORDER_ID_PREFIX = "HBOT"

DEFAULT_SUBACCOUNT_INDEX = 0
EXTRA_TRANSACTION_GAS = pyinjective.constant.GAS_FEE_BUFFER_AMOUNT
DEFAULT_GAS_PRICE = pyinjective.constant.GAS_PRICE
TX_GAS_PRICE = pyinjective.constant.GAS_PRICE
GAS_LIMIT_ADJUSTMENT_MULTIPLIER = None # Leave as None to use the default value from the SDK. Otherwise, a float value.

EXPECTED_BLOCK_TIME = 1.5
TRANSACTIONS_CHECK_INTERVAL = 3 * EXPECTED_BLOCK_TIME
Expand Down

0 comments on commit f3aaf6d

Please sign in to comment.