async def updateMarketConfig(
marketId: int,
name: str,
minLeverage: float,
maxLeverage: float,
minTradeSize: float,
maxTradeSize: float,
tickDecimals: int,
lotSize: int,
sizeDecimals: int,
):
"""Update market configuration parameters."""
contract = retrieveContract()
w3 = retrieveWeb3Instance()
tick_units = tickDecimals
MyStruct = namedtuple(
"MarketConfigInput",
[
"name",
"minLeverage",
"maxLeverage",
"minTradeSize",
"maxTradeSize",
"tickDecimals",
"lotSize",
"sizeDecimals",
],
)
my_struct_data = MyStruct(
name=Web3.to_bytes(text=name).ljust(32, b"\0"),
minLeverage=convertFloatToUINT(minLeverage, LEVERAGE_SCALAR),
maxLeverage=convertFloatToUINT(maxLeverage, LEVERAGE_SCALAR),
minTradeSize=convertFloatToUINT(minTradeSize, USDC_DECIMALS),
maxTradeSize=convertFloatToUINT(maxTradeSize, USDC_DECIMALS),
tickDecimals=tickDecimals,
lotSize=lotSize,
sizeDecimals=sizeDecimals,
)
transaction = contract.functions.updateMarketConfig(
marketId, my_struct_data
).build_transaction(
{
"from": Web3.to_checksum_address(os.getenv("ACCOUNT")),
"nonce": w3.eth.get_transaction_count(
Web3.to_checksum_address(os.getenv("ACCOUNT"))
),
}
)
await submitTransactionWithOracle(w3, transaction, marketId)
Function Reference
updateMarketConfig
Python SDK reference for updateMarketConfig.
Update market configuration parameters.