From 3db64cf1e8f52de0b1a7354fc465b92cf803696e Mon Sep 17 00:00:00 2001 From: Mushu Date: Mon, 8 Oct 2018 13:17:07 +0200 Subject: [PATCH] =?UTF-8?q?recup=C3=A9ration=20de=20la=20fonction=20btc=20?= =?UTF-8?q?fees=20et=20main.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MagnaSim.py | 31 +++++++++++++++++++++++++++++-- main.py | 8 +++++--- 2 files changed, 34 insertions(+), 5 deletions(-) mode change 100755 => 100644 MagnaSim.py mode change 100755 => 100644 main.py diff --git a/MagnaSim.py b/MagnaSim.py old mode 100755 new mode 100644 index 2072106..e6f305c --- a/MagnaSim.py +++ b/MagnaSim.py @@ -35,7 +35,6 @@ class Populations: self.population = self.population.append(pd.Series(inds, index=range(start, end))) self.nmbr += nb return - class Individu: #tout OK """ @@ -76,4 +75,32 @@ class Individu: #tout OK abs(np.random.normal( loc=10, scale=50)) ) - return \ No newline at end of file + return + +class Transaction: + """ + This class keeps track of the transactions + """ + def __init__(self): + self.btc=0 + self.etg=0 + self.mgn=0 + return + + +def fees_btc(nbr_transaction_btc): + """ + Cette fonction calcule une version simplifié des frais de transaction + """ + # Dans un premier temps je vais prendre pour valeur pour valeur de transfere : + # 20sat/byte + # On simplifie aussi en considerant qu'on a 1 input et 1 output + fees_btc = (nbr_transaction_btc*180 + 40 + nbr_transaction_btc)*20 + return fees_btc + +def fees_eth(nbr_transaction_eth): + return + +def fees_mgn(nbr_transaction_mgn): + return + diff --git a/main.py b/main.py old mode 100755 new mode 100644 index dfcb97e..5cb291c --- a/main.py +++ b/main.py @@ -2,9 +2,11 @@ import math import numpy as np import pandas as pd -import MagnaSim -pop = MagnaSim.Populations(10) - +import MagnaSim as MaSi +pop = MaSi.Populations(10) +trans = MaSi.Transaction() for i in pop.population: x = np.random.normal(i.magna_wallet_btc[0],i.magna_wallet_btc[1]) + trans.btc+=1 print(abs(x)) +print("Nombre de BTC : {:f}".format(MaSi.fees_btc(trans.btc)*0.0000001))