Mushu 6 vuotta sitten
commit
b81c5c1e62
4 muutettua tiedostoa jossa 170 lisäystä ja 0 poistoa
  1. 1 0
      .gitignore
  2. 79 0
      MagnaSim.py
  3. 80 0
      README.md
  4. 10 0
      main.py

+ 1 - 0
.gitignore Näytä tiedosto

@@ -0,0 +1 @@
1
+__pycache__

+ 79 - 0
MagnaSim.py Näytä tiedosto

@@ -0,0 +1,79 @@
1
+#! /usr/bin/env python3
2
+
3
+import math
4
+import numpy as np
5
+import pandas as pd
6
+
7
+class Populations:
8
+    """
9
+    This class is made of a pd.Series of the clients and the operation that 
10
+    can be made on the population.
11
+    """
12
+    def __init__(self, carac):
13
+        """
14
+        Population constructor, initialises the client population with
15
+        the caracterictic given to it.
16
+        """
17
+        self.population = pd.Series()
18
+        self.nmbr = carac
19
+        self.add_client(self.nmbr)
20
+        """
21
+        We have to define more caracteristics. We will start with a
22
+        simple serie of inds and their number
23
+        """
24
+        return
25
+
26
+    def add_client(self, nb):#Need to add an arg "habits"
27
+        """
28
+        Add 'nb' clients to the population.
29
+        """
30
+        start = len(self.population)
31
+        end = start + nb
32
+        inds = []
33
+        for i in range(nb):
34
+            inds.append(Individu())
35
+        self.population = self.population.append(pd.Series(inds, index=range(start, end)))
36
+        self.nmbr += nb
37
+        return
38
+    
39
+
40
+class Individu: #tout OK
41
+    """
42
+    This class define the clients, it's caracteristics being :
43
+        - User habits :
44
+            - The habits with the Magna Wallet and the 3 tokens :
45
+                -self.magna_wallet_btc
46
+                -self.magna_wallet_eth
47
+                -self.magna_wallet_mgn
48
+            They containe statisctical law of the user habits.
49
+    The methods of this class operate on only one client.
50
+    """
51
+
52
+    def __init__(self):#OK
53
+        """
54
+        Constructeur d'une instance 'individu'.
55
+        Ce constructeur fait appel aux fonction especes et aleatoire
56
+        pour initialisé les variables d'un individu aux valeurs propres
57
+        à son espèce.
58
+        """
59
+        # Those 3 caracteristic are the users habits concerning the client
60
+        # use of Magna Wallet
61
+        self.magna_wallet_btc = (
62
+            np.random.normal(
63
+                loc=0.00001, scale=0.002),
64
+            abs(np.random.normal(
65
+                loc=0.002, scale=0.01))
66
+        )
67
+        self.magna_wallet_eth = (
68
+            np.random.normal(
69
+                loc=0.01, scale=0.9),
70
+            abs(np.random.normal(
71
+                loc=0.5, scale=5))
72
+        )
73
+        self.magna_wallet_mgn = (
74
+            np.random.normal(
75
+                loc=1, scale=10),
76
+            abs(np.random.normal(
77
+                loc=10, scale=50))
78
+        )
79
+        return

+ 80 - 0
README.md Näytä tiedosto

@@ -0,0 +1,80 @@
1
+#Project title
2
+
3
+MagnaSim is intended to simulation clients usage of the Magna ecosystem.
4
+
5
+#Motivation
6
+
7
+From that simulation we want to obtain different information :
8
+- What should be the pricing ?
9
+- What should be the descrease rate of token's volume, assuming \
10
+the current eurostat demographic projections ?
11
+
12
+#Status
13
+
14
+__to be done__
15
+*Build status of continus integration i.e. travis, appveyor etc. Ex. -*
16
+
17
+##Task list
18
+- [x]Population generation.
19
+- []Crypto fees :
20
+	- [x]BTC fees calculation
21
+	- []ETH fees calculation
22
+	- []Stellar fees calculation
23
+- []Setting user interface to modify parameters
24
+
25
+#Code style
26
+
27
+[PEP8](https://www.python.org/dev/peps/pep-0008/)
28
+
29
+#Screenshots
30
+
31
+__to be done__
32
+*Include logo/demo screenshot etc.*
33
+
34
+#Tech/framework used
35
+
36
+__to be done__
37
+
38
+#Features
39
+
40
+__to be done__
41
+*What makes your project stand out?*
42
+
43
+#Code Example
44
+
45
+__to be done__
46
+*Show what the library does as concisely as possible, developers should be able to figure out how your project solves their problem by looking at the code example. Make sure the API you are showing off is obvious, and that your code is short and concise.*
47
+
48
+#Installation
49
+
50
+__to be done__
51
+Provide step by step series of examples and explanations about how to get a development env running.
52
+
53
+#API Reference
54
+
55
+__to be done__
56
+*Depending on the size of the project, if it is small and simple enough the reference docs can be added to the README. For medium size to larger projects it is important to at least provide a link to where the API reference docs live.*
57
+
58
+#Tests
59
+
60
+__to be done__
61
+*Describe and show how to run the tests with code examples.*
62
+
63
+#How to use?
64
+
65
+__to be done__
66
+*If people like your project they’ll want to learn how they can use it. To do so include step by step guide to use your project.*
67
+
68
+#Contribute
69
+
70
+__to be done__
71
+*Let people know how they can contribute into your project. A contributing guideline will be a big plus.*
72
+
73
+#Credits
74
+
75
+__to be done__
76
+
77
+#License
78
+
79
+__to be done__
80
+*MIT © Yourname*

+ 10 - 0
main.py Näytä tiedosto

@@ -0,0 +1,10 @@
1
+#! /usr/bin/env python3
2
+import math
3
+import numpy as np
4
+import pandas as pd
5
+import MagnaSim
6
+pop = MagnaSim.Populations(10)
7
+
8
+for i in pop.population:
9
+    x = np.random.normal(i.magna_wallet_btc[0],i.magna_wallet_btc[1])
10
+    print(abs(x))