some things work
This commit is contained in:
+14
-2
@@ -7,6 +7,10 @@ class Exchange():
|
||||
|
||||
def __init__(self) -> None:
|
||||
|
||||
self.reset()
|
||||
pass
|
||||
|
||||
def reset(self):
|
||||
self.account={}
|
||||
self.escrow={}
|
||||
self.lme=LightMatchingEngine()
|
||||
@@ -21,8 +25,7 @@ class Exchange():
|
||||
self.demand={}
|
||||
self.total_supply={}
|
||||
self.supply={}
|
||||
pass
|
||||
|
||||
|
||||
def add_to_account(self,account_id,resource,amount):
|
||||
"""
|
||||
Adds resources to account escrow
|
||||
@@ -237,4 +240,13 @@ class Exchange():
|
||||
if account_id in self.account:
|
||||
if resource in self.account[account_id]:
|
||||
return self.account[account_id][resource]
|
||||
return 0
|
||||
|
||||
def get_total_demand(self,resource):
|
||||
if resource in self.total_demand:
|
||||
return self.total_demand[resource]
|
||||
return 0
|
||||
def get_total_supply(self,resource):
|
||||
if resource in self.total_supply:
|
||||
return self.total_supply[resource]
|
||||
return 0
|
||||
Reference in New Issue
Block a user