%%HP: T(3)A(D)F(.);
@ FXPRICES by Chris Tham
DIR
  GO
    \<< CMENU TMENU
    \>>
  CMENU { MKC RMC { "USD" {
    \<< "USD" CIN
    \>>
    \<< "USD" COUT
    \>> DROP } } { "AUD" {
    \<< "AUD" CIN
    \>>
    \<< "AUD" COUT
    \>>
    \<< "AUD" CSTO
    \>> } } { "DEM" {
    \<< "DEM" CIN
    \>>
    \<< "DEM" COUT
    \>>
    \<< CINV "DEM" CSTO
    \>> } } }
  bUSD '1_USD'
  oUSD '1_USD'
  bAUD '.779_USD'
  oAUD '.7795_USD'
  bDEM '.550660792952_USD'
  oDEM '.550812448361_USD'
  MKC
    \<< \-> A B C
      \<< C$ 5 { { "
A + C$ 7 " { \<< "
+ A + C$ 11 " CIN \>> \<< "
+ A + C$ 11 " COUT \>> \<<  +
        IF C
        THEN " CINV" +
        END C$ 1 "
+ A + C$ 1 "
+ "CSTO \>> } } }" + STR\-> CMENU SWAP + 'CMENU' STO B
        IF C
        THEN CINV
        END A CSTO { GO } ORDER GO
      \>>
    \>>
  RMC
    \<< \-> M
      \<< CMENU LIST\-> \-> N
        \<< 1 N
          START N ROLL
            IF DUP \->STR M POS
            THEN DROP 'N' DECR DROP
            END
          NEXT N \->LIST 'CMENU' STO M CBO PURGE PURGE GO
        \>>
      \>>
    \>>
  CIN
    \<< BO SWAP UVAL *
    \>>
  COUT
    \<< SWAP NEG SWAP BO CONVERT
    \>>
  CINV
    \<< C\->R INV SWAP INV R\->C
    \>>
  CSTO
    \<< CBO \-> P B O
      \<< '1_USD' P RE OVER * B STO P IM SWAP * O STO
      \>>
    \>>
  CBO
    \<< "'b" OVER + "'" + STR\-> SWAP "'o" SWAP + "'" + STR\->
    \>>
  BO
    \<< OVER 0 \>= "1_b" "1_o" IFTE SWAP + STR\->
    \>>
  USD '1_m'
END
