• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python marketsim._函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中marketsim._函数的典型用法代码示例。如果您正苦于以下问题:Python _函数的具体用法?Python _怎么用?Python _使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了_函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: __init__

 def __init__(self, lhs, rhs):
     self.lhs = lhs
     self.rhs = rhs 
     if types.IEvent in inspect.getmro(type(lhs)):
         event.subscribe(lhs, _(self).fire, self)
     if types.IEvent in inspect.getmro(type(rhs)):
         event.subscribe(rhs, _(self).fire, self)
开发者ID:Courvoisier13,项目名称:marketsimulator,代码行数:7,代码来源:_all.py


示例2: __init__

 def __init__(self):
     event.subscribe(self.inner.on_order_created, _(self).onOrderCreated, self)
     event.subscribe(observable.OnOrderMatched(), _(self)._onOrderMatched, self)
     self.on_traded = event.Event()
     self.orderBook = orderbook.OfTrader()
     self._balance = 0
     self._position = 0
开发者ID:Courvoisier13,项目名称:marketsimulator,代码行数:7,代码来源:_account.py


示例3: __init__

 def __init__(self):
     event.subscribe(self.inner.on_order_created, _(self).onOrderCreated, self)
     event.subscribe(OnOrderMatched(), _(self)._onOrderMatched, self)
     from marketsim.gen._out.event._event import Event
     self.on_traded = Event()
     self.orderBook = OfTrader()
     self._balance = 0
     self._position = 0
开发者ID:SemanticBeeng,项目名称:marketsimulator,代码行数:8,代码来源:account.py


示例4: __init__

    def __init__(self):
        self.ask = self.book.Asks.BestPrice
        self.bid = self.book.Bids.BestPrice

        self.reset()
        event.subscribe(self.ask, _(self)._update, self)
        event.subscribe(self.bid, _(self)._update, self)
        event.subscribe(self.depth, _(self)._update, self)
开发者ID:SemanticBeeng,项目名称:marketsimulator,代码行数:8,代码来源:cumulative_price.py


示例5: bind_impl

 def bind_impl(self, ctx):
     if not hasattr(self, '_subscriptions'):
         self.trader.bind_ex(ctx)
         event.subscribe(self.trader.on_order_matched, _(self).onOrderMatched, self)
         event.subscribe(self.trader.on_order_disposed, _(self).onOrderDisposed, self)
         for x in self._subscriptions:
             x.bind_ex(ctx)
         self._bound_ex = True
开发者ID:SemanticBeeng,项目名称:marketsimulator,代码行数:8,代码来源:props.py


示例6: __init__

 def __init__(self):
     Strategy.__init__(self)
     props = dict([(k, getattr(self, k)) for k in self._properties.iterkeys() ])
     sp = merge_dict(props, side=Side.Sell)
     bp = merge_dict(props, side=Side.Buy) 
     self._sell = LiquidityProviderSide(**sp)
     self._buy = LiquidityProviderSide(**bp)
     event.subscribe(self._sell.on_order_created, _(self)._send, self)
     event.subscribe(self._buy.on_order_created, _(self)._send, self)
开发者ID:Courvoisier13,项目名称:marketsimulator,代码行数:9,代码来源:_lp.py


示例7: __init__

 def __init__(self, source, timeframe = 1.):
     ops.Observable[types.ICandleStick].__init__(self)
     self._source = source
     self._event = event.subscribe(source, _(self)._update, self)
     event.subscribe(event.Every(ops.constant(timeframe)), _(self)._flush, self)
     self.timeframe = timeframe
     self.reset()
     self._mean = CMA(source)
     self._stddev = StdDev(source)
开发者ID:Courvoisier13,项目名称:marketsimulator,代码行数:9,代码来源:_candlestick.py


示例8: __init__

    def __init__(self):
        Strategy.__init__(self)
        from marketsim._pub import strategy, side

        self._seller = strategy.price.Ladder(self.orderFactory, self.initialSize, side.Sell())
        self._buyer = strategy.price.Ladder(self.orderFactory, self.initialSize, side.Buy())

        event.subscribe(self._seller.on_order_created, _(self)._send, self)
        event.subscribe(self._buyer.on_order_created, _(self)._send, self)
开发者ID:SemanticBeeng,项目名称:marketsimulator,代码行数:9,代码来源:ladder.py


示例9: __init__

 def __init__(self, queue, book, link):
     self._queue = queue
     self.book = book
     self._link = link
     queue.bestPrice += _(self)._onBestChanged
     self.bestPrice = BestPrice(self)
     self.lastTrade = LastTrade()
     queue.lastTrade += _(self)._onTraded
     self.reset()
开发者ID:Courvoisier13,项目名称:marketsimulator,代码行数:9,代码来源:_remote.py


示例10: __init__

    def __init__(self):

        ops.Observable[float].__init__(self)

        self.price = LastTradePrice(self.book)

        self.reset()
        event.subscribe(self.price, _(self)._update, self)
        event.subscribe(self.depth, _(self)._update, self)
