@@ -10,7 +10,20 @@ I did this project mainly to learn Rust, so the code may be not very good at som
1010![ ] ( https://raw.githubusercontent.com/Julien-R44/cli-candlestick-chart/main/docs/capture.png )
1111![ ] ( https://raw.githubusercontent.com/Julien-R44/cli-candlestick-chart/main/docs/capture2.png )
1212
13- # Usage
13+ # Table of contents
14+ * [ Features] ( #features )
15+ * [ API Usage] ( #api-usage )
16+ * [ Binary Usage] ( #binary-usage )
17+ * [ Examples] ( #examples )
18+ * [ Build] ( #build )
19+
20+
21+ # Features
22+ - Customizable
23+ - Auto-fit to terminal size
24+ - Shipped as binary for standalone usage
25+
26+ # API Usage
1427Add this to your ` Cargo.toml `
1528``` toml
1629[dependencies ]
@@ -28,21 +41,6 @@ fn main() {
2841 Candle :: new (127.720001 , 131.050003 , 126.379997 , 126.599998 ),
2942 Candle :: new (128.360001 , 131.630005 , 127.860001 , 130.919998 ),
3043 Candle :: new (132.429993 , 132.630005 , 130.229996 , 132.050003 ),
31- Candle :: new (129.190002 , 130.169998 , 128.500000 , 128.979996 ),
32- Candle :: new (128.500000 , 129.690002 , 126.860001 , 128.800003 ),
33- Candle :: new (128.759995 , 131.449997 , 128.490005 , 130.889999 ),
34- Candle :: new (130.800003 , 131.000000 , 128.759995 , 128.910004 ),
35- Candle :: new (128.779999 , 130.220001 , 127.000000 , 127.139999 ),
36- Candle :: new (127.779999 , 128.710007 , 126.940002 , 127.830002 ),
37- Candle :: new (128.660004 , 132.490005 , 128.550003 , 132.029999 ),
38- Candle :: new (133.800003 , 139.669998 , 133.589996 , 136.869995 ),
39- Candle :: new (136.279999 , 139.850006 , 135.020004 , 139.070007 ),
40- Candle :: new (143.070007 , 145.089996 , 136.539993 , 142.919998 ),
41- Candle :: new (143.600006 , 144.300003 , 141.369995 , 143.160004 ),
42- Candle :: new (143.429993 , 144.300003 , 140.410004 , 142.059998 ),
43- Candle :: new (139.520004 , 141.990005 , 136.699997 , 137.089996 ),
44- Candle :: new (135.830002 , 136.740005 , 130.210007 , 131.960007 ),
45- Candle :: new (133.750000 , 135.380005 , 130.929993 , 134.139999 ),
4644 ];
4745
4846 // Create and display the chart
@@ -59,11 +57,65 @@ fn main() {
5957}
6058```
6159
60+ # Binary Usage
61+ ```
62+ USAGE:
63+ cli-candlestick-chart.exe [OPTIONS]
64+
65+ FLAGS:
66+ -h, --help Prints help information
67+ -V, --version Prints version information
68+
69+ OPTIONS:
70+ --bear-color <BEAR_COLOR> Sets the descending candles color.
71+ --bull-color <BULL_COLOR> Sets the ascending candles color.
72+ --chart-name <CHART_NAME> Sets the chart name.
73+ -f, --file <FILE> File to read candles from, if reading-mode is `*-file.`
74+ -r, --reading-mode <READING_MODE> Make the program reads and parse candles from stdin.
75+ [possible values: stdin, csv-file, json-file]
76+ ```
77+
78+ Examples :
79+
80+
6281# Examples
82+ ## Api
6383- [ Basic example with CSV parsing] ( https://github.com/Julien-R44/cli-candlestick-chart/blob/main/examples/basic-with-csv-parsing.rs )
6484
6585 ` cargo run --example basic-with-csv-parsing --features=serde `
6686
6787- [ Fetch candles from binance] ( https://github.com/Julien-R44/cli-candlestick-chart/blob/main/examples/fetch-from-binance.rs )
6888
69- ` cargo run --example fetch-from-binance --features=serde `
89+ ` cargo run --example fetch-from-binance --features=serde `
90+
91+ ## Binary
92+ - Read CSV from file :
93+ ```
94+ ./cli-candlestick-chart \
95+ -r=csv-file \
96+ -f=./examples/BTC-USD.csv \
97+ --chart-name="My BTC Chart" \
98+ --bear-color="#b967ff" \
99+ --bull-color="ff6b99"
100+ ```
101+
102+ - Read from stdin :
103+ ```
104+ echo '[
105+ {
106+ "open": 28994.009766,
107+ "high": 29600.626953,
108+ "low": 28803.585938,
109+ "close": 29374.152344
110+ },
111+ {
112+ "open": 29376.455078,
113+ "high": 33155.117188,
114+ "low": 29091.181641,
115+ "close": 32127.267578
116+ }
117+ ] | ./cli-candlestick-chart -r=stdin \
118+ --chart-name="My BTC Chart" \
119+ --bear-color="#b967ff" \
120+ --bull-color="ff6b99"
121+ ```
0 commit comments