MCPcopy Index your code
hub / github.com/dabeaz-course/python-mastery / run

Method run

Data/stocksim.py:150–161  ·  view source on GitHub ↗
(self,dt)

Source from the content-addressed store, hash-verified

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

Callers 1

stocksim.pyFile · 0.80

Calls 3

publishMethod · 0.95
incrMethod · 0.80
make_recordMethod · 0.45

Tested by

no test coverage detected