开发者ID:Courvoisier13,项目名称:marketsimulator,代码行数:9,代码来源:cumulative_price.py


示例11: __init__

 def __init__(self):
     Strategy.__init__(self)
     self._current = None
     self._estimators = []
     for s in self.strategies:
         event.subscribe(s.on_order_created, _(self).send, self)
         e = self.performance(self.account(s))
         e._origin = s
         self._estimators.append(e)
     event.subscribe(event.Every(ops.constant(1.)), _(self)._wakeUp, self)
开发者ID:Courvoisier13,项目名称:marketsimulator,代码行数:10,代码来源:_choose_best.py


示例12: onOrderMatched

 def onOrderMatched(self, order, price, volume):
     if order is not self._stopLossOrder:
         if volume > 0:
             handler = event.GreaterThan((1+self._maxloss) * price, _(self)._onPriceChanged)\
                         if self.side == Side.Sell else\
                       event.LessThan((1-self._maxloss) * price, _(self)._onPriceChanged)
                         
             self._stopSubscription = event.subscribe(self._obsPrice, handler, self, self._ctx)
             self.onMatchedWith(price, +volume)
     else:
         self.onMatchedWith(price, -volume)
开发者ID:Courvoisier13,项目名称:marketsimulator,代码行数:11,代码来源:_stoploss.py


示例13: onOrderMatched

 def onOrderMatched(self, order, price, volume):
     from marketsim.gen._out._side import Side
     from marketsim.gen._out.event._greaterthan import GreaterThan
     from marketsim.gen._out.event._lessthan import LessThan
     if order is not self._stopLossOrder:
         if volume > 0:
             handler = GreaterThan((1+self._maxloss) * price, _(self)._onPriceChanged)\
                         if self.side == Side.Sell else\
                       LessThan((1-self._maxloss) * price, _(self)._onPriceChanged)
                         
             self._stopSubscription = event.subscribe(self._obsPrice, handler, self)
             self._stopSubscription.bind_ex(self._ctx_ex)
             self.onMatchedWith(price, +volume)
     else:
         self.onMatchedWith(price, -volume)
开发者ID:SemanticBeeng,项目名称:marketsimulator,代码行数:15,代码来源:stoploss.py


示例14: __init__

 def __init__(self, source, folder):
     """ Initializes folder with source of values and accumulator object        
     """
     self._acc = folder
     self._source = source
     self._event = event.subscribe(self._source, _(self)._update, self)
     self._alias = ["_details", "fold", "old"]
开发者ID:Courvoisier13,项目名称:marketsimulator,代码行数:7,代码来源:_average.py


示例15: __init__

    def __init__(self):
        self.attributes = {"smooth":True}

        self._timer = event.Every(self.intervalDistr)
        event.subscribe(self._timer, _(self)._wakeUp, self)
        
        self.reset()
开发者ID:SemanticBeeng,项目名称:marketsimulator,代码行数:7,代码来源:randomwalk.py


示例16: process

 def process(self, order):
     if isinstance(order, types.IOrder):
         BookBase.process(self, order)
     else:
         # if 'callback' in dir(order):
         #    order.callback = _(self, order.callback)._sendToDownLink
         self._upLink.send(_(self._book, order).process)
开发者ID:Courvoisier13,项目名称:marketsimulator,代码行数:7,代码来源:_remote.py


示例17: __init__

 def __init__(self, source = ops.constant(1.)):
     ops.Observable[float].__init__(self)
     
     self._source = source
     self._event = event.subscribe(source, _(self)._wakeup, self)
     self._previous = None
     self._value = None
开发者ID:Courvoisier13,项目名称:marketsimulator,代码行数:7,代码来源:_two_point.py


示例18: __init__

 def __init__(self):
     self._efficiency = Efficiency(self.trader)
     event.subscribe(
             OnEveryDt(self._efficiency, 1),
              _(self)._update, self)
     self._score = 1
     self._last = 0
开发者ID:SemanticBeeng,项目名称:marketsimulator,代码行数:7,代码来源:weight.py


示例19: _update

 def _update(self, dummy = None):
     depth = self.depth()
     side = Side.Buy if depth < 0 else Side.Sell
     self.book.process(
                     request.EvalMarketOrder(side,
                                             abs(depth),
                                             _(self, -sign(depth))._callback))
开发者ID:Courvoisier13,项目名称:marketsimulator,代码行数:7,代码来源:cumulative_price.py


示例20: onOrderCreated

 def onOrderCreated(self, order, source):
     self.orderBook.process(
                 request.EvalMarketOrder(
                             order.side,
                             order.volumeUnmatched,
                             _(self,
                               order.side,
                               order.volumeUnmatched)._update))
开发者ID:SemanticBeeng,项目名称:marketsimulator,代码行数:8,代码来源:account.py



注:本文中的marketsim._函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python marketsim.deref_opt函数代码示例发布时间:2022-05-27
下一篇:
Python app.Marketplace类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap