new: script to calculate positions based on golden ratio

This commit is contained in:
xpk
2025-11-26 09:02:52 +08:00
parent ca7f67dfc8
commit 953305814e
+36
View File
@@ -0,0 +1,36 @@
#!/usr/bin/env python3
r"""
Documentation
License: This program is released under the MIT License
"""
# Imports
import sys
from terminaltables import SingleTable
# Main function
def main() -> None:
difference = float(sys.argv[2]) - float(sys.argv[1]);
if float(sys.argv[2]) > float(sys.argv[1]):
label1, label2 = "LO", "HI"
else:
label1, label2 = "HI", "LO"
table_data = [
['Position', 'Value'],
[label1, f"{int(sys.argv[1]):,}"],
['0.382', f"{int(difference * 0.382 + float(sys.argv[1])):,}"],
['0.5', f"{int(difference * 0.5 + float(sys.argv[1])):,}"],
['0.618', f"{int(difference * 0.618 + float(sys.argv[1])):,}"],
['0.764', f"{int(difference * 0.764 + float(sys.argv[1])):,}"],
[label2, f"{int(sys.argv[2]):,}"]
]
t1 = SingleTable(table_data)
print(t1.table)
# Call main function
if __name__ == '__main__':
main()