Calculating The Volume's Price

I am trying to calculate the price of a volume of any pair in a standard currency, which is the broker’s account currency. Let’s assume:

AC: Account Currency, this is the broker account currency, e.g. USD, EUR, etc…
Symbol: The currency pair being traded, e.g. AUDJPY
Base: Is the base of the Symbol. i.e. in AUDJPY it is AUD
Quote: Is the quote of the Symbol. i.e. in AUDJPY it is JPY
Rate: is the rate of the symbol. i.e. for AUDJPY it is 77.12
Vol: Volume being traded
Price: The price of the traded volume in the AC currency (this is what we need to calculate)

Sometimes, where the traded currency does not include the AC, we will have to introduce an intermediate exchange pair. So, if the AC is in EUR and the traded currency is AUDJPY, then the exchange currency is EURJPY.

ExSymbol: The intermediate exchange currency
ExBase: Base of the ExSymbol
ExQuote: Quote of the ExQuote
ExRate: Is the price of the symbol

I would like to validate if this pseudo-code is the right calculation?

Case 1: if AC = Base
Price = Vol
Case 2: if AC = Quote
Price = Vol x Rate

if not one of the above two cases, introduce an exchange pair

Case 3: if ExBase = Base
Price = Rate * Vol * ExRate
Case 4: if ExBase = Quote
Price = Rate * Vol / ExRate
Case 5: if ExQuote = Base
Price = Vol * ExRate;
Case 6: if ExQuote = Quote
Price = Vol / ExRate;

Let me give an example of each case:

Case 1:
AC: AUD
Symbol: AUDJPY
Case 2:
AC: JPY
Symbol: AUDJPY
Case 3:
AC: GBP
Symbol: EURUSD
ExSymbol: EURGBP
Case 4:
AC: JPY
Symbol: EURGBP
ExSymbol: GBPJPY
Case 5:
AC: EUR
Symbol: AUDJPY
ExSymbol: EURAUD
Case 6:
AC: GBP
Symbol: AUDUSD
ExSymbol: GBPUSD

I am aware that some cases, between 3 to 6 can be eliminated by picking a different exchange currency.

To make this a reference for me and everybody, could you please help me with the calculation?

Hi,
I do not understand what this means, but I thought I would ask “why are you trying to calculate this?”

By volume being traded do you mean the number of contracts you are trading or the volume in the entire market?

Hi Modeoman, I am building a trading bot.
I mean the volume of a tick. So if you have this tick:
Date, Ask, Bid, Volume
2020-12-07 12:54:03.123, 1.3245, 1.4344, 1000

So, the volume is 1000 in this example.

Is this 1000 the quantity being offered for buy (or offered for sale) like a level 2 trading screen where all the bids and offers are shown in two tables side by side with their respective prices and “volumes” or quantities available at that particular price?

I am not clear here whether you are referring to the volume of an asset at a particular time in the market, or the volume of the asset only held by you.