MCPcopy Create free account
hub / github.com/dabeaz-course/practical-python / run

Method run

Work/Data/stocksim.py:148–159  ·  view source on GitHub ↗
(self,dt)

Source from the content-addressed store, hash-verified

146
147 # Run forever. Dt is in seconds
148 def run(self,dt):
149 for s in self.stocks:
150 self.prices[s] = self.stocks[s].price
151 self.publish(self.stocks[s].make_record())
152 while self.time < 1000:
153 for s in self.stocks:
154 self.stocks[s].incr(dt/60.0) # Increment is in minutes
155 if self.stocks[s].price != self.prices[s]:
156 self.prices[s] = self.stocks[s].price
157 self.publish(self.stocks[s].make_record())
158 time.sleep(dt)
159 self.time += (dt/60.0)
160
161
162class BasicPrinter(object):

Callers 1

stocksim.pyFile · 0.80

Calls 3

publishMethod · 0.95
make_recordMethod · 0.80
incrMethod · 0.80

Tested by

no test coverage detected