Open extra topbar

Calculate fees gathered from users?

If you are new here, please see some information on how to ask for support. Thank you!

Calculate fees gathered from users?

dashed-slug.net Forums CoinPayments.net Coin Adapter extension support Calculate fees gathered from users?

Tagged: , ,

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #8507
    Stockero
    Participant

    Under wallet>adapters within admin panel i see

    Hot Wallet Balance

    Sum of User Balances

    And i was wondering if i subtract

    Hot Wallet Balance – Sum of User Balances= disposable income from fees?

    What I’m trying to do is accurately pinpoint how much my website made from user fees so i can
    Use those fees that was gathered towards Airdrops.

    #8509
    alexg
    Keymaster

    Hello,

    Unfortunately the plugin does not record the actual amount that was paid in fees to the blockchain network. The plugin only records the fees that the user sees, which should be more than the actual fee. The reason is that not all wallets report back the actual fees paid and therefore the transaction DB schema and coin adapter API are not designed to hold that information.

    If you know how much your wallet pays in fees in a typical transaction, you can calculate this. Go to the admin dashboard and you will see sums of fees paid and transaction counts for the last day, week, month, and year.

    For example, say that there have been 10 BTC withdrawals, and the sum of fees paid was 0.00500000 using CoinPayments. We know that CoinPayments uses a fee of 0.00040000 (or 40k satoshis) per BTC withdrawal. Therefore, the fees that remain with your site are 0.00500000 – 10*0.0004 = 0.001 BTC.

    On the other hand, the fees that you see paid for internal transfers is accurate, as shown in the admin dashboard. All the fees paid for internal transfers are yours since you don’t pay a network fee for those.

    The same goes for full node wallets, you just need the txfee value that you use in your .conf file to do the same calculation.

    Hope this helps. Let me know if you have any more questions about this.

    with regards

    #8512
    Stockero
    Participant

    Thank you for the reply, this definitely helps.

    #8513
    Stockero
    Participant

    It’s pretty much
    My Fixed fee – number of withdraws*coinpayments network fee = earned commission

    #8514
    Stockero
    Participant

    Oops this is what i meant.

    Fees paid to withdrawals – number of withdraws*coinpayments network fee = earned commission

    #8517
    alexg
    Keymaster

    Yes, that last formula is correct for withdrawals. Don’t forget to also count the internal transfers (moves) if you have any.

    #8519
    Stockero
    Participant

    Ty, I’ll take that to account.
    I guess all i have left to ask is if i make a withdraw the first month for example, 0.005
    And i wait two months to make the 2nd withdraw I’d have to keep track of the previous withdraw amount and calculate that as well?

    For example,
    Fees paid to withdrawals – number of withdraws*coinpayments network fee – 0.005 = earned commission

    #8521
    alexg
    Keymaster

    Yes, or if you really want to calculate withdrawal fees paid in any arbitrary range, you can easily pull this info from your SQL console (phpMyAdmin or mysql client command line).

    Assuming that your DB prefix is wp_, which is the default:

    SELECT
    	symbol,
    	SUM( fee ) as fees,
    	COUNT( 1 ) as count
    FROM
    	wp_wallets_txs
    WHERE
    	status = 'done'
    	AND category = 'withdraw'
    	AND amount < 0
    	AND created_time BETWEEN '2019-12-15' AND NOW()
    GROUP BY
    	symbol
    ORDER BY
    	symbol;

    This query will sum the fees paid and transaction count for each coin, between the specified date and today. You can modify this range to fit your needs.

    From these total fees, you then need to subtract the actual fee paid to the blockchain, times the transaction count.

    Hope this helps. Let me know if you have any further questions.

    #8524
    Stockero
    Participant

    Amazing, that’s exactly what i need.
    Thank you. I express my gratitude.

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.