PyWaves icon indicating copy to clipboard operation
PyWaves copied to clipboard

Order Rejected Error - WX Fee discrepancy

Open Maxximiliann opened this issue 3 years ago • 0 comments

import pywaves as pw


def get_amount_asset(amount_asset_id):
    if amount_asset_id == 'WAVES':
        return pw.WAVES

    return pw.Asset(amount_asset_id)


def get_price_asset(price_asset_id):
    if price_asset_id == 'WAVES':
        return pw.WAVES

    return pw.Asset(price_asset_id)


def configure_trading_account():
    matcher_url = 'https://matcher.waves.exchange'
    pw.setMatcher(matcher_url)
    wallet_key = os.environ.get('WALLET_KEY')
    trading_account = pw.Address(privateKey=wallet_key)

    return trading_account


def compose_order_symbol(amount_asset_id, price_asset_id):
    amount_asset = get_amount_asset(amount_asset_id)
    price_asset = get_price_asset(price_asset_id)
    order_symbol = pw.AssetPair(amount_asset, price_asset)

    return order_symbol


def execute_buy_order():
    amount_asset_id = "HZk1mbfuJpmxU1Fs4AX5MWLVYtctsNcg6e2C6VKqK8zk",
    price_asset_id = "474jTeYx2r2Va35794tCScAXWJG9hU2HcgxzMowaZUnu",
    amount = 162766
    price = 6758

    asset_fee_id = "Atqv59EYzjFGuitKVnMRk6H8FukjoV3ktPorbEys25on",
    discount_tx_fee = 2507538

    order_symbol = compose_order_symbol(amount_asset_id, price_asset_id)
    trading_account = configure_trading_account()

    submission_report = trading_account.buy(
        assetPair=order_symbol, amount=amount, price=price,
        matcherFee=discount_tx_fee,
        matcherFeeAssetId=asset_fee_id)

    return 'ok', {'submission_report': submission_report}

Order- pair: LTC/ETH side: buy amount asset: HZk1mbfuJpmxU1Fs4AX5MWLVYtctsNcg6e2C6VKqK8zk price asset: 474jTeYx2r2Va35794tCScAXWJG9hU2HcgxzMowaZUnu amount: 0.00162766 price: 0.00006758

asset paid in: WX tx fee: 0.02507538 (verified on https://waves.exchange/trading/spot/LTC_ETH)

Error- Order Rejected - Required 8.3821938 Atqv59EYzjFGuitKVnMRk6H8FukjoV3ktPorbEys25on as fee for this order, but given 0.02507538 Atqv59EYzjFGuitKVnMRk6H8FukjoV3ktPorbEys25on

Any suggestions on what exactly is causing the fee disparity and how to resolve this issue?

Maxximiliann avatar Jul 29 '22 19:07 Maxximiliann