Browse Source

added CloudMining

Fabian Peter Hammerle 7 years ago
parent
commit
d2aec24d36
3 changed files with 33 additions and 2 deletions
  1. 14 0
      finoex/__init__.py
  2. 2 2
      setup.py
  3. 17 0
      tests/test_yaml.py

+ 14 - 0
finoex/__init__.py

@@ -417,6 +417,20 @@ class HostingService(Service):
             self.operating_system = operating_system
 
 
+class CloudMining(Service):
+
+    yaml_tag = u'!cloud-mining'
+
+    def __init__(self,
+                 hashrate=None,
+                 **kwargs
+                 ):
+        super(CloudMining, self).__init__(**kwargs)
+        if hashrate:
+            assert isinstance(hashrate, ioex.calcex.Figure)
+            self.hashrate = hashrate
+
+
 class Transportation(Item):
 
     yaml_tag = u'!transportation'

+ 2 - 2
setup.py

@@ -4,12 +4,12 @@ import glob
 
 setup(
     name = 'finoex',
-    version = '0.6.0',
+    version = '0.7.0',
     # description = '',
     author = 'Fabian Peter Hammerle',
     author_email = 'fabian.hammerle@gmail.com',
     url = 'https://git.hammerle.me/fphammerle/finoex',
-    download_url = 'https://git.hammerle.me/fphammerle/finoex/archive/0.6.0.tar.gz',
+    download_url = 'https://git.hammerle.me/fphammerle/finoex/archive/0.7.0.tar.gz',
     keywords = ['finances'],
     # classifiers = [],
     packages = ['finoex'],

+ 17 - 0
tests/test_yaml.py

@@ -55,6 +55,13 @@ def get_hosting_service():
         state = 'running',
         )
 
+def get_cloud_mining():
+    return finoex.CloudMining(
+        hashrate = ioex.calcex.Figure(8, u'TH/s'),
+        name = u'sha256 BTC',
+        price_brutto = finoex.Sum(1.0, u'EUR'),
+        )
+
 def get_service_b():
     return finoex.Service(
         name = u'service',
@@ -301,6 +308,11 @@ name: virtual server
 operating_system: debian 8
 price_brutto: !sum '1.0 EUR'
 state: running
+"""],
+    [get_cloud_mining(), u"""!cloud-mining
+hashrate: !figure '8 TH/s'
+name: sha256 BTC
+price_brutto: !sum '1.0 EUR'
 """],
     [get_pledge(), u"""!pledge
 campaign: !campaign
@@ -478,6 +490,11 @@ name: virtual server
 operating_system: debian 8
 price_brutto: !sum '1.0 EUR'
 state: running
+"""],
+    [get_cloud_mining(), u"""!cloud-mining
+hashrate: !figure 8 TH/s
+name: sha256 BTC
+price_brutto: !sum 1.0 EUR
 """],
     [get_pledge(), u"""!pledge
 campaign: !campaign