def Ladder(ctx): const = constant linear_signal = math.RandomWalk(initialValue=10, deltaDistr=const(-.1), name="20-0.1t") return [ ctx.makeTrader_A( strategy.price.LiquidityProvider().Strategy( orderFactory=order.side_price.Limit( volume=const(10.)).sideprice_WithExpiry(const(50.))), "liquidity"), ctx.makeTrader_A( order.side_price.Limit(volume=const(1.)) # .sideprice_Iceberg(lotSize=const(1)) .LadderMM(initialSize=10).LadderBalancer(maximalSize=10).StopLoss( lossFactor=constant(0.03)).Suspend(CurrentTime() < 30).Suspend( (300 < CurrentTime()).And(CurrentTime() < 350)), "ladder mm"), ctx.makeTrader_A( strategy.side.Signal(linear_signal).Strategy( event.Every(constant(1.)), order.side.Market(const(4))), "signal"), ]
def run(name, constructor, only_veusz): with scheduler.create() as world: ctx = Context(world, veusz.Graph) traders = constructor(ctx) if config.useMinorTraders: traders.extend([ ctx.makeMinorTrader(strategy.RSI_linear(k=const(0.07)), "RSI 0.07"), ctx.makeMinorTrader(strategy.RSI_linear(k=const(-0.07)), "RSI -0.07"), ctx.makeMinorTrader( strategy.Bollinger_linear(alpha=0.15, k=const(-0.5)), "Bollinger -0.5"), ctx.makeMinorTrader( strategy.Bollinger_linear(alpha=0.15, k=const(+0.5)), "Bollinger +0.5"), ]) books = orderBooksToRender(ctx, traders) for t in traders + books: for ts in t.timeseries: ts.graph.addTimeSerie(ts) r = registry.create() root = registry.Simulation(traders, list(ctx.books.itervalues()), ctx.graphs) r.insert(root) r.pushAllReferences() context.bind(root, {'world': world}) def checks(): if not only_veusz and config.checkConsistency: r.typecheck() try: dumped = pickle.dumps(r) pickle.loads(dumped) except Exception, err: print err checks() stat = world.workTill(500) checks() if config.showTiming: print "\n", stat non_empty_graphs = [g for g in ctx.graphs if len(g._datas)] veusz.render(name, non_empty_graphs) world._reset() context.reset(root) if False and config.runTwoTimes: world.workTill(500) veusz.render(name, non_empty_graphs)
def __init__(self, world, graph_renderer): self.world = world self.book_A = orderbook.Local(tickSize=0.01, name="A") self.book_B = orderbook.Local(tickSize=0.01, name="B") self.book_C = orderbook.Local(tickSize=0.01, name="C") if config.showTiming: self.world.process(const(10), bind.Function(_print, '.')) self.world.process(const(100), bind.Function(_print, '\n')) delay = constant(1.07) self.link_A = orderbook.TwoWayLink(orderbook.Link(delay), orderbook.Link(delay)) self.link_B = orderbook.TwoWayLink(orderbook.Link(delay), orderbook.Link(delay)) self.link_C = orderbook.TwoWayLink(orderbook.Link(delay), orderbook.Link(delay)) self.remote_A = orderbook.Remote(self.book_A, self.link_A) self.remote_B = orderbook.Remote(self.book_B, self.link_B) self.remote_C = orderbook.Remote(self.book_C, self.link_C) self.graph = graph_renderer self.price_graph = self.graph("Price") self.askbid_graph = self.graph("AskBid") self.candles_graph = self.graph("Candles") self.avgs_graph = self.graph("Averages") self.macd_graph = self.graph("MACD") self.eff_graph = self.graph("efficiency") self.amount_graph = self.graph("amount") self.balance_graph = self.graph('balance') self.bollinger_a015_graph = self.graph('bollinger alpha 0.15') self.bollinger_20_graph = self.graph('bollinger 20') self.bollinger_100_graph = self.graph('bollinger 100') self.minmax_graph = self.graph('minmax') self.minors_eff_graph = self.graph('minor traders efficiency') self.minors_amount_graph = self.graph('minor traders position') self.graphs = [ self.price_graph, self.askbid_graph, self.candles_graph, self.avgs_graph, self.macd_graph, self.eff_graph, self.amount_graph, self.balance_graph, self.bollinger_20_graph, self.bollinger_a015_graph, self.bollinger_100_graph, self.minmax_graph, self.minors_eff_graph, self.minors_amount_graph ] self.books = { 'Asset A' : self.book_A , 'Asset B' : self.book_B , 'Remote A': self.remote_A, 'Remote B': self.remote_B }
def run(name, constructor, only_veusz): with createScheduler() as world: import time t0 = time.clock() ctx = Context(world, veusz.Graph) print time.clock() - t0 traders = constructor(ctx) print time.clock() - t0 if config.useMinorTraders: traders.extend([ ctx.makeMinorTrader(strategy.position.RSI_linear(k = const(0.7)).Strategy(), "RSI 0.07"), ctx.makeMinorTrader(strategy.position.RSI_linear(k = const(-0.7)).Strategy(), "RSI -0.07"), ctx.makeMinorTrader(strategy.position.Bollinger_linear(alpha=0.15, k = const(-5.)).Strategy(), "Bollinger -0.5"), ctx.makeMinorTrader(strategy.position.Bollinger_linear(alpha=0.15, k = const(+5.)).Strategy(), "Bollinger +0.5"), ]) books = orderBooksToRender(ctx, traders) r = registry.create() root = registry.Simulation(traders, list(ctx.books.itervalues()), ctx.graphs) # r.insert(root) print time.clock() - t0 root.registerIn(r) # r.pushAllReferences() print time.clock() - t0 root.bind_ex(context.BindingContextEx({'world' : world })) def checks(): if not only_veusz and config.checkConsistency: r.typecheck() try: dumped = pickle.dumps(r) pickle.loads(dumped) except Exception, err: print err print time.clock() - t0 checks() stat = world.workTill(config.veuszRunLength) checks() if config.showTiming: print "\n", stat non_empty_graphs = [g for g in ctx.graphs if len(g._datas)] veusz.render(name, non_empty_graphs) world.reset_ex(0) root.reset_ex(0) if config.runTwoTimes: world.workTill(config.veuszRunLength) veusz.render(name, non_empty_graphs)
def __init__(self, world, graph_renderer): self.world = world self.book_A = orderbook.Local(tickSize=0.01, name="A") self.book_B = orderbook.Local(tickSize=0.01, name="B") self.book_C = orderbook.Local(tickSize=0.01, name="C") if config.showTiming: self.world.process(const(10), bind.Function(_print, '.')) self.world.process(const(100), bind.Function(_print, '\n')) delay = constant(1.07) def link(): return delay.Link.TwoWayLink(delay.Link) self.link_A = link() self.link_B = link() self.link_C = link() self.remote_A = self.book_A.Remote(self.link_A) self.remote_B = self.book_B.Remote(self.link_B) self.remote_C = self.book_C.Remote(self.link_C) self.graph = graph_renderer self.price_graph = self.graph("Price") self.askbid_graph = self.graph("AskBid") self.candles_graph = self.graph("Candles") self.avgs_graph = self.graph("Averages") self.macd_graph = self.graph("MACD") self.eff_graph = self.graph("efficiency") self.amount_graph = self.graph("amount") self.balance_graph = self.graph('balance') self.bollinger_a015_graph = self.graph('bollinger alpha 0.15') self.bollinger_20_graph = self.graph('bollinger 20') self.bollinger_100_graph = self.graph('bollinger 100') self.minmax_graph = self.graph('minmax') self.minors_eff_graph = self.graph('minor traders efficiency') self.minors_amount_graph = self.graph('minor traders position') self.graphs = [ self.price_graph, self.askbid_graph, self.candles_graph, self.avgs_graph, self.macd_graph, self.eff_graph, self.amount_graph, self.balance_graph, self.bollinger_20_graph, self.bollinger_a015_graph, self.bollinger_100_graph, self.minmax_graph, self.minors_eff_graph, self.minors_amount_graph ] self.books = { 'Asset A': self.book_A, 'Asset B': self.book_B, 'Remote A': self.remote_A, 'Remote B': self.remote_B }
def run(name, constructor, only_veusz): with scheduler.create() as world: ctx = Context(world, veusz.Graph) traders = constructor(ctx) if config.useMinorTraders: traders.extend([ ctx.makeMinorTrader(strategy.RSI_linear(k = const(0.07)), "RSI 0.07"), ctx.makeMinorTrader(strategy.RSI_linear(k = const(-0.07)), "RSI -0.07"), ctx.makeMinorTrader(strategy.Bollinger_linear(alpha=0.15, k = const(-0.5)), "Bollinger -0.5"), ctx.makeMinorTrader(strategy.Bollinger_linear(alpha=0.15, k = const(+0.5)), "Bollinger +0.5"), ]) books = orderBooksToRender(ctx, traders) for t in traders + books: for ts in t.timeseries: ts.graph.addTimeSerie(ts) r = registry.create() root = registry.Simulation(traders, list(ctx.books.itervalues()), ctx.graphs) r.insert(root) r.pushAllReferences() context.bind(root, {'world' : world }) def checks(): if not only_veusz and config.checkConsistency: r.typecheck() try: dumped = pickle.dumps(r) pickle.loads(dumped) except Exception, err: print err checks() stat = world.workTill(500) checks() if config.showTiming: print "\n", stat non_empty_graphs = [g for g in ctx.graphs if len(g._datas)] veusz.render(name, non_empty_graphs) world._reset() context.reset(root) if False and config.runTwoTimes: world.workTill(500) veusz.render(name, non_empty_graphs)
def Canceller(ctx): ctx.volumeStep = 15 return [ ctx.makeTrader_A(strategy.price.LiquidityProvider() .Strategy(orderFactory=order.side_price.Limit(const(10))), "LiquidityProviderEx-"), ctx.makeTrader_A(strategy.Canceller(), "canceller"), ctx.makeTrader_A( strategy.side.FundamentalValue(fv=const(200)).Strategy(), "fv_1000") ]
def Canceller(ctx): ctx.volumeStep = 15 return [ ctx.makeTrader_A(strategy.LiquidityProvider(), "LiquidityProviderEx-"), ctx.makeTrader_A(strategy.Canceller(), "canceller"), ctx.makeTrader_A( strategy.FundamentalValue(fundamentalValue=const(1000)), "fv_1000") ]
def FundamentalValue(ctx): ctx.volumeStep = 30 fv = 200 demo = ctx.addGraph('demo') myVolume = lambda: [(trader.Position(), demo), (const(200.).OnEveryDt(100), demo), (orderbook.OfTrader().Asks.BestPrice, demo), (orderbook.OfTrader().Bids.BestPrice, demo)] return [ ctx.makeTrader_A( strategy.price.LiquidityProvider() .Strategy(orderFactory = order.side_price.Limit(volume=const(6.)) .sideprice_WithExpiry(const(100.))), "liquidity"), ctx.makeTrader_A( strategy.side.FundamentalValue( const(fv) ).Strategy( event.Every(const(1.)), order.side.Market(volume = const(1.))), "fv_200", myVolume()), ]
def Canceller(ctx): ctx.volumeStep = 15 return [ ctx.makeTrader_A(strategy.LiquidityProvider(), "LiquidityProviderEx-"), ctx.makeTrader_A(strategy.Canceller(), "canceller"), ctx.makeTrader_A( strategy.FundamentalValue( fundamentalValue = const(1000)), "fv_1000") ]
def FundamentalValue(ctx): ctx.volumeStep = 30 fv = 200 demo = ctx.addGraph('demo') myVolume = lambda: [(trader.Position(), demo)] myPrice = lambda: [(orderbook.MidPrice(), demo)] return [ ctx.makeTrader_A( strategy.LiquidityProvider( orderFactory = order.side_price.WithExpiry(const(10), order.side_price.Limit(volume=const(6)))), "liquidity"), ctx.makeTrader_A( strategy.FundamentalValue( event.Every(const(1.)), order.side.Market(volume = const(1.)), const(fv)), "fv_200", myVolume()), ]
def FundamentalValue(ctx): ctx.volumeStep = 30 fv = 200 demo = ctx.addGraph('demo') myVolume = lambda: [(trader.Position(), demo), (const(200.).OnEveryDt(100), demo), (orderbook.OfTrader().Asks.BestPrice, demo), (orderbook.OfTrader().Bids.BestPrice, demo)] return [ ctx.makeTrader_A( strategy.price.LiquidityProvider().Strategy( orderFactory=order.side_price.Limit( volume=const(6.)).sideprice_WithExpiry(const(100.))), "liquidity"), ctx.makeTrader_A( strategy.side.FundamentalValue(const(fv)).Strategy( event.Every(const(1.)), order.side.Market(volume=const(1.))), "fv_200", myVolume()), ]
def run(name, constructor, only_veusz): with createScheduler() as world: import time t0 = time.clock() ctx = Context(world, veusz.Graph) print time.clock() - t0 traders = constructor(ctx) print time.clock() - t0 if config.useMinorTraders: traders.extend([ ctx.makeMinorTrader( strategy.position.RSI_linear(k=const(0.7)).Strategy(), "RSI 0.07"), ctx.makeMinorTrader( strategy.position.RSI_linear(k=const(-0.7)).Strategy(), "RSI -0.07"), ctx.makeMinorTrader( strategy.position.Bollinger_linear( alpha=0.15, k=const(-5.)).Strategy(), "Bollinger -0.5"), ctx.makeMinorTrader( strategy.position.Bollinger_linear( alpha=0.15, k=const(+5.)).Strategy(), "Bollinger +0.5"), ]) books = orderBooksToRender(ctx, traders) r = registry.create() root = registry.Simulation(traders, list(ctx.books.itervalues()), ctx.graphs) # r.insert(root) print time.clock() - t0 root.registerIn(r) # r.pushAllReferences() print time.clock() - t0 root.bind_ex(context.BindingContextEx({'world': world})) def checks(): if not only_veusz and config.checkConsistency: r.typecheck() try: dumped = pickle.dumps(r) pickle.loads(dumped) except Exception, err: print err print time.clock() - t0 checks() stat = world.workTill(config.veuszRunLength) checks() if config.showTiming: print "\n", stat non_empty_graphs = [g for g in ctx.graphs if len(g._datas)] veusz.render(name, non_empty_graphs) world.reset_ex(0) root.reset_ex(0) if config.runTwoTimes: world.workTill(config.veuszRunLength) veusz.render(name, non_empty_graphs)
def Complete(ctx): ctx.volumeStep = 100 c_200 = const(200.) fv_200_12 = strategy.side.FundamentalValue(c_200).Strategy(orderFactory=order.side.Market(volume=const(12))) fv_200 = strategy.side.FundamentalValue(c_200).Strategy(orderFactory=order.side.Market(volume=const(1))) def s_fv(fv): return strategy.TradeIfProfitable( strategy.side.FundamentalValue(const(fv)).Strategy(orderFactory=order.side.Market(volume=const(1)))) def fv_virtual(fv): return ctx.makeTrader_A(s_fv(fv), "v" + str(fv)) return [ ctx.makeTrader_A( strategy.price.LiquidityProvider() .Strategy(orderFactory = order.side_price.Limit(volume=constant(170)) .sideprice_WithExpiry(constant(10))), "liquidity"), ctx.makeTrader_A(fv_200_12, "t200"), ctx.makeTrader_A(fv_200, "t200_1"), ctx.makeTrader_A(strategy.side.FundamentalValue(const(150.)) .Strategy(event.Every(constant(1.)), order.side.Market(const(1.))), "t150"), ctx.makeTrader_A(strategy.side.MeanReversion().Strategy(event.Every(constant(1.)), order.side.Market(const(1.))), "mr_0_15"), ctx.makeTrader_A(strategy.side.CrossingAverages(alpha_1=0.15, alpha_2=0.015) .Strategy(event.Every(constant(1.)), order.side.Market(const(1.))), label="avg+"), ctx.makeTrader_A(strategy.side.CrossingAverages(alpha_1=0.015, alpha_2=0.15) .Strategy(event.Every(constant(1.)), order.side.Market(const(1.))), label="avg-"), ctx.makeTrader_A(strategy.TradeIfProfitable(fv_200), "v_fv200"), fv_virtual(160.), fv_virtual(170.), fv_virtual(180.), fv_virtual(190.), ctx.makeTrader_A(strategy.ChooseTheBest([ s_fv(160.), s_fv(170.), s_fv(180.), s_fv(190.), ]), "best") ]
def fv(x): return strategy.FundamentalValue( event.Every(constant(1.)), order.side.Market(volume=constant(1.)), fundamentalValue=const(x))
def Orders(ctx): linear_signal = math.RandomWalk(initialValue=20, deltaDistr=const(-.1), name="20-0.1t") midPrice = orderbook.MidPrice(ctx.book_A) return [ ctx.makeTrader_A( strategy.price.LiquidityProvider().Strategy( event.Every(const(1.)), order.side_price.Limit(volume=const(35))), "liquidity"), ctx.makeTrader_A( strategy.price.LiquidityProvider().Strategy( event.Every(const(100.)), order.side_price.Limit(volume=const(5)).sideprice_StopLoss( const(0.1))), "liquidity stoploss"), ctx.makeTrader_A( strategy.price.LiquidityProvider().Strategy( event.Every(const(10.)), order.side_price.Limit(volume=const(5)).sideprice_Iceberg( const(1))), "liquidity iceberg"), ctx.makeTrader_A( strategy.price.LiquidityProvider().Strategy( event.Every(const(10.)), order.side_price.Limit(volume=const(5)).sideprice_WithExpiry( const(5))), "liquidity expiry"), ctx.makeTrader_A( strategy.price.LiquidityProvider().Strategy( event.Every(const(10.)), order.side_price.Limit(volume=const(15)).sideprice_Iceberg( const(1)).sideprice_WithExpiry(const(5))), "liquidity iceberg expiry"), ctx.makeTrader_A( strategy.side.Signal(linear_signal).Strategy( event.Every(const(1.)), order.side.Market(volume=const(1))), "signal market"), ctx.makeTrader_A( strategy.side.Signal(linear_signal).Strategy( event.Every(const(1.)), order.side.price.Limit(const(1)).side_FloatingPrice( const(100))), "signal floating"), ctx.makeTrader_A( strategy.side.Signal(linear_signal).Strategy( event.Every(const(1.)), order.side.Limit(const(110), const(3)).side_Iceberg(const(1))), "signal iceberg"), ctx.makeTrader_A( strategy.side.Signal(linear_signal).Strategy( event.Every(const(1.)), order.side.Limit(const(120), const(1)).side_ImmediateOrCancel), "signal ioc"), ctx.makeTrader_A( strategy.side.Signal(linear_signal).Strategy( event.Every(const(10.)), order.side.price.Limit(const(1)).side_Peg), "signal peg"), ctx.makeTrader_A( strategy.side.Signal(linear_signal).Strategy( event.Every(const(1.)), order.side.Market(volume=const(1)).side_StopLoss(const(0.1))), "signal stoploss"), ctx.makeTrader_A( strategy.side.Signal(linear_signal).Strategy( event.Every(const(10.)), order.side.Limit(price=midPrice, volume=const(1))), "signal limit"), ctx.makeTrader_A( strategy.side.Signal(Interlacing()).Strategy( event.Every(const(10)), order.side.Limit(price=const(120), volume=const(1))), "noise limit"), ctx.makeTrader_A( strategy.side.Signal(Interlacing()).Strategy( event.Every(const(10)), order.side.Limit(price=const(120), volume=const(1)).side_WithExpiry(const(10))), "noise expiry"), ctx.makeTrader_A( strategy.side.Signal(Interlacing()).Strategy( event.Every(const(10.)), order.side.price.Limit(const(1)).side_Peg.side_Iceberg( const(1))), "iceberg peg"), ctx.makeTrader_A( strategy.side.Signal(Interlacing()).Strategy( event.Every(const(10.)), order.side.price.Limit(const(3)).side_price_Iceberg( const(1)).side_Peg), "peg iceberg"), ctx.makeTrader_A( strategy.side.Signal(Interlacing()).Strategy( event.Every(constant(3.)), order.side.price.Limit(const(3)).side_price_Iceberg( const(1)).side_Peg.side_WithExpiry(const(3))), "peg iceberg expiry"), ctx.makeTrader_A( strategy.side.Signal(Interlacing()).Strategy( event.Every(constant(10.)), order.side.price.Limit(const(1)).side_Peg.side_Iceberg( const(1)).side_WithExpiry(const(10.))), "iceberg peg expiry"), ]
def Orders(ctx): linear_signal = math.RandomWalk(initialValue=20, deltaDistr=const(-.1), name="20-0.1t") midPrice = orderbook.MidPrice(ctx.book_A) return [ ctx.makeTrader_A( strategy.LiquidityProvider( event.Every(const(1.)), order.side_price.Limit(volume=const(35))), "liquidity"), ctx.makeTrader_A( strategy.LiquidityProvider( event.Every(const(100.)), order.side_price.StopLoss(const(0.1), order.side_price.Limit(volume=const(5)))), "liquidity stoploss"), ctx.makeTrader_A( strategy.LiquidityProvider( event.Every(const(10.)), order.side_price.Iceberg( order.side_price.Limit(volume=const(5)), const(1))), "liquidity iceberg"), ctx.makeTrader_A( strategy.LiquidityProvider( event.Every(const(10.)), order.side_price.WithExpiry(const(5), order.side_price.Limit(volume=const(5)))), "liquidity expiry"), ctx.makeTrader_A( strategy.LiquidityProvider( event.Every(const(10.)), order.side_price.WithExpiry(const(5), order.side_price.Iceberg( order.side_price.Limit(volume=const(15)), const(1)))), "liquidity iceberg expiry"), ctx.makeTrader_A(strategy.Signal( event.Every(const(1.)), order.side.Market(volume = const(1)), linear_signal), "signal market"), ctx.makeTrader_A(strategy.Signal( event.Every(const(1.)), order.side.FloatingPrice(const(100.), order.side.price.Limit(const(1))), linear_signal), "signal floating"), ctx.makeTrader_A(strategy.Signal( event.Every(const(1.)), order.side.Iceberg( order.side.Limit(const(110), const(3)), const(1)), linear_signal), "signal iceberg"), ctx.makeTrader_A(strategy.Signal( event.Every(const(1.)), order.side.ImmediateOrCancel( order.side.Limit(const(120), const(1))), linear_signal), "signal ioc"), ctx.makeTrader_A(strategy.Signal( event.Every(const(10.)), order.side.Peg( order.side.price.Limit(const(1))), linear_signal), "signal peg"), ctx.makeTrader_A(strategy.Signal( event.Every(const(1.)), order.side.StopLoss( const(0.1), order.side.Market( volume = const(1))), linear_signal), "signal stoploss"), ctx.makeTrader_A(strategy.Signal( event.Every(const(10.)), order.side.Limit( price = midPrice, volume = const(1)), linear_signal), "signal limit"), ctx.makeTrader_A(strategy.Signal( event.Every(const(10)), order.side.Limit( price = const(120), volume = const(1)), Interlacing()), "noise limit"), ctx.makeTrader_A(strategy.Signal( event.Every(const(10)), order.side.WithExpiry( const(10), order.side.Limit( price = const(120), volume = const(1))), Interlacing()), "noise expiry"), ctx.makeTrader_A(strategy.Signal( event.Every(const(10.)), order.side.Iceberg( order.side.Peg( order.side.price.Limit(const(1))), const(1)), Interlacing()), "iceberg peg"), ctx.makeTrader_A(strategy.Signal( event.Every(const(10.)), order.side.Peg( order.side.price.Iceberg( order.side.price.Limit(const(3)), const(1))), Interlacing()), "peg iceberg"), ctx.makeTrader_A(strategy.Signal( event.Every(constant(3.)), order.side.WithExpiry( constant(3.), order.side.Peg( order.side.price.Iceberg( order.side.price.Limit(const(3)), const(1)))), Interlacing()), "peg iceberg expiry"), ctx.makeTrader_A(strategy.Signal( event.Every(constant(10.)), order.side.WithExpiry( constant(10.), order.side.Iceberg( order.side.Peg( order.side.price.Limit(const(1))), const(1))), Interlacing()), "iceberg peg expiry"), ]
def s_fv(fv): return strategy.TradeIfProfitable( strategy.side.FundamentalValue(const(fv)).Strategy(orderFactory=order.side.Market(volume=const(1))))
def MultiarmedBandit(ctx): ctx.volumeStep = 30 demo = ctx.addGraph('demo') myVolume = lambda: [(trader.Position(), demo)] def fv(x): return strategy.FundamentalValue( event.Every(constant(1.)), order.side.Market(volume=constant(1.)), fundamentalValue=const(x)) xs = range(100, 300, 50) + range(160, 190, 10) def strategies(): return map(fv, xs) def fv_traders(): return [ctx.makeTrader_A(fv(x), "fv" + str(x), myVolume()) for x in xs] return [ ctx.makeTrader_A( strategy.LiquidityProvider(orderFactory=order.side_price.Limit( volume=constant(45))), "liquidity"), ctx.makeTrader_A( strategy.FundamentalValue(event.Every(constant(1.)), order.side.Market(volume=constant(12.)), fundamentalValue=const(200)), 'fv 12-200'), ctx.makeTrader_A( strategy.MultiArmedBandit( strategies(), strategy.account.virtualMarket(), strategy.weight.efficiencyTrend()), 'virt trend', myVolume()), ctx.makeTrader_A( strategy.MultiArmedBandit(strategies(), strategy.account.real(), strategy.weight.efficiencyTrend()), 'real trend', myVolume()), ctx.makeTrader_A( strategy.MultiArmedBandit( strategies(), strategy.account.virtualMarket(), strategy.weight.efficiency()), 'virt efficiency', myVolume()), ctx.makeTrader_A( strategy.MultiArmedBandit(strategies(), strategy.account.real(), strategy.weight.efficiency()), 'real efficiency', myVolume()), ctx.makeTrader_A( strategy.MultiArmedBandit( strategies(), strategy.account.virtualMarket(), strategy.weight.score(), strategy.weight.atanPow()), 'virt score', myVolume()), ctx.makeTrader_A( strategy.MultiArmedBandit( strategies(), strategy.account.real(), strategy.weight.score(), strategy.weight.clamp0()), 'real score', myVolume()), ctx.makeTrader_A( strategy.MultiArmedBandit( strategies(), strategy.account.virtualMarket(), strategy.weight.efficiencyTrend(), strategy.weight.identityF(), strategy.weight.chooseTheBest()), 'virt best', myVolume()), ctx.makeTrader_A( strategy.MultiArmedBandit( strategies(), strategy.account.real(), strategy.weight.unit(), strategy.weight.identityF()), 'uniform', myVolume()), ] + fv_traders()