feature: add alternate algorithm handlers (#240)
* feature: handle all hashrate algorithm conversions for antminers * feature: handle all hashrate algorithm conversions for auradine * feature: handle all hashrate algorithm conversions for avalonminers * feature: handle all hashrate algorithm conversions for bitaxe * feature: handle all hashrate algorithm conversions for epic * feature: handle all hashrate algorithm conversions for goldshell * refactor: clean up imports * feature: handle all hashrate algorithm conversions for hammer * feature: handle all hashrate algorithm conversions for iceriver * feature: handle all hashrate algorithm conversions for innosilicon * feature: handle all hashrate algorithm conversions for whatsminer * tests: update tests to check if miners have board, fan, and algo values * feature: finish updating all miners with boards, fans, and algos * feature: update algorithm default values * feature: add algorithm hashrate values * feature: improve hashrate types, and use `self.algo` inside miners --------- Co-authored-by: Upstream Data <brett@upstreamdata.ca>
This commit is contained in:
@@ -24,12 +24,12 @@ from pydantic import BaseModel, Field, computed_field, field_serializer
|
||||
from pyasic.config import MinerConfig
|
||||
from pyasic.config.mining import MiningModePowerTune
|
||||
from pyasic.data.pools import PoolMetrics, Scheme
|
||||
from pyasic.device.algorithm.hashrate import AlgoHashRateType
|
||||
|
||||
from .boards import HashBoard
|
||||
from .device import DeviceInfo
|
||||
from .error_codes import BraiinsOSError, InnosiliconError, WhatsminerError, X19Error
|
||||
from .fans import Fan
|
||||
from .hashrate import AlgoHashRate, AlgoHashRateType, HashUnit
|
||||
|
||||
|
||||
class MinerData(BaseModel):
|
||||
@@ -49,7 +49,6 @@ class MinerData(BaseModel):
|
||||
fw_ver: The current firmware version on the miner as a str.
|
||||
hostname: The network hostname of the miner as a str.
|
||||
hashrate: The hashrate of the miner in TH/s as a float. Calculated automatically.
|
||||
_hashrate: Backup for hashrate found via API instead of hashboards.
|
||||
expected_hashrate: The factory nominal hashrate of the miner in TH/s as a float.
|
||||
hashboards: A list of [`HashBoard`][pyasic.data.HashBoard]s on the miner with their statistics.
|
||||
temperature_avg: The average temperature across the boards. Calculated automatically.
|
||||
|
||||
@@ -18,7 +18,7 @@ from typing import Any
|
||||
|
||||
from pydantic import BaseModel, field_serializer
|
||||
|
||||
from .hashrate import AlgoHashRateType
|
||||
from pyasic.device.algorithm.hashrate import AlgoHashRateType
|
||||
|
||||
|
||||
class HashBoard(BaseModel):
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
from enum import Enum
|
||||
|
||||
from pyasic.data.hashrate.base import AlgoHashRateType
|
||||
from pyasic.data.hashrate.sha256 import SHA256HashRate
|
||||
from pyasic.device.algorithm.sha256 import SHA256Unit
|
||||
|
||||
|
||||
class AlgoHashRate(Enum):
|
||||
SHA256 = SHA256HashRate
|
||||
|
||||
def __call__(self, *args, **kwargs):
|
||||
return self.value(*args, **kwargs)
|
||||
|
||||
|
||||
class HashUnit:
|
||||
SHA256 = SHA256Unit
|
||||
@@ -1,5 +0,0 @@
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class AlgoHashRateType(BaseModel):
|
||||
pass
|
||||
@@ -1,6 +1,26 @@
|
||||
from pyasic.device.algorithm.base import MinerAlgoType
|
||||
from pyasic.device.algorithm.sha256 import SHA256Algo
|
||||
from .base import MinerAlgoType
|
||||
from .blake256 import Blake256Algo
|
||||
from .eaglesong import EaglesongAlgo
|
||||
from .equihash import EquihashAlgo
|
||||
from .ethash import EtHashAlgo
|
||||
from .handshake import HandshakeAlgo
|
||||
from .hashrate import *
|
||||
from .hashrate.unit import *
|
||||
from .kadena import KadenaAlgo
|
||||
from .kheavyhash import KHeavyHashAlgo
|
||||
from .scrypt import ScryptAlgo
|
||||
from .sha256 import SHA256Algo
|
||||
from .x11 import X11Algo
|
||||
|
||||
|
||||
class MinerAlgo:
|
||||
SHA256 = SHA256Algo
|
||||
SCRYPT = ScryptAlgo
|
||||
KHEAVYHASH = KHeavyHashAlgo
|
||||
KADENA = KadenaAlgo
|
||||
HANDSHAKE = HandshakeAlgo
|
||||
X11 = X11Algo
|
||||
BLAKE256 = Blake256Algo
|
||||
EAGLESONG = EaglesongAlgo
|
||||
ETHASH = EtHashAlgo
|
||||
EQUIHASH = EquihashAlgo
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from enum import IntEnum
|
||||
from .hashrate.base import AlgoHashRateType
|
||||
from .hashrate.unit.base import AlgoHashRateUnitType
|
||||
|
||||
|
||||
class MinerAlgoType(str):
|
||||
pass
|
||||
hashrate: type[AlgoHashRateType]
|
||||
unit: type[AlgoHashRateUnitType]
|
||||
|
||||
17
pyasic/device/algorithm/blake256.py
Normal file
17
pyasic/device/algorithm/blake256.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from .base import MinerAlgoType
|
||||
from .hashrate import Blake256HashRate
|
||||
from .hashrate.unit import Blake256Unit
|
||||
|
||||
|
||||
# make this json serializable
|
||||
class _Blake256Algo(MinerAlgoType):
|
||||
hashrate = Blake256HashRate
|
||||
unit = Blake256Unit
|
||||
|
||||
def __repr__(self):
|
||||
return "Blake256Algo"
|
||||
|
||||
|
||||
Blake256Algo = _Blake256Algo("Blake256")
|
||||
17
pyasic/device/algorithm/eaglesong.py
Normal file
17
pyasic/device/algorithm/eaglesong.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from .base import MinerAlgoType
|
||||
from .hashrate import EaglesongHashRate
|
||||
from .hashrate.unit import EaglesongUnit
|
||||
|
||||
|
||||
# make this json serializable
|
||||
class _EaglesongAlgo(MinerAlgoType):
|
||||
hashrate = EaglesongHashRate
|
||||
unit = EaglesongUnit
|
||||
|
||||
def __repr__(self):
|
||||
return "EaglesongAlgo"
|
||||
|
||||
|
||||
EaglesongAlgo = _EaglesongAlgo("Eaglesong")
|
||||
17
pyasic/device/algorithm/equihash.py
Normal file
17
pyasic/device/algorithm/equihash.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from .base import MinerAlgoType
|
||||
from .hashrate import EquihashHashRate
|
||||
from .hashrate.unit import EquihashUnit
|
||||
|
||||
|
||||
# make this json serializable
|
||||
class _EquihashAlgo(MinerAlgoType):
|
||||
hashrate = EquihashHashRate
|
||||
unit = EquihashUnit
|
||||
|
||||
def __repr__(self):
|
||||
return "EquihashAlgo"
|
||||
|
||||
|
||||
EquihashAlgo = _EquihashAlgo("Equihash")
|
||||
17
pyasic/device/algorithm/ethash.py
Normal file
17
pyasic/device/algorithm/ethash.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from .base import MinerAlgoType
|
||||
from .hashrate import EtHashHashRate
|
||||
from .hashrate.unit import EtHashUnit
|
||||
|
||||
|
||||
# make this json serializable
|
||||
class _EtHashAlgo(MinerAlgoType):
|
||||
hashrate = EtHashHashRate
|
||||
unit = EtHashUnit
|
||||
|
||||
def __repr__(self):
|
||||
return "EtHashAlgo"
|
||||
|
||||
|
||||
EtHashAlgo = _EtHashAlgo("EtHash")
|
||||
17
pyasic/device/algorithm/handshake.py
Normal file
17
pyasic/device/algorithm/handshake.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from .base import MinerAlgoType
|
||||
from .hashrate import HandshakeHashRate
|
||||
from .hashrate.unit import HandshakeUnit
|
||||
|
||||
|
||||
# make this json serializable
|
||||
class _HandshakeAlgo(MinerAlgoType):
|
||||
hashrate = HandshakeHashRate
|
||||
unit = HandshakeUnit
|
||||
|
||||
def __repr__(self):
|
||||
return "HandshakeAlgo"
|
||||
|
||||
|
||||
HandshakeAlgo = _HandshakeAlgo("Handshake")
|
||||
24
pyasic/device/algorithm/hashrate/__init__.py
Normal file
24
pyasic/device/algorithm/hashrate/__init__.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from .base import AlgoHashRateType
|
||||
from .blake256 import Blake256HashRate
|
||||
from .eaglesong import EaglesongHashRate
|
||||
from .equihash import EquihashHashRate
|
||||
from .ethash import EtHashHashRate
|
||||
from .handshake import HandshakeHashRate
|
||||
from .kadena import KadenaHashRate
|
||||
from .kheavyhash import KHeavyHashHashRate
|
||||
from .scrypt import ScryptHashRate
|
||||
from .sha256 import SHA256HashRate
|
||||
from .x11 import X11HashRate
|
||||
|
||||
|
||||
class AlgoHashRate:
|
||||
SHA256 = SHA256HashRate
|
||||
SCRYPT = ScryptHashRate
|
||||
KHEAVYHASH = KHeavyHashHashRate
|
||||
KADENA = KadenaHashRate
|
||||
HANDSHAKE = HandshakeHashRate
|
||||
X11 = X11HashRate
|
||||
BLAKE256 = Blake256HashRate
|
||||
EAGLESONG = EaglesongHashRate
|
||||
ETHASH = EtHashHashRate
|
||||
EQUIHASH = EquihashHashRate
|
||||
26
pyasic/device/algorithm/hashrate/base.py
Normal file
26
pyasic/device/algorithm/hashrate/base.py
Normal file
@@ -0,0 +1,26 @@
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from .unit.base import AlgoHashRateUnitType
|
||||
|
||||
|
||||
class AlgoHashRateType(BaseModel, ABC):
|
||||
unit: AlgoHashRateUnitType
|
||||
rate: float
|
||||
|
||||
@abstractmethod
|
||||
def into(self, other: "AlgoHashRateUnitType"):
|
||||
pass
|
||||
|
||||
def __float__(self):
|
||||
return float(self.rate)
|
||||
|
||||
def __int__(self):
|
||||
return int(self.rate)
|
||||
|
||||
def __repr__(self):
|
||||
return f"{self.rate} {str(self.unit)}"
|
||||
|
||||
def __round__(self, n: int = None):
|
||||
return round(self.rate, n)
|
||||
51
pyasic/device/algorithm/hashrate/blake256.py
Normal file
51
pyasic/device/algorithm/hashrate/blake256.py
Normal file
@@ -0,0 +1,51 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from pyasic.device.algorithm.hashrate.base import AlgoHashRateType
|
||||
from pyasic.device.algorithm.hashrate.unit.blake256 import Blake256Unit
|
||||
|
||||
from .unit import HashUnit
|
||||
|
||||
|
||||
class Blake256HashRate(AlgoHashRateType):
|
||||
rate: float
|
||||
unit: Blake256Unit = HashUnit.BLAKE256.default
|
||||
|
||||
def __add__(self, other: Blake256HashRate | int | float) -> Blake256HashRate:
|
||||
if isinstance(other, Blake256HashRate):
|
||||
return Blake256HashRate(
|
||||
rate=self.rate + other.into(self.unit).rate, unit=self.unit
|
||||
)
|
||||
return Blake256HashRate(rate=self.rate + other, unit=self.unit)
|
||||
|
||||
def __sub__(self, other: Blake256HashRate | int | float) -> Blake256HashRate:
|
||||
if isinstance(other, Blake256HashRate):
|
||||
return Blake256HashRate(
|
||||
rate=self.rate - other.into(self.unit).rate, unit=self.unit
|
||||
)
|
||||
return Blake256HashRate(rate=self.rate - other, unit=self.unit)
|
||||
|
||||
def __truediv__(self, other: Blake256HashRate | int | float):
|
||||
if isinstance(other, Blake256HashRate):
|
||||
return Blake256HashRate(
|
||||
rate=self.rate / other.into(self.unit).rate, unit=self.unit
|
||||
)
|
||||
return Blake256HashRate(rate=self.rate / other, unit=self.unit)
|
||||
|
||||
def __floordiv__(self, other: Blake256HashRate | int | float):
|
||||
if isinstance(other, Blake256HashRate):
|
||||
return Blake256HashRate(
|
||||
rate=self.rate // other.into(self.unit).rate, unit=self.unit
|
||||
)
|
||||
return Blake256HashRate(rate=self.rate // other, unit=self.unit)
|
||||
|
||||
def __mul__(self, other: Blake256HashRate | int | float):
|
||||
if isinstance(other, Blake256HashRate):
|
||||
return Blake256HashRate(
|
||||
rate=self.rate * other.into(self.unit).rate, unit=self.unit
|
||||
)
|
||||
return Blake256HashRate(rate=self.rate * other, unit=self.unit)
|
||||
|
||||
def into(self, other: Blake256Unit) -> Blake256HashRate:
|
||||
return Blake256HashRate(
|
||||
rate=self.rate / (other.value / self.unit.value), unit=other
|
||||
)
|
||||
51
pyasic/device/algorithm/hashrate/eaglesong.py
Normal file
51
pyasic/device/algorithm/hashrate/eaglesong.py
Normal file
@@ -0,0 +1,51 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from pyasic.device.algorithm.hashrate.base import AlgoHashRateType
|
||||
from pyasic.device.algorithm.hashrate.unit.eaglesong import EaglesongUnit
|
||||
|
||||
from .unit import HashUnit
|
||||
|
||||
|
||||
class EaglesongHashRate(AlgoHashRateType):
|
||||
rate: float
|
||||
unit: EaglesongUnit = HashUnit.EAGLESONG.default
|
||||
|
||||
def __add__(self, other: EaglesongHashRate | int | float) -> EaglesongHashRate:
|
||||
if isinstance(other, EaglesongHashRate):
|
||||
return EaglesongHashRate(
|
||||
rate=self.rate + other.into(self.unit).rate, unit=self.unit
|
||||
)
|
||||
return EaglesongHashRate(rate=self.rate + other, unit=self.unit)
|
||||
|
||||
def __sub__(self, other: EaglesongHashRate | int | float) -> EaglesongHashRate:
|
||||
if isinstance(other, EaglesongHashRate):
|
||||
return EaglesongHashRate(
|
||||
rate=self.rate - other.into(self.unit).rate, unit=self.unit
|
||||
)
|
||||
return EaglesongHashRate(rate=self.rate - other, unit=self.unit)
|
||||
|
||||
def __truediv__(self, other: EaglesongHashRate | int | float):
|
||||
if isinstance(other, EaglesongHashRate):
|
||||
return EaglesongHashRate(
|
||||
rate=self.rate / other.into(self.unit).rate, unit=self.unit
|
||||
)
|
||||
return EaglesongHashRate(rate=self.rate / other, unit=self.unit)
|
||||
|
||||
def __floordiv__(self, other: EaglesongHashRate | int | float):
|
||||
if isinstance(other, EaglesongHashRate):
|
||||
return EaglesongHashRate(
|
||||
rate=self.rate // other.into(self.unit).rate, unit=self.unit
|
||||
)
|
||||
return EaglesongHashRate(rate=self.rate // other, unit=self.unit)
|
||||
|
||||
def __mul__(self, other: EaglesongHashRate | int | float):
|
||||
if isinstance(other, EaglesongHashRate):
|
||||
return EaglesongHashRate(
|
||||
rate=self.rate * other.into(self.unit).rate, unit=self.unit
|
||||
)
|
||||
return EaglesongHashRate(rate=self.rate * other, unit=self.unit)
|
||||
|
||||
def into(self, other: EaglesongUnit) -> EaglesongHashRate:
|
||||
return EaglesongHashRate(
|
||||
rate=self.rate / (other.value / self.unit.value), unit=other
|
||||
)
|
||||
51
pyasic/device/algorithm/hashrate/equihash.py
Normal file
51
pyasic/device/algorithm/hashrate/equihash.py
Normal file
@@ -0,0 +1,51 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from pyasic.device.algorithm.hashrate.base import AlgoHashRateType
|
||||
from pyasic.device.algorithm.hashrate.unit.equihash import EquihashUnit
|
||||
|
||||
from .unit import HashUnit
|
||||
|
||||
|
||||
class EquihashHashRate(AlgoHashRateType):
|
||||
rate: float
|
||||
unit: EquihashUnit = HashUnit.ETHASH.default
|
||||
|
||||
def __add__(self, other: EquihashHashRate | int | float) -> EquihashHashRate:
|
||||
if isinstance(other, EquihashHashRate):
|
||||
return EquihashHashRate(
|
||||
rate=self.rate + other.into(self.unit).rate, unit=self.unit
|
||||
)
|
||||
return EquihashHashRate(rate=self.rate + other, unit=self.unit)
|
||||
|
||||
def __sub__(self, other: EquihashHashRate | int | float) -> EquihashHashRate:
|
||||
if isinstance(other, EquihashHashRate):
|
||||
return EquihashHashRate(
|
||||
rate=self.rate - other.into(self.unit).rate, unit=self.unit
|
||||
)
|
||||
return EquihashHashRate(rate=self.rate - other, unit=self.unit)
|
||||
|
||||
def __truediv__(self, other: EquihashHashRate | int | float):
|
||||
if isinstance(other, EquihashHashRate):
|
||||
return EquihashHashRate(
|
||||
rate=self.rate / other.into(self.unit).rate, unit=self.unit
|
||||
)
|
||||
return EquihashHashRate(rate=self.rate / other, unit=self.unit)
|
||||
|
||||
def __floordiv__(self, other: EquihashHashRate | int | float):
|
||||
if isinstance(other, EquihashHashRate):
|
||||
return EquihashHashRate(
|
||||
rate=self.rate // other.into(self.unit).rate, unit=self.unit
|
||||
)
|
||||
return EquihashHashRate(rate=self.rate // other, unit=self.unit)
|
||||
|
||||
def __mul__(self, other: EquihashHashRate | int | float):
|
||||
if isinstance(other, EquihashHashRate):
|
||||
return EquihashHashRate(
|
||||
rate=self.rate * other.into(self.unit).rate, unit=self.unit
|
||||
)
|
||||
return EquihashHashRate(rate=self.rate * other, unit=self.unit)
|
||||
|
||||
def into(self, other: EquihashUnit) -> EquihashHashRate:
|
||||
return EquihashHashRate(
|
||||
rate=self.rate / (other.value / self.unit.value), unit=other
|
||||
)
|
||||
51
pyasic/device/algorithm/hashrate/ethash.py
Normal file
51
pyasic/device/algorithm/hashrate/ethash.py
Normal file
@@ -0,0 +1,51 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from pyasic.device.algorithm.hashrate.base import AlgoHashRateType
|
||||
from pyasic.device.algorithm.hashrate.unit.ethash import EtHashUnit
|
||||
|
||||
from .unit import HashUnit
|
||||
|
||||
|
||||
class EtHashHashRate(AlgoHashRateType):
|
||||
rate: float
|
||||
unit: EtHashUnit = HashUnit.ETHASH.default
|
||||
|
||||
def __add__(self, other: EtHashHashRate | int | float) -> EtHashHashRate:
|
||||
if isinstance(other, EtHashHashRate):
|
||||
return EtHashHashRate(
|
||||
rate=self.rate + other.into(self.unit).rate, unit=self.unit
|
||||
)
|
||||
return EtHashHashRate(rate=self.rate + other, unit=self.unit)
|
||||
|
||||
def __sub__(self, other: EtHashHashRate | int | float) -> EtHashHashRate:
|
||||
if isinstance(other, EtHashHashRate):
|
||||
return EtHashHashRate(
|
||||
rate=self.rate - other.into(self.unit).rate, unit=self.unit
|
||||
)
|
||||
return EtHashHashRate(rate=self.rate - other, unit=self.unit)
|
||||
|
||||
def __truediv__(self, other: EtHashHashRate | int | float):
|
||||
if isinstance(other, EtHashHashRate):
|
||||
return EtHashHashRate(
|
||||
rate=self.rate / other.into(self.unit).rate, unit=self.unit
|
||||
)
|
||||
return EtHashHashRate(rate=self.rate / other, unit=self.unit)
|
||||
|
||||
def __floordiv__(self, other: EtHashHashRate | int | float):
|
||||
if isinstance(other, EtHashHashRate):
|
||||
return EtHashHashRate(
|
||||
rate=self.rate // other.into(self.unit).rate, unit=self.unit
|
||||
)
|
||||
return EtHashHashRate(rate=self.rate // other, unit=self.unit)
|
||||
|
||||
def __mul__(self, other: EtHashHashRate | int | float):
|
||||
if isinstance(other, EtHashHashRate):
|
||||
return EtHashHashRate(
|
||||
rate=self.rate * other.into(self.unit).rate, unit=self.unit
|
||||
)
|
||||
return EtHashHashRate(rate=self.rate * other, unit=self.unit)
|
||||
|
||||
def into(self, other: EtHashUnit) -> EtHashHashRate:
|
||||
return EtHashHashRate(
|
||||
rate=self.rate / (other.value / self.unit.value), unit=other
|
||||
)
|
||||
51
pyasic/device/algorithm/hashrate/handshake.py
Normal file
51
pyasic/device/algorithm/hashrate/handshake.py
Normal file
@@ -0,0 +1,51 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from pyasic.device.algorithm.hashrate.base import AlgoHashRateType
|
||||
from pyasic.device.algorithm.hashrate.unit.handshake import HandshakeUnit
|
||||
|
||||
from .unit import HashUnit
|
||||
|
||||
|
||||
class HandshakeHashRate(AlgoHashRateType):
|
||||
rate: float
|
||||
unit: HandshakeUnit = HashUnit.HANDSHAKE.default
|
||||
|
||||
def __add__(self, other: HandshakeHashRate | int | float) -> HandshakeHashRate:
|
||||
if isinstance(other, HandshakeHashRate):
|
||||
return HandshakeHashRate(
|
||||
rate=self.rate + other.into(self.unit).rate, unit=self.unit
|
||||
)
|
||||
return HandshakeHashRate(rate=self.rate + other, unit=self.unit)
|
||||
|
||||
def __sub__(self, other: HandshakeHashRate | int | float) -> HandshakeHashRate:
|
||||
if isinstance(other, HandshakeHashRate):
|
||||
return HandshakeHashRate(
|
||||
rate=self.rate - other.into(self.unit).rate, unit=self.unit
|
||||
)
|
||||
return HandshakeHashRate(rate=self.rate - other, unit=self.unit)
|
||||
|
||||
def __truediv__(self, other: HandshakeHashRate | int | float):
|
||||
if isinstance(other, HandshakeHashRate):
|
||||
return HandshakeHashRate(
|
||||
rate=self.rate / other.into(self.unit).rate, unit=self.unit
|
||||
)
|
||||
return HandshakeHashRate(rate=self.rate / other, unit=self.unit)
|
||||
|
||||
def __floordiv__(self, other: HandshakeHashRate | int | float):
|
||||
if isinstance(other, HandshakeHashRate):
|
||||
return HandshakeHashRate(
|
||||
rate=self.rate // other.into(self.unit).rate, unit=self.unit
|
||||
)
|
||||
return HandshakeHashRate(rate=self.rate // other, unit=self.unit)
|
||||
|
||||
def __mul__(self, other: HandshakeHashRate | int | float):
|
||||
if isinstance(other, HandshakeHashRate):
|
||||
return HandshakeHashRate(
|
||||
rate=self.rate * other.into(self.unit).rate, unit=self.unit
|
||||
)
|
||||
return HandshakeHashRate(rate=self.rate * other, unit=self.unit)
|
||||
|
||||
def into(self, other: HandshakeUnit) -> HandshakeHashRate:
|
||||
return HandshakeHashRate(
|
||||
rate=self.rate / (other.value / self.unit.value), unit=other
|
||||
)
|
||||
51
pyasic/device/algorithm/hashrate/kadena.py
Normal file
51
pyasic/device/algorithm/hashrate/kadena.py
Normal file
@@ -0,0 +1,51 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from pyasic.device.algorithm.hashrate.base import AlgoHashRateType
|
||||
from pyasic.device.algorithm.hashrate.unit.kadena import KadenaUnit
|
||||
|
||||
from .unit import HashUnit
|
||||
|
||||
|
||||
class KadenaHashRate(AlgoHashRateType):
|
||||
rate: float
|
||||
unit: KadenaUnit = HashUnit.KADENA.default
|
||||
|
||||
def __add__(self, other: KadenaHashRate | int | float) -> KadenaHashRate:
|
||||
if isinstance(other, KadenaHashRate):
|
||||
return KadenaHashRate(
|
||||
rate=self.rate + other.into(self.unit).rate, unit=self.unit
|
||||
)
|
||||
return KadenaHashRate(rate=self.rate + other, unit=self.unit)
|
||||
|
||||
def __sub__(self, other: KadenaHashRate | int | float) -> KadenaHashRate:
|
||||
if isinstance(other, KadenaHashRate):
|
||||
return KadenaHashRate(
|
||||
rate=self.rate - other.into(self.unit).rate, unit=self.unit
|
||||
)
|
||||
return KadenaHashRate(rate=self.rate - other, unit=self.unit)
|
||||
|
||||
def __truediv__(self, other: KadenaHashRate | int | float):
|
||||
if isinstance(other, KadenaHashRate):
|
||||
return KadenaHashRate(
|
||||
rate=self.rate / other.into(self.unit).rate, unit=self.unit
|
||||
)
|
||||
return KadenaHashRate(rate=self.rate / other, unit=self.unit)
|
||||
|
||||
def __floordiv__(self, other: KadenaHashRate | int | float):
|
||||
if isinstance(other, KadenaHashRate):
|
||||
return KadenaHashRate(
|
||||
rate=self.rate // other.into(self.unit).rate, unit=self.unit
|
||||
)
|
||||
return KadenaHashRate(rate=self.rate // other, unit=self.unit)
|
||||
|
||||
def __mul__(self, other: KadenaHashRate | int | float):
|
||||
if isinstance(other, KadenaHashRate):
|
||||
return KadenaHashRate(
|
||||
rate=self.rate * other.into(self.unit).rate, unit=self.unit
|
||||
)
|
||||
return KadenaHashRate(rate=self.rate * other, unit=self.unit)
|
||||
|
||||
def into(self, other: KadenaUnit) -> KadenaHashRate:
|
||||
return KadenaHashRate(
|
||||
rate=self.rate / (other.value / self.unit.value), unit=other
|
||||
)
|
||||
51
pyasic/device/algorithm/hashrate/kheavyhash.py
Normal file
51
pyasic/device/algorithm/hashrate/kheavyhash.py
Normal file
@@ -0,0 +1,51 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from pyasic.device.algorithm.hashrate.base import AlgoHashRateType
|
||||
from pyasic.device.algorithm.hashrate.unit.kheavyhash import KHeavyHashUnit
|
||||
|
||||
from .unit import HashUnit
|
||||
|
||||
|
||||
class KHeavyHashHashRate(AlgoHashRateType):
|
||||
rate: float
|
||||
unit: KHeavyHashUnit = HashUnit.KHEAVYHASH.default
|
||||
|
||||
def __add__(self, other: KHeavyHashHashRate | int | float) -> KHeavyHashHashRate:
|
||||
if isinstance(other, KHeavyHashHashRate):
|
||||
return KHeavyHashHashRate(
|
||||
rate=self.rate + other.into(self.unit).rate, unit=self.unit
|
||||
)
|
||||
return KHeavyHashHashRate(rate=self.rate + other, unit=self.unit)
|
||||
|
||||
def __sub__(self, other: KHeavyHashHashRate | int | float) -> KHeavyHashHashRate:
|
||||
if isinstance(other, KHeavyHashHashRate):
|
||||
return KHeavyHashHashRate(
|
||||
rate=self.rate - other.into(self.unit).rate, unit=self.unit
|
||||
)
|
||||
return KHeavyHashHashRate(rate=self.rate - other, unit=self.unit)
|
||||
|
||||
def __truediv__(self, other: KHeavyHashHashRate | int | float):
|
||||
if isinstance(other, KHeavyHashHashRate):
|
||||
return KHeavyHashHashRate(
|
||||
rate=self.rate / other.into(self.unit).rate, unit=self.unit
|
||||
)
|
||||
return KHeavyHashHashRate(rate=self.rate / other, unit=self.unit)
|
||||
|
||||
def __floordiv__(self, other: KHeavyHashHashRate | int | float):
|
||||
if isinstance(other, KHeavyHashHashRate):
|
||||
return KHeavyHashHashRate(
|
||||
rate=self.rate // other.into(self.unit).rate, unit=self.unit
|
||||
)
|
||||
return KHeavyHashHashRate(rate=self.rate // other, unit=self.unit)
|
||||
|
||||
def __mul__(self, other: KHeavyHashHashRate | int | float):
|
||||
if isinstance(other, KHeavyHashHashRate):
|
||||
return KHeavyHashHashRate(
|
||||
rate=self.rate * other.into(self.unit).rate, unit=self.unit
|
||||
)
|
||||
return KHeavyHashHashRate(rate=self.rate * other, unit=self.unit)
|
||||
|
||||
def into(self, other: KHeavyHashUnit) -> KHeavyHashHashRate:
|
||||
return KHeavyHashHashRate(
|
||||
rate=self.rate / (other.value / self.unit.value), unit=other
|
||||
)
|
||||
51
pyasic/device/algorithm/hashrate/scrypt.py
Normal file
51
pyasic/device/algorithm/hashrate/scrypt.py
Normal file
@@ -0,0 +1,51 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from pyasic.device.algorithm.hashrate.base import AlgoHashRateType
|
||||
from pyasic.device.algorithm.hashrate.unit.scrypt import ScryptUnit
|
||||
|
||||
from .unit import HashUnit
|
||||
|
||||
|
||||
class ScryptHashRate(AlgoHashRateType):
|
||||
rate: float
|
||||
unit: ScryptUnit = HashUnit.SCRYPT.default
|
||||
|
||||
def __add__(self, other: ScryptHashRate | int | float) -> ScryptHashRate:
|
||||
if isinstance(other, ScryptHashRate):
|
||||
return ScryptHashRate(
|
||||
rate=self.rate + other.into(self.unit).rate, unit=self.unit
|
||||
)
|
||||
return ScryptHashRate(rate=self.rate + other, unit=self.unit)
|
||||
|
||||
def __sub__(self, other: ScryptHashRate | int | float) -> ScryptHashRate:
|
||||
if isinstance(other, ScryptHashRate):
|
||||
return ScryptHashRate(
|
||||
rate=self.rate - other.into(self.unit).rate, unit=self.unit
|
||||
)
|
||||
return ScryptHashRate(rate=self.rate - other, unit=self.unit)
|
||||
|
||||
def __truediv__(self, other: ScryptHashRate | int | float):
|
||||
if isinstance(other, ScryptHashRate):
|
||||
return ScryptHashRate(
|
||||
rate=self.rate / other.into(self.unit).rate, unit=self.unit
|
||||
)
|
||||
return ScryptHashRate(rate=self.rate / other, unit=self.unit)
|
||||
|
||||
def __floordiv__(self, other: ScryptHashRate | int | float):
|
||||
if isinstance(other, ScryptHashRate):
|
||||
return ScryptHashRate(
|
||||
rate=self.rate // other.into(self.unit).rate, unit=self.unit
|
||||
)
|
||||
return ScryptHashRate(rate=self.rate // other, unit=self.unit)
|
||||
|
||||
def __mul__(self, other: ScryptHashRate | int | float):
|
||||
if isinstance(other, ScryptHashRate):
|
||||
return ScryptHashRate(
|
||||
rate=self.rate * other.into(self.unit).rate, unit=self.unit
|
||||
)
|
||||
return ScryptHashRate(rate=self.rate * other, unit=self.unit)
|
||||
|
||||
def into(self, other: ScryptUnit) -> ScryptHashRate:
|
||||
return ScryptHashRate(
|
||||
rate=self.rate / (other.value / self.unit.value), unit=other
|
||||
)
|
||||
@@ -1,25 +1,14 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from pyasic.data.hashrate.base import AlgoHashRateType
|
||||
from pyasic.device.algorithm import MinerAlgo
|
||||
from pyasic.device.algorithm.sha256 import SHA256Unit
|
||||
from pyasic.device.algorithm.hashrate.base import AlgoHashRateType
|
||||
from pyasic.device.algorithm.hashrate.unit.sha256 import SHA256Unit
|
||||
|
||||
from .unit import HashUnit
|
||||
|
||||
|
||||
class SHA256HashRate(AlgoHashRateType):
|
||||
rate: float
|
||||
unit: SHA256Unit = MinerAlgo.SHA256.unit.default
|
||||
|
||||
def __float__(self):
|
||||
return float(self.rate)
|
||||
|
||||
def __int__(self):
|
||||
return int(self.rate)
|
||||
|
||||
def __repr__(self):
|
||||
return f"{self.rate} {str(self.unit)}"
|
||||
|
||||
def __round__(self, n: int = None):
|
||||
return round(self.rate, n)
|
||||
unit: SHA256Unit = HashUnit.SHA256.default
|
||||
|
||||
def __add__(self, other: SHA256HashRate | int | float) -> SHA256HashRate:
|
||||
if isinstance(other, SHA256HashRate):
|
||||
23
pyasic/device/algorithm/hashrate/unit/__init__.py
Normal file
23
pyasic/device/algorithm/hashrate/unit/__init__.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from .blake256 import Blake256Unit
|
||||
from .eaglesong import EaglesongUnit
|
||||
from .equihash import EquihashUnit
|
||||
from .ethash import EtHashUnit
|
||||
from .handshake import HandshakeUnit
|
||||
from .kadena import KadenaUnit
|
||||
from .kheavyhash import KHeavyHashUnit
|
||||
from .scrypt import ScryptUnit
|
||||
from .sha256 import SHA256Unit
|
||||
from .x11 import X11Unit
|
||||
|
||||
|
||||
class HashUnit:
|
||||
SHA256 = SHA256Unit
|
||||
SCRYPT = ScryptUnit
|
||||
KHEAVYHASH = KHeavyHashUnit
|
||||
KADENA = KadenaUnit
|
||||
HANDSHAKE = HandshakeUnit
|
||||
X11 = X11Unit
|
||||
BLAKE256 = Blake256Unit
|
||||
EAGLESONG = EaglesongUnit
|
||||
ETHASH = EtHashUnit
|
||||
EQUIHASH = EquihashUnit
|
||||
17
pyasic/device/algorithm/hashrate/unit/base.py
Normal file
17
pyasic/device/algorithm/hashrate/unit/base.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from enum import IntEnum
|
||||
|
||||
|
||||
class AlgoHashRateUnitType(IntEnum):
|
||||
H: int
|
||||
KH: int
|
||||
MH: int
|
||||
GH: int
|
||||
TH: int
|
||||
PH: int
|
||||
EH: int
|
||||
ZH: int
|
||||
default: int
|
||||
|
||||
@classmethod
|
||||
def from_str(cls, value):
|
||||
return cls.default
|
||||
57
pyasic/device/algorithm/hashrate/unit/blake256.py
Normal file
57
pyasic/device/algorithm/hashrate/unit/blake256.py
Normal file
@@ -0,0 +1,57 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from .base import AlgoHashRateUnitType
|
||||
|
||||
|
||||
class Blake256Unit(AlgoHashRateUnitType):
|
||||
H = 1
|
||||
KH = int(H) * 1000
|
||||
MH = int(KH) * 1000
|
||||
GH = int(MH) * 1000
|
||||
TH = int(GH) * 1000
|
||||
PH = int(TH) * 1000
|
||||
EH = int(PH) * 1000
|
||||
ZH = int(EH) * 1000
|
||||
|
||||
default = TH
|
||||
|
||||
def __str__(self):
|
||||
if self.value == self.H:
|
||||
return "H/s"
|
||||
if self.value == self.KH:
|
||||
return "KH/s"
|
||||
if self.value == self.MH:
|
||||
return "MH/s"
|
||||
if self.value == self.GH:
|
||||
return "GH/s"
|
||||
if self.value == self.TH:
|
||||
return "TH/s"
|
||||
if self.value == self.PH:
|
||||
return "PH/s"
|
||||
if self.value == self.EH:
|
||||
return "EH/s"
|
||||
if self.value == self.ZH:
|
||||
return "ZH/s"
|
||||
|
||||
@classmethod
|
||||
def from_str(cls, value: str):
|
||||
if value == "H":
|
||||
return cls.H
|
||||
elif value == "KH":
|
||||
return cls.KH
|
||||
elif value == "MH":
|
||||
return cls.MH
|
||||
elif value == "GH":
|
||||
return cls.GH
|
||||
elif value == "TH":
|
||||
return cls.TH
|
||||
elif value == "PH":
|
||||
return cls.PH
|
||||
elif value == "EH":
|
||||
return cls.EH
|
||||
elif value == "ZH":
|
||||
return cls.ZH
|
||||
return cls.default
|
||||
|
||||
def __repr__(self):
|
||||
return str(self)
|
||||
57
pyasic/device/algorithm/hashrate/unit/eaglesong.py
Normal file
57
pyasic/device/algorithm/hashrate/unit/eaglesong.py
Normal file
@@ -0,0 +1,57 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from .base import AlgoHashRateUnitType
|
||||
|
||||
|
||||
class EaglesongUnit(AlgoHashRateUnitType):
|
||||
H = 1
|
||||
KH = int(H) * 1000
|
||||
MH = int(KH) * 1000
|
||||
GH = int(MH) * 1000
|
||||
TH = int(GH) * 1000
|
||||
PH = int(TH) * 1000
|
||||
EH = int(PH) * 1000
|
||||
ZH = int(EH) * 1000
|
||||
|
||||
default = TH
|
||||
|
||||
def __str__(self):
|
||||
if self.value == self.H:
|
||||
return "H/s"
|
||||
if self.value == self.KH:
|
||||
return "KH/s"
|
||||
if self.value == self.MH:
|
||||
return "MH/s"
|
||||
if self.value == self.GH:
|
||||
return "GH/s"
|
||||
if self.value == self.TH:
|
||||
return "TH/s"
|
||||
if self.value == self.PH:
|
||||
return "PH/s"
|
||||
if self.value == self.EH:
|
||||
return "EH/s"
|
||||
if self.value == self.ZH:
|
||||
return "ZH/s"
|
||||
|
||||
@classmethod
|
||||
def from_str(cls, value: str):
|
||||
if value == "H":
|
||||
return cls.H
|
||||
elif value == "KH":
|
||||
return cls.KH
|
||||
elif value == "MH":
|
||||
return cls.MH
|
||||
elif value == "GH":
|
||||
return cls.GH
|
||||
elif value == "TH":
|
||||
return cls.TH
|
||||
elif value == "PH":
|
||||
return cls.PH
|
||||
elif value == "EH":
|
||||
return cls.EH
|
||||
elif value == "ZH":
|
||||
return cls.ZH
|
||||
return cls.default
|
||||
|
||||
def __repr__(self):
|
||||
return str(self)
|
||||
57
pyasic/device/algorithm/hashrate/unit/equihash.py
Normal file
57
pyasic/device/algorithm/hashrate/unit/equihash.py
Normal file
@@ -0,0 +1,57 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from .base import AlgoHashRateUnitType
|
||||
|
||||
|
||||
class EquihashUnit(AlgoHashRateUnitType):
|
||||
H = 1
|
||||
KH = int(H) * 1000
|
||||
MH = int(KH) * 1000
|
||||
GH = int(MH) * 1000
|
||||
TH = int(GH) * 1000
|
||||
PH = int(TH) * 1000
|
||||
EH = int(PH) * 1000
|
||||
ZH = int(EH) * 1000
|
||||
|
||||
default = KH
|
||||
|
||||
def __str__(self):
|
||||
if self.value == self.H:
|
||||
return "Sol/s"
|
||||
if self.value == self.KH:
|
||||
return "KSol/s"
|
||||
if self.value == self.MH:
|
||||
return "MSol/s"
|
||||
if self.value == self.GH:
|
||||
return "GSol/s"
|
||||
if self.value == self.TH:
|
||||
return "TSol/s"
|
||||
if self.value == self.PH:
|
||||
return "PSol/s"
|
||||
if self.value == self.EH:
|
||||
return "ESol/s"
|
||||
if self.value == self.ZH:
|
||||
return "ZSol/s"
|
||||
|
||||
@classmethod
|
||||
def from_str(cls, value: str):
|
||||
if value == "H":
|
||||
return cls.H
|
||||
elif value == "KH":
|
||||
return cls.KH
|
||||
elif value == "MH":
|
||||
return cls.MH
|
||||
elif value == "GH":
|
||||
return cls.GH
|
||||
elif value == "TH":
|
||||
return cls.TH
|
||||
elif value == "PH":
|
||||
return cls.PH
|
||||
elif value == "EH":
|
||||
return cls.EH
|
||||
elif value == "ZH":
|
||||
return cls.ZH
|
||||
return cls.default
|
||||
|
||||
def __repr__(self):
|
||||
return str(self)
|
||||
57
pyasic/device/algorithm/hashrate/unit/ethash.py
Normal file
57
pyasic/device/algorithm/hashrate/unit/ethash.py
Normal file
@@ -0,0 +1,57 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from .base import AlgoHashRateUnitType
|
||||
|
||||
|
||||
class EtHashUnit(AlgoHashRateUnitType):
|
||||
H = 1
|
||||
KH = int(H) * 1000
|
||||
MH = int(KH) * 1000
|
||||
GH = int(MH) * 1000
|
||||
TH = int(GH) * 1000
|
||||
PH = int(TH) * 1000
|
||||
EH = int(PH) * 1000
|
||||
ZH = int(EH) * 1000
|
||||
|
||||
default = MH
|
||||
|
||||
def __str__(self):
|
||||
if self.value == self.H:
|
||||
return "H/s"
|
||||
if self.value == self.KH:
|
||||
return "KH/s"
|
||||
if self.value == self.MH:
|
||||
return "MH/s"
|
||||
if self.value == self.GH:
|
||||
return "GH/s"
|
||||
if self.value == self.TH:
|
||||
return "TH/s"
|
||||
if self.value == self.PH:
|
||||
return "PH/s"
|
||||
if self.value == self.EH:
|
||||
return "EH/s"
|
||||
if self.value == self.ZH:
|
||||
return "ZH/s"
|
||||
|
||||
@classmethod
|
||||
def from_str(cls, value: str):
|
||||
if value == "H":
|
||||
return cls.H
|
||||
elif value == "KH":
|
||||
return cls.KH
|
||||
elif value == "MH":
|
||||
return cls.MH
|
||||
elif value == "GH":
|
||||
return cls.GH
|
||||
elif value == "TH":
|
||||
return cls.TH
|
||||
elif value == "PH":
|
||||
return cls.PH
|
||||
elif value == "EH":
|
||||
return cls.EH
|
||||
elif value == "ZH":
|
||||
return cls.ZH
|
||||
return cls.default
|
||||
|
||||
def __repr__(self):
|
||||
return str(self)
|
||||
57
pyasic/device/algorithm/hashrate/unit/handshake.py
Normal file
57
pyasic/device/algorithm/hashrate/unit/handshake.py
Normal file
@@ -0,0 +1,57 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from .base import AlgoHashRateUnitType
|
||||
|
||||
|
||||
class HandshakeUnit(AlgoHashRateUnitType):
|
||||
H = 1
|
||||
KH = int(H) * 1000
|
||||
MH = int(KH) * 1000
|
||||
GH = int(MH) * 1000
|
||||
TH = int(GH) * 1000
|
||||
PH = int(TH) * 1000
|
||||
EH = int(PH) * 1000
|
||||
ZH = int(EH) * 1000
|
||||
|
||||
default = TH
|
||||
|
||||
def __str__(self):
|
||||
if self.value == self.H:
|
||||
return "H/s"
|
||||
if self.value == self.KH:
|
||||
return "KH/s"
|
||||
if self.value == self.MH:
|
||||
return "MH/s"
|
||||
if self.value == self.GH:
|
||||
return "GH/s"
|
||||
if self.value == self.TH:
|
||||
return "TH/s"
|
||||
if self.value == self.PH:
|
||||
return "PH/s"
|
||||
if self.value == self.EH:
|
||||
return "EH/s"
|
||||
if self.value == self.ZH:
|
||||
return "ZH/s"
|
||||
|
||||
@classmethod
|
||||
def from_str(cls, value: str):
|
||||
if value == "H":
|
||||
return cls.H
|
||||
elif value == "KH":
|
||||
return cls.KH
|
||||
elif value == "MH":
|
||||
return cls.MH
|
||||
elif value == "GH":
|
||||
return cls.GH
|
||||
elif value == "TH":
|
||||
return cls.TH
|
||||
elif value == "PH":
|
||||
return cls.PH
|
||||
elif value == "EH":
|
||||
return cls.EH
|
||||
elif value == "ZH":
|
||||
return cls.ZH
|
||||
return cls.default
|
||||
|
||||
def __repr__(self):
|
||||
return str(self)
|
||||
57
pyasic/device/algorithm/hashrate/unit/kadena.py
Normal file
57
pyasic/device/algorithm/hashrate/unit/kadena.py
Normal file
@@ -0,0 +1,57 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from .base import AlgoHashRateUnitType
|
||||
|
||||
|
||||
class KadenaUnit(AlgoHashRateUnitType):
|
||||
H = 1
|
||||
KH = int(H) * 1000
|
||||
MH = int(KH) * 1000
|
||||
GH = int(MH) * 1000
|
||||
TH = int(GH) * 1000
|
||||
PH = int(TH) * 1000
|
||||
EH = int(PH) * 1000
|
||||
ZH = int(EH) * 1000
|
||||
|
||||
default = TH
|
||||
|
||||
def __str__(self):
|
||||
if self.value == self.H:
|
||||
return "H/s"
|
||||
if self.value == self.KH:
|
||||
return "KH/s"
|
||||
if self.value == self.MH:
|
||||
return "MH/s"
|
||||
if self.value == self.GH:
|
||||
return "GH/s"
|
||||
if self.value == self.TH:
|
||||
return "TH/s"
|
||||
if self.value == self.PH:
|
||||
return "PH/s"
|
||||
if self.value == self.EH:
|
||||
return "EH/s"
|
||||
if self.value == self.ZH:
|
||||
return "ZH/s"
|
||||
|
||||
@classmethod
|
||||
def from_str(cls, value: str):
|
||||
if value == "H":
|
||||
return cls.H
|
||||
elif value == "KH":
|
||||
return cls.KH
|
||||
elif value == "MH":
|
||||
return cls.MH
|
||||
elif value == "GH":
|
||||
return cls.GH
|
||||
elif value == "TH":
|
||||
return cls.TH
|
||||
elif value == "PH":
|
||||
return cls.PH
|
||||
elif value == "EH":
|
||||
return cls.EH
|
||||
elif value == "ZH":
|
||||
return cls.ZH
|
||||
return cls.default
|
||||
|
||||
def __repr__(self):
|
||||
return str(self)
|
||||
57
pyasic/device/algorithm/hashrate/unit/kheavyhash.py
Normal file
57
pyasic/device/algorithm/hashrate/unit/kheavyhash.py
Normal file
@@ -0,0 +1,57 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from .base import AlgoHashRateUnitType
|
||||
|
||||
|
||||
class KHeavyHashUnit(AlgoHashRateUnitType):
|
||||
H = 1
|
||||
KH = int(H) * 1000
|
||||
MH = int(KH) * 1000
|
||||
GH = int(MH) * 1000
|
||||
TH = int(GH) * 1000
|
||||
PH = int(TH) * 1000
|
||||
EH = int(PH) * 1000
|
||||
ZH = int(EH) * 1000
|
||||
|
||||
default = TH
|
||||
|
||||
def __str__(self):
|
||||
if self.value == self.H:
|
||||
return "H/s"
|
||||
if self.value == self.KH:
|
||||
return "KH/s"
|
||||
if self.value == self.MH:
|
||||
return "MH/s"
|
||||
if self.value == self.GH:
|
||||
return "GH/s"
|
||||
if self.value == self.TH:
|
||||
return "TH/s"
|
||||
if self.value == self.PH:
|
||||
return "PH/s"
|
||||
if self.value == self.EH:
|
||||
return "EH/s"
|
||||
if self.value == self.ZH:
|
||||
return "ZH/s"
|
||||
|
||||
@classmethod
|
||||
def from_str(cls, value: str):
|
||||
if value == "H":
|
||||
return cls.H
|
||||
elif value == "KH":
|
||||
return cls.KH
|
||||
elif value == "MH":
|
||||
return cls.MH
|
||||
elif value == "GH":
|
||||
return cls.GH
|
||||
elif value == "TH":
|
||||
return cls.TH
|
||||
elif value == "PH":
|
||||
return cls.PH
|
||||
elif value == "EH":
|
||||
return cls.EH
|
||||
elif value == "ZH":
|
||||
return cls.ZH
|
||||
return cls.default
|
||||
|
||||
def __repr__(self):
|
||||
return str(self)
|
||||
57
pyasic/device/algorithm/hashrate/unit/scrypt.py
Normal file
57
pyasic/device/algorithm/hashrate/unit/scrypt.py
Normal file
@@ -0,0 +1,57 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from enum import IntEnum
|
||||
|
||||
|
||||
class ScryptUnit(IntEnum):
|
||||
H = 1
|
||||
KH = int(H) * 1000
|
||||
MH = int(KH) * 1000
|
||||
GH = int(MH) * 1000
|
||||
TH = int(GH) * 1000
|
||||
PH = int(TH) * 1000
|
||||
EH = int(PH) * 1000
|
||||
ZH = int(EH) * 1000
|
||||
|
||||
default = GH
|
||||
|
||||
def __str__(self):
|
||||
if self.value == self.H:
|
||||
return "H/s"
|
||||
if self.value == self.KH:
|
||||
return "KH/s"
|
||||
if self.value == self.MH:
|
||||
return "MH/s"
|
||||
if self.value == self.GH:
|
||||
return "GH/s"
|
||||
if self.value == self.TH:
|
||||
return "TH/s"
|
||||
if self.value == self.PH:
|
||||
return "PH/s"
|
||||
if self.value == self.EH:
|
||||
return "EH/s"
|
||||
if self.value == self.ZH:
|
||||
return "ZH/s"
|
||||
|
||||
@classmethod
|
||||
def from_str(cls, value: str):
|
||||
if value == "H":
|
||||
return cls.H
|
||||
elif value == "KH":
|
||||
return cls.KH
|
||||
elif value == "MH":
|
||||
return cls.MH
|
||||
elif value == "GH":
|
||||
return cls.GH
|
||||
elif value == "TH":
|
||||
return cls.TH
|
||||
elif value == "PH":
|
||||
return cls.PH
|
||||
elif value == "EH":
|
||||
return cls.EH
|
||||
elif value == "ZH":
|
||||
return cls.ZH
|
||||
return cls.default
|
||||
|
||||
def __repr__(self):
|
||||
return str(self)
|
||||
57
pyasic/device/algorithm/hashrate/unit/sha256.py
Normal file
57
pyasic/device/algorithm/hashrate/unit/sha256.py
Normal file
@@ -0,0 +1,57 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from .base import AlgoHashRateUnitType
|
||||
|
||||
|
||||
class SHA256Unit(AlgoHashRateUnitType):
|
||||
H = 1
|
||||
KH = int(H) * 1000
|
||||
MH = int(KH) * 1000
|
||||
GH = int(MH) * 1000
|
||||
TH = int(GH) * 1000
|
||||
PH = int(TH) * 1000
|
||||
EH = int(PH) * 1000
|
||||
ZH = int(EH) * 1000
|
||||
|
||||
default = TH
|
||||
|
||||
def __str__(self):
|
||||
if self.value == self.H:
|
||||
return "H/s"
|
||||
if self.value == self.KH:
|
||||
return "KH/s"
|
||||
if self.value == self.MH:
|
||||
return "MH/s"
|
||||
if self.value == self.GH:
|
||||
return "GH/s"
|
||||
if self.value == self.TH:
|
||||
return "TH/s"
|
||||
if self.value == self.PH:
|
||||
return "PH/s"
|
||||
if self.value == self.EH:
|
||||
return "EH/s"
|
||||
if self.value == self.ZH:
|
||||
return "ZH/s"
|
||||
|
||||
@classmethod
|
||||
def from_str(cls, value: str):
|
||||
if value == "H":
|
||||
return cls.H
|
||||
elif value == "KH":
|
||||
return cls.KH
|
||||
elif value == "MH":
|
||||
return cls.MH
|
||||
elif value == "GH":
|
||||
return cls.GH
|
||||
elif value == "TH":
|
||||
return cls.TH
|
||||
elif value == "PH":
|
||||
return cls.PH
|
||||
elif value == "EH":
|
||||
return cls.EH
|
||||
elif value == "ZH":
|
||||
return cls.ZH
|
||||
return cls.default
|
||||
|
||||
def __repr__(self):
|
||||
return str(self)
|
||||
57
pyasic/device/algorithm/hashrate/unit/x11.py
Normal file
57
pyasic/device/algorithm/hashrate/unit/x11.py
Normal file
@@ -0,0 +1,57 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from .base import AlgoHashRateUnitType
|
||||
|
||||
|
||||
class X11Unit(AlgoHashRateUnitType):
|
||||
H = 1
|
||||
KH = int(H) * 1000
|
||||
MH = int(KH) * 1000
|
||||
GH = int(MH) * 1000
|
||||
TH = int(GH) * 1000
|
||||
PH = int(TH) * 1000
|
||||
EH = int(PH) * 1000
|
||||
ZH = int(EH) * 1000
|
||||
|
||||
default = GH
|
||||
|
||||
def __str__(self):
|
||||
if self.value == self.H:
|
||||
return "H/s"
|
||||
if self.value == self.KH:
|
||||
return "KH/s"
|
||||
if self.value == self.MH:
|
||||
return "MH/s"
|
||||
if self.value == self.GH:
|
||||
return "GH/s"
|
||||
if self.value == self.TH:
|
||||
return "TH/s"
|
||||
if self.value == self.PH:
|
||||
return "PH/s"
|
||||
if self.value == self.EH:
|
||||
return "EH/s"
|
||||
if self.value == self.ZH:
|
||||
return "ZH/s"
|
||||
|
||||
@classmethod
|
||||
def from_str(cls, value: str):
|
||||
if value == "H":
|
||||
return cls.H
|
||||
elif value == "KH":
|
||||
return cls.KH
|
||||
elif value == "MH":
|
||||
return cls.MH
|
||||
elif value == "GH":
|
||||
return cls.GH
|
||||
elif value == "TH":
|
||||
return cls.TH
|
||||
elif value == "PH":
|
||||
return cls.PH
|
||||
elif value == "EH":
|
||||
return cls.EH
|
||||
elif value == "ZH":
|
||||
return cls.ZH
|
||||
return cls.default
|
||||
|
||||
def __repr__(self):
|
||||
return str(self)
|
||||
49
pyasic/device/algorithm/hashrate/x11.py
Normal file
49
pyasic/device/algorithm/hashrate/x11.py
Normal file
@@ -0,0 +1,49 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from pyasic.device.algorithm.hashrate.base import AlgoHashRateType
|
||||
from pyasic.device.algorithm.hashrate.unit.x11 import X11Unit
|
||||
|
||||
from .unit import HashUnit
|
||||
|
||||
|
||||
class X11HashRate(AlgoHashRateType):
|
||||
rate: float
|
||||
unit: X11Unit = HashUnit.X11.default
|
||||
|
||||
def __add__(self, other: X11HashRate | int | float) -> X11HashRate:
|
||||
if isinstance(other, X11HashRate):
|
||||
return X11HashRate(
|
||||
rate=self.rate + other.into(self.unit).rate, unit=self.unit
|
||||
)
|
||||
return X11HashRate(rate=self.rate + other, unit=self.unit)
|
||||
|
||||
def __sub__(self, other: X11HashRate | int | float) -> X11HashRate:
|
||||
if isinstance(other, X11HashRate):
|
||||
return X11HashRate(
|
||||
rate=self.rate - other.into(self.unit).rate, unit=self.unit
|
||||
)
|
||||
return X11HashRate(rate=self.rate - other, unit=self.unit)
|
||||
|
||||
def __truediv__(self, other: X11HashRate | int | float):
|
||||
if isinstance(other, X11HashRate):
|
||||
return X11HashRate(
|
||||
rate=self.rate / other.into(self.unit).rate, unit=self.unit
|
||||
)
|
||||
return X11HashRate(rate=self.rate / other, unit=self.unit)
|
||||
|
||||
def __floordiv__(self, other: X11HashRate | int | float):
|
||||
if isinstance(other, X11HashRate):
|
||||
return X11HashRate(
|
||||
rate=self.rate // other.into(self.unit).rate, unit=self.unit
|
||||
)
|
||||
return X11HashRate(rate=self.rate // other, unit=self.unit)
|
||||
|
||||
def __mul__(self, other: X11HashRate | int | float):
|
||||
if isinstance(other, X11HashRate):
|
||||
return X11HashRate(
|
||||
rate=self.rate * other.into(self.unit).rate, unit=self.unit
|
||||
)
|
||||
return X11HashRate(rate=self.rate * other, unit=self.unit)
|
||||
|
||||
def into(self, other: X11Unit) -> X11HashRate:
|
||||
return X11HashRate(rate=self.rate / (other.value / self.unit.value), unit=other)
|
||||
17
pyasic/device/algorithm/kadena.py
Normal file
17
pyasic/device/algorithm/kadena.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from .base import MinerAlgoType
|
||||
from .hashrate import KadenaHashRate
|
||||
from .hashrate.unit import KadenaUnit
|
||||
|
||||
|
||||
# make this json serializable
|
||||
class _KadenaAlgo(MinerAlgoType):
|
||||
hashrate = KadenaHashRate
|
||||
unit = KadenaUnit
|
||||
|
||||
def __repr__(self):
|
||||
return "KadenaAlgo"
|
||||
|
||||
|
||||
KadenaAlgo = _KadenaAlgo("Kadena")
|
||||
17
pyasic/device/algorithm/kheavyhash.py
Normal file
17
pyasic/device/algorithm/kheavyhash.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from .base import MinerAlgoType
|
||||
from .hashrate import KHeavyHashHashRate
|
||||
from .hashrate.unit import KHeavyHashUnit
|
||||
|
||||
|
||||
# make this json serializable
|
||||
class _KHeavyHashAlgo(MinerAlgoType):
|
||||
hashrate = KHeavyHashHashRate
|
||||
unit = KHeavyHashUnit
|
||||
|
||||
def __repr__(self):
|
||||
return "KHeavyHashAlgo"
|
||||
|
||||
|
||||
KHeavyHashAlgo = _KHeavyHashAlgo("KHeavyHash")
|
||||
17
pyasic/device/algorithm/scrypt.py
Normal file
17
pyasic/device/algorithm/scrypt.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from .base import MinerAlgoType
|
||||
from .hashrate import ScryptHashRate
|
||||
from .hashrate.unit import ScryptUnit
|
||||
|
||||
|
||||
# make this json serializable
|
||||
class _ScryptAlgo(MinerAlgoType):
|
||||
hashrate = ScryptHashRate
|
||||
unit = ScryptUnit
|
||||
|
||||
def __repr__(self):
|
||||
return "ScryptAlgo"
|
||||
|
||||
|
||||
ScryptAlgo = _ScryptAlgo("Scrypt")
|
||||
@@ -1,66 +1,13 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from enum import IntEnum
|
||||
|
||||
from .base import MinerAlgoType
|
||||
|
||||
|
||||
class SHA256Unit(IntEnum):
|
||||
H = 1
|
||||
KH = int(H) * 1000
|
||||
MH = int(KH) * 1000
|
||||
GH = int(MH) * 1000
|
||||
TH = int(GH) * 1000
|
||||
PH = int(TH) * 1000
|
||||
EH = int(PH) * 1000
|
||||
ZH = int(EH) * 1000
|
||||
|
||||
default = TH
|
||||
|
||||
def __str__(self):
|
||||
if self.value == self.H:
|
||||
return "H/s"
|
||||
if self.value == self.KH:
|
||||
return "KH/s"
|
||||
if self.value == self.MH:
|
||||
return "MH/s"
|
||||
if self.value == self.GH:
|
||||
return "GH/s"
|
||||
if self.value == self.TH:
|
||||
return "TH/s"
|
||||
if self.value == self.PH:
|
||||
return "PH/s"
|
||||
if self.value == self.EH:
|
||||
return "EH/s"
|
||||
if self.value == self.ZH:
|
||||
return "ZH/s"
|
||||
|
||||
@classmethod
|
||||
def from_str(cls, value: str):
|
||||
if value == "H":
|
||||
return cls.H
|
||||
elif value == "KH":
|
||||
return cls.KH
|
||||
elif value == "MH":
|
||||
return cls.MH
|
||||
elif value == "GH":
|
||||
return cls.GH
|
||||
elif value == "TH":
|
||||
return cls.TH
|
||||
elif value == "PH":
|
||||
return cls.PH
|
||||
elif value == "EH":
|
||||
return cls.EH
|
||||
elif value == "ZH":
|
||||
return cls.ZH
|
||||
return cls.default
|
||||
|
||||
def __repr__(self):
|
||||
return str(self)
|
||||
from .hashrate import SHA256HashRate
|
||||
from .hashrate.unit import SHA256Unit
|
||||
|
||||
|
||||
# make this json serializable
|
||||
class _SHA256Algo(MinerAlgoType):
|
||||
hashrate = SHA256HashRate
|
||||
unit = SHA256Unit
|
||||
|
||||
def __repr__(self):
|
||||
|
||||
17
pyasic/device/algorithm/x11.py
Normal file
17
pyasic/device/algorithm/x11.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from .base import MinerAlgoType
|
||||
from .hashrate import X11HashRate
|
||||
from .hashrate.unit import X11Unit
|
||||
|
||||
|
||||
# make this json serializable
|
||||
class _X11Algo(MinerAlgoType):
|
||||
hashrate = X11HashRate
|
||||
unit = X11Unit
|
||||
|
||||
def __repr__(self):
|
||||
return "X11Algo"
|
||||
|
||||
|
||||
X11Algo = _X11Algo("X11")
|
||||
@@ -18,7 +18,8 @@ from typing import List, Optional
|
||||
|
||||
import asyncssh
|
||||
|
||||
from pyasic.data import AlgoHashRate, HashBoard, HashUnit
|
||||
from pyasic.data import HashBoard
|
||||
from pyasic.device.algorithm import AlgoHashRate, HashUnit
|
||||
from pyasic.errors import APIError
|
||||
from pyasic.miners.backends import Hiveon
|
||||
from pyasic.miners.data import DataFunction, DataLocations, DataOptions, RPCAPICommand
|
||||
|
||||
@@ -16,12 +16,13 @@
|
||||
|
||||
import logging
|
||||
from pathlib import Path
|
||||
from typing import List, Optional, Union
|
||||
from typing import List, Optional
|
||||
|
||||
from pyasic.config import MinerConfig, MiningModeConfig
|
||||
from pyasic.data import AlgoHashRate, Fan, HashBoard, HashUnit
|
||||
from pyasic.data import Fan, HashBoard
|
||||
from pyasic.data.error_codes import MinerErrorData, X19Error
|
||||
from pyasic.data.pools import PoolMetrics, PoolUrl
|
||||
from pyasic.device.algorithm import AlgoHashRate
|
||||
from pyasic.errors import APIError
|
||||
from pyasic.miners.backends.bmminer import BMMiner
|
||||
from pyasic.miners.backends.cgminer import CGMiner
|
||||
@@ -260,8 +261,8 @@ class AntminerModern(BMMiner):
|
||||
if rpc_stats is not None:
|
||||
try:
|
||||
for board in rpc_stats["STATS"][0]["chain"]:
|
||||
hashboards[board["index"]].hashrate = AlgoHashRate.SHA256(
|
||||
rate=board["rate_real"], unit=HashUnit.SHA256.GH
|
||||
hashboards[board["index"]].hashrate = self.algo.hashrate(
|
||||
rate=board["rate_real"], unit=self.algo.unit.GH
|
||||
).into(self.algo.unit.default)
|
||||
hashboards[board["index"]].chips = board["asic_num"]
|
||||
board_temp_data = list(
|
||||
@@ -317,8 +318,8 @@ class AntminerModern(BMMiner):
|
||||
rate_unit = rpc_stats["STATS"][1]["rate_unit"]
|
||||
except KeyError:
|
||||
rate_unit = "GH"
|
||||
return AlgoHashRate.SHA256(
|
||||
rate=float(expected_rate), unit=HashUnit.SHA256.from_str(rate_unit)
|
||||
return self.algo.hashrate(
|
||||
rate=float(expected_rate), unit=self.algo.unit.from_str(rate_unit)
|
||||
).into(self.algo.unit.default)
|
||||
except LookupError:
|
||||
pass
|
||||
@@ -624,8 +625,8 @@ class AntminerOld(CGMiner):
|
||||
|
||||
hashrate = boards[1].get(f"chain_rate{i}")
|
||||
if hashrate:
|
||||
hashboard.hashrate = AlgoHashRate.SHA256(
|
||||
rate=float(hashrate), unit=HashUnit.SHA256.GH
|
||||
hashboard.hashrate = self.algo.hashrate(
|
||||
rate=float(hashrate), unit=self.algo.unit.GH
|
||||
).into(self.algo.unit.default)
|
||||
|
||||
chips = boards[1].get(f"chain_acn{i}")
|
||||
|
||||
@@ -18,7 +18,8 @@ from enum import Enum
|
||||
from typing import List, Optional
|
||||
|
||||
from pyasic.config import MinerConfig
|
||||
from pyasic.data import AlgoHashRate, Fan, HashBoard, HashUnit
|
||||
from pyasic.data import Fan, HashBoard
|
||||
from pyasic.device.algorithm import AlgoHashRate
|
||||
from pyasic.errors import APIError
|
||||
from pyasic.miners.data import (
|
||||
DataFunction,
|
||||
@@ -292,9 +293,9 @@ class Auradine(StockFirmware):
|
||||
|
||||
if rpc_summary is not None:
|
||||
try:
|
||||
return AlgoHashRate.SHA256(
|
||||
return self.algo.hashrate(
|
||||
rate=float(rpc_summary["SUMMARY"][0]["MHS 5s"]),
|
||||
unit=HashUnit.SHA256.MH,
|
||||
unit=self.algo.unit.MH,
|
||||
).into(self.algo.unit.default)
|
||||
except (LookupError, ValueError, TypeError):
|
||||
pass
|
||||
@@ -322,8 +323,8 @@ class Auradine(StockFirmware):
|
||||
try:
|
||||
for board in rpc_devs["DEVS"]:
|
||||
b_id = board["ID"] - 1
|
||||
hashboards[b_id].hashrate = AlgoHashRate.SHA256(
|
||||
rate=float(board["MHS 5s"]), unit=HashUnit.SHA256.MH
|
||||
hashboards[b_id].hashrate = self.algo.hashrate(
|
||||
rate=float(board["MHS 5s"]), unit=self.algo.unit.MH
|
||||
).into(self.algo.unit.default)
|
||||
hashboards[b_id].temp = round(float(board["Temperature"]))
|
||||
hashboards[b_id].missing = False
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
import re
|
||||
from typing import List, Optional
|
||||
|
||||
from pyasic.data import AlgoHashRate, Fan, HashBoard, HashUnit
|
||||
from pyasic.data import Fan, HashBoard
|
||||
from pyasic.device.algorithm import AlgoHashRate
|
||||
from pyasic.errors import APIError
|
||||
from pyasic.miners.backends.cgminer import CGMiner
|
||||
from pyasic.miners.data import DataFunction, DataLocations, DataOptions, RPCAPICommand
|
||||
@@ -183,8 +184,8 @@ class AvalonMiner(CGMiner):
|
||||
|
||||
if rpc_devs is not None:
|
||||
try:
|
||||
return AlgoHashRate.SHA256(
|
||||
rate=float(rpc_devs["DEVS"][0]["MHS 1m"]), unit=HashUnit.SHA256.MH
|
||||
return self.algo.hashrate(
|
||||
rate=float(rpc_devs["DEVS"][0]["MHS 1m"]), unit=self.algo.unit.MH
|
||||
).into(self.algo.unit.default)
|
||||
except (KeyError, IndexError, ValueError, TypeError):
|
||||
pass
|
||||
@@ -216,8 +217,8 @@ class AvalonMiner(CGMiner):
|
||||
|
||||
try:
|
||||
board_hr = parsed_stats["MGHS"][board]
|
||||
hashboards[board].hashrate = AlgoHashRate.SHA256(
|
||||
rate=float(board_hr), unit=HashUnit.SHA256.GH
|
||||
hashboards[board].hashrate = self.algo.hashrate(
|
||||
rate=float(board_hr), unit=self.algo.unit.GH
|
||||
).into(self.algo.unit.default)
|
||||
except LookupError:
|
||||
pass
|
||||
@@ -252,8 +253,8 @@ class AvalonMiner(CGMiner):
|
||||
try:
|
||||
unparsed_stats = rpc_stats["STATS"][0]["MM ID0"]
|
||||
parsed_stats = self.parse_stats(unparsed_stats)
|
||||
return AlgoHashRate.SHA256(
|
||||
rate=float(parsed_stats["GHSmm"][0]), unit=HashUnit.SHA256.GH
|
||||
return self.algo.hashrate(
|
||||
rate=float(parsed_stats["GHSmm"][0]), unit=self.algo.unit.GH
|
||||
).into(self.algo.unit.default)
|
||||
except (IndexError, KeyError, ValueError, TypeError):
|
||||
pass
|
||||
|
||||
@@ -17,8 +17,9 @@
|
||||
from typing import List, Optional
|
||||
|
||||
from pyasic.config import MinerConfig
|
||||
from pyasic.data import AlgoHashRate, Fan, HashBoard, HashUnit
|
||||
from pyasic.data import Fan, HashBoard
|
||||
from pyasic.data.pools import PoolMetrics, PoolUrl
|
||||
from pyasic.device.algorithm import AlgoHashRate
|
||||
from pyasic.errors import APIError
|
||||
from pyasic.miners.data import DataFunction, DataLocations, DataOptions, RPCAPICommand
|
||||
from pyasic.miners.device.firmware import StockFirmware
|
||||
@@ -120,9 +121,9 @@ class BFGMiner(StockFirmware):
|
||||
|
||||
if rpc_summary is not None:
|
||||
try:
|
||||
return AlgoHashRate.SHA256(
|
||||
return self.algo.hashrate(
|
||||
rate=float(rpc_summary["SUMMARY"][0]["MHS 20s"]),
|
||||
unit=HashUnit.SHA256.MH,
|
||||
unit=self.algo.unit.MH,
|
||||
).into(self.algo.unit.default)
|
||||
except (LookupError, ValueError, TypeError):
|
||||
pass
|
||||
@@ -167,8 +168,8 @@ class BFGMiner(StockFirmware):
|
||||
|
||||
hashrate = boards[1].get(f"chain_rate{i}")
|
||||
if hashrate:
|
||||
hashboard.hashrate = AlgoHashRate.SHA256(
|
||||
rate=float(hashrate), unit=HashUnit.SHA256.GH
|
||||
hashboard.hashrate = self.algo.hashrate(
|
||||
rate=float(hashrate), unit=self.algo.unit.GH
|
||||
).into(self.algo.unit.default)
|
||||
|
||||
chips = boards[1].get(f"chain_acn{i}")
|
||||
@@ -260,8 +261,8 @@ class BFGMiner(StockFirmware):
|
||||
rate_unit = rpc_stats["STATS"][1]["rate_unit"]
|
||||
except KeyError:
|
||||
rate_unit = "GH"
|
||||
return AlgoHashRate.SHA256(
|
||||
rate=float(expected_rate), unit=HashUnit.SHA256.from_str(rate_unit)
|
||||
return self.algo.hashrate(
|
||||
rate=float(expected_rate), unit=self.algo.unit.from_str(rate_unit)
|
||||
).into(self.algo.unit.default)
|
||||
except LookupError:
|
||||
pass
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
from typing import List, Optional
|
||||
|
||||
from pyasic import APIError, MinerConfig
|
||||
from pyasic.data import AlgoHashRate, Fan, HashBoard, HashUnit
|
||||
from pyasic.device import MinerFirmware
|
||||
from pyasic.data import Fan, HashBoard
|
||||
from pyasic.device.algorithm import AlgoHashRate
|
||||
from pyasic.device.firmware import MinerFirmware
|
||||
from pyasic.miners.base import BaseMiner
|
||||
from pyasic.miners.data import DataFunction, DataLocations, DataOptions, WebAPICommand
|
||||
from pyasic.web.bitaxe import BitAxeWebAPI
|
||||
@@ -93,8 +94,8 @@ class BitAxe(BaseMiner):
|
||||
|
||||
if web_system_info is not None:
|
||||
try:
|
||||
return AlgoHashRate.SHA256(
|
||||
rate=float(web_system_info["hashRate"]), unit=HashUnit.SHA256.GH
|
||||
return self.algo.hashrate(
|
||||
rate=float(web_system_info["hashRate"]), unit=self.algo.unit.GH
|
||||
).into(self.algo.unit.default)
|
||||
except KeyError:
|
||||
pass
|
||||
@@ -123,9 +124,9 @@ class BitAxe(BaseMiner):
|
||||
try:
|
||||
return [
|
||||
HashBoard(
|
||||
hashrate=AlgoHashRate.SHA256(
|
||||
hashrate=self.algo.hashrate(
|
||||
rate=float(web_system_info["hashRate"]),
|
||||
unit=HashUnit.SHA256.GH,
|
||||
unit=self.algo.unit.GH,
|
||||
).into(self.algo.unit.default),
|
||||
chip_temp=web_system_info.get("temp"),
|
||||
temp=web_system_info.get("vrTemp"),
|
||||
|
||||
@@ -17,8 +17,9 @@
|
||||
from typing import List, Optional
|
||||
|
||||
from pyasic.config import MinerConfig
|
||||
from pyasic.data import AlgoHashRate, Fan, HashBoard, HashUnit
|
||||
from pyasic.data import Fan, HashBoard
|
||||
from pyasic.data.pools import PoolMetrics, PoolUrl
|
||||
from pyasic.device.algorithm import AlgoHashRate
|
||||
from pyasic.errors import APIError
|
||||
from pyasic.miners.data import DataFunction, DataLocations, DataOptions, RPCAPICommand
|
||||
from pyasic.miners.device.firmware import StockFirmware
|
||||
@@ -124,9 +125,9 @@ class BMMiner(StockFirmware):
|
||||
|
||||
if rpc_summary is not None:
|
||||
try:
|
||||
return AlgoHashRate.SHA256(
|
||||
return self.algo.hashrate(
|
||||
rate=float(rpc_summary["SUMMARY"][0]["GHS 5s"]),
|
||||
unit=HashUnit.SHA256.GH,
|
||||
unit=self.algo.unit.GH,
|
||||
).into(self.algo.unit.default)
|
||||
except (LookupError, ValueError, TypeError):
|
||||
pass
|
||||
@@ -184,8 +185,8 @@ class BMMiner(StockFirmware):
|
||||
|
||||
hashrate = boards[1].get(f"chain_rate{i}")
|
||||
if hashrate:
|
||||
hashboard.hashrate = AlgoHashRate.SHA256(
|
||||
rate=float(hashrate), unit=HashUnit.SHA256.GH
|
||||
hashboard.hashrate = self.algo.hashrate(
|
||||
rate=float(hashrate), unit=self.algo.unit.GH
|
||||
).into(self.algo.unit.default)
|
||||
|
||||
chips = boards[1].get(f"chain_acn{i}")
|
||||
@@ -246,8 +247,8 @@ class BMMiner(StockFirmware):
|
||||
rate_unit = rpc_stats["STATS"][1]["rate_unit"]
|
||||
except KeyError:
|
||||
rate_unit = "GH"
|
||||
return AlgoHashRate.SHA256(
|
||||
rate=float(expected_rate), unit=HashUnit.SHA256.from_str(rate_unit)
|
||||
return self.algo.hashrate(
|
||||
rate=float(expected_rate), unit=self.algo.unit.from_str(rate_unit)
|
||||
).into(self.algo.unit.default)
|
||||
except LookupError:
|
||||
pass
|
||||
|
||||
@@ -29,9 +29,10 @@ except ImportError:
|
||||
|
||||
from pyasic.config import MinerConfig
|
||||
from pyasic.config.mining import MiningModePowerTune
|
||||
from pyasic.data import AlgoHashRate, Fan, HashBoard, HashUnit
|
||||
from pyasic.data import Fan, HashBoard
|
||||
from pyasic.data.error_codes import BraiinsOSError, MinerErrorData
|
||||
from pyasic.data.pools import PoolMetrics, PoolUrl
|
||||
from pyasic.device.algorithm import AlgoHashRate, AlgoHashRateType
|
||||
from pyasic.errors import APIError
|
||||
from pyasic.miners.data import (
|
||||
DataFunction,
|
||||
@@ -222,7 +223,7 @@ class BOSMiner(BraiinsOSFirmware):
|
||||
cfg = await self.get_config()
|
||||
if cfg is None:
|
||||
return False
|
||||
cfg.mining_mode = MiningModePowerTune(wattage)
|
||||
cfg.mining_mode = MiningModePowerTune(power=wattage)
|
||||
await self.send_config(cfg)
|
||||
except APIError:
|
||||
raise
|
||||
@@ -362,9 +363,9 @@ class BOSMiner(BraiinsOSFirmware):
|
||||
|
||||
if rpc_summary is not None:
|
||||
try:
|
||||
return AlgoHashRate.SHA256(
|
||||
return self.algo.hashrate(
|
||||
rate=float(rpc_summary["SUMMARY"][0]["MHS 1m"]),
|
||||
unit=HashUnit.SHA256.MH,
|
||||
unit=self.algo.unit.MH,
|
||||
).into(self.algo.unit.default)
|
||||
except (KeyError, IndexError, ValueError, TypeError):
|
||||
pass
|
||||
@@ -435,8 +436,8 @@ class BOSMiner(BraiinsOSFirmware):
|
||||
|
||||
for board in rpc_devs["DEVS"]:
|
||||
_id = board["ID"] - offset
|
||||
hashboards[_id].hashrate = AlgoHashRate.SHA256(
|
||||
rate=float(board["MHS 1m"]), unit=HashUnit.SHA256.MH
|
||||
hashboards[_id].hashrate = self.algo.hashrate(
|
||||
rate=float(board["MHS 1m"]), unit=self.algo.unit.MH
|
||||
).into(self.algo.unit.default)
|
||||
except (IndexError, KeyError):
|
||||
pass
|
||||
@@ -534,7 +535,7 @@ class BOSMiner(BraiinsOSFirmware):
|
||||
|
||||
async def _get_expected_hashrate(
|
||||
self, rpc_devs: dict = None
|
||||
) -> Optional[AlgoHashRate]:
|
||||
) -> Optional[AlgoHashRateType]:
|
||||
if rpc_devs is None:
|
||||
try:
|
||||
rpc_devs = await self.rpc.devs()
|
||||
@@ -546,18 +547,20 @@ class BOSMiner(BraiinsOSFirmware):
|
||||
hr_list = []
|
||||
|
||||
for board in rpc_devs["DEVS"]:
|
||||
expected_hashrate = float(board["Nominal MHS"] / 1000000)
|
||||
expected_hashrate = float(board["Nominal MHS"])
|
||||
if expected_hashrate:
|
||||
hr_list.append(expected_hashrate)
|
||||
|
||||
if len(hr_list) == 0:
|
||||
return AlgoHashRate.SHA256(rate=float(0))
|
||||
return self.algo.hashrate(
|
||||
rate=float(0), unit=self.algo.unit.default
|
||||
)
|
||||
else:
|
||||
return AlgoHashRate.SHA256(
|
||||
return self.algo.hashrate(
|
||||
rate=float(
|
||||
(sum(hr_list) / len(hr_list)) * self.expected_hashboards
|
||||
),
|
||||
unit=HashUnit.SHA256.MH,
|
||||
unit=self.algo.unit.MH,
|
||||
).into(self.algo.unit.default)
|
||||
except (IndexError, KeyError):
|
||||
pass
|
||||
@@ -895,9 +898,9 @@ class BOSer(BraiinsOSFirmware):
|
||||
|
||||
if rpc_summary is not None:
|
||||
try:
|
||||
return AlgoHashRate.SHA256(
|
||||
return self.algo.hashrate(
|
||||
rate=float(rpc_summary["SUMMARY"][0]["MHS 1m"]),
|
||||
unit=HashUnit.SHA256.MH,
|
||||
unit=self.algo.unit.MH,
|
||||
).into(self.algo.unit.default)
|
||||
except (KeyError, IndexError, ValueError, TypeError):
|
||||
pass
|
||||
@@ -913,11 +916,11 @@ class BOSer(BraiinsOSFirmware):
|
||||
|
||||
if grpc_miner_details is not None:
|
||||
try:
|
||||
return AlgoHashRate.SHA256(
|
||||
return self.algo.hashrate(
|
||||
rate=float(
|
||||
grpc_miner_details["stickerHashrate"]["gigahashPerSecond"]
|
||||
),
|
||||
unit=HashUnit.SHA256.GH,
|
||||
unit=self.algo.unit.GH,
|
||||
).into(self.algo.unit.default)
|
||||
except LookupError:
|
||||
pass
|
||||
@@ -949,13 +952,13 @@ class BOSer(BraiinsOSFirmware):
|
||||
)
|
||||
if board.get("stats") is not None:
|
||||
if not board["stats"]["realHashrate"]["last5S"] == {}:
|
||||
hashboards[idx].hashrate = AlgoHashRate.SHA256(
|
||||
hashboards[idx].hashrate = self.algo.hashrate(
|
||||
rate=float(
|
||||
board["stats"]["realHashrate"]["last5S"][
|
||||
"gigahashPerSecond"
|
||||
]
|
||||
),
|
||||
unit=HashUnit.SHA256.GH,
|
||||
unit=self.algo.unit.GH,
|
||||
).into(self.algo.unit.default)
|
||||
hashboards[idx].missing = False
|
||||
|
||||
|
||||
@@ -21,9 +21,10 @@ from typing import List, Optional
|
||||
import aiofiles
|
||||
|
||||
from pyasic.config import MinerConfig, MiningModeConfig
|
||||
from pyasic.data import AlgoHashRate, Fan, HashBoard, HashUnit
|
||||
from pyasic.data import Fan, HashBoard
|
||||
from pyasic.data.error_codes import MinerErrorData, WhatsminerError
|
||||
from pyasic.data.pools import PoolMetrics, PoolUrl
|
||||
from pyasic.device.algorithm import AlgoHashRate
|
||||
from pyasic.errors import APIError
|
||||
from pyasic.miners.data import DataFunction, DataLocations, DataOptions, RPCAPICommand
|
||||
from pyasic.miners.device.firmware import StockFirmware
|
||||
@@ -403,9 +404,9 @@ class BTMiner(StockFirmware):
|
||||
|
||||
if rpc_summary is not None:
|
||||
try:
|
||||
return AlgoHashRate.SHA256(
|
||||
return self.algo.hashrate(
|
||||
rate=float(rpc_summary["SUMMARY"][0]["MHS 1m"]),
|
||||
unit=HashUnit.SHA256.MH,
|
||||
unit=self.algo.unit.MH,
|
||||
).into(self.algo.unit.default)
|
||||
except LookupError:
|
||||
pass
|
||||
@@ -434,8 +435,8 @@ class BTMiner(StockFirmware):
|
||||
self.expected_hashboards += 1
|
||||
hashboards[board["ASC"]].chip_temp = round(board["Chip Temp Avg"])
|
||||
hashboards[board["ASC"]].temp = round(board["Temperature"])
|
||||
hashboards[board["ASC"]].hashrate = AlgoHashRate.SHA256(
|
||||
rate=float(board["MHS 1m"]), unit=HashUnit.SHA256.MH
|
||||
hashboards[board["ASC"]].hashrate = self.algo.hashrate(
|
||||
rate=float(board["MHS 1m"]), unit=self.algo.unit.MH
|
||||
).into(self.algo.unit.default)
|
||||
hashboards[board["ASC"]].chips = board["Effective Chips"]
|
||||
hashboards[board["ASC"]].serial_number = board["PCB SN"]
|
||||
@@ -584,8 +585,8 @@ class BTMiner(StockFirmware):
|
||||
try:
|
||||
expected_hashrate = rpc_summary["SUMMARY"][0]["Factory GHS"]
|
||||
if expected_hashrate:
|
||||
return AlgoHashRate.SHA256(
|
||||
rate=float(expected_hashrate), unit=HashUnit.SHA256.GH
|
||||
return self.algo.hashrate(
|
||||
rate=float(expected_hashrate), unit=self.algo.unit.GH
|
||||
).into(self.algo.unit.default)
|
||||
|
||||
except LookupError:
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
from typing import List, Optional
|
||||
|
||||
from pyasic.config import MinerConfig
|
||||
from pyasic.data import AlgoHashRate, HashUnit
|
||||
from pyasic.data.pools import PoolMetrics, PoolUrl
|
||||
from pyasic.device.algorithm import AlgoHashRate
|
||||
from pyasic.errors import APIError
|
||||
from pyasic.miners.data import DataFunction, DataLocations, DataOptions, RPCAPICommand
|
||||
from pyasic.miners.device.firmware import StockFirmware
|
||||
@@ -123,9 +123,9 @@ class CGMiner(StockFirmware):
|
||||
|
||||
if rpc_summary is not None:
|
||||
try:
|
||||
return AlgoHashRate.SHA256(
|
||||
return self.algo.hashrate(
|
||||
rate=float(rpc_summary["SUMMARY"][0]["GHS 5s"]),
|
||||
unit=HashUnit.SHA256.GH,
|
||||
unit=self.algo.unit.GH,
|
||||
).into(self.algo.unit.default)
|
||||
except (LookupError, ValueError, TypeError):
|
||||
pass
|
||||
|
||||
@@ -18,9 +18,10 @@ from pathlib import Path
|
||||
from typing import List, Optional
|
||||
|
||||
from pyasic.config import MinerConfig
|
||||
from pyasic.data import AlgoHashRate, Fan, HashBoard, HashUnit
|
||||
from pyasic.data import Fan, HashBoard
|
||||
from pyasic.data.error_codes import MinerErrorData, X19Error
|
||||
from pyasic.data.pools import PoolMetrics, PoolUrl
|
||||
from pyasic.device.algorithm import AlgoHashRate
|
||||
from pyasic.errors import APIError
|
||||
from pyasic.logger import logger
|
||||
from pyasic.miners.data import DataFunction, DataLocations, DataOptions, WebAPICommand
|
||||
@@ -234,9 +235,9 @@ class ePIC(ePICFirmware):
|
||||
if web_summary["HBs"] is not None:
|
||||
for hb in web_summary["HBs"]:
|
||||
hashrate += hb["Hashrate"][0]
|
||||
return AlgoHashRate.SHA256(
|
||||
rate=float(hashrate), unit=HashUnit.SHA256.MH
|
||||
).into(HashUnit.SHA256.TH)
|
||||
return self.algo.hashrate(
|
||||
rate=float(hashrate), unit=self.algo.unit.MH
|
||||
).into(self.algo.unit.TH)
|
||||
except (LookupError, ValueError, TypeError):
|
||||
pass
|
||||
|
||||
@@ -260,8 +261,8 @@ class ePIC(ePICFirmware):
|
||||
ideal = hb["Hashrate"][1] / 100
|
||||
|
||||
hashrate += hb["Hashrate"][0] / ideal
|
||||
return AlgoHashRate.SHA256(
|
||||
rate=float(hashrate), unit=HashUnit.SHA256.MH
|
||||
return self.algo.hashrate(
|
||||
rate=float(hashrate), unit=self.algo.unit.MH
|
||||
).into(self.algo.unit.default)
|
||||
except (LookupError, ValueError, TypeError):
|
||||
pass
|
||||
@@ -352,8 +353,8 @@ class ePIC(ePICFirmware):
|
||||
hashrate = hb["Hashrate"][0]
|
||||
# Update the Hashboard object
|
||||
hb_list[hb["Index"]].missing = False
|
||||
hb_list[hb["Index"]].hashrate = AlgoHashRate.SHA256(
|
||||
rate=float(hashrate), unit=HashUnit.SHA256.MH
|
||||
hb_list[hb["Index"]].hashrate = self.algo.hashrate(
|
||||
rate=float(hashrate), unit=self.algo.unit.MH
|
||||
).into(self.algo.unit.default)
|
||||
hb_list[hb["Index"]].chips = num_of_chips
|
||||
hb_list[hb["Index"]].temp = int(hb["Temperature"])
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
from typing import List
|
||||
|
||||
from pyasic.config import MinerConfig, MiningModeConfig
|
||||
from pyasic.data import AlgoHashRate, HashBoard, HashUnit
|
||||
from pyasic.data import HashBoard
|
||||
from pyasic.errors import APIError
|
||||
from pyasic.logger import logger
|
||||
from pyasic.miners.backends import BFGMiner
|
||||
@@ -162,8 +162,8 @@ class GoldshellMiner(BFGMiner):
|
||||
if board.get("ID") is not None:
|
||||
try:
|
||||
b_id = board["ID"]
|
||||
hashboards[b_id].hashrate = AlgoHashRate.SHA256(
|
||||
rate=float(board["MHS 20s"]), unit=HashUnit.SHA256.MH
|
||||
hashboards[b_id].hashrate = self.algo.hashrate(
|
||||
rate=float(board["MHS 20s"]), unit=self.algo.unit.MH
|
||||
).into(self.algo.unit.default)
|
||||
hashboards[b_id].temp = board["tstemp-2"]
|
||||
hashboards[b_id].missing = False
|
||||
|
||||
@@ -17,9 +17,10 @@
|
||||
from typing import List, Optional
|
||||
|
||||
from pyasic import MinerConfig
|
||||
from pyasic.data import AlgoHashRate, Fan, HashBoard, HashUnit
|
||||
from pyasic.data import Fan, HashBoard
|
||||
from pyasic.data.error_codes import MinerErrorData, X19Error
|
||||
from pyasic.data.pools import PoolMetrics, PoolUrl
|
||||
from pyasic.device.algorithm import AlgoHashRate
|
||||
from pyasic.errors import APIError
|
||||
from pyasic.miners.data import (
|
||||
DataFunction,
|
||||
@@ -171,9 +172,9 @@ class BlackMiner(StockFirmware):
|
||||
|
||||
if rpc_summary is not None:
|
||||
try:
|
||||
return AlgoHashRate.SHA256(
|
||||
return self.algo.hashrate(
|
||||
rate=float(rpc_summary["SUMMARY"][0]["GHS 5s"]),
|
||||
unit=HashUnit.SHA256.GH,
|
||||
unit=self.algo.unit.GH,
|
||||
).into(self.algo.unit.default)
|
||||
except (LookupError, ValueError, TypeError):
|
||||
pass
|
||||
@@ -231,8 +232,8 @@ class BlackMiner(StockFirmware):
|
||||
|
||||
hashrate = boards[1].get(f"chain_rate{i}")
|
||||
if hashrate:
|
||||
hashboard.hashrate = AlgoHashRate.SHA256(
|
||||
rate=float(hashrate), unit=HashUnit.SHA256.GH
|
||||
hashboard.hashrate = self.algo.hashrate(
|
||||
rate=float(hashrate), unit=self.algo.unit.GH
|
||||
).into(self.algo.unit.default)
|
||||
|
||||
chips = boards[1].get(f"chain_acn{i}")
|
||||
@@ -364,8 +365,8 @@ class BlackMiner(StockFirmware):
|
||||
rate_unit = rpc_stats["STATS"][1]["rate_unit"]
|
||||
except KeyError:
|
||||
rate_unit = "GH"
|
||||
return AlgoHashRate.SHA256(
|
||||
rate=float(expected_rate), unit=HashUnit.SHA256.from_str(rate_unit)
|
||||
return self.algo.hashrate(
|
||||
rate=float(expected_rate), unit=self.algo.unit.from_str(rate_unit)
|
||||
).into(self.algo.unit.default)
|
||||
except LookupError:
|
||||
pass
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
from typing import List, Optional
|
||||
|
||||
from pyasic import MinerConfig
|
||||
from pyasic.data import AlgoHashRate, Fan, HashBoard, HashUnit
|
||||
from pyasic.data import Fan, HashBoard
|
||||
from pyasic.data.pools import PoolMetrics, PoolUrl
|
||||
from pyasic.device import MinerAlgo
|
||||
from pyasic.device.algorithm import AlgoHashRate, MinerAlgo
|
||||
from pyasic.errors import APIError
|
||||
from pyasic.miners.data import DataFunction, DataLocations, DataOptions, WebAPICommand
|
||||
from pyasic.miners.device.firmware import StockFirmware
|
||||
@@ -131,7 +131,7 @@ class IceRiver(StockFirmware):
|
||||
if web_userpanel is not None:
|
||||
try:
|
||||
base_unit = web_userpanel["userpanel"]["data"]["unit"]
|
||||
return AlgoHashRate.SHA256(
|
||||
return self.algo.hashrate(
|
||||
rate=float(
|
||||
web_userpanel["userpanel"]["data"]["rtpow"].replace(
|
||||
base_unit, ""
|
||||
@@ -187,9 +187,9 @@ class IceRiver(StockFirmware):
|
||||
idx = int(board["no"] - 1)
|
||||
hb_list[idx].chip_temp = round(board["outtmp"])
|
||||
hb_list[idx].temp = round(board["intmp"])
|
||||
hb_list[idx].hashrate = AlgoHashRate.SHA256(
|
||||
hb_list[idx].hashrate = self.algo.hashrate(
|
||||
rate=float(board["rtpow"].replace("G", "")),
|
||||
unit=HashUnit.SHA256.GH,
|
||||
unit=self.algo.unit.GH,
|
||||
).into(self.algo.unit.default)
|
||||
hb_list[idx].chips = int(board["chipnum"])
|
||||
hb_list[idx].missing = False
|
||||
|
||||
@@ -16,10 +16,11 @@
|
||||
from typing import List, Optional
|
||||
|
||||
from pyasic.config import MinerConfig
|
||||
from pyasic.data import AlgoHashRate, Fan, HashBoard, HashUnit
|
||||
from pyasic.data import Fan, HashBoard
|
||||
from pyasic.data.error_codes import MinerErrorData
|
||||
from pyasic.data.error_codes.innosilicon import InnosiliconError
|
||||
from pyasic.data.pools import PoolMetrics, PoolUrl
|
||||
from pyasic.device.algorithm import AlgoHashRate
|
||||
from pyasic.errors import APIError
|
||||
from pyasic.miners.backends import CGMiner
|
||||
from pyasic.miners.data import (
|
||||
@@ -186,23 +187,23 @@ class Innosilicon(CGMiner):
|
||||
if web_get_all is not None:
|
||||
try:
|
||||
if "Hash Rate H" in web_get_all["total_hash"].keys():
|
||||
return AlgoHashRate.SHA256(
|
||||
return self.algo.hashrate(
|
||||
rate=float(web_get_all["total_hash"]["Hash Rate H"]),
|
||||
unit=HashUnit.SHA256.H,
|
||||
unit=self.algo.unit.H,
|
||||
).into(self.algo.unit.default)
|
||||
elif "Hash Rate" in web_get_all["total_hash"].keys():
|
||||
return AlgoHashRate.SHA256(
|
||||
return self.algo.hashrate(
|
||||
rate=float(web_get_all["total_hash"]["Hash Rate"]),
|
||||
unit=HashUnit.SHA256.MH,
|
||||
unit=self.algo.unit.MH,
|
||||
).into(self.algo.unit.default)
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
if rpc_summary is not None:
|
||||
try:
|
||||
return AlgoHashRate.SHA256(
|
||||
return self.algo.hashrate(
|
||||
rate=float(rpc_summary["SUMMARY"][0]["MHS 1m"]),
|
||||
unit=HashUnit.SHA256.MH,
|
||||
unit=self.algo.unit.MH,
|
||||
).into(self.algo.unit.default)
|
||||
except (KeyError, IndexError):
|
||||
pass
|
||||
@@ -255,8 +256,8 @@ class Innosilicon(CGMiner):
|
||||
|
||||
hashrate = board.get("Hash Rate H")
|
||||
if hashrate:
|
||||
hashboards[idx].hashrate = AlgoHashRate.SHA256(
|
||||
rate=float(hashrate), unit=HashUnit.SHA256.H
|
||||
hashboards[idx].hashrate = self.algo.hashrate(
|
||||
rate=float(hashrate), unit=self.algo.unit.H
|
||||
).into(self.algo.unit.default)
|
||||
|
||||
chip_temp = board.get("Temp max")
|
||||
|
||||
@@ -17,8 +17,9 @@ import logging
|
||||
from typing import List, Optional
|
||||
|
||||
from pyasic.config import MinerConfig
|
||||
from pyasic.data import AlgoHashRate, Fan, HashBoard, HashUnit
|
||||
from pyasic.data import Fan, HashBoard
|
||||
from pyasic.data.pools import PoolMetrics, PoolUrl
|
||||
from pyasic.device.algorithm import AlgoHashRate
|
||||
from pyasic.errors import APIError
|
||||
from pyasic.miners.data import DataFunction, DataLocations, DataOptions, RPCAPICommand
|
||||
from pyasic.miners.device.firmware import LuxOSFirmware
|
||||
@@ -178,9 +179,9 @@ class LUXMiner(LuxOSFirmware):
|
||||
|
||||
if rpc_summary is not None:
|
||||
try:
|
||||
return AlgoHashRate.SHA256(
|
||||
return self.algo.hashrate(
|
||||
rate=float(rpc_summary["SUMMARY"][0]["GHS 5s"]),
|
||||
unit=HashUnit.SHA256.GH,
|
||||
unit=self.algo.unit.GH,
|
||||
).into(self.algo.unit.default)
|
||||
except (LookupError, ValueError, TypeError):
|
||||
pass
|
||||
@@ -202,9 +203,9 @@ class LUXMiner(LuxOSFirmware):
|
||||
board_stats = rpc_stats["STATS"][1]
|
||||
for idx in range(3):
|
||||
board_n = idx + 1
|
||||
hashboards[idx].hashrate = AlgoHashRate.SHA256(
|
||||
hashboards[idx].hashrate = self.algo.hashrate(
|
||||
rate=float(board_stats[f"chain_rate{board_n}"]),
|
||||
unit=HashUnit.SHA256.GH,
|
||||
unit=self.algo.unit.GH,
|
||||
).into(self.algo.unit.default)
|
||||
hashboards[idx].chips = int(board_stats[f"chain_acn{board_n}"])
|
||||
chip_temp_data = list(
|
||||
@@ -276,8 +277,8 @@ class LUXMiner(LuxOSFirmware):
|
||||
rate_unit = rpc_stats["STATS"][1]["rate_unit"]
|
||||
except KeyError:
|
||||
rate_unit = "GH"
|
||||
return AlgoHashRate.SHA256(
|
||||
rate=float(expected_rate), unit=HashUnit.SHA256.from_str(rate_unit)
|
||||
return self.algo.hashrate(
|
||||
rate=float(expected_rate), unit=self.algo.unit.from_str(rate_unit)
|
||||
).into(self.algo.unit.default)
|
||||
except LookupError:
|
||||
pass
|
||||
|
||||
@@ -2,8 +2,9 @@ from typing import List, Optional
|
||||
|
||||
from pyasic import MinerConfig
|
||||
from pyasic.config import MiningModeConfig
|
||||
from pyasic.data import AlgoHashRate, Fan, HashBoard, HashUnit
|
||||
from pyasic.data import Fan, HashBoard
|
||||
from pyasic.data.pools import PoolMetrics, PoolUrl
|
||||
from pyasic.device.algorithm import AlgoHashRate
|
||||
from pyasic.errors import APIError
|
||||
from pyasic.miners.data import DataFunction, DataLocations, DataOptions, WebAPICommand
|
||||
from pyasic.miners.device.firmware import MaraFirmware
|
||||
@@ -178,8 +179,8 @@ class MaraMiner(MaraFirmware):
|
||||
try:
|
||||
for hb in web_hashboards["hashboards"]:
|
||||
idx = hb["index"]
|
||||
hashboards[idx].hashrate = AlgoHashRate.SHA256(
|
||||
rate=float(hb["hashrate_average"]), unit=HashUnit.SHA256.GH
|
||||
hashboards[idx].hashrate = self.algo.hashrate(
|
||||
rate=float(hb["hashrate_average"]), unit=self.algo.unit.GH
|
||||
).into(self.algo.unit.default)
|
||||
hashboards[idx].temp = round(
|
||||
sum(hb["temperature_pcb"]) / len(hb["temperature_pcb"])
|
||||
@@ -242,8 +243,8 @@ class MaraMiner(MaraFirmware):
|
||||
|
||||
if web_brief is not None:
|
||||
try:
|
||||
return AlgoHashRate.SHA256(
|
||||
rate=float(web_brief["hashrate_realtime"]), unit=HashUnit.SHA256.TH
|
||||
return self.algo.hashrate(
|
||||
rate=float(web_brief["hashrate_realtime"]), unit=self.algo.unit.TH
|
||||
).into(self.algo.unit.default)
|
||||
except LookupError:
|
||||
pass
|
||||
@@ -290,8 +291,8 @@ class MaraMiner(MaraFirmware):
|
||||
|
||||
if web_brief is not None:
|
||||
try:
|
||||
return AlgoHashRate.SHA256(
|
||||
rate=float(web_brief["hashrate_ideal"]), unit=HashUnit.SHA256.GH
|
||||
return self.algo.hashrate(
|
||||
rate=float(web_brief["hashrate_ideal"]), unit=self.algo.unit.GH
|
||||
).into(self.algo.unit.default)
|
||||
except LookupError:
|
||||
pass
|
||||
|
||||
@@ -15,8 +15,9 @@
|
||||
from typing import List, Optional, Tuple
|
||||
|
||||
from pyasic.config import MinerConfig
|
||||
from pyasic.data import AlgoHashRate, Fan, HashBoard
|
||||
from pyasic.data import Fan, HashBoard
|
||||
from pyasic.data.error_codes import MinerErrorData
|
||||
from pyasic.device.algorithm import AlgoHashRate
|
||||
from pyasic.miners.base import BaseMiner
|
||||
from pyasic.rpc.unknown import UnknownRPCAPI
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
from typing import Optional
|
||||
|
||||
from pyasic import MinerConfig
|
||||
from pyasic.data import AlgoHashRate, HashUnit
|
||||
from pyasic.device.algorithm import AlgoHashRate
|
||||
from pyasic.errors import APIError
|
||||
from pyasic.miners.backends.bmminer import BMMiner
|
||||
from pyasic.miners.data import (
|
||||
@@ -207,9 +207,9 @@ class VNish(VNishFirmware, BMMiner):
|
||||
|
||||
if rpc_summary is not None:
|
||||
try:
|
||||
return AlgoHashRate.SHA256(
|
||||
return self.algo.hashrate(
|
||||
rate=float(rpc_summary["SUMMARY"][0]["GHS 5s"]),
|
||||
unit=HashUnit.SHA256.GH,
|
||||
unit=self.algo.unit.GH,
|
||||
).into(self.algo.unit.default)
|
||||
except (LookupError, ValueError, TypeError):
|
||||
pass
|
||||
|
||||
@@ -19,14 +19,15 @@ import warnings
|
||||
from typing import List, Optional, Protocol, Tuple, Type, TypeVar, Union
|
||||
|
||||
from pyasic.config import MinerConfig
|
||||
from pyasic.data import AlgoHashRate, Fan, HashBoard, MinerData
|
||||
from pyasic.data import Fan, HashBoard, MinerData
|
||||
from pyasic.data.device import DeviceInfo
|
||||
from pyasic.data.error_codes import MinerErrorData
|
||||
from pyasic.data.pools import PoolMetrics
|
||||
from pyasic.device import MinerModel
|
||||
from pyasic.device.algorithm import MinerAlgo
|
||||
from pyasic.device.algorithm import MinerAlgoType
|
||||
from pyasic.device.algorithm.hashrate import AlgoHashRate
|
||||
from pyasic.device.firmware import MinerFirmware
|
||||
from pyasic.device.makes import MinerMake
|
||||
from pyasic.device.models import MinerModelType
|
||||
from pyasic.errors import APIError
|
||||
from pyasic.logger import logger
|
||||
from pyasic.miners.data import DataLocations, DataOptions, RPCAPICommand, WebAPICommand
|
||||
@@ -43,13 +44,13 @@ class MinerProtocol(Protocol):
|
||||
ssh: _ssh_cls = None
|
||||
|
||||
make: MinerMake = None
|
||||
raw_model: MinerModel = None
|
||||
raw_model: MinerModelType = None
|
||||
firmware: MinerFirmware = None
|
||||
algo = MinerAlgo.SHA256
|
||||
algo: MinerAlgoType = None
|
||||
|
||||
expected_hashboards: int = 3
|
||||
expected_hashboards: int = None
|
||||
expected_chips: int = None
|
||||
expected_fans: int = 2
|
||||
expected_fans: int = None
|
||||
|
||||
data_locations: DataLocations = None
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
# See the License for the specific language governing permissions and -
|
||||
# limitations under the License. -
|
||||
# ------------------------------------------------------------------------------
|
||||
from pyasic.device.algorithm import MinerAlgo
|
||||
from pyasic.device.models import MinerModel
|
||||
from pyasic.miners.device.makes import AntMinerMake
|
||||
|
||||
@@ -21,9 +22,15 @@ class Z15(AntMinerMake):
|
||||
raw_model = MinerModel.ANTMINER.Z15
|
||||
|
||||
expected_chips = 3
|
||||
expected_hashboards = 3
|
||||
expected_fans = 2
|
||||
algo = MinerAlgo.EQUIHASH
|
||||
|
||||
|
||||
class Z15Pro(AntMinerMake):
|
||||
raw_model = MinerModel.ANTMINER.Z15Pro
|
||||
|
||||
expected_chips = 6
|
||||
expected_hashboards = 3
|
||||
expected_fans = 2
|
||||
algo = MinerAlgo.EQUIHASH
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
# See the License for the specific language governing permissions and -
|
||||
# limitations under the License. -
|
||||
# ------------------------------------------------------------------------------
|
||||
from pyasic.device.algorithm import MinerAlgo
|
||||
from pyasic.device.models import MinerModel
|
||||
from pyasic.miners.device.makes import AntMinerMake
|
||||
|
||||
@@ -22,6 +23,8 @@ class S17(AntMinerMake):
|
||||
|
||||
expected_chips = 48
|
||||
expected_fans = 4
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
|
||||
class S17Plus(AntMinerMake):
|
||||
@@ -29,6 +32,8 @@ class S17Plus(AntMinerMake):
|
||||
|
||||
expected_chips = 65
|
||||
expected_fans = 4
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
|
||||
class S17Pro(AntMinerMake):
|
||||
@@ -36,6 +41,8 @@ class S17Pro(AntMinerMake):
|
||||
|
||||
expected_chips = 48
|
||||
expected_fans = 4
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
|
||||
class S17e(AntMinerMake):
|
||||
@@ -43,3 +50,5 @@ class S17e(AntMinerMake):
|
||||
|
||||
expected_chips = 135
|
||||
expected_fans = 4
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
# See the License for the specific language governing permissions and -
|
||||
# limitations under the License. -
|
||||
# ------------------------------------------------------------------------------
|
||||
from pyasic.device.algorithm import MinerAlgo
|
||||
from pyasic.device.models import MinerModel
|
||||
from pyasic.miners.device.makes import AntMinerMake
|
||||
|
||||
@@ -22,6 +23,8 @@ class T17(AntMinerMake):
|
||||
|
||||
expected_chips = 30
|
||||
expected_fans = 4
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
|
||||
class T17Plus(AntMinerMake):
|
||||
@@ -29,6 +32,8 @@ class T17Plus(AntMinerMake):
|
||||
|
||||
expected_chips = 44
|
||||
expected_fans = 4
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
|
||||
class T17e(AntMinerMake):
|
||||
@@ -36,3 +41,5 @@ class T17e(AntMinerMake):
|
||||
|
||||
expected_chips = 78
|
||||
expected_fans = 4
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
# See the License for the specific language governing permissions and -
|
||||
# limitations under the License. -
|
||||
# ------------------------------------------------------------------------------
|
||||
from pyasic.device.algorithm import MinerAlgo
|
||||
from pyasic.device.models import MinerModel
|
||||
from pyasic.miners.device.makes import AntMinerMake
|
||||
|
||||
@@ -22,6 +23,8 @@ class S19(AntMinerMake):
|
||||
|
||||
expected_chips = 76
|
||||
expected_fans = 4
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
|
||||
class S19NoPIC(AntMinerMake):
|
||||
@@ -29,6 +32,8 @@ class S19NoPIC(AntMinerMake):
|
||||
|
||||
expected_chips = 88
|
||||
expected_fans = 4
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
|
||||
class S19Pro(AntMinerMake):
|
||||
@@ -36,6 +41,8 @@ class S19Pro(AntMinerMake):
|
||||
|
||||
expected_chips = 114
|
||||
expected_fans = 4
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
|
||||
class S19i(AntMinerMake):
|
||||
@@ -43,6 +50,8 @@ class S19i(AntMinerMake):
|
||||
|
||||
expected_chips = 80
|
||||
expected_fans = 4
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
|
||||
class S19Plus(AntMinerMake):
|
||||
@@ -50,6 +59,8 @@ class S19Plus(AntMinerMake):
|
||||
|
||||
expected_chips = 80
|
||||
expected_fans = 4
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
|
||||
class S19ProPlus(AntMinerMake):
|
||||
@@ -57,6 +68,8 @@ class S19ProPlus(AntMinerMake):
|
||||
|
||||
expected_chips = 120
|
||||
expected_fans = 4
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
|
||||
class S19XP(AntMinerMake):
|
||||
@@ -64,6 +77,8 @@ class S19XP(AntMinerMake):
|
||||
|
||||
expected_chips = 110
|
||||
expected_fans = 4
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
|
||||
class S19a(AntMinerMake):
|
||||
@@ -71,6 +86,8 @@ class S19a(AntMinerMake):
|
||||
|
||||
expected_chips = 72
|
||||
expected_fans = 4
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
|
||||
class S19aPro(AntMinerMake):
|
||||
@@ -78,6 +95,8 @@ class S19aPro(AntMinerMake):
|
||||
|
||||
expected_chips = 100
|
||||
expected_fans = 4
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
|
||||
class S19j(AntMinerMake):
|
||||
@@ -85,6 +104,8 @@ class S19j(AntMinerMake):
|
||||
|
||||
expected_chips = 114
|
||||
expected_fans = 4
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
|
||||
class S19jNoPIC(AntMinerMake):
|
||||
@@ -92,6 +113,8 @@ class S19jNoPIC(AntMinerMake):
|
||||
|
||||
expected_chips = 88
|
||||
expected_fans = 4
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
|
||||
class S19jPro(AntMinerMake):
|
||||
@@ -99,6 +122,8 @@ class S19jPro(AntMinerMake):
|
||||
|
||||
expected_chips = 126
|
||||
expected_fans = 4
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
|
||||
class S19jProNoPIC(AntMinerMake):
|
||||
@@ -106,6 +131,8 @@ class S19jProNoPIC(AntMinerMake):
|
||||
|
||||
expected_chips = 126
|
||||
expected_fans = 4
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
|
||||
class S19jProPlus(AntMinerMake):
|
||||
@@ -113,6 +140,8 @@ class S19jProPlus(AntMinerMake):
|
||||
|
||||
expected_chips = 120
|
||||
expected_fans = 4
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
|
||||
class S19jProPlusNoPIC(AntMinerMake):
|
||||
@@ -120,6 +149,8 @@ class S19jProPlusNoPIC(AntMinerMake):
|
||||
|
||||
expected_chips = 120
|
||||
expected_fans = 4
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
|
||||
class S19kPro(AntMinerMake):
|
||||
@@ -127,6 +158,8 @@ class S19kPro(AntMinerMake):
|
||||
|
||||
expected_chips = 77
|
||||
expected_fans = 4
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
|
||||
class S19kProNoPIC(AntMinerMake):
|
||||
@@ -134,6 +167,8 @@ class S19kProNoPIC(AntMinerMake):
|
||||
|
||||
expected_chips = 77
|
||||
expected_fans = 4
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
|
||||
class S19L(AntMinerMake):
|
||||
@@ -141,6 +176,8 @@ class S19L(AntMinerMake):
|
||||
|
||||
expected_chips = 76
|
||||
expected_fans = 4
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
|
||||
class S19Hydro(AntMinerMake):
|
||||
@@ -149,6 +186,7 @@ class S19Hydro(AntMinerMake):
|
||||
expected_chips = 104
|
||||
expected_hashboards = 4
|
||||
expected_fans = 0
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
|
||||
class S19ProHydro(AntMinerMake):
|
||||
@@ -157,6 +195,7 @@ class S19ProHydro(AntMinerMake):
|
||||
expected_chips = 180
|
||||
expected_hashboards = 4
|
||||
expected_fans = 0
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
|
||||
class S19ProPlusHydro(AntMinerMake):
|
||||
@@ -165,6 +204,7 @@ class S19ProPlusHydro(AntMinerMake):
|
||||
expected_chips = 180
|
||||
expected_hashboards = 4
|
||||
expected_fans = 0
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
|
||||
class S19KPro(AntMinerMake):
|
||||
@@ -172,3 +212,5 @@ class S19KPro(AntMinerMake):
|
||||
|
||||
expected_chips = 77
|
||||
expected_fans = 4
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
# See the License for the specific language governing permissions and -
|
||||
# limitations under the License. -
|
||||
# ------------------------------------------------------------------------------
|
||||
from pyasic.device.algorithm import MinerAlgo
|
||||
from pyasic.device.models import MinerModel
|
||||
from pyasic.miners.device.makes import AntMinerMake
|
||||
|
||||
@@ -22,3 +23,5 @@ class T19(AntMinerMake):
|
||||
|
||||
expected_chips = 76
|
||||
expected_fans = 4
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
# See the License for the specific language governing permissions and -
|
||||
# limitations under the License. -
|
||||
# ------------------------------------------------------------------------------
|
||||
from pyasic.device.algorithm import MinerAlgo
|
||||
from pyasic.device.models import MinerModel
|
||||
from pyasic.miners.device.makes import AntMinerMake
|
||||
|
||||
@@ -22,6 +23,8 @@ class S21(AntMinerMake):
|
||||
|
||||
expected_chips = 108
|
||||
expected_fans = 4
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
|
||||
class S21Pro(AntMinerMake):
|
||||
@@ -29,3 +32,5 @@ class S21Pro(AntMinerMake):
|
||||
|
||||
expected_chips = 65
|
||||
expected_fans = 4
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
# See the License for the specific language governing permissions and -
|
||||
# limitations under the License. -
|
||||
# ------------------------------------------------------------------------------
|
||||
from pyasic.device.algorithm import MinerAlgo
|
||||
from pyasic.device.models import MinerModel
|
||||
from pyasic.miners.device.makes import AntMinerMake
|
||||
|
||||
@@ -22,3 +23,5 @@ class T21(AntMinerMake):
|
||||
|
||||
expected_chips = 108
|
||||
expected_fans = 4
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
# See the License for the specific language governing permissions and -
|
||||
# limitations under the License. -
|
||||
# ------------------------------------------------------------------------------
|
||||
from pyasic.device.algorithm import MinerAlgo
|
||||
from pyasic.device.models import MinerModel
|
||||
from pyasic.miners.device.makes import AntMinerMake
|
||||
|
||||
@@ -21,3 +22,6 @@ class D3(AntMinerMake):
|
||||
raw_model = MinerModel.ANTMINER.D3
|
||||
|
||||
expected_chips = 60
|
||||
expected_hashboards = 3
|
||||
expected_fans = 4
|
||||
algo = MinerAlgo.X11
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
# See the License for the specific language governing permissions and -
|
||||
# limitations under the License. -
|
||||
# ------------------------------------------------------------------------------
|
||||
from pyasic.device.algorithm import MinerAlgo
|
||||
from pyasic.device.models import MinerModel
|
||||
from pyasic.miners.device.makes import AntMinerMake
|
||||
|
||||
@@ -21,3 +22,6 @@ class HS3(AntMinerMake):
|
||||
raw_model = MinerModel.ANTMINER.HS3
|
||||
|
||||
expected_chips = 92
|
||||
expected_hashboards = 3
|
||||
expected_fans = 4
|
||||
algo = MinerAlgo.HANDSHAKE
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
# See the License for the specific language governing permissions and -
|
||||
# limitations under the License. -
|
||||
# ------------------------------------------------------------------------------
|
||||
from pyasic.device.algorithm import MinerAlgo
|
||||
from pyasic.device.models import MinerModel
|
||||
from pyasic.miners.device.makes import AntMinerMake
|
||||
|
||||
@@ -21,3 +22,6 @@ class KA3(AntMinerMake):
|
||||
raw_model = MinerModel.ANTMINER.KA3
|
||||
|
||||
expected_chips = 92
|
||||
expected_hashboards = 3
|
||||
expected_fans = 4
|
||||
algo = MinerAlgo.KADENA
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
# See the License for the specific language governing permissions and -
|
||||
# limitations under the License. -
|
||||
# ------------------------------------------------------------------------------
|
||||
from pyasic.device.algorithm import MinerAlgo
|
||||
from pyasic.device.models import MinerModel
|
||||
from pyasic.miners.device.makes import AntMinerMake
|
||||
|
||||
@@ -22,3 +23,5 @@ class KS3(AntMinerMake):
|
||||
|
||||
expected_chips = 92
|
||||
expected_fans = 2
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.KHEAVYHASH
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
# See the License for the specific language governing permissions and -
|
||||
# limitations under the License. -
|
||||
# ------------------------------------------------------------------------------
|
||||
from pyasic.device.algorithm import MinerAlgo
|
||||
from pyasic.device.models import MinerModel
|
||||
from pyasic.miners.device.makes import AntMinerMake
|
||||
|
||||
@@ -21,3 +22,6 @@ class L3Plus(AntMinerMake):
|
||||
raw_model = MinerModel.ANTMINER.L3Plus
|
||||
|
||||
expected_chips = 72
|
||||
expected_hashboards = 4
|
||||
expected_fans = 2
|
||||
algo = MinerAlgo.SCRYPT
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
# See the License for the specific language governing permissions and -
|
||||
# limitations under the License. -
|
||||
# ------------------------------------------------------------------------------
|
||||
from pyasic.device.algorithm import MinerAlgo
|
||||
from pyasic.device.models import MinerModel
|
||||
from pyasic.miners.device.makes import AntMinerMake
|
||||
|
||||
@@ -21,3 +22,6 @@ class DR5(AntMinerMake):
|
||||
raw_model = MinerModel.ANTMINER.DR5
|
||||
|
||||
expected_chips = 72
|
||||
expected_fans = 2
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.BLAKE256
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
# See the License for the specific language governing permissions and -
|
||||
# limitations under the License. -
|
||||
# ------------------------------------------------------------------------------
|
||||
from pyasic.device.algorithm import MinerAlgo
|
||||
from pyasic.device.models import MinerModel
|
||||
from pyasic.miners.device.makes import AntMinerMake
|
||||
|
||||
@@ -21,3 +22,6 @@ class KS5(AntMinerMake):
|
||||
raw_model = MinerModel.ANTMINER.KS5
|
||||
|
||||
expected_chips = 92
|
||||
expected_hashboards = 3
|
||||
expected_fans = 4
|
||||
algo = MinerAlgo.KHEAVYHASH
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
# See the License for the specific language governing permissions and -
|
||||
# limitations under the License. -
|
||||
# ------------------------------------------------------------------------------
|
||||
from pyasic.device.algorithm import MinerAlgo
|
||||
from pyasic.device.models import MinerModel
|
||||
from pyasic.miners.device.makes import AntMinerMake
|
||||
|
||||
@@ -22,3 +23,5 @@ class D7(AntMinerMake):
|
||||
|
||||
expected_fans = 4
|
||||
expected_chips = 70
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.X11
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
# See the License for the specific language governing permissions and -
|
||||
# limitations under the License. -
|
||||
# ------------------------------------------------------------------------------
|
||||
from pyasic.device.algorithm import MinerAlgo
|
||||
from pyasic.device.models import MinerModel
|
||||
from pyasic.miners.device.makes import AntMinerMake
|
||||
|
||||
@@ -21,4 +22,6 @@ class K7(AntMinerMake):
|
||||
raw_model = MinerModel.ANTMINER.K7
|
||||
|
||||
expected_chips = 92
|
||||
expected_fans = 4
|
||||
expected_fans = 2
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.EAGLESONG
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
# See the License for the specific language governing permissions and -
|
||||
# limitations under the License. -
|
||||
# ------------------------------------------------------------------------------
|
||||
from pyasic.device.algorithm import MinerAlgo
|
||||
from pyasic.device.models import MinerModel
|
||||
from pyasic.miners.device.makes import AntMinerMake
|
||||
|
||||
@@ -22,3 +23,5 @@ class L7(AntMinerMake):
|
||||
|
||||
expected_chips = 120
|
||||
expected_fans = 4
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.SCRYPT
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
# See the License for the specific language governing permissions and -
|
||||
# limitations under the License. -
|
||||
# ------------------------------------------------------------------------------
|
||||
from pyasic.device.algorithm import MinerAlgo
|
||||
from pyasic.device.models import MinerModel
|
||||
from pyasic.miners.device.makes import AntMinerMake
|
||||
|
||||
@@ -21,3 +22,6 @@ class D9(AntMinerMake):
|
||||
raw_model = MinerModel.ANTMINER.D9
|
||||
|
||||
expected_chips = 126
|
||||
expected_hashboards = 3
|
||||
expected_fans = 4
|
||||
algo = MinerAlgo.X11
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
# See the License for the specific language governing permissions and -
|
||||
# limitations under the License. -
|
||||
# ------------------------------------------------------------------------------
|
||||
from pyasic.device.algorithm import MinerAlgo
|
||||
from pyasic.device.models import MinerModel
|
||||
from pyasic.miners.device.makes import AntMinerMake
|
||||
|
||||
@@ -23,3 +24,4 @@ class E9Pro(AntMinerMake):
|
||||
expected_chips = 8
|
||||
expected_hashboards = 2
|
||||
expected_fans = 4
|
||||
algo = MinerAlgo.ETHASH
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
# See the License for the specific language governing permissions and -
|
||||
# limitations under the License. -
|
||||
# ------------------------------------------------------------------------------
|
||||
from pyasic.device.algorithm import MinerAlgo
|
||||
from pyasic.device.models import MinerModel
|
||||
from pyasic.miners.device.makes import AntMinerMake
|
||||
|
||||
@@ -21,15 +22,24 @@ class S9(AntMinerMake):
|
||||
raw_model = MinerModel.ANTMINER.S9
|
||||
|
||||
expected_chips = 63
|
||||
expected_hashboards = 3
|
||||
expected_fans = 2
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
|
||||
class S9i(AntMinerMake):
|
||||
raw_model = MinerModel.ANTMINER.S9i
|
||||
|
||||
expected_chips = 63
|
||||
expected_hashboards = 3
|
||||
expected_fans = 2
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
|
||||
class S9j(AntMinerMake):
|
||||
raw_model = MinerModel.ANTMINER.S9j
|
||||
|
||||
expected_chips = 63
|
||||
expected_hashboards = 3
|
||||
expected_fans = 2
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
# See the License for the specific language governing permissions and -
|
||||
# limitations under the License. -
|
||||
# ------------------------------------------------------------------------------
|
||||
from pyasic.device.algorithm import MinerAlgo
|
||||
from pyasic.device.models import MinerModel
|
||||
from pyasic.miners.device.makes import AntMinerMake
|
||||
|
||||
@@ -21,3 +22,6 @@ class T9(AntMinerMake):
|
||||
raw_model = MinerModel.ANTMINER.T9
|
||||
|
||||
expected_chips = 54
|
||||
expected_hashboards = 3
|
||||
expected_fans = 2
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from pyasic.device.algorithm import MinerAlgo
|
||||
from pyasic.device.models import MinerModel
|
||||
from pyasic.miners.device.makes import AuradineMake
|
||||
|
||||
@@ -6,3 +7,5 @@ class AuradineAD2500(AuradineMake):
|
||||
raw_model = MinerModel.AURADINE.AD2500
|
||||
|
||||
expected_fans = 0
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from pyasic.device.algorithm import MinerAlgo
|
||||
from pyasic.device.models import MinerModel
|
||||
from pyasic.miners.device.makes import AuradineMake
|
||||
|
||||
@@ -6,3 +7,5 @@ class AuradineAD3500(AuradineMake):
|
||||
raw_model = MinerModel.AURADINE.AD3500
|
||||
|
||||
expected_fans = 0
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from pyasic.device.algorithm import MinerAlgo
|
||||
from pyasic.device.models import MinerModel
|
||||
from pyasic.miners.device.makes import AuradineMake
|
||||
|
||||
@@ -6,3 +7,5 @@ class AuradineAI2500(AuradineMake):
|
||||
raw_model = MinerModel.AURADINE.AI2500
|
||||
|
||||
expected_fans = 0
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from pyasic.device.algorithm import MinerAlgo
|
||||
from pyasic.device.models import MinerModel
|
||||
from pyasic.miners.device.makes import AuradineMake
|
||||
|
||||
@@ -6,3 +7,5 @@ class AuradineAI3680(AuradineMake):
|
||||
raw_model = MinerModel.AURADINE.AI3680
|
||||
|
||||
expected_fans = 0
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from pyasic.device.algorithm import MinerAlgo
|
||||
from pyasic.device.models import MinerModel
|
||||
from pyasic.miners.device.makes import AuradineMake
|
||||
|
||||
@@ -7,3 +8,5 @@ class AuradineAT1500(AuradineMake):
|
||||
|
||||
expected_chips = 132
|
||||
expected_fans = 4
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from pyasic.device.algorithm import MinerAlgo
|
||||
from pyasic.device.models import MinerModel
|
||||
from pyasic.miners.device.makes import AuradineMake
|
||||
|
||||
@@ -6,9 +7,13 @@ class AuradineAT2860(AuradineMake):
|
||||
raw_model = MinerModel.AURADINE.AT2860
|
||||
|
||||
expected_fans = 4
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
|
||||
class AuradineAT2880(AuradineMake):
|
||||
raw_model = MinerModel.AURADINE.AT2880
|
||||
|
||||
expected_fans = 4
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
# See the License for the specific language governing permissions and -
|
||||
# limitations under the License. -
|
||||
# ------------------------------------------------------------------------------
|
||||
from pyasic.device.algorithm import MinerAlgo
|
||||
from pyasic.device.models import MinerModel
|
||||
from pyasic.miners.device.makes import AvalonMinerMake
|
||||
|
||||
@@ -21,3 +22,6 @@ class Avalon1026(AvalonMinerMake):
|
||||
raw_model = MinerModel.AVALONMINER.Avalon1026
|
||||
|
||||
expected_chips = 80
|
||||
expected_hashboards = 3
|
||||
expected_fans = 2
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
# See the License for the specific language governing permissions and -
|
||||
# limitations under the License. -
|
||||
# ------------------------------------------------------------------------------
|
||||
from pyasic.device.algorithm import MinerAlgo
|
||||
from pyasic.device.models import MinerModel
|
||||
from pyasic.miners.device.makes import AvalonMinerMake
|
||||
|
||||
@@ -21,3 +22,6 @@ class Avalon1047(AvalonMinerMake):
|
||||
raw_model = MinerModel.AVALONMINER.Avalon1047
|
||||
|
||||
expected_chips = 80
|
||||
expected_hashboards = 3
|
||||
expected_fans = 2
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
# See the License for the specific language governing permissions and -
|
||||
# limitations under the License. -
|
||||
# ------------------------------------------------------------------------------
|
||||
from pyasic.device.algorithm import MinerAlgo
|
||||
from pyasic.device.models import MinerModel
|
||||
from pyasic.miners.device.makes import AvalonMinerMake
|
||||
|
||||
@@ -21,3 +22,5 @@ class Avalon1066(AvalonMinerMake):
|
||||
raw_model = MinerModel.AVALONMINER.Avalon1066
|
||||
expected_chips = 114
|
||||
expected_fans = 4
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
# See the License for the specific language governing permissions and -
|
||||
# limitations under the License. -
|
||||
# ------------------------------------------------------------------------------
|
||||
from pyasic.device.algorithm import MinerAlgo
|
||||
from pyasic.device.models import MinerModel
|
||||
from pyasic.miners.device.makes import AvalonMinerMake
|
||||
|
||||
@@ -22,3 +23,5 @@ class Avalon1166Pro(AvalonMinerMake):
|
||||
|
||||
expected_chips = 120
|
||||
expected_fans = 4
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
# See the License for the specific language governing permissions and -
|
||||
# limitations under the License. -
|
||||
# ------------------------------------------------------------------------------
|
||||
from pyasic.device.algorithm import MinerAlgo
|
||||
from pyasic.device.models import MinerModel
|
||||
from pyasic.miners.device.makes import AvalonMinerMake
|
||||
|
||||
@@ -22,3 +23,5 @@ class Avalon1246(AvalonMinerMake):
|
||||
|
||||
expected_chips = 120
|
||||
expected_fans = 4
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
# See the License for the specific language governing permissions and -
|
||||
# limitations under the License. -
|
||||
# ------------------------------------------------------------------------------
|
||||
from pyasic.device.algorithm import MinerAlgo
|
||||
from pyasic.device.models import MinerModel
|
||||
from pyasic.miners.device.makes import AvalonMinerMake
|
||||
|
||||
@@ -23,3 +24,4 @@ class Avalon721(AvalonMinerMake):
|
||||
expected_hashboards = 4
|
||||
expected_chips = 18
|
||||
expected_fans = 1
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
# See the License for the specific language governing permissions and -
|
||||
# limitations under the License. -
|
||||
# ------------------------------------------------------------------------------
|
||||
from pyasic.device.algorithm import MinerAlgo
|
||||
from pyasic.device.models import MinerModel
|
||||
from pyasic.miners.device.makes import AvalonMinerMake
|
||||
|
||||
@@ -23,3 +24,4 @@ class Avalon741(AvalonMinerMake):
|
||||
expected_hashboards = 4
|
||||
expected_chips = 22
|
||||
expected_fans = 1
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
# See the License for the specific language governing permissions and -
|
||||
# limitations under the License. -
|
||||
# ------------------------------------------------------------------------------
|
||||
from pyasic.device.algorithm import MinerAlgo
|
||||
from pyasic.device.models import MinerModel
|
||||
from pyasic.miners.device.makes import AvalonMinerMake
|
||||
|
||||
@@ -23,3 +24,4 @@ class Avalon761(AvalonMinerMake):
|
||||
expected_hashboards = 4
|
||||
expected_chips = 18
|
||||
expected_fans = 1
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
# See the License for the specific language governing permissions and -
|
||||
# limitations under the License. -
|
||||
# ------------------------------------------------------------------------------
|
||||
from pyasic.device.algorithm import MinerAlgo
|
||||
from pyasic.device.models import MinerModel
|
||||
from pyasic.miners.device.makes import AvalonMinerMake
|
||||
|
||||
@@ -23,3 +24,4 @@ class Avalon821(AvalonMinerMake):
|
||||
expected_hashboards = 4
|
||||
expected_chips = 26
|
||||
expected_fans = 1
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
# See the License for the specific language governing permissions and -
|
||||
# limitations under the License. -
|
||||
# ------------------------------------------------------------------------------
|
||||
from pyasic.device.algorithm import MinerAlgo
|
||||
from pyasic.device.models import MinerModel
|
||||
from pyasic.miners.device.makes import AvalonMinerMake
|
||||
|
||||
@@ -23,3 +24,4 @@ class Avalon841(AvalonMinerMake):
|
||||
expected_hashboards = 4
|
||||
expected_chips = 26
|
||||
expected_fans = 1
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
# See the License for the specific language governing permissions and -
|
||||
# limitations under the License. -
|
||||
# ------------------------------------------------------------------------------
|
||||
from pyasic.device.algorithm import MinerAlgo
|
||||
from pyasic.device.models import MinerModel
|
||||
from pyasic.miners.device.makes import AvalonMinerMake
|
||||
|
||||
@@ -23,3 +24,4 @@ class Avalon851(AvalonMinerMake):
|
||||
expected_hashboards = 4
|
||||
expected_chips = 26
|
||||
expected_fans = 1
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
# See the License for the specific language governing permissions and -
|
||||
# limitations under the License. -
|
||||
# ------------------------------------------------------------------------------
|
||||
from pyasic.device.algorithm import MinerAlgo
|
||||
from pyasic.device.models import MinerModel
|
||||
from pyasic.miners.device.makes import AvalonMinerMake
|
||||
|
||||
@@ -23,3 +24,4 @@ class Avalon921(AvalonMinerMake):
|
||||
expected_hashboards = 4
|
||||
expected_chips = 26
|
||||
expected_fans = 1
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from pyasic.device import MinerModel
|
||||
from pyasic.device.algorithm import MinerAlgo
|
||||
from pyasic.device.models import MinerModel
|
||||
from pyasic.miners.device.makes import AvalonMinerMake
|
||||
|
||||
|
||||
@@ -8,3 +9,4 @@ class AvalonNano3(AvalonMinerMake):
|
||||
expected_hashboards = 1
|
||||
expected_chips = 10
|
||||
expected_fans = 1
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user