@drico2008/fincli 0.1.3 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +909 -684
- package/fincli/__init__.py +3 -3
- package/fincli/app/agents/__init__.py +5 -0
- package/fincli/app/agents/registry.py +76 -0
- package/fincli/app/analysis/ai_prompts.py +23 -16
- package/fincli/app/analysis/analyzer.py +107 -100
- package/fincli/app/analysis/assistant_context.py +187 -160
- package/fincli/app/analysis/backtest.py +179 -0
- package/fincli/app/analysis/gameplay_plan.py +79 -0
- package/fincli/app/analysis/indicators.py +1 -1
- package/fincli/app/analysis/market_structure.py +1 -1
- package/fincli/app/analysis/multi_timeframe.py +180 -0
- package/fincli/app/analysis/trading_methods.py +144 -0
- package/fincli/app/cli/commands.py +105 -77
- package/fincli/app/cli/router.py +2143 -1121
- package/fincli/app/connectors/__init__.py +5 -0
- package/fincli/app/connectors/catalog.py +148 -0
- package/fincli/app/connectors/news_connectors.py +412 -0
- package/fincli/app/modules/alerts.py +80 -0
- package/fincli/app/modules/economic_calendar.py +374 -1
- package/fincli/app/modules/reports.py +151 -0
- package/fincli/app/modules/scanner.py +111 -93
- package/fincli/app/modules/session_history.py +113 -0
- package/fincli/app/modules/transactions.py +84 -84
- package/fincli/app/modules/user_profile.py +84 -0
- package/fincli/app/plugins/loader.py +72 -0
- package/fincli/app/providers/ai/anthropic_provider.py +8 -7
- package/fincli/app/providers/ai/gemini_provider.py +8 -7
- package/fincli/app/providers/ai/groq_provider.py +8 -7
- package/fincli/app/providers/ai/huggingface_provider.py +8 -7
- package/fincli/app/providers/ai/manager.py +60 -60
- package/fincli/app/providers/ai/openai_provider.py +8 -7
- package/fincli/app/providers/ai/openrouter_provider.py +8 -7
- package/fincli/app/providers/ai/together_provider.py +8 -7
- package/fincli/app/providers/market/alphavantage_provider.py +194 -0
- package/fincli/app/providers/market/base.py +98 -77
- package/fincli/app/providers/market/custom_provider.py +186 -169
- package/fincli/app/providers/market/manager.py +85 -2
- package/fincli/app/providers/market/news_provider.py +4 -4
- package/fincli/app/providers/market/symbols.py +143 -0
- package/fincli/app/providers/market/twelvedata_provider.py +167 -167
- package/fincli/app/providers/market/yfinance_provider.py +1 -1
- package/fincli/app/research/__init__.py +7 -0
- package/fincli/app/research/engine.py +75 -0
- package/fincli/app/research/formatter.py +22 -0
- package/fincli/app/research/models.py +18 -0
- package/fincli/app/research/prompt_builder.py +47 -0
- package/fincli/app/services/macro_data.py +50 -0
- package/fincli/app/services/market_data.py +203 -203
- package/fincli/app/services/news_aggregator.py +90 -0
- package/fincli/app/services/web_research.py +267 -0
- package/fincli/app/storage/cache.py +2 -2
- package/fincli/app/storage/config.py +122 -88
- package/fincli/app/storage/database.py +201 -85
- package/fincli/app/storage/secrets.py +12 -3
- package/fincli/app/tui/components.py +68 -50
- package/fincli/app/tui/layout.py +270 -258
- package/fincli/app/tui/market_provider_selector.py +6 -1
- package/fincli/app/tui/model_selector.py +11 -3
- package/fincli/app/tui/theme.py +134 -74
- package/fincli/app/utils/formatting.py +125 -12
- package/npm/bin/fincli.js +9 -2
- package/package.json +23 -23
- package/pyproject.toml +35 -35
package/README.md
CHANGED
|
@@ -1,684 +1,909 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
fincli
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
/
|
|
142
|
-
/
|
|
143
|
-
/
|
|
144
|
-
/
|
|
145
|
-
/
|
|
146
|
-
/
|
|
147
|
-
/
|
|
148
|
-
/
|
|
149
|
-
/
|
|
150
|
-
/
|
|
151
|
-
/
|
|
152
|
-
/
|
|
153
|
-
/
|
|
154
|
-
/
|
|
155
|
-
/
|
|
156
|
-
/
|
|
157
|
-
/
|
|
158
|
-
/
|
|
159
|
-
/
|
|
160
|
-
/
|
|
161
|
-
/
|
|
162
|
-
/
|
|
163
|
-
/
|
|
164
|
-
/
|
|
165
|
-
/
|
|
166
|
-
/
|
|
167
|
-
/
|
|
168
|
-
/
|
|
169
|
-
/
|
|
170
|
-
/
|
|
171
|
-
/
|
|
172
|
-
/
|
|
173
|
-
/
|
|
174
|
-
/
|
|
175
|
-
/
|
|
176
|
-
/
|
|
177
|
-
/
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
/
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
/
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
```
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
```text
|
|
281
|
-
/
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
```
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
-
|
|
396
|
-
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
/
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
```
|
|
458
|
-
|
|
459
|
-
/
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
/
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
/
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
```
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
/
|
|
546
|
-
```
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
```
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
/
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
/
|
|
576
|
-
/
|
|
577
|
-
/
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
```
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
##
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
```
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
```
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
1
|
+
<<<<<<< HEAD
|
|
2
|
+
# FinCLI v0.2.2
|
|
3
|
+
=======
|
|
4
|
+
# FinCLI v0.1.9
|
|
5
|
+
>>>>>>> a26bfe0e03787066d4676c17641647723991f356
|
|
6
|
+
|
|
7
|
+
FinCLI is a modern financial CLI/TUI terminal for market monitoring, technical analysis, AI-assisted research, portfolio tracking, watchlists, trading journals, and configurable market/news provider workflows.
|
|
8
|
+
|
|
9
|
+
Current status: FinCLI is an active MVP moving into v0.2 with a Textual TUI, provider chain, symbol normalization, AI assistance, web research, portfolio, journal, watchlist, exports, and local session history.
|
|
10
|
+
|
|
11
|
+
- Single-column Textual TUI with an inline command palette and scrollable command suggestions. The old sidebar has been removed so market output has more room.
|
|
12
|
+
- Slash command router for the core FinCLI v0.1 command system.
|
|
13
|
+
- Config system using optional `.env` values for local development, `~/.fincli/config.json` for non-secret preferences, and `~/.fincli/secrets.env` for API keys saved from commands.
|
|
14
|
+
- SQLite local storage for watchlist, portfolio, journal, transactions, session history, and persistent market cache.
|
|
15
|
+
- yfinance fallback for quote, OHLCV history, news, Yahoo tables, and fundamental snapshots.
|
|
16
|
+
- Finnhub provider for quotes, stock candles, company news, company profile, and economic calendar via `FINNHUB_API_KEY`.
|
|
17
|
+
- Twelve Data provider for multi-asset market data via `TWELVE_DATA_API_KEY`.
|
|
18
|
+
- Alpha Vantage provider for stock/FX quote, daily history, news sentiment, and company overview via `ALPHA_VANTAGE_API_KEY`.
|
|
19
|
+
- 100+ news connector catalog for `/news`, including public RSS fallbacks and API-key-ready providers such as Marketaux, NewsAPI, GNews, Alpha Vantage News, Finnhub News, StockNewsAPI, APITube, Benzinga, Polygon, Tiingo, FMP, and EODHD.
|
|
20
|
+
- Symbol search and provider-specific normalization with `/symbol`.
|
|
21
|
+
- Provider entitlement and realtime/delayed labeling with `/provider entitlement`.
|
|
22
|
+
- Economic calendar through Finnhub when an API key is configured, with a local fallback when the provider is unavailable.
|
|
23
|
+
- Technical analysis: SMA, EMA, RSI, MACD, Bollinger Bands, ATR, support/resistance, volume, trend bias, and technical signal scoring.
|
|
24
|
+
- Market structure analysis: HH/HL, LH/LL, break of structure, change of character, liquidity areas, and risk zones.
|
|
25
|
+
- Technical Debate engine for `/technical`: Bull Chooser, Bear Chooser, Caution Chooser, and Judge.
|
|
26
|
+
- Watchlist scanner: `/scan watchlist` with filters such as `rsi<30`, `rsi>70`, and `trend=bullish`.
|
|
27
|
+
- Persistent market cache for quote, OHLCV history, news, and fundamentals to reduce unnecessary API calls.
|
|
28
|
+
- `/ai` and `/analyze` use the active AI provider. `/ai` has a FinCLI-specific persona, anti-coding guardrails, optional market context, and optional web research context.
|
|
29
|
+
- AI HTTP clients for OpenAI-compatible APIs, Gemini, and Anthropic. OpenRouter, OpenAI, Together, Groq, and HuggingFace use OpenAI-compatible request flows.
|
|
30
|
+
- Portfolio view calculates current price, PnL, PnL percent, allocation, and transaction-ledger performance.
|
|
31
|
+
- Portfolio and journal export to CSV or JSON.
|
|
32
|
+
- Basic tests for command registry, router, config, storage, market providers, technical analysis, AI commands, TUI selectors, web research, and session history.
|
|
33
|
+
|
|
34
|
+
## Stack
|
|
35
|
+
|
|
36
|
+
- Python 3.11+
|
|
37
|
+
- Textual + Rich for the terminal UI
|
|
38
|
+
- SQLite for local storage
|
|
39
|
+
- python-dotenv for optional local `.env` support
|
|
40
|
+
- yfinance for fallback market/news/fundamental data
|
|
41
|
+
- httpx for provider APIs and lightweight web research
|
|
42
|
+
- pandas + numpy for analysis workflows
|
|
43
|
+
- pytest for tests
|
|
44
|
+
- npm wrapper for global installation through `npm install -g`
|
|
45
|
+
|
|
46
|
+
Textual was chosen because FinCLI needs an interactive terminal dashboard instead of a static CLI. Rich is still used for tables, panels, Markdown rendering, and structured output.
|
|
47
|
+
|
|
48
|
+
## Install
|
|
49
|
+
|
|
50
|
+
For local development:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
python -m venv .venv
|
|
54
|
+
.venv\Scripts\activate
|
|
55
|
+
pip install -e ".[dev]"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Alternative:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
pip install -r requirements.txt
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Global Install
|
|
65
|
+
|
|
66
|
+
The recommended Python CLI approach is `pipx`, because FinCLI dependencies are installed in an isolated environment while the `fincli` command remains globally available:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
pip install pipx
|
|
70
|
+
pipx ensurepath
|
|
71
|
+
pipx install .
|
|
72
|
+
fincli
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
If the Python package is published to PyPI:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
pipx install fincli
|
|
79
|
+
fincli
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
FinCLI also ships with an npm wrapper so users can follow a common "install once, run anywhere" CLI pattern:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
npm install -g @drico2008/fincli
|
|
86
|
+
fincli
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
For local npm testing before publishing:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
npm install -g .
|
|
93
|
+
fincli
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Note: the npm wrapper still requires Python 3.11+ during installation. The postinstall script creates a local `.npm-python` virtual environment inside the installed package, installs the Python FinCLI package there, and the global `fincli` command runs `python -m fincli.app.main`.
|
|
97
|
+
|
|
98
|
+
## Setup
|
|
99
|
+
|
|
100
|
+
For local development, you may copy `.env.example`:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
copy .env.example .env
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Only fill API keys for providers you want to use. The yfinance fallback does not require an API key. FinCLI never prints full API keys in the terminal.
|
|
107
|
+
|
|
108
|
+
For global npm installs, users do not need to open the installed package folder or edit `.env`. Save API keys directly from FinCLI:
|
|
109
|
+
|
|
110
|
+
```text
|
|
111
|
+
/ai_model key groq <api_key>
|
|
112
|
+
/ai_model key openrouter <api_key>
|
|
113
|
+
/news_model key finnhub <api_key>
|
|
114
|
+
/news_model key twelvedata <api_key>
|
|
115
|
+
/news_model key custom <api_key> https://your-market-api.example.com
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Keys are saved locally at:
|
|
119
|
+
|
|
120
|
+
```text
|
|
121
|
+
~/.fincli/secrets.env
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
The file is not printed in full by FinCLI. `/config` and `/provider key status` only show masked key status and safe source labels.
|
|
125
|
+
|
|
126
|
+
## Run
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
fincli
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Or:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
python -m fincli.app.main
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Main Commands
|
|
139
|
+
|
|
140
|
+
```text
|
|
141
|
+
/help
|
|
142
|
+
/dashboard
|
|
143
|
+
/config
|
|
144
|
+
/ai_model
|
|
145
|
+
/ai_model openrouter openai/gpt-4o-mini
|
|
146
|
+
/ai_model key groq <api_key>
|
|
147
|
+
/news_model
|
|
148
|
+
/news_model list
|
|
149
|
+
/news_model search rss
|
|
150
|
+
/news_model use google_news_rss
|
|
151
|
+
/news_model priority google_news_rss,yfinance,marketaux,newsapi,gnews
|
|
152
|
+
/news_model key finnhub <api_key>
|
|
153
|
+
/news_model key marketaux <api_key>
|
|
154
|
+
/news_model key alphavantage <api_key>
|
|
155
|
+
/symbol XAUUSD
|
|
156
|
+
/symbol normalize BBRI
|
|
157
|
+
/market AAPL 1d
|
|
158
|
+
/provider status
|
|
159
|
+
/provider list
|
|
160
|
+
/provider entitlement
|
|
161
|
+
/provider test AAPL
|
|
162
|
+
/provider key status
|
|
163
|
+
/watchlist
|
|
164
|
+
/watchlist add AAPL
|
|
165
|
+
/watchlist remove AAPL
|
|
166
|
+
/portfolio
|
|
167
|
+
/portfolio add BTC-USD 0.05 65000
|
|
168
|
+
/portfolio remove BTC-USD
|
|
169
|
+
/portfolio performance
|
|
170
|
+
/tx add buy AAPL 10 185
|
|
171
|
+
/tx add sell AAPL 5 195
|
|
172
|
+
/tx list
|
|
173
|
+
/journal
|
|
174
|
+
/journal add BTC-USD bullish "Failed breakout, wait for confirmation"
|
|
175
|
+
/journal stats
|
|
176
|
+
/journal review
|
|
177
|
+
/alert
|
|
178
|
+
/alert add AAPL above 200
|
|
179
|
+
/alert check
|
|
180
|
+
/history
|
|
181
|
+
/history sessions
|
|
182
|
+
/history show <session_id>
|
|
183
|
+
/history save "Morning market research"
|
|
184
|
+
/history delete <session_id>
|
|
185
|
+
/quote AAPL
|
|
186
|
+
/technical BTC-USD 1d
|
|
187
|
+
/technical XAUUSD 1d
|
|
188
|
+
/technical EURUSD 1d
|
|
189
|
+
/mtf AAPL 1d,1h,15m
|
|
190
|
+
/backtest AAPL sma_cross 1d
|
|
191
|
+
/backtest EURUSD rsi_reversion 1h
|
|
192
|
+
/structure BTC-USD 1d
|
|
193
|
+
/news AAPL
|
|
194
|
+
/web why is the rupiah weakening today
|
|
195
|
+
/web sources why is the rupiah weakening today
|
|
196
|
+
/funda MSFT
|
|
197
|
+
/yahoo BBRI history 6mo 1d
|
|
198
|
+
/yahoo BBRI statistics
|
|
199
|
+
/yahoo BBRI profile
|
|
200
|
+
/yahoo BBRI financials
|
|
201
|
+
/yahoo BBRI analysis
|
|
202
|
+
/yahoo BBRI holders
|
|
203
|
+
/ai explain today's market risk
|
|
204
|
+
/analyze ETH-USD 4h
|
|
205
|
+
/scan watchlist rsi<30
|
|
206
|
+
/scan watchlist trend=bullish
|
|
207
|
+
/scan watchlist rsi>60 trend=bullish
|
|
208
|
+
/scan export csv scan.csv rsi<30 1d
|
|
209
|
+
/report market AAPL md report.md
|
|
210
|
+
/report market AAPL json report.json
|
|
211
|
+
/calendar
|
|
212
|
+
/calendar today
|
|
213
|
+
/calendar 2026-06-05 2026-06-12 country=US impact=high
|
|
214
|
+
/calendar export csv calendar.csv week US high
|
|
215
|
+
/export portfolio json C:\Users\MSI\Desktop\portfolio.json
|
|
216
|
+
/export journal csv C:\Users\MSI\Desktop\journal.csv
|
|
217
|
+
/cache stats
|
|
218
|
+
/cache clear
|
|
219
|
+
/clear
|
|
220
|
+
/exit
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
`/market`, `/quote`, `/technical`, `/structure`, and `/funda` use the active market provider chain. `/news` uses the active news fallback chain from `/news_model priority`. `/ai` and `/analyze` use the active AI provider from `/ai_model`. `/analyze` sends indicator, market structure, news, and fundamental context to the AI prompt. `/ai` can also attach quote, OHLCV/technical, structure, news, fundamental, and web context when the prompt asks for current information or mentions a clear symbol such as `AAPL`, `EURUSD`, or `XAUUSD`.
|
|
224
|
+
|
|
225
|
+
## AI Chat UX
|
|
226
|
+
|
|
227
|
+
Inside the TUI, regular input without a slash is treated as chat to the active AI assistant:
|
|
228
|
+
|
|
229
|
+
```text
|
|
230
|
+
hello
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
Output is rendered as a terminal chat:
|
|
234
|
+
|
|
235
|
+
```text
|
|
236
|
+
> hello
|
|
237
|
+
> Thinking: routing prompt to active AI provider...
|
|
238
|
+
* Provider: ...
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
Explicit command mode is still supported:
|
|
242
|
+
|
|
243
|
+
```text
|
|
244
|
+
/ai explain today's market risk
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
The FinCLI assistant is customized for market workflows:
|
|
248
|
+
|
|
249
|
+
- It understands FinCLI as a financial terminal dashboard.
|
|
250
|
+
- It supports free chat for general questions, market research, portfolio workflows, journal review, provider setup, and risk analysis.
|
|
251
|
+
- It refuses coding, debugging, refactoring, and software-building requests inside the FinCLI assistant so the in-app assistant remains focused.
|
|
252
|
+
- If a prompt includes a clear market symbol, FinCLI attaches market context from the active provider chain before calling the AI provider.
|
|
253
|
+
- If a prompt needs recent public information, FinCLI can collect lightweight web context and pass it to the AI prompt.
|
|
254
|
+
- It never exposes API keys and never claims realtime data when the active provider is delayed or fallback-only.
|
|
255
|
+
|
|
256
|
+
Examples:
|
|
257
|
+
|
|
258
|
+
```text
|
|
259
|
+
what caused the rupiah to weaken today
|
|
260
|
+
latest BI rate news and possible impact on IHSG
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
Web research summarized by AI:
|
|
264
|
+
|
|
265
|
+
```text
|
|
266
|
+
/web why is the rupiah weakening today
|
|
267
|
+
/web gold price and dollar index update
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
Raw web sources without AI synthesis:
|
|
271
|
+
|
|
272
|
+
```text
|
|
273
|
+
/web sources why is the rupiah weakening today
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
FinCLI uses lightweight HTTP web research, not Chrome automation. This is more stable for global npm installs and does not open a browser in the background. Web-based output should still be verified because source quality can vary.
|
|
277
|
+
|
|
278
|
+
## Interactive AI Model Selector
|
|
279
|
+
|
|
280
|
+
```text
|
|
281
|
+
/ai_model
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
In the TUI, this opens a modern CLI-style selector:
|
|
285
|
+
|
|
286
|
+
- Select Provider
|
|
287
|
+
- Show current/configured provider status
|
|
288
|
+
- Use existing configuration or configure again
|
|
289
|
+
- Enter API key from the popup when the provider has no key
|
|
290
|
+
- Select Model
|
|
291
|
+
- Search model/provider
|
|
292
|
+
- Navigate with `up/down`, `Enter`, `Tab`, and `Esc`
|
|
293
|
+
|
|
294
|
+
Set a provider/model directly:
|
|
295
|
+
|
|
296
|
+
```text
|
|
297
|
+
/ai_model openrouter openai/gpt-4o-mini
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
Save a key directly:
|
|
301
|
+
|
|
302
|
+
```text
|
|
303
|
+
/ai_model key openrouter <api_key>
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
## News Connectors and Fallbacks
|
|
307
|
+
|
|
308
|
+
```text
|
|
309
|
+
/news_model
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
`/news_model` manages the `/news` provider chain. It supports public RSS fallbacks, yfinance news, custom news APIs, and API-key providers.
|
|
313
|
+
|
|
314
|
+
Useful commands:
|
|
315
|
+
|
|
316
|
+
```text
|
|
317
|
+
/news_model list
|
|
318
|
+
/news_model search rss
|
|
319
|
+
/news_model use google_news_rss
|
|
320
|
+
/news_model priority google_news_rss,yfinance,yahoo_finance_rss,marketaux,newsapi,gnews
|
|
321
|
+
/news_model key marketaux <api_key>
|
|
322
|
+
/news_model key custom_news <api_key> https://your-news-api.example.com
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
Practical free-first default:
|
|
326
|
+
|
|
327
|
+
```text
|
|
328
|
+
/news_model priority google_news_rss,yfinance,yahoo_finance_rss
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
API-key providers such as Marketaux, NewsAPI, GNews, Finnhub, and Alpha Vantage depend on their free-tier limits, plan, exchange entitlement, and rate limits. Public RSS sources may fail or change without notice, so FinCLI tries the next fallback automatically.
|
|
332
|
+
|
|
333
|
+
## Economic Calendar
|
|
334
|
+
|
|
335
|
+
```text
|
|
336
|
+
/calendar
|
|
337
|
+
/calendar today
|
|
338
|
+
/calendar week US high
|
|
339
|
+
/calendar 2026-06-05 2026-06-12 country=US impact=high
|
|
340
|
+
/calendar export csv calendar.csv week US high
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
When `FINNHUB_API_KEY` is configured, FinCLI pulls actual economic calendar data from Finnhub. If the key is missing or the provider fails, FinCLI shows a local fallback list of important event categories such as central bank decisions, inflation releases, labor data, GDP/PMI, and retail sales. The fallback does not claim actual event dates.
|
|
344
|
+
|
|
345
|
+
Calendar output includes impact summary counts. `/calendar export` writes filtered events to CSV or JSON.
|
|
346
|
+
|
|
347
|
+
## Market Cache
|
|
348
|
+
|
|
349
|
+
FinCLI uses two cache layers:
|
|
350
|
+
|
|
351
|
+
- Runtime memory cache for repeated commands in the same TUI session.
|
|
352
|
+
- Persistent SQLite cache in `~/.fincli/fincli.db` for quotes, OHLCV history, news, and fundamentals.
|
|
353
|
+
|
|
354
|
+
Cache TTL follows `cache_ttl_seconds` from config. This reduces rate-limit pressure, speeds up watchlist/scanner workflows, and makes provider fallback more efficient.
|
|
355
|
+
|
|
356
|
+
Commands:
|
|
357
|
+
|
|
358
|
+
```text
|
|
359
|
+
/cache stats
|
|
360
|
+
/cache clear
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
`/cache clear` removes runtime cache and persistent market cache. API keys stay safe because market cache stores provider responses, not secrets.
|
|
364
|
+
|
|
365
|
+
## Dashboard
|
|
366
|
+
|
|
367
|
+
```text
|
|
368
|
+
/dashboard
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
The dashboard is designed as a compact first screen, not a stacked wall of panels. It includes:
|
|
372
|
+
|
|
373
|
+
- Provider chain
|
|
374
|
+
- Watchlist price snapshot
|
|
375
|
+
- Portfolio market value and PnL
|
|
376
|
+
- Journal win rate
|
|
377
|
+
- Command hints for next steps
|
|
378
|
+
|
|
379
|
+
## Market Overview
|
|
380
|
+
|
|
381
|
+
Use `/market` as a professional entry point for a symbol:
|
|
382
|
+
|
|
383
|
+
```text
|
|
384
|
+
/market AAPL 1d
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
Output includes:
|
|
388
|
+
|
|
389
|
+
- Data Quality score
|
|
390
|
+
- Quote and provider status
|
|
391
|
+
- RSI, trend, MACD, ATR
|
|
392
|
+
- Support/resistance
|
|
393
|
+
- Market structure
|
|
394
|
+
- Fundamental snapshot
|
|
395
|
+
- Latest news
|
|
396
|
+
- Disclaimer
|
|
397
|
+
|
|
398
|
+
Use `/market` before moving into `/technical`, `/structure`, or `/analyze`.
|
|
399
|
+
|
|
400
|
+
## Instrument Coverage
|
|
401
|
+
|
|
402
|
+
Coverage depends on provider and symbol format:
|
|
403
|
+
|
|
404
|
+
- `yfinance`: stocks, ETFs, indices, forex, crypto, commodities, and mutual funds as long as Yahoo supports the symbol.
|
|
405
|
+
- `custom`: any instrument your API exposes through the FinCLI custom provider schema.
|
|
406
|
+
- `finnhub`: stock quotes/candles, forex candles, crypto candles, company news, company profile, and economic calendar depending on API plan.
|
|
407
|
+
- `twelvedata`: multi-asset stocks, forex, ETFs, indices, commodities, and crypto with more consistent global market symbol formatting.
|
|
408
|
+
- `alphavantage`: stocks and FX quote/history plus news sentiment and company overview, with strict free-plan rate limits.
|
|
409
|
+
|
|
410
|
+
Recommended provider priority for multi-asset usage:
|
|
411
|
+
|
|
412
|
+
```text
|
|
413
|
+
/provider priority twelvedata,finnhub,yfinance
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
With that setup:
|
|
417
|
+
|
|
418
|
+
- `twelvedata` is tried first for forex, indices, commodities, and global stocks.
|
|
419
|
+
- `finnhub` is used as fallback for stocks and selected news/fundamental data.
|
|
420
|
+
- `yfinance` remains the free delayed fallback if API providers fail.
|
|
421
|
+
|
|
422
|
+
Example yfinance symbols:
|
|
423
|
+
|
|
424
|
+
```text
|
|
425
|
+
AAPL
|
|
426
|
+
MSFT
|
|
427
|
+
SPY
|
|
428
|
+
^GSPC
|
|
429
|
+
BTC-USD
|
|
430
|
+
ETH-USD
|
|
431
|
+
EURUSD=X
|
|
432
|
+
GC=F
|
|
433
|
+
CL=F
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
FinCLI accepts common aliases and maps them into provider-specific formats:
|
|
437
|
+
|
|
438
|
+
```text
|
|
439
|
+
EURUSD -> EURUSD=X for yfinance, EUR/USD for Twelve Data, OANDA:EUR_USD for Finnhub forex candles
|
|
440
|
+
XAUUSD -> XAUUSD=X for yfinance, XAU/USD for Twelve Data
|
|
441
|
+
SPX -> ^GSPC for yfinance
|
|
442
|
+
NASDAQ -> ^IXIC for yfinance
|
|
443
|
+
DAX -> ^GDAXI for yfinance
|
|
444
|
+
NIKKEI -> ^N225 for yfinance
|
|
445
|
+
WTI -> CL=F for yfinance
|
|
446
|
+
BRENT -> BZ=F for yfinance
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
## Technical AI Summary
|
|
450
|
+
|
|
451
|
+
`/technical` includes a structured summary designed for AI assistance:
|
|
452
|
+
|
|
453
|
+
```text
|
|
454
|
+
/technical EURUSD 1d
|
|
455
|
+
/technical XAUUSD 1d
|
|
456
|
+
/technical SPX 1d
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
Output includes trend bias, RSI, MACD, support/resistance, ATR, market structure summary, signal, and risk notes. The signal is rule-based and transparent:
|
|
460
|
+
|
|
461
|
+
```text
|
|
462
|
+
Signal: BEST TO BUY | BEST TO SELL | CAUTION
|
|
463
|
+
Signal Score
|
|
464
|
+
Confidence
|
|
465
|
+
Signal Reasoning
|
|
466
|
+
Signal Risk Notes
|
|
467
|
+
Invalidation / Caution Level
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
The signal is not a guaranteed entry instruction. FinCLI uses scenario language, confirmation, invalidation, and risk notes instead of profit claims.
|
|
471
|
+
|
|
472
|
+
`/technical` also uses `Technical Debate`:
|
|
473
|
+
|
|
474
|
+
- `Bull Chooser`: finds buy-candidate arguments.
|
|
475
|
+
- `Bear Chooser`: finds sell-candidate arguments.
|
|
476
|
+
- `Caution Chooser`: finds conflicts, overextension, volatility risk, and weak confirmation.
|
|
477
|
+
- `Judge`: decides the final `BEST TO BUY`, `BEST TO SELL`, or `CAUTION`.
|
|
478
|
+
|
|
479
|
+
The debate result is also included in AI prompts so the assistant does not reason from only one side.
|
|
480
|
+
|
|
481
|
+
```text
|
|
482
|
+
/analyze EURUSD 1d
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
## Multi-Timeframe Analysis
|
|
486
|
+
|
|
487
|
+
```text
|
|
488
|
+
/mtf AAPL
|
|
489
|
+
/mtf EURUSD 1d,1h,15m
|
|
490
|
+
/mtf XAUUSD 1d,4h,1h
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
`/mtf` fetches multiple timeframes through the active provider chain, summarizes trend/structure/RSI/MACD/key levels for each timeframe, and returns an alignment label such as `aligned bullish`, `mostly bearish`, or `mixed`. The default timeframe set is `1d,1h,15m` for yfinance compatibility. Use `4h` when the active provider supports it.
|
|
494
|
+
|
|
495
|
+
## Lightweight Backtesting
|
|
496
|
+
|
|
497
|
+
```text
|
|
498
|
+
/backtest AAPL sma_cross 1d
|
|
499
|
+
/backtest EURUSD rsi_reversion 1h
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
The v0.2 lightweight backtester supports educational long-only rule-based strategies:
|
|
503
|
+
|
|
504
|
+
- `sma_cross`: enters on fast/slow SMA bullish cross and exits on bearish cross.
|
|
505
|
+
- `rsi_reversion`: enters below RSI 30 and exits above RSI 55.
|
|
506
|
+
|
|
507
|
+
Output includes candles, trades, total return, win rate, max drawdown, exposure, latest trade, and risk notes. The backtest ignores fees, slippage, spreads, liquidity, and execution constraints.
|
|
508
|
+
|
|
509
|
+
## Scanner
|
|
510
|
+
|
|
511
|
+
Examples:
|
|
512
|
+
|
|
513
|
+
```text
|
|
514
|
+
/scan watchlist
|
|
515
|
+
/scan watchlist rsi<30
|
|
516
|
+
/scan watchlist rsi>70
|
|
517
|
+
/scan watchlist trend=bullish
|
|
518
|
+
/scan watchlist trend=bearish 1d
|
|
519
|
+
/scan watchlist rsi>60 trend=bullish
|
|
520
|
+
/scan export csv scan.csv rsi<30 1d
|
|
521
|
+
/scan export json scan.json trend=bullish 1d
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
The scanner fetches history asynchronously in limited batches, calculates indicators, and only displays symbols that match the filter.
|
|
525
|
+
|
|
526
|
+
Scanner exports write matched scan rows from the current watchlist to CSV or JSON.
|
|
527
|
+
|
|
528
|
+
## Exportable Market Reports
|
|
529
|
+
|
|
530
|
+
```text
|
|
531
|
+
/report market AAPL md report.md
|
|
532
|
+
/report market AAPL json report.json
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
Market reports reuse the `/market` overview pipeline and export quote, data quality, technicals, market structure, fundamentals, latest news, and disclaimer to Markdown or JSON.
|
|
536
|
+
|
|
537
|
+
## Portfolio Transaction Ledger
|
|
538
|
+
|
|
539
|
+
Use the transaction ledger for more serious portfolio tracking:
|
|
540
|
+
|
|
541
|
+
```text
|
|
542
|
+
/tx add buy AAPL 10 185
|
|
543
|
+
/tx add sell AAPL 5 195
|
|
544
|
+
/tx list
|
|
545
|
+
/portfolio performance
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
Buy transactions update quantity and average price. Sell transactions reduce position size and record realized PnL. `/portfolio performance` shows cost basis, market value, unrealized PnL, realized PnL, and total PnL.
|
|
549
|
+
|
|
550
|
+
## Journal Analytics
|
|
551
|
+
|
|
552
|
+
```text
|
|
553
|
+
/journal stats
|
|
554
|
+
/journal review
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
`/journal stats` calculates total entries, wins/losses, win rate, dominant instrument, dominant emotion, and top tags. `/journal review` sends journal statistics and recent entries to the active AI provider for process review, repeated mistake detection, risk notes, and habit improvement. Output includes a non-financial-advice disclaimer.
|
|
558
|
+
|
|
559
|
+
## Session History
|
|
560
|
+
|
|
561
|
+
```text
|
|
562
|
+
/history
|
|
563
|
+
/history sessions
|
|
564
|
+
/history show <session_id>
|
|
565
|
+
/history save "Morning market research"
|
|
566
|
+
/history delete <session_id>
|
|
567
|
+
/history clear current
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
FinCLI stores local session events in SQLite so users can review previous terminal sessions. API key commands are redacted before being saved.
|
|
571
|
+
|
|
572
|
+
## Price Alerts
|
|
573
|
+
|
|
574
|
+
```text
|
|
575
|
+
/alert
|
|
576
|
+
/alert add AAPL above 200
|
|
577
|
+
/alert add EURUSD below 1.0800
|
|
578
|
+
/alert check
|
|
579
|
+
/alert remove <id>
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
Alerts are stored locally in SQLite. v0.2.0 checks alerts manually with `/alert check` using the active quote provider. Triggered alerts are marked inactive. This is not a background notification daemon yet.
|
|
583
|
+
|
|
584
|
+
## AI Providers
|
|
585
|
+
|
|
586
|
+
Supported provider keys:
|
|
587
|
+
|
|
588
|
+
- `openrouter`: `OPENROUTER_API_KEY`
|
|
589
|
+
- `openai`: `OPENAI_API_KEY`
|
|
590
|
+
- `groq`: `GROQ_API_KEY`
|
|
591
|
+
- `together`: `TOGETHER_API_KEY`
|
|
592
|
+
- `huggingface`: `HUGGINGFACE_API_KEY`
|
|
593
|
+
- `gemini`: `GEMINI_API_KEY`
|
|
594
|
+
- `anthropic`: `ANTHROPIC_API_KEY`
|
|
595
|
+
|
|
596
|
+
Examples:
|
|
597
|
+
|
|
598
|
+
```text
|
|
599
|
+
/ai_model openrouter openai/gpt-4o-mini
|
|
600
|
+
/ai_model key openrouter <api_key>
|
|
601
|
+
/ai explain NVDA market risk briefly
|
|
602
|
+
/analyze AAPL 1d
|
|
603
|
+
```
|
|
604
|
+
|
|
605
|
+
API keys are never printed in full.
|
|
606
|
+
|
|
607
|
+
## Realtime vs Delayed Data
|
|
608
|
+
|
|
609
|
+
FinCLI uses yfinance as the default fallback. yfinance data is usually delayed and must not be described as realtime. API providers may provide realtime data only if the provider, subscription plan, and exchange entitlement support it.
|
|
610
|
+
|
|
611
|
+
FinCLI displays provider status as realtime, delayed, fallback, or unavailable whenever the provider exposes that status.
|
|
612
|
+
|
|
613
|
+
## Yahoo Finance Tables
|
|
614
|
+
|
|
615
|
+
FinCLI uses yfinance for global equities available on Yahoo Finance. For non-US stocks, use the Yahoo exchange suffix when known, such as `BBRI.JK`, `HSBA.L`, `SHOP.TO`, or `0700.HK`. For common IDX tickers such as `BBRI`, `BBCA`, `BMRI`, `TLKM`, and `ASII`, FinCLI automatically maps them to `.JK`.
|
|
616
|
+
|
|
617
|
+
Commands:
|
|
618
|
+
|
|
619
|
+
```text
|
|
620
|
+
/quote BBRI
|
|
621
|
+
/technical BBRI 1d
|
|
622
|
+
/analyze BBRI 1d
|
|
623
|
+
/yahoo BBRI history 6mo 1d
|
|
624
|
+
/yahoo BBRI news
|
|
625
|
+
/yahoo BBRI statistics
|
|
626
|
+
/yahoo BBRI profile
|
|
627
|
+
/yahoo BBRI financials
|
|
628
|
+
/yahoo BBRI balance
|
|
629
|
+
/yahoo BBRI cashflow
|
|
630
|
+
/yahoo BBRI analysis
|
|
631
|
+
/yahoo BBRI holders
|
|
632
|
+
```
|
|
633
|
+
|
|
634
|
+
Yahoo Finance URL examples:
|
|
635
|
+
|
|
636
|
+
```text
|
|
637
|
+
https://finance.yahoo.com/quote/BBRI.JK/
|
|
638
|
+
https://finance.yahoo.com/quote/BBRI.JK/news/
|
|
639
|
+
https://finance.yahoo.com/quote/BBRI.JK/key-statistics/
|
|
640
|
+
https://finance.yahoo.com/quote/BBRI.JK/history/
|
|
641
|
+
https://finance.yahoo.com/quote/BBRI.JK/profile/
|
|
642
|
+
https://finance.yahoo.com/quote/BBRI.JK/financials/
|
|
643
|
+
https://finance.yahoo.com/quote/BBRI.JK/analysis/
|
|
644
|
+
https://finance.yahoo.com/quote/BBRI.JK/holders/
|
|
645
|
+
```
|
|
646
|
+
|
|
647
|
+
Availability of news, analysis, holders, and financial tables depends on Yahoo coverage for the exchange/ticker.
|
|
648
|
+
|
|
649
|
+
## Finnhub Provider
|
|
650
|
+
|
|
651
|
+
Open the provider selector:
|
|
652
|
+
|
|
653
|
+
```text
|
|
654
|
+
/news_model
|
|
655
|
+
```
|
|
656
|
+
|
|
657
|
+
Environment variable:
|
|
658
|
+
|
|
659
|
+
```env
|
|
660
|
+
FINNHUB_API_KEY=your-finnhub-key
|
|
661
|
+
```
|
|
662
|
+
|
|
663
|
+
Or save it from FinCLI:
|
|
664
|
+
|
|
665
|
+
```text
|
|
666
|
+
/news_model key finnhub <api_key>
|
|
667
|
+
```
|
|
668
|
+
|
|
669
|
+
Finnhub endpoints used:
|
|
670
|
+
|
|
671
|
+
```text
|
|
672
|
+
GET /quote
|
|
673
|
+
GET /stock/candle
|
|
674
|
+
GET /forex/candle
|
|
675
|
+
GET /crypto/candle
|
|
676
|
+
GET /company-news
|
|
677
|
+
GET /stock/profile2
|
|
678
|
+
GET /calendar/economic
|
|
679
|
+
```
|
|
680
|
+
|
|
681
|
+
Finnhub provides REST/WebSocket data for stocks, currencies/forex, and crypto, plus fundamental/news data depending on plan. In FinCLI, news/fundamental support is strongest for equities; forex/crypto are mainly used for candles and technical analysis.
|
|
682
|
+
|
|
683
|
+
## Twelve Data Provider
|
|
684
|
+
|
|
685
|
+
Open the provider selector:
|
|
686
|
+
|
|
687
|
+
```text
|
|
688
|
+
/news_model
|
|
689
|
+
```
|
|
690
|
+
|
|
691
|
+
Environment variable:
|
|
692
|
+
|
|
693
|
+
```env
|
|
694
|
+
TWELVE_DATA_API_KEY=your-twelve-data-key
|
|
695
|
+
```
|
|
696
|
+
|
|
697
|
+
Or save it from FinCLI:
|
|
698
|
+
|
|
699
|
+
```text
|
|
700
|
+
/news_model key twelvedata <api_key>
|
|
701
|
+
```
|
|
702
|
+
|
|
703
|
+
Twelve Data endpoints used:
|
|
704
|
+
|
|
705
|
+
```text
|
|
706
|
+
GET /quote
|
|
707
|
+
GET /time_series
|
|
708
|
+
```
|
|
709
|
+
|
|
710
|
+
Twelve Data is useful for multi-asset symbols such as forex (`EURUSD`), metals (`XAUUSD`), global indices, ETFs, crypto, and popular US/Europe/Asia stocks. Always check provider plan and exchange entitlement for realtime vs delayed access.
|
|
711
|
+
|
|
712
|
+
## Alpha Vantage Provider
|
|
713
|
+
|
|
714
|
+
Open the provider selector:
|
|
715
|
+
|
|
716
|
+
```text
|
|
717
|
+
/news_model
|
|
718
|
+
```
|
|
719
|
+
|
|
720
|
+
Environment variable:
|
|
721
|
+
|
|
722
|
+
```env
|
|
723
|
+
ALPHA_VANTAGE_API_KEY=your-alpha-vantage-key
|
|
724
|
+
```
|
|
725
|
+
|
|
726
|
+
Or save it from FinCLI:
|
|
727
|
+
|
|
728
|
+
```text
|
|
729
|
+
/news_model key alphavantage <api_key>
|
|
730
|
+
```
|
|
731
|
+
|
|
732
|
+
Alpha Vantage functions used:
|
|
733
|
+
|
|
734
|
+
```text
|
|
735
|
+
GLOBAL_QUOTE
|
|
736
|
+
TIME_SERIES_DAILY_ADJUSTED
|
|
737
|
+
CURRENCY_EXCHANGE_RATE
|
|
738
|
+
FX_DAILY
|
|
739
|
+
NEWS_SENTIMENT
|
|
740
|
+
OVERVIEW
|
|
741
|
+
```
|
|
742
|
+
|
|
743
|
+
Alpha Vantage is useful as an additional stocks/FX adapter. Free plans are rate-limited, and realtime/delayed availability depends on provider plan and exchange coverage.
|
|
744
|
+
|
|
745
|
+
## Provider Commands
|
|
746
|
+
|
|
747
|
+
```text
|
|
748
|
+
/news_model
|
|
749
|
+
/provider list
|
|
750
|
+
/provider status
|
|
751
|
+
/provider test AAPL
|
|
752
|
+
/provider test finnhub AAPL
|
|
753
|
+
/provider key status
|
|
754
|
+
```
|
|
755
|
+
|
|
756
|
+
`/news_model` is the main TUI flow for selecting market/news providers and fallback priority. `/provider status` shows the active provider, fallback chain, and health message. `/provider test <symbol>` tests the active provider. `/provider test <provider> <symbol>` tests a specific provider without changing the active provider.
|
|
757
|
+
|
|
758
|
+
Manual commands such as `/provider use ...` and `/provider priority ...` are still available as advanced CLI fallback commands, but they are not the primary command-palette flow.
|
|
759
|
+
|
|
760
|
+
Example fallback chain saved by the selector:
|
|
761
|
+
|
|
762
|
+
```text
|
|
763
|
+
twelvedata -> finnhub -> custom -> yfinance
|
|
764
|
+
```
|
|
765
|
+
|
|
766
|
+
With this chain, FinCLI tries Twelve Data first. If it fails, it tries the next provider and finally uses delayed yfinance fallback.
|
|
767
|
+
|
|
768
|
+
## Symbol Search and Normalization
|
|
769
|
+
|
|
770
|
+
```text
|
|
771
|
+
/symbol apple
|
|
772
|
+
/symbol XAUUSD
|
|
773
|
+
/symbol normalize EURUSD
|
|
774
|
+
/symbol normalize BBRI
|
|
775
|
+
```
|
|
776
|
+
|
|
777
|
+
`/symbol` searches the local symbol catalog and displays provider-specific symbol mappings for yfinance, Twelve Data, Finnhub, and custom providers. `/symbol normalize <symbol>` works for any input and shows how FinCLI will normalize the symbol before sending it to each provider.
|
|
778
|
+
|
|
779
|
+
Examples:
|
|
780
|
+
|
|
781
|
+
```text
|
|
782
|
+
EURUSD -> EURUSD=X for yfinance, EUR/USD for Twelve Data, OANDA:EUR_USD for Finnhub
|
|
783
|
+
XAUUSD -> XAUUSD=X for yfinance, XAU/USD for Twelve Data
|
|
784
|
+
BBRI -> BBRI.JK for yfinance
|
|
785
|
+
```
|
|
786
|
+
|
|
787
|
+
Normalization does not guarantee provider entitlement. Check `/provider entitlement` and your provider plan for realtime/delayed access and supported exchanges.
|
|
788
|
+
|
|
789
|
+
## Custom Market Provider
|
|
790
|
+
|
|
791
|
+
Open the provider selector:
|
|
792
|
+
|
|
793
|
+
```text
|
|
794
|
+
/news_model
|
|
795
|
+
```
|
|
796
|
+
|
|
797
|
+
Environment variables:
|
|
798
|
+
|
|
799
|
+
```env
|
|
800
|
+
MARKET_DATA_API_KEY=your-key
|
|
801
|
+
MARKET_DATA_BASE_URL=https://your-market-api.example.com
|
|
802
|
+
```
|
|
803
|
+
|
|
804
|
+
Or save from FinCLI:
|
|
805
|
+
|
|
806
|
+
```text
|
|
807
|
+
/news_model key custom <api_key> https://your-market-api.example.com
|
|
808
|
+
```
|
|
809
|
+
|
|
810
|
+
FinCLI calls:
|
|
811
|
+
|
|
812
|
+
```text
|
|
813
|
+
GET /quote/{symbol}
|
|
814
|
+
GET /history/{symbol}?period=6mo&interval=1d
|
|
815
|
+
GET /news/{symbol}?limit=5
|
|
816
|
+
GET /fundamentals/{symbol}
|
|
817
|
+
```
|
|
818
|
+
|
|
819
|
+
Headers are sent as `X-API-Key` and `Authorization: Bearer <key>`. API keys are not displayed in the terminal.
|
|
820
|
+
|
|
821
|
+
Quote payload example:
|
|
822
|
+
|
|
823
|
+
```json
|
|
824
|
+
{
|
|
825
|
+
"symbol": "AAPL",
|
|
826
|
+
"price": 123.45,
|
|
827
|
+
"currency": "USD",
|
|
828
|
+
"timestamp": "2026-06-04T12:00:00",
|
|
829
|
+
"status": "realtime"
|
|
830
|
+
}
|
|
831
|
+
```
|
|
832
|
+
|
|
833
|
+
## Local Storage
|
|
834
|
+
|
|
835
|
+
FinCLI stores local data at:
|
|
836
|
+
|
|
837
|
+
```text
|
|
838
|
+
~/.fincli/config.json
|
|
839
|
+
~/.fincli/fincli.db
|
|
840
|
+
~/.fincli/fincli.log
|
|
841
|
+
~/.fincli/secrets.env
|
|
842
|
+
```
|
|
843
|
+
|
|
844
|
+
API keys are not stored in command output. For global npm installs, the main setup path is:
|
|
845
|
+
|
|
846
|
+
```text
|
|
847
|
+
/ai_model key groq <api_key>
|
|
848
|
+
/news_model key twelvedata <api_key>
|
|
849
|
+
```
|
|
850
|
+
|
|
851
|
+
Keys are stored in `~/.fincli/secrets.env`, automatically loaded for future FinCLI sessions, and do not need to be configured again. If a local `.env` contains an empty value, FinCLI still uses the saved local secret.
|
|
852
|
+
|
|
853
|
+
## Security Notes
|
|
854
|
+
|
|
855
|
+
- Do not commit `.env`.
|
|
856
|
+
- Do not publish `~/.fincli/secrets.env`.
|
|
857
|
+
- FinCLI masks keys in `/config` and `/provider key status`.
|
|
858
|
+
- Session history redacts `/ai_model key ...` and `/news_model key ...` commands.
|
|
859
|
+
- If an API key was ever exposed in a screenshot, npm package, log, or public repository, revoke and rotate it from the provider dashboard.
|
|
860
|
+
|
|
861
|
+
## Test
|
|
862
|
+
|
|
863
|
+
```bash
|
|
864
|
+
pytest
|
|
865
|
+
```
|
|
866
|
+
|
|
867
|
+
Latest local verification:
|
|
868
|
+
|
|
869
|
+
```text
|
|
870
|
+
113 passed
|
|
871
|
+
```
|
|
872
|
+
|
|
873
|
+
NPM wrapper check:
|
|
874
|
+
|
|
875
|
+
```bash
|
|
876
|
+
npm run check
|
|
877
|
+
npm pack --dry-run
|
|
878
|
+
```
|
|
879
|
+
|
|
880
|
+
## Troubleshooting
|
|
881
|
+
|
|
882
|
+
- `fincli` is not recognized: reinstall with `pip install -e .`, `pipx install .`, or `npm install -g .` from the project root.
|
|
883
|
+
- The TUI looks cramped: increase terminal size.
|
|
884
|
+
- API key is not detected: use `/ai_model key <provider> <api_key>` or `/news_model key <provider> <api_key>`, then check `/config` or `/provider key status`.
|
|
885
|
+
- `/quote` fails because yfinance is missing: run `pip install -e ".[dev]"` or `pip install -r requirements.txt`.
|
|
886
|
+
- Config is corrupted: delete `~/.fincli/config.json` to return to defaults.
|
|
887
|
+
- Market data fails for a symbol: check the symbol format for the active provider and try `/provider test <symbol>`.
|
|
888
|
+
|
|
889
|
+
## Roadmap v0.2
|
|
890
|
+
|
|
891
|
+
- More provider adapters. Alpha Vantage started in v0.2.0.
|
|
892
|
+
- Symbol search and provider-specific symbol normalization UI. Started in v0.2.0 through `/symbol`.
|
|
893
|
+
- Economic calendar improvements. Summary counts and export started in v0.2.0.
|
|
894
|
+
- Screener and scanner export. Scanner export started in v0.2.0 through `/scan export`.
|
|
895
|
+
- Lightweight backtesting. Started in v0.2.0 through `/backtest`.
|
|
896
|
+
- Alert system. Started in v0.2.0 through local price alerts and `/alert check`.
|
|
897
|
+
- Exportable market reports. Started in v0.2.0 through `/report market`.
|
|
898
|
+
- Multi-timeframe analysis. Started in v0.2.0 through `/mtf`.
|
|
899
|
+
- Stronger custom provider schema validation. Started in v0.2.0.
|
|
900
|
+
- Provider entitlement handling and realtime/delayed labeling improvements. Started in v0.2.0 through `/provider entitlement`.
|
|
901
|
+
|
|
902
|
+
## Roadmap v0.3
|
|
903
|
+
|
|
904
|
+
- Plugin system.
|
|
905
|
+
- Strategy builder.
|
|
906
|
+
- Advanced portfolio analytics.
|
|
907
|
+
- Notification integrations.
|
|
908
|
+
- Optional cloud sync.
|
|
909
|
+
- Realtime streaming where supported by provider plans.
|