new: script to calculate positions based on golden ratio
This commit is contained in:
Executable
+36
@@ -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()
|
||||
Reference in New Issue
Block a user