Extracting traffic levels via SSH

Hi OpenWrt, I am trying to programmatically request the amount of inbound and outbound traffic on an interface, but am curious if there is a better command to do so.

What I am after is something similar to the LuCI realtime graphs (see attached image).

What I've found is the command:
ubus call network.device status '{ "name": "wlan0" }'
Which returns the total number of RX/TX bytes, and I guess that could be requested once a second in order to calculate those values (kB/s). But is there an actual command to generate these values?

Thanks in advance,

The firmware of the radio is: LuCI doodlelabs/openwrt-v19.07.7 branch (git-21.146.51148-fed5229)