abstract-math 0.0.0.3__py3-none-any.whl → 0.0.0.5__py3-none-any.whl

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.

Potentially problematic release.


This version of abstract-math might be problematic. Click here for more details.

@@ -0,0 +1,97 @@
1
+ from decimal import Decimal, getcontext
2
+ from .safe_math import *
3
+ getcontext().prec = 50 # High precision for accuracy
4
+ SOL_DECIMAL_PLACE = 9
5
+ SOL_LAMPORTS = sol_lamports =int(exponential(1,exp=SOL_DECIMAL_PLACE,num=1))
6
+ def get_proper_args(strings,*args,**kwargs):
7
+ properArgs = []
8
+ for key in strings:
9
+ kwarg get_virtual_reserve_ratio(*args,**kwargs)= kwargs.get(key)
10
+ if kwarg == None and args:
11
+ kwarg = args[0]
12
+ args = [] if len(args) == 1 else args[1:]
13
+ properArgs.append(kwarg)
14
+ return properArgs
15
+
16
+ #lamports
17
+ def get_lamports(integer):
18
+ return exp_it(10,len(str(integer))+1,1)
19
+ def get_lamport_difference(lamports,virtual_lamports):
20
+ integer = int(virtual_lamports/lamports)
21
+ exponential = len(str(integer))
22
+ return int(exponential(1,exp=exponential,num=1))
23
+ #virtual reserves
24
+ def get_vitual_reserves(*args,**kwargs):
25
+ proper_args = get_proper_args(["virtualSolReserves","virtualTokenReserves"],*args,**kwargs)
26
+ return proper_args
27
+ def get_virtual_reserve_ratio(*args,**kwargs):
28
+ proper_args = get_vitual_reserves(*args,**kwargs)
29
+ return divide_it(*proper_args)
30
+ #sol reserves
31
+ def get_virtual_sol_reservs(*args,**kwargs):
32
+ proper_args = get_proper_args(["virtualSolReserves"],*args,**kwargs)
33
+ return proper_args[0] if proper_args else proper_args
34
+ def get_virtual_sol_lamports(*args,**kwargs):
35
+ virtual_sol_reserves = get_virtual_sol_reservs(*args,**kwargs)
36
+ virtual_sol_lamports = get_lamports(virtual_sol_reserves)
37
+ return virtual_sol_lamports
38
+ def get_virtual_sol_lamp_difference(*args,**kwargs):
39
+ virtual_sol_lamports = get_virtual_sol_lamports(*args,**kwargs)
40
+ return get_lamport_difference(SOL_LAMPORTS,virtual_sol_lamports)
41
+ #sol Amount
42
+ def get_sol_amount(*args,**kwargs):
43
+ proper_args = get_proper_args(["solAmount"],*args,**kwargs)
44
+ return proper_args[0] if proper_args else proper_args
45
+ def getSolAmountUi(*args,**kwargs):
46
+ sol_amount = get_sol_amount(*args,**kwargs)
47
+ return exponential(sol_amount,SOL_DECIMAL_PLACE)
48
+ #token reserves
49
+ def get_virtual_token_reservs(*args,**kwargs):
50
+ proper_args = get_proper_args(["virtualTokenReserves"],*args,**kwargs)
51
+ return proper_args[0] if proper_args else proper_args
52
+ def get_virtual_token_lamports(*args,**kwargs):
53
+ virtual_token_reserves = get_virtual_token_reservs(*args,**kwargs)
54
+ virtual_token_lamports = get_lamports(virtual_token_reserves)
55
+ return virtual_token_lamports
56
+ #token amount
57
+ def get_token_amount(*args,**kwargs):
58
+ proper_args = get_proper_args(["tokenAmount"],*args,**kwargs)
59
+ return proper_args[0] if proper_args else proper_args
60
+ def get_token_amount_ui(*args,**kwargs):
61
+ token_amount = get_token_amount(*args,**kwargs)
62
+ token_decimals = derive_token_decimals(*args,**kwargs)
63
+ return exponential(token_amount,exp=token_decimals)
64
+ #token derivision
65
+ def derive_token_decimals_from_token_variables(variables):
66
+ variables["price"] = get_price(**variables)
67
+ variables["tokenDecimals"] = derive_decimals_from_vars(*args,**kwargs)
68
+ return variables
69
+ def get_derived_token_ratio(*args,**kwarg):
70
+ derived_token_amount = derive_token_amount(*args,**kwargs)
71
+ token_amount = get_token_amount(*args,**kwargs)
72
+ ratio = divide_it(derived_token_amount,token_amount)
73
+ return ratio
74
+ def derive_token_amount(*args,**kwargs):
75
+ virtual_token_reserves = get_virtual_token_reserves(*args,**kwargs)
76
+ price = get_price(*args,**kwargs)
77
+ derived_token_amount = divide_it(virtual_token_reserves,price)
78
+ return derived_token_amount
79
+ #derive variables
80
+ def get_price(*args,**kwargs):
81
+ reserve_ratios = get_virtual_reserve_ratio(*args,**kwargs)
82
+ virtual_sol_lamp_difference = get_virtual_sol_lamp_difference(*args,**kwargs)
83
+ return reserve_ratios/virtual_sol_lamp_difference
84
+ def derive_decimals_from_vars(*args,**kwargs):
85
+ ratio = get_derived_token_ratio(*args,**kwarg)
86
+ decimals = -1
87
+ while abs(ratio - round(ratio)) > 1e-9:
88
+ ratio *= 10
89
+ decimals += 1
90
+ return decimals
91
+ def update_token_variables(variables):
92
+ variables['solAmountUi'] = getSolAmountUi(**variables)
93
+ variables['solDecimals'] = 9
94
+ variables = derive_token_decimals_from_token_variables(variables)
95
+ variables['tokenAmountUi'] = exponential(variables['tokenAmount'],variables["tokenDecimals"])
96
+ return variables
97
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: abstract_math
3
- Version: 0.0.0.3
3
+ Version: 0.0.0.5
4
4
  Author: putkoff
5
5
  Author-email: partners@abstractendeavors.com
6
6
  Classifier: Development Status :: 3 - Alpha
@@ -0,0 +1,8 @@
1
+ abstract_math/__init__.py,sha256=3I0YJakDUyWD7qXpdRsaEsmcA7IxwcWhoyecvDfOE98,54
2
+ abstract_math/derive_tokens.py,sha256=SOR8TcbGHz4Xgu2GgSO6zUA1_dh8QH1ld34i1aVhl3k,4314
3
+ abstract_math/deriveit.py,sha256=Og8QtDGRrgGbmaHTh-jEusg35jUpb74DgzslsxZ_2iU,4271
4
+ abstract_math/safe_math.py,sha256=CP05f3-SHQ3aJu1bO1IJGQ7HYOwpqonMVb0kN3gBbEU,6838
5
+ abstract_math-0.0.0.5.dist-info/METADATA,sha256=SqSijSYTcd_26QExbF9ZMUpxytaiX8KFoNpgueGoDZM,579
6
+ abstract_math-0.0.0.5.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
7
+ abstract_math-0.0.0.5.dist-info/top_level.txt,sha256=b7jOgD9c0U-CGH-l7yxhMPukzD40kMEQkQRV_sGyVfE,14
8
+ abstract_math-0.0.0.5.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- abstract_math/__init__.py,sha256=3I0YJakDUyWD7qXpdRsaEsmcA7IxwcWhoyecvDfOE98,54
2
- abstract_math/deriveit.py,sha256=Og8QtDGRrgGbmaHTh-jEusg35jUpb74DgzslsxZ_2iU,4271
3
- abstract_math/safe_math.py,sha256=CP05f3-SHQ3aJu1bO1IJGQ7HYOwpqonMVb0kN3gBbEU,6838
4
- abstract_math-0.0.0.3.dist-info/METADATA,sha256=jO07_wMODpJSmnZK_HW2mbr0V9K2RuW-tC_8d2YPAa8,579
5
- abstract_math-0.0.0.3.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
6
- abstract_math-0.0.0.3.dist-info/top_level.txt,sha256=b7jOgD9c0U-CGH-l7yxhMPukzD40kMEQkQRV_sGyVfE,14
7
- abstract_math-0.0.0.3.dist-info/RECORD,,