How does one insert a variable value into a “myCRED plugin shortcode [closed]

You can create the shortcode as a string like this :

$rate = 2587.36;
$code = "[mycred_exchange from=\"mycred_default\" to=\"mycred_usd\" min=\"0.00001\" rate=\"$rate\"]";

and then, to execute the code

echo do_shortcode($code);

error code: 523