@@ -4,7 +4,6 @@ use clap::{App, Arg};
44pub enum CandlesRetrievalMode {
55 Stdin ,
66 CsvFile ,
7- Yahoo ,
87}
98
109pub struct CliOptions {
@@ -13,8 +12,6 @@ pub struct CliOptions {
1312 pub chart_name : Option < String > ,
1413 pub bear_color : Option < String > ,
1514 pub bull_color : Option < String > ,
16- pub ticker : Option < String > ,
17- pub interval : String ,
1815}
1916
2017pub fn get_args ( ) -> CliOptions {
@@ -26,7 +23,7 @@ pub fn get_args() -> CliOptions {
2623 . short ( "m" )
2724 . long ( "mode" )
2825 . help ( "Select the method for retrieving the candles." )
29- . possible_values ( & [ "stdin" , "csv-file" , "json-file" , "yahoo-fetch" ] )
26+ . possible_values ( & [ "stdin" , "csv-file" , "json-file" ] )
3027 . takes_value ( true )
3128 . required ( true ) ,
3229 )
@@ -55,35 +52,14 @@ pub fn get_args() -> CliOptions {
5552 . help ( "Sets the ascending candles color in hexadecimal." )
5653 . takes_value ( true ) ,
5754 )
58- . arg (
59- Arg :: with_name ( "TICKER" )
60- . long ( "ticker" )
61- . takes_value ( true )
62- . required_if ( "MODE" , "yahoo-fetch" )
63- . help ( "[MODE:*-fetch] The broker-side ticker of the asset you want to plot." ) ,
64- )
65- . arg (
66- Arg :: with_name ( "INTERVAL" )
67- . long ( "interval" )
68- . default_value ( "1d" )
69- . possible_values ( & [
70- "1m" , "2m" , "5m" , "15m" , "30m" , "60m" , "90m" , "1h" , "1d" , "5d" , "1wk" , "1mo" ,
71- "3mo" ,
72- ] )
73- . takes_value ( true )
74- . help ( "[MODE:*-fetch] The interval you want to retrieve the candles from the API" ) ,
75- )
7655 . get_matches ( ) ;
7756
7857 return CliOptions {
7958 mode : match matches. value_of ( "MODE" ) . unwrap ( ) {
8059 "stdin" => CandlesRetrievalMode :: Stdin ,
8160 "csv-file" => CandlesRetrievalMode :: CsvFile ,
82- "yahoo-fetch" => CandlesRetrievalMode :: Yahoo ,
8361 _ => panic ! ( "Invalid reading mode." ) ,
8462 } ,
85- interval : matches. value_of ( "INTERVAL" ) . unwrap ( ) . to_string ( ) ,
86- ticker : matches. value_of ( "TICKER" ) . map ( |s| s. to_string ( ) ) ,
8763 file_path : matches. value_of ( "FILE" ) . map ( |s| s. to_string ( ) ) ,
8864 chart_name : matches. value_of ( "CHART_NAME" ) . map ( |s| s. to_string ( ) ) ,
8965 bear_color : matches. value_of ( "BEAR_COLOR" ) . map ( |s| s. to_string ( ) ) ,
0 commit comments