Polar Sun

Acropolis => Scriptorium => Source Code => Topic started by: Pallas_Boreas on 2026-Aug-27, 04:07:10

Title: KFI MicroPython Scripts
Post by: Pallas_Boreas on 2026-Aug-27, 04:07:10
These scripts should work on any relatively recent device that has MicroPython of at least version 1.9.4, equivalent too Python 3.8, and maybe older since it uses only core features and simple logic with the standard math library being the only import. They will also work on the full Python.

I wanted a portable, quick, way to calculate the KFI on my calculator. It also serves as a reference on the steps involved.

kfi(.py) will ask for the length of the look back period/candles (n=*) and then the necessary values and then output them and the derivatives Dv, Cr, and F. n between 3 & 5 is optimal before lag starts to be introduced in the denominator Eta and D in the numerator, being more significant for Eta then D because it is in the denominator. If looking over a long period say daily or weekly then the increased lag won't matter.

Included is a complimentary script that prints the information of m_divisor, asset class, and phase thresholds.

I wrote it on the Casio fx-CG100 graphing calculator, MicroPython 1.9.4. Also tested on Python 3.14.6, ipython 9.16.1 on Linux with Positron IDE.

For a zipped file and the possibility to tip they can also be downloaded at: https://ko-fi.com/s/216efb3532.
Title: Re: KFI MicroPython Scripts
Post by: Pallas_Boreas on 2026-Aug-31, 03:31:14
There is a background story of the equation at the Polar Sun Research Substack: Coffee Rings, Markets, Pencils, Mathematics, Physics, And Capital Flows (https://pallasboreas.substack.com/p/coffee-rings-markets-pencils-mathematics).
Title: Re: KFI MicroPython Scripts
Post by: Pallas_Boreas on 2026-Aug-31, 03:43:08
The original kfi(.py) with n=5 is now here renamed kfi0(.py).