fCash Markets

Get active fCash Markets

We can use the getActiveMarkets method to get a list of the current active markets in a given currency:
activeMarkets = notional.getActiveMarkets(currencyId)

Get a market's total fCash and total Prime Cash holdings

market3Months = activeMarkets[0]
market6Months = activeMarkets[1]
# Get the maturity of the 3 Month market
maturity = market3Months[1]
# Get the 3 Month market total Prime Cash balance
primeCashBalance3MonthMarket = market3Months[3]/1e8
# Get the 3 Month market total fCash balance
fCashBalance3MonthMarket = market3Months[2]/1e8

Get a market's utilization

An fCash market's utilization is defined as total fCash/ (total fCash + total Prime Cash in underlying):
from brownie.network.state import Chain
chain = Chain()
primeFactors = notional.getPrimeFactorsStored(currencyId, chain.time())
supplyScalar = primeFactors["factors"]["supplyScalar"]/1e18
underlyingScalar = primeFactors["factors"]["underlyingScalar"]/1e18
marketPrimeCashSupply = primeCashBalance3MonthMarket * underlyingScalar * supplyScalar
fCashMarketUtilization = fCashBalance3MonthMarket / (fCashBalance3MonthMarket + marketPrimeCashSupply)

Get fCash rates

# Last Implied Rate 3 Month Market
lastImpliedRate = market3Months[5]
# Oracle Rate 3 Month Market
oracleRate = market3Months[6]