@@ -219,6 +219,18 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
219
219
. validator ( is_valid_token_or_sol)
220
220
. default_value ( "USDC" )
221
221
. help ( "Token to deposit" ) ,
222
+ )
223
+ . arg (
224
+ Arg :: with_name ( "raw" )
225
+ . long ( "raw" )
226
+ . takes_value ( false )
227
+ . help ( "Only output raw numerical value" ) ,
228
+ )
229
+ . arg (
230
+ Arg :: with_name ( "bps" )
231
+ . long ( "bps" )
232
+ . takes_value ( false )
233
+ . help ( "Display in Basis Points instead of Percent" ) ,
222
234
) ,
223
235
) ;
224
236
@@ -276,9 +288,22 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
276
288
( "supply-apy" , Some ( matches) ) => {
277
289
let pool = value_t_or_exit ! ( matches, "pool" , String ) ;
278
290
let token = MaybeToken :: from ( value_t ! ( matches, "token" , Token ) . ok ( ) ) ;
291
+ let raw = matches. is_present ( "raw" ) ;
292
+ let bps = matches. is_present ( "bps" ) ;
279
293
280
- let apr = pool_supply_apr ( & rpc_client, & pool, token) ?;
281
- let msg = format ! ( "{} {} {:.2}%" , pool, token, apr_to_apy( apr) * 100. ) ;
294
+ let apy = apr_to_apy ( pool_supply_apr ( & rpc_client, & pool, token) ?) * 100. ;
295
+
296
+ let value = if bps {
297
+ format ! ( "{:.0}" , apy * 100. )
298
+ } else {
299
+ format ! ( "{:.2}" , apy)
300
+ } ;
301
+
302
+ let msg = if raw {
303
+ value. to_string ( )
304
+ } else {
305
+ format ! ( "{pool} {token} {value}{}" , if bps { "bps" } else { "%" } )
306
+ } ;
282
307
notifier. send ( & msg) . await ;
283
308
println ! ( "{msg}" ) ;
284
309
}
0 commit comments