Skip to content

Commit 3ba34c7

Browse files
committed
🔥 remove *-fetch mode
1 parent 9921a33 commit 3ba34c7

4 files changed

Lines changed: 4 additions & 116 deletions

File tree

README.md

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
- Auto-fit to terminal size
3333
- Shipped as library with simple API
3434
- Shipped as binary for standalone usage
35-
- Can fetch charts from Yahoo Finance.
3635

3736
# API Usage
3837
Add this to your `Cargo.toml`
@@ -88,16 +87,9 @@ OPTIONS:
8887
--bear-color <BEAR_COLOR> Sets the descending candles color in hexadecimal.
8988
--bull-color <BULL_COLOR> Sets the ascending candles color in hexadecimal.
9089
--chart-name <CHART_NAME> Sets the chart name.
91-
-f, --file <FILE> [MODE:*-file] File to read candles from.`
92-
93-
--interval <INTERVAL> [MODE:*-fetch] The interval you want to retrieve the candles from the API
94-
[default: 1d]
95-
[possible values: 1m, 2m, 5m, 15m, 30m, 60m, 90m, 1h, 1d, 5d, 1wk, 1mo, 3mo]
96-
90+
-f, --file <FILE> [MODE:*-file] File to read candles from.`
9791
-m, --mode <MODE> Select the method for retrieving the candles.
98-
[possible values: stdin, csv-file, json-file, yahoo-fetch]
99-
100-
--ticker <TICKER> [MODE:*-fetch] The broker-side ticker of the asset you want to plot.
92+
[possible values: stdin, csv-file, json-file]
10193
```
10294
When requesting the CSV file mode, the library expects a CSV file with `open,high,low,close` headers fields.
10395

@@ -151,12 +143,4 @@ echo '[
151143
--chart-name="My BTC Chart" \
152144
--bear-color="#b967ff" \
153145
--bull-color="ff6b99"
154-
```
155-
156-
- Fetch from Yahoo Finance :
157-
```bash
158-
./cli-candlestick-chart \
159-
--mode=yahoo-fetch \
160-
--ticker=UBER
161-
--interval=1d
162-
```
146+
```

src/bin/cli/get_args.rs

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use clap::{App, Arg};
44
pub enum CandlesRetrievalMode {
55
Stdin,
66
CsvFile,
7-
Yahoo,
87
}
98

109
pub 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

2017
pub 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()),

src/bin/cli/main.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ use utils::hexa_to_rgb;
88
mod get_args;
99
use get_args::{get_args, CandlesRetrievalMode};
1010

11-
mod yahoo_api;
12-
use yahoo_api::get_yahoo_klines;
13-
1411
fn parse_candles_from_stdin() -> Vec<Candle> {
1512
let stdin = io::stdin();
1613

@@ -48,9 +45,6 @@ fn main() {
4845
let filepath = options.file_path.expect("No file path provided.");
4946
candles = parse_candles_from_csv(&filepath).unwrap();
5047
}
51-
CandlesRetrievalMode::Yahoo => {
52-
candles = get_yahoo_klines(&options.ticker.to_owned().unwrap(), &options.interval);
53-
}
5448
};
5549

5650
let mut chart = Chart::new(&candles);

src/bin/cli/yahoo_api.rs

Lines changed: 0 additions & 66 deletions
This file was deleted.

0 commit comments

Comments
 (0)