Created
December 15, 2019 03:57
-
-
Save yurenju/b90bd7a279261f59add1c9e44e1c5664 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UniswapModel(Model): | |
def __init__(self, num_traders, num_arbitrageurs, trader_dai, trader_eth, uniswap_dai, uniswap_eth): | |
super().__init__() | |
self.num_traders = num_traders | |
self.schedule = RandomActivation(self) | |
self.uniswap = Uniswap(1, self, uniswap_dai, uniswap_eth) | |
for i in range(num_traders): | |
trader = Trader(i, self, trader_eth, trader_dai, i < num_arbitrageurs) | |
self.schedule.add(trader) | |
self.datacollector = DataCollector(model_reporters=model_reporters,agent_reporters=agent_reporters) | |
def step(self): | |
self.datacollector.collect(self) | |
self.uniswap.step() | |
self.schedule.step() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment