intrepidshape/elm-web3-ui/2.0.0

NOTE: the latest version is 4.0.0

Web3.Ui.TrendIndicator

Compact Up/Neutral/Down arrow with paired volume pills. Useful for any trend-aware contract — trend-detector outputs, lending-rate sentiment, DAO vote pressure indicators, etc.

-- From explicit trend:
Web3.Ui.TrendIndicator.view
    { trend = Web3.Ui.TrendIndicator.Down
    , buyVolume = buyVol
    , sellVolume = sellVol
    }


-- Or derive trend from volumes given a threshold (in basis points,
-- e.g., 5800 = 58% one side):
let
    trend =
        Web3.Ui.TrendIndicator.fromVolumes
            { buyVolume = buyVol
            , sellVolume = sellVol
            , thresholdBps = 5800
            }
in
Web3.Ui.TrendIndicator.view { trend = trend, buyVolume = buyVol, sellVolume = sellVol }

Style classes: web3-trend, web3-trend--up, web3-trend--neutral, web3-trend--down, web3-trend__arrow, web3-trend__pill.

{ trend : Trend
, buyVolume : BigInt
, sellVolume : BigInt
}
-> Html msg

Render the indicator.

type Trend
= Up
| Neutral
| Down
{ buyVolume : BigInt
, sellVolume : BigInt
, thresholdBps : Int
}
-> Trend

Derive a Trend from buy/sell volumes plus a threshold in basis points. The side that exceeds the threshold determines the direction; otherwise Neutral.