# Struct and macro - currency pair - ways to specify

**URL:** <https://discourse.julialang.org/t/struct-and-macro-currency-pair-ways-to-specify/97930>\
**Category:** General Usage\
**Tags:** macros, struct\
**Created:** [April 26, 2023, 6:39am UTC](https://discourse.julialang.org/t/struct-and-macro-currency-pair-ways-to-specify/97930 "2023-04-26T06:39:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lincoln\_Hannah](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lincoln_hannah/32/19198_2.png) [@Lincoln\_Hannah](https://discourse.julialang.org/u/Lincoln_Hannah)\
**Post date:** [April 26, 2023, 6:39am UTC](https://discourse.julialang.org/t/struct-and-macro-currency-pair-ways-to-specify/97930/1 "2023-04-26T06:39:02Z")

</div>

I’ve defined a currency pair as

```julia
struct ccy_pair;   
      c1::Symbol
      c2::Symbol
end

ccy_pair(x::String) = ccy_pair(Symbol(x[1:3]),Symbol(x[end-2:end]))

macro p_str(x) ccy_pair(x) end

```

So I can write as `ccy_pair( :AUD, :USD )` or `p"AUD/USD"`.

Is it possible to write it any more briefly?  
`AUD/USD` would be ideal but I don’t think this is possible.

---

<div class="post-metadata">

**Author:** ![jar1](https://avatars.discourse-cdn.com/v4/letter/j/c0e974/32.png) [@jar1](https://discourse.julialang.org/u/jar1)\
**Post date:** [April 26, 2023, 6:53am UTC](https://discourse.julialang.org/t/struct-and-macro-currency-pair-ways-to-specify/97930/2 "2023-04-26T06:53:15Z")

</div>

```julia
julia> using UnitfulAssets: AUD,USD

julia> AUD/USD
AUD USD^-1

```
