Skip to content

Instantly share code, notes, and snippets.

@yurenju
Created December 15, 2019 03:57
Show Gist options
  • Save yurenju/b90bd7a279261f59add1c9e44e1c5664 to your computer and use it in GitHub Desktop.
Save yurenju/b90bd7a279261f59add1c9e44e1c5664 to your computer and use it in GitHub Desktop.
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