MCPcopy Index your code
hub / github.com/ScottfreeLLC/AlphaPy / run_system

Function run_system

alphapy/system.py:309–383  ·  view source on GitHub ↗

r"""Run a system for a given group, creating a trades frame. Parameters ---------- model : alphapy.Model The model object with specifications. system : alphapy.System The system to run. group : alphapy.Group The group of symbols to trade. intraday : b

(model,
               system,
               group,
               intraday = False,
               quantity = 1)

Source from the content-addressed store, hash-verified

307#
308
309def run_system(model,
310 system,
311 group,
312 intraday = False,
313 quantity = 1):
314 r"""Run a system for a given group, creating a trades frame.
315
316 Parameters
317 ----------
318 model : alphapy.Model
319 The model object with specifications.
320 system : alphapy.System
321 The system to run.
322 group : alphapy.Group
323 The group of symbols to trade.
324 intraday : bool, optional
325 If true, this is an intraday system.
326 quantity : float, optional
327 The amount to trade for each symbol, e.g., number of shares
328
329 Returns
330 -------
331 tf : pandas.DataFrame
332 All of the trades for this ``group``.
333
334 """
335
336 system_name = system.name
337 logger.info("Generating Trades for System %s", system_name)
338
339 # Unpack the model data.
340
341 directory = model.specs['directory']
342 extension = model.specs['extension']
343 separator = model.specs['separator']
344
345 # Extract the group information.
346
347 gname = group.name
348 gmembers = group.members
349 gspace = group.space
350
351 # Run the system for each member of the group
352
353 gtlist = []
354 for symbol in gmembers:
355 # generate the trades for this member
356 tlist = trade_system(model, system, gspace, intraday, symbol, quantity)
357 if tlist:
358 # add trades to global trade list
359 for item in tlist:
360 gtlist.append(item)
361 else:
362 logger.info("No trades for symbol %s", symbol)
363
364 # Create group trades frame
365
366 tf = None

Callers 1

market_pipelineFunction · 0.90

Calls 4

SpaceClass · 0.90
frame_nameFunction · 0.90
write_frameFunction · 0.90
trade_systemFunction · 0.85

Tested by

no test coverage detected