Created
November 13, 2020 07:25
-
-
Save codcodog/2c4c569501788e352eabd45e7e7a4331 to your computer and use it in GitHub Desktop.
bias calculate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
avg_price = float(sys.argv[1]) | |
new_price = float(sys.argv[2]) | |
bias = float(sys.argv[3]) | |
unit = (new_price - avg_price) / bias | |
buy_price1 = round(avg_price - unit * 3, 3) | |
buy_price2 = round(avg_price - unit * 5, 3) | |
buy_price3 = round(avg_price - unit * 7, 3) | |
sell_price1 = round(avg_price + unit * 3, 3) | |
sell_price2 = round(avg_price + unit * 5, 3) | |
sell_price3 = round(avg_price + unit * 7, 3) | |
sell_price4 = round(avg_price + unit * 10, 3) | |
print("-3 bias: ", buy_price1) | |
print("-5 bias: ", buy_price2) | |
print("-7 bias: ", buy_price3) | |
print("") | |
print("22 price: {}, now price: {}, now bias: {}".format(avg_price, new_price, bias)) | |
print() | |
print("3 bias: ", sell_price1) | |
print("5 bias: ", sell_price2) | |
print("7 bias: ", sell_price3) | |
print("10 bias: ", sell_price4) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment