hashprice 0.1.0__tar.gz
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.
- hashprice-0.1.0/LICENSE +21 -0
- hashprice-0.1.0/PKG-INFO +32 -0
- hashprice-0.1.0/README.md +15 -0
- hashprice-0.1.0/pyproject.toml +28 -0
- hashprice-0.1.0/setup.cfg +4 -0
- hashprice-0.1.0/src/hashprice/__init__.py +38 -0
- hashprice-0.1.0/src/hashprice/__main__.py +3 -0
- hashprice-0.1.0/src/hashprice.egg-info/PKG-INFO +32 -0
- hashprice-0.1.0/src/hashprice.egg-info/SOURCES.txt +11 -0
- hashprice-0.1.0/src/hashprice.egg-info/dependency_links.txt +1 -0
- hashprice-0.1.0/src/hashprice.egg-info/entry_points.txt +2 -0
- hashprice-0.1.0/src/hashprice.egg-info/top_level.txt +1 -0
- hashprice-0.1.0/tests/test_hashprice.py +12 -0
hashprice-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 BitSquad LLC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
hashprice-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: hashprice
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Bitcoin hashprice: USD per PH/s per day from BTC price and network hashrate
|
|
5
|
+
Author-email: BitSquad LLC <admin@megawattland.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://megawattland.com
|
|
8
|
+
Project-URL: Repository, https://github.com/chutch62416-netizen/vault
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Requires-Python: >=3.9
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Dynamic: license-file
|
|
17
|
+
|
|
18
|
+
# hashprice
|
|
19
|
+
|
|
20
|
+
Bitcoin hashprice: USD per PH/s per day from BTC price and network hashrate
|
|
21
|
+
|
|
22
|
+
```python
|
|
23
|
+
from hashprice import hashprice
|
|
24
|
+
hashprice(100_000, 700) # USD per PH/s per day
|
|
25
|
+
hashprice(100_000, 700, block_subsidy_btc=3.125, fees_btc_per_block=0.1)
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
hashprice 100000 700 [--subsidy 3.125] [--fees 0.1]
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Maintained by [BitSquad LLC / MegawattLand](https://megawattland.com). MIT license. Source: https://github.com/chutch62416-netizen/vault
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# hashprice
|
|
2
|
+
|
|
3
|
+
Bitcoin hashprice: USD per PH/s per day from BTC price and network hashrate
|
|
4
|
+
|
|
5
|
+
```python
|
|
6
|
+
from hashprice import hashprice
|
|
7
|
+
hashprice(100_000, 700) # USD per PH/s per day
|
|
8
|
+
hashprice(100_000, 700, block_subsidy_btc=3.125, fees_btc_per_block=0.1)
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
hashprice 100000 700 [--subsidy 3.125] [--fees 0.1]
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Maintained by [BitSquad LLC / MegawattLand](https://megawattland.com). MIT license. Source: https://github.com/chutch62416-netizen/vault
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "hashprice"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Bitcoin hashprice: USD per PH/s per day from BTC price and network hashrate"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = {text = "MIT"}
|
|
11
|
+
authors = [{name = "BitSquad LLC", email = "admin@megawattland.com"}]
|
|
12
|
+
requires-python = ">=3.9"
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Development Status :: 3 - Alpha",
|
|
15
|
+
"License :: OSI Approved :: MIT License",
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Operating System :: OS Independent",
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
[project.urls]
|
|
21
|
+
Homepage = "https://megawattland.com"
|
|
22
|
+
Repository = "https://github.com/chutch62416-netizen/vault"
|
|
23
|
+
|
|
24
|
+
[project.scripts]
|
|
25
|
+
hashprice = "hashprice:main"
|
|
26
|
+
|
|
27
|
+
[tool.setuptools.packages.find]
|
|
28
|
+
where = ["src"]
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"""hashprice: USD revenue per PH/s per day."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import argparse
|
|
5
|
+
|
|
6
|
+
__version__ = "0.1.0"
|
|
7
|
+
__all__ = ["hashprice", "main", "__version__"]
|
|
8
|
+
|
|
9
|
+
BLOCKS_PER_DAY = 144.0
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def hashprice(btc_price_usd: float, network_hashrate_ehs: float,
|
|
13
|
+
block_subsidy_btc: float = 3.125, fees_btc_per_block: float = 0.1) -> float:
|
|
14
|
+
"""Return expected USD per PH/s per day.
|
|
15
|
+
|
|
16
|
+
Network hashrate in EH/s; 1 EH/s = 1000 PH/s. Blocks per day assumed 144.
|
|
17
|
+
"""
|
|
18
|
+
if network_hashrate_ehs <= 0:
|
|
19
|
+
raise ValueError("network_hashrate_ehs must be > 0")
|
|
20
|
+
btc_per_day = BLOCKS_PER_DAY * (block_subsidy_btc + fees_btc_per_block)
|
|
21
|
+
btc_per_phs_day = btc_per_day / (network_hashrate_ehs * 1000.0)
|
|
22
|
+
return btc_per_phs_day * btc_price_usd
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def main(argv=None) -> int:
|
|
26
|
+
p = argparse.ArgumentParser(prog="hashprice", description="USD per PH/s per day")
|
|
27
|
+
p.add_argument("--version", action="version", version=__version__)
|
|
28
|
+
p.add_argument("btc_price_usd", type=float)
|
|
29
|
+
p.add_argument("network_hashrate_ehs", type=float)
|
|
30
|
+
p.add_argument("--subsidy", type=float, default=3.125, help="block subsidy BTC (default 3.125)")
|
|
31
|
+
p.add_argument("--fees", type=float, default=0.1, help="fees per block BTC (default 0.1)")
|
|
32
|
+
a = p.parse_args(argv)
|
|
33
|
+
print(f"{hashprice(a.btc_price_usd, a.network_hashrate_ehs, a.subsidy, a.fees):.2f}")
|
|
34
|
+
return 0
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
if __name__ == "__main__":
|
|
38
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: hashprice
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Bitcoin hashprice: USD per PH/s per day from BTC price and network hashrate
|
|
5
|
+
Author-email: BitSquad LLC <admin@megawattland.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://megawattland.com
|
|
8
|
+
Project-URL: Repository, https://github.com/chutch62416-netizen/vault
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Requires-Python: >=3.9
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Dynamic: license-file
|
|
17
|
+
|
|
18
|
+
# hashprice
|
|
19
|
+
|
|
20
|
+
Bitcoin hashprice: USD per PH/s per day from BTC price and network hashrate
|
|
21
|
+
|
|
22
|
+
```python
|
|
23
|
+
from hashprice import hashprice
|
|
24
|
+
hashprice(100_000, 700) # USD per PH/s per day
|
|
25
|
+
hashprice(100_000, 700, block_subsidy_btc=3.125, fees_btc_per_block=0.1)
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
hashprice 100000 700 [--subsidy 3.125] [--fees 0.1]
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Maintained by [BitSquad LLC / MegawattLand](https://megawattland.com). MIT license. Source: https://github.com/chutch62416-netizen/vault
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/hashprice/__init__.py
|
|
5
|
+
src/hashprice/__main__.py
|
|
6
|
+
src/hashprice.egg-info/PKG-INFO
|
|
7
|
+
src/hashprice.egg-info/SOURCES.txt
|
|
8
|
+
src/hashprice.egg-info/dependency_links.txt
|
|
9
|
+
src/hashprice.egg-info/entry_points.txt
|
|
10
|
+
src/hashprice.egg-info/top_level.txt
|
|
11
|
+
tests/test_hashprice.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
hashprice
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
from hashprice import hashprice
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def test_hashprice():
|
|
6
|
+
# 144 * 3.225 = 464.4 BTC/day; / 700000 PH = 0.000663428 BTC; * 100000 = 66.34
|
|
7
|
+
assert hashprice(100_000, 700) == pytest.approx(66.34, abs=0.01)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def test_zero_hashrate():
|
|
11
|
+
with pytest.raises(ValueError):
|
|
12
|
+
hashprice(1, 0)
|