class IFunctionIEvent_from_IFunctionSideIFunctionfloat(object):
    _types = [meta.function((
        IFunctionSide,
        IFunctionfloat,
    ), IEvent)]
    _types.append(IFunctionobject_from_IFunctionSideIFunctionfloat)
    pass
class IFunctionobject_from_IFunctionSideIFunctionfloat(object):
    _types = [meta.function((
        IFunctionSide,
        IFunctionfloat,
    ), object)]

    pass
Пример #3
0
class IFunctionIFunctionIObservableIOrder_from_IFunctionfloat_from_IFunctionSide(
        object):
    _types = [
        meta.function((IFunctionSide, ),
                      IFunctionIObservableIOrder_from_IFunctionfloat)
    ]
    _types.append(IFunctionobject_from_IFunctionSide)
    _types.append(
        IFunctionIFunctionobject_from_IFunctionfloat_from_IFunctionSide)
    _types.append(
        IFunctionIFunctionIFunctionIOrder_from_IFunctionfloat_from_IFunctionSide
    )
    _types.append(
        IFunctionIFunctionIEvent_from_IFunctionfloat_from_IFunctionSide)

    def side_price_StopLoss(self, maxloss=None):
        from marketsim.gen._out.order._curried._side_price_stoploss import side_price_StopLoss
        return side_price_StopLoss(self, maxloss)

    def sideprice_FloatingPrice(self, floatingPrice=None):
        from marketsim.gen._out.order._curried._sideprice_floatingprice import sideprice_FloatingPrice
        return sideprice_FloatingPrice(self, floatingPrice)

    @property
    def sideprice_Peg(self):
        from marketsim.gen._out.order._curried._sideprice_peg import sideprice_Peg
        return sideprice_Peg(self)

    @property
    def side_Peg(self):
        from marketsim.gen._out.order._curried._side_peg import side_Peg
        return side_Peg(self)

    def side_price_Iceberg(self, lotSize=None):
        from marketsim.gen._out.order._curried._side_price_iceberg import side_price_Iceberg
        return side_price_Iceberg(self, lotSize)

    @property
    def side_price_ImmediateOrCancel(self):
        from marketsim.gen._out.order._curried._side_price_immediateorcancel import side_price_ImmediateOrCancel
        return side_price_ImmediateOrCancel(self)

    def side_price_FloatingPrice(self, floatingPrice=None):
        from marketsim.gen._out.order._curried._side_price_floatingprice import side_price_FloatingPrice
        return side_price_FloatingPrice(self, floatingPrice)

    def side_FloatingPrice(self, floatingPrice=None):
        from marketsim.gen._out.order._curried._side_floatingprice import side_FloatingPrice
        return side_FloatingPrice(self, floatingPrice)

    def side_price_WithExpiry(self, expiry=None):
        from marketsim.gen._out.order._curried._side_price_withexpiry import side_price_WithExpiry
        return side_price_WithExpiry(self, expiry)

    @property
    def side_price_Peg(self):
        from marketsim.gen._out.order._curried._side_price_peg import side_price_Peg
        return side_price_Peg(self)

    pass
Пример #4
0
class IFunctionIFunctionIFunctionobject_from_IFunctionfloat_from_IFunctionSide(
        object):
    _types = [
        meta.function((IFunctionSide, ),
                      IFunctionIFunctionobject_from_IFunctionfloat)
    ]
    _types.append(IFunctionobject_from_IFunctionSide)
    _types.append(
        IFunctionIFunctionobject_from_IFunctionfloat_from_IFunctionSide)
    pass
Пример #5
0
class IFunctionbool(Function_impl):
    _types = [meta.function((), bool)]
    _types.append(IFunctionobject)

    def And(self, y=None):
        from marketsim.gen._out.ops._and import And
        return And(self, y)

    def Or(self, y=None):
        from marketsim.gen._out.ops._or import Or
        return Or(self, y)

    def Condition(self, ifpart=None, elsepart=None):
        from marketsim.gen._out.ops._condition import Condition
        return Condition(self, ifpart, elsepart)

    pass
Пример #6
0
class IFunctionSide(object):
    _types = [meta.function((), Side)]
    _types.append(IFunctionobject)

    def price_Limit(self, volume=None):
        from marketsim.gen._out.order._curried._price_limit import price_Limit
        return price_Limit(self, volume)

    def Limit(self, price=None, volume=None):
        from marketsim.gen._out.order._limit import Limit
        return Limit(self, price, volume)

    def Market(self, volume=None):
        from marketsim.gen._out.order._market import Market
        return Market(self, volume)

    def FixedBudget(self, budget=None):
        from marketsim.gen._out.order._fixedbudget import FixedBudget
        return FixedBudget(self, budget)

    pass
Пример #7
0
class IFunctionIObservableIOrder_from_IFunctionSideIFunctionfloat(object):
    _types = [
        meta.function((
            IFunctionSide,
            IFunctionfloat,
        ), IObservableIOrder)
    ]
    _types.append(IFunctionobject_from_IFunctionSideIFunctionfloat)
    _types.append(IFunctionIFunctionIOrder_from_IFunctionSideIFunctionfloat)
    _types.append(IFunctionIEvent_from_IFunctionSideIFunctionfloat)

    def sideprice_StopLoss(self, maxloss=None):
        from marketsim.gen._out.order._curried._sideprice_stoploss import sideprice_StopLoss
        return sideprice_StopLoss(self, maxloss)

    def Ladder(self, initialSize=None, side=None):
        from marketsim.gen._out.strategy.price._ladder import Ladder
        return Ladder(self, initialSize, side)

    def sideprice_WithExpiry(self, expiry=None):
        from marketsim.gen._out.order._curried._sideprice_withexpiry import sideprice_WithExpiry
        return sideprice_WithExpiry(self, expiry)

    def LadderMM(self, initialSize=None):
        from marketsim.gen._out.strategy.price._laddermm import LadderMM
        return LadderMM(self, initialSize)

    def sideprice_Iceberg(self, lotSize=None):
        from marketsim.gen._out.order._curried._sideprice_iceberg import sideprice_Iceberg
        return sideprice_Iceberg(self, lotSize)

    @property
    def sideprice_ImmediateOrCancel(self):
        from marketsim.gen._out.order._curried._sideprice_immediateorcancel import sideprice_ImmediateOrCancel
        return sideprice_ImmediateOrCancel(self)

    pass
class IFunctionIFunctionIOrder_from_IFunctionfloat(object):
    _types = [meta.function((IFunctionfloat, ), IFunctionIOrder)]
    _types.append(IFunctionobject_from_IFunctionfloat)
    _types.append(IFunctionIFunctionobject_from_IFunctionfloat)
    pass
Пример #9
0
class IFunctionICandleStick(object):
    _types = [meta.function((), ICandleStick)]
    _types.append(IFunctionobject)
    pass
class IFunctionIFunctionlistOffloat_from_listOffloat(object):
    _types = [meta.function((listOf(float), ), IFunctionlistOffloat)]
    _types.append(IFunctionobject_from_listOffloat)
    _types.append(IFunctionIFunctionobject_from_listOffloat)
    _types.append(IFunctionIFunctionlistOfobject_from_listOffloat)
    pass
class IFunctionIAccount_from_ISingleAssetStrategy(object):
    _types = [meta.function((ISingleAssetStrategy, ), IAccount)]
    _types.append(IFunctionobject_from_ISingleAssetStrategy)
    pass
class IFunctionobject_from_IFunctionSide(object):
    _types = [meta.function((IFunctionSide,),object)]
    
    pass
Пример #13
0
    def processIn(self, book):
        """ Called when an order book tries to determine 
        how the order should be processed 
        """
        self._book = book
        self._tryToResend()

def iceberg(volumeLimit, orderFactory):
    """ Returns a function to create iceberg orders with 
    given volumeLimit and orderFactory to create real orders
    """
    def inner(*args):
        return Iceberg(volumeLimit, orderFactory, *args)
    return inner

LimitOrderFactorySignature = meta.function((types.Side,), meta.function((types.Price, types.Volume), types.IOrder))

@registry.expose(['Iceberg'])
class IcebergFactory(object):
    """ Virtual order that implements iceberg strategy:
    First it sends an order for a small potion of its volume to a book and
    once it is filled resends a new order 
    """
    
    def __init__(self, volumeLimit = 10, orderFactory = LimitFactory):
        self.volumeLimit = volumeLimit
        self.orderFactory = orderFactory
        
    _types = [LimitOrderFactorySignature]
        
    _properties = {'volumeLimit'  : int,
Пример #14
0
class IFunctionobject(object):
    _types = [meta.function((), object)]

    pass
Пример #15
0
class IFunctionlistOffloat(object):
    _types = [meta.function((), listOf(float))]
    _types.append(IFunctionobject)
    _types.append(IFunctionlistOfobject)
    pass
class IFunctionobject_from_listOffloat(object):
    _types = [meta.function((listOf(float),),object)]
    
    pass
Пример #17
0
class IFunctionobject_from_IAccount(object):
    _types = [meta.function((IAccount, ), object)]

    pass
Пример #18
0
class IFunctionint(Function_impl):
    _types = [meta.function((), int)]
    _types.append(IFunctionobject)
    _types.append(IFunctionfloat)
    pass
Пример #19
0
class IFunctionIOrder(object):
    _types = [meta.function((),IOrder)]
    _types.append(IFunctionobject)
    pass
class IFunctionIFunctionfloat_from_IAccount(object):
    _types = [meta.function((IAccount, ), IFunctionfloat)]
    _types.append(IFunctionobject_from_IAccount)
    _types.append(IFunctionIFunctionobject_from_IAccount)
    pass
Пример #21
0
@registry.expose(alias=['AtanPow'])
@meta.sig(args=(types.IFunction[float],), rv=types.IFunction[float])
def atanpow(f, base = 1.002):
    return ops.Atan(ops.Pow(ops.constant(base), f))

@registry.expose(alias=['Clamp0'])
@meta.sig(args=(types.IFunction[float],), rv=types.IFunction[float])
def clamp0(f):
    return ops.Max(f, ops.constant(0)) + 1

def identity(x):
    return x

Ts = [float, meta.listOf(float), types.IFunction[float]]
identity._types = [meta.function((t,), t) for t in Ts]

registry.expose(alias=['identity'])(identity)

def cachedattr(obj, name, setter):
    if not hasattr(obj, name):
        setattr(obj, name, setter())
        
    return getattr(obj, name)

@registry.expose(alias=['Efficiency'])
@meta.sig(args=(types.IAccount,), rv=types.IFunction[float])
def efficiency(trader):
    return cachedattr(trader, '_efficiency', 
                      lambda: observable.Efficiency(trader))
Пример #22
0
class IFunctionfloat(Function_impl):
    _types = [meta.function((), float)]
    _types.append(IFunctionobject)

    @property
    def Negate(self):
        from marketsim.gen._out.ops._negate import Negate
        return Negate(self)

    def OnEveryDt(self, dt=None):
        from marketsim.gen._out.observable._oneverydt import OnEveryDt
        return OnEveryDt(self, dt)

    def Min(self, y=None):
        from marketsim.gen._out.math._min import Min
        return Min(self, y)

    @property
    def side_FixedBudget(self):
        from marketsim.gen._out.order._curried._side_fixedbudget import side_FixedBudget
        return side_FixedBudget(self)

    @property
    def sideprice_Limit(self):
        from marketsim.gen._out.order._curried._sideprice_limit import sideprice_Limit
        return sideprice_Limit(self)

    def Signal(self, threshold=None):
        from marketsim.gen._out.strategy.side._signal import Signal
        return Signal(self, threshold)

    @property
    def signedVolume_LimitSigned(self):
        from marketsim.gen._out.order._curried._signedvolume_limitsigned import signedVolume_LimitSigned
        return signedVolume_LimitSigned(self)

    def Add(self, y=None):
        from marketsim.gen._out.ops._add import Add
        return Add(self, y)

    @property
    def Atan(self):
        from marketsim.gen._out.math._atan import Atan
        return Atan(self)

    def Less(self, y=None):
        from marketsim.gen._out.ops._less import Less
        return Less(self, y)

    @property
    def FundamentalValue(self):
        from marketsim.gen._out.strategy.side._fundamentalvalue import FundamentalValue
        return FundamentalValue(self)

    @property
    def MarketSigned(self):
        from marketsim.gen._out.order._marketsigned import MarketSigned
        return MarketSigned(self)

    def Mul(self, y=None):
        from marketsim.gen._out.ops._mul import Mul
        return Mul(self, y)

    def NotEqual(self, y=None):
        from marketsim.gen._out.ops._notequal import NotEqual
        return NotEqual(self, y)

    def Max(self, y=None):
        from marketsim.gen._out.math._max import Max
        return Max(self, y)

    @property
    def Sqr(self):
        from marketsim.gen._out.math._sqr import Sqr
        return Sqr(self)

    @property
    def Sqrt(self):
        from marketsim.gen._out.math._sqrt import Sqrt
        return Sqrt(self)

    def GreaterEqual(self, y=None):
        from marketsim.gen._out.ops._greaterequal import GreaterEqual
        return GreaterEqual(self, y)

    def side_Limit(self, volume=None):
        from marketsim.gen._out.order._curried._side_limit import side_Limit
        return side_Limit(self, volume)

    @property
    def Exp(self):
        from marketsim.gen._out.math._exp import Exp
        return Exp(self)

    @property
    def Log(self):
        from marketsim.gen._out.math._log import Log
        return Log(self)

    def getOrElse(self, elsePart=None):
        from marketsim.gen._out._ifdefined import IfDefined
        return IfDefined(self, elsePart)

    @property
    def side_price_Limit(self):
        from marketsim.gen._out.order._curried._side_price_limit import side_price_Limit
        return side_price_Limit(self)

    @property
    def isLossTooHigh(self):
        from marketsim.gen._out.strategy.price._islosstoohigh import isLossTooHigh
        return isLossTooHigh(self)

    @property
    def side_Market(self):
        from marketsim.gen._out.order._curried._side_market import side_Market
        return side_Market(self)

    @property
    def Clamp0(self):
        from marketsim.gen._out.strategy.weight._clamp0 import Clamp0
        return Clamp0(self)

    @property
    def Canceller(self):
        from marketsim.gen._out.strategy._canceller import Canceller
        return Canceller(self)

    def Sub(self, y=None):
        from marketsim.gen._out.ops._sub import Sub
        return Sub(self, y)

    def AtanPow(self, base=None):
        from marketsim.gen._out.strategy.weight._atanpow import AtanPow
        return AtanPow(self, base)

    def Pow(self, power=None):
        from marketsim.gen._out.math._pow import Pow
        return Pow(self, power)

    def LimitSigned(self, price=None):
        from marketsim.gen._out.order._limitsigned import LimitSigned
        return LimitSigned(self, price)

    @property
    def Noise(self):
        from marketsim.gen._out.strategy.side._noise import Noise
        return Noise(self)

    @property
    def IdentityF(self):
        from marketsim.gen._out.strategy.weight._identityf import IdentityF
        return IdentityF(self)

    def Div(self, y=None):
        from marketsim.gen._out.ops._div import Div
        return Div(self, y)

    def LessEqual(self, y=None):
        from marketsim.gen._out.ops._lessequal import LessEqual
        return LessEqual(self, y)

    def Equal(self, y=None):
        from marketsim.gen._out.ops._equal import Equal
        return Equal(self, y)

    def Greater(self, y=None):
        from marketsim.gen._out.ops._greater import Greater
        return Greater(self, y)

    pass
Пример #23
0
class IFunctionobject_from_ISingleAssetStrategy(object):
    _types = [meta.function((ISingleAssetStrategy, ), object)]

    pass
Пример #24
0
class IFunctionIVolumeLevels(object):
    _types = [meta.function((),IVolumeLevels)]
    _types.append(IFunctionobject)
    pass