An (forex) Order Book (OB) for a trading (forex) pair (e.g. XBT-USD) has ASK and BID rows. Each row has PRICE and VOLUME (at least). Each row represents an offer for selling or buying a maximum of VOLUME amount at PRICE.
Starting with a START-AMOUNT in BASE currency, how can I calculate exactly how many rows, starting from the 1st, i.e. the "cheaper-for-me"?
It is a simple calculation yet I am confused:
- as to whether I need to use the ASK or BID rows.
- as to what currency is VOLUME in.
- as to whether VOLUME in ASK and VOLUME in BID are in different currencies.
- Sometimes I will need to buy USD with XBT and so I will need the USD-XBT OB which does not exist (at least in kraken.com where I focus), can I use XBT-USD OB in order to buy XBT with USD? How?
Additionally, how should I use the "pair decimals" and "lot decimals" for the specific trading pair in order to do accurate, integer calculations? Note: terminology specifically refers to kraken.com's OB from the kraken.com's Asset-pair metadata but mainly I am asking: if someone tells us that in a specific book, currency (I guess BASE?) is expressed in 1 decimals and volume in 8, how can I do the calculations in integers to be accurate. (I realise that can be a question on its own and can ask it separately if people suggest it).
I am not sure if different forex platforms have different conventions, if they do then I am working with kraken.com . Here is some example data specific to kraken.com:
XBTUSD (get it with this API call from browser:
ASKS:
45867.70000,0.002
45870.90000,0.001
45873.80000,0.001
45875.90000,0.379
45880.70000,0.215
BIDS:
45867.60000,3.708
45867.30000,0.186
45866.80000,1.090
45865.90000,0.436
45865.50000,0.030
XBTUSD metadata (get it with this API call from browser):
...
pair_decimals:1,lot_decimals:8
...
p.s. I have very little experience with finance, more with programming and algorithms